Skip to content

Latest commit

 

History

History
1951 lines (901 loc) · 23.1 KB

README.md

File metadata and controls

1951 lines (901 loc) · 23.1 KB

RULE Api Wrapper Documentation

Table of Contents

Api

  • Full name: \Rule\ApiWrapper\Api\Api

__construct

Create api instance

Api::__construct( \Rule\ApiWrapper\Client\Client $client )

Parameters:

Parameter Type Description
$client \Rule\ApiWrapper\Client\Client HTTP client implementation for api

getClient

Get http client

Api::getClient(  ): \Rule\ApiWrapper\Client\Client

ApiFactory

  • Full name: \Rule\ApiWrapper\ApiFactory

make

Creates api resource

ApiFactory::make( string $key, string $resource,  $version = 'v2' ): \Rule\ApiWrapper\Api
  • This method is static. Parameters:
Parameter Type Description
$key string Rule api key
$resource string Resource name [subscriber, campaign, customization, suppression, tag, template, transaction]
$version ****

Campaign

  • Full name: \Rule\ApiWrapper\Api\V2\Campaign\Campaign
  • Parent class: \Rule\ApiWrapper\Api\Api

__construct

Create api instance

Campaign::__construct( \Rule\ApiWrapper\Client\Client $client )

Parameters:

Parameter Type Description
$client \Rule\ApiWrapper\Client\Client HTTP client implementation for api

getClient

Get http client

Campaign::getClient(  ): \Rule\ApiWrapper\Client\Client

getList

Get campaigns

Campaign::getList( integer $limit = 100 ): array

Parameters:

Parameter Type Description
$limit integer Limit for the campaigns count, default 100 max 100

Return Value:

Request result

See Also:


get

Get campaign data.

Campaign::get( integer $id ): array

Parameters:

Parameter Type Description
$id integer Id of the campaign.

Return Value:

Request result

See Also:


statistics

Get campaign statistics.

Campaign::statistics( integer $id ): array

Parameters:

Parameter Type Description
$id integer Id of the campaign.

Return Value:

Request result

See Also:


send

Send campaign.

Campaign::send( array $campaign ): array

Parameters:

Parameter Type Description
$campaign array Campaign data formated according {@link https://rule.se/apidoc/#campaigns-send-campaign-post}

See Also:


schedule

Schedule campaign.

Campaign::schedule( array $campaign ): array

Parameters:

Parameter Type Description
$campaign array Campaign data formated according {@link https://rule.se/apidoc/#campaigns-send-campaign-post}

See Also:


Client

  • Full name: \Rule\ApiWrapper\Guzzle\Client
  • Parent class: \Rule\ApiWrapper\Client\Client

__construct

Creates new Guzzle client instance

Client::__construct( string $apiKey, string $version = 'v2', string $baseUrl = "http://app.rule.io/api/" )

Client constructor.

Parameters:

Parameter Type Description
$apiKey string
$version string
$baseUrl string

getApiKey

Get Rule api key

Client::getApiKey(  ): string

getVersion

Get Rule api version

Client::getVersion(  ): string

getBaseUrl

Get base Rule url

Client::getBaseUrl(  ): string

setApiKey

Client::setApiKey(  $key )

Parameters:

Parameter Type Description
$key ****

setVersion

Client::setVersion(  $version )

Parameters:

Parameter Type Description
$version ****

setBaseUrl

Client::setBaseUrl(  $baseUrl )

Parameters:

Parameter Type Description
$baseUrl ****

get

Makes get request

Client::get( \Rule\ApiWrapper\Client\Request $request ): \Rule\ApiWrapper\Client\Response

Parameters:

Parameter Type Description
$request \Rule\ApiWrapper\Client\Request Request instance

post

Makes post request

Client::post( \Rule\ApiWrapper\Client\Request $request ): \Rule\ApiWrapper\Client\Response

Parameters:

Parameter Type Description
$request \Rule\ApiWrapper\Client\Request Request instance

put

Makes put request

Client::put( \Rule\ApiWrapper\Client\Request $request ): \Rule\ApiWrapper\Client\Response

Parameters:

Parameter Type Description
$request \Rule\ApiWrapper\Client\Request Request instance

delete

Makes delete request

Client::delete( \Rule\ApiWrapper\Client\Request $request ): \Rule\ApiWrapper\Client\Response

Parameters:

Parameter Type Description
$request \Rule\ApiWrapper\Client\Request Request instance

Customization

  • Full name: \Rule\ApiWrapper\Api\V2\Customization\Customization
  • Parent class: \Rule\ApiWrapper\Api\Api

__construct

Create api instance

Customization::__construct( \Rule\ApiWrapper\Client\Client $client )

Parameters:

Parameter Type Description
$client \Rule\ApiWrapper\Client\Client HTTP client implementation for api

getClient

Get http client

Customization::getClient(  ): \Rule\ApiWrapper\Client\Client

create

Create fields.

Customization::create( array $fields ): array

Parameters:

Parameter Type Description
$fields array Array of fields {@link https://rule.se/apidoc/#subscriber-fields-create-groups-and-fields-post}

Return Value:

Response result


getList

Get groups.

Customization::getList( integer $limit = 100 ): array

Parameters:

Parameter Type Description
$limit integer Limit of the results count

Return Value:

Request result


get

Get group fields

Customization::get( integer $id ): array

Parameters:

Parameter Type Description
$id integer Id of the group

Return Value:

Request result


InvalidResourceException

  • Full name: \Rule\ApiWrapper\Api\Exception\InvalidResourceException
  • Parent class:

LaravelServiceProvider

  • Full name: \Rule\ApiWrapper\LaravelServiceProvider
  • Parent class:

register

LaravelServiceProvider::register(  )

Request

  • Full name: \Rule\ApiWrapper\Client\Request

__construct

Request constructor. Create new Request instance

Request::__construct(  $resource )

Parameters:

Parameter Type Description
$resource ****

setQuery

Sets request query

Request::setQuery( array $query )

Parameters:

Parameter Type Description
$query array

getQuery

Returns request query

Request::getQuery(  ): mixed

setIdParam

Sets id parameter to Request

Request::setIdParam( string $idParam )

Parameters:

Parameter Type Description
$idParam string

getIdParam

Returns request id parameter

Request::getIdParam(  ): mixed

setParams

Sets request parameters

Request::setParams( array $params )

Parameters:

Parameter Type Description
$params array

getParams

Returns request parameters

Request::getParams(  ): mixed

setResource

Sets request resource

Request::setResource( string $resource )

Parameters:

Parameter Type Description
$resource string

getResource

Returns request resource

Request::getResource(  ): mixed

setSubresources

Sets request subresources

Request::setSubresources( array $subresources )

Parameters:

Parameter Type Description
$subresources array

getSubresources

Returns request subresources

Request::getSubresources(  ): mixed

addSubresource

Adds subresources to request

Request::addSubresource( array $subresource )

Parameters:

Parameter Type Description
$subresource array

setMethod

Set request method

Request::setMethod( string $method )

Parameters:

Parameter Type Description
$method string

getMethod

Returns request method

Request::getMethod(  ): mixed

getRelativeUrl

Get relative url from request

Request::getRelativeUrl(  ): string

Return Value:

Relative url


RequestFactory

  • Full name: \Rule\ApiWrapper\Guzzle\RequestFactory

make

RequestFactory::make( \Rule\ApiWrapper\Client\Request $request,  $baseUrl = "" )
  • This method is static. Parameters:
Parameter Type Description
$request \Rule\ApiWrapper\Client\Request
$baseUrl ****

Response

  • Full name: \Rule\ApiWrapper\Client\Response

__construct

Response constructor. Creates new Response instance.

Response::__construct(  $statusCode, array $data )

Parameters:

Parameter Type Description
$statusCode ****
$data array

getStatusCode

Returns Response status code.

Response::getStatusCode(  ): integer

getData

Returns Response result.

Response::getData(  ): array

ResponseErrorException

  • Full name: \Rule\ApiWrapper\Api\Exception\ResponseErrorException
  • Parent class:

ResponseFactory

  • Full name: \Rule\ApiWrapper\Guzzle\ResponseFactory

make

ResponseFactory::make( \GuzzleHttp\Psr7\Response $response )
  • This method is static. Parameters:
Parameter Type Description
$response \GuzzleHttp\Psr7\Response

Subscriber

  • Full name: \Rule\ApiWrapper\Api\V2\Subscriber\Subscriber
  • Parent class: \Rule\ApiWrapper\Api\Api

__construct

Create api instance

Subscriber::__construct( \Rule\ApiWrapper\Client\Client $client )

Parameters:

Parameter Type Description
$client \Rule\ApiWrapper\Client\Client HTTP client implementation for api

getClient

Get http client

Subscriber::getClient(  ): \Rule\ApiWrapper\Client\Client

create

Creates new subscriber

Subscriber::create( array $subscriber ): array

Parameters:

Parameter Type Description
$subscriber array

See Also:


createMultiple

Create new subscribers

Subscriber::createMultiple( array $subscribers ): array

Parameters:

Parameter Type Description
$subscribers array

See Also:


getList

Returns subscribers list

Subscriber::getList( integer $limit = 100 ): array

Parameters:

Parameter Type Description
$limit integer

See Also:


get

Returns single subscriber

Subscriber::get(  $id, string $identifyBy = 'email' ): array

Parameters:

Parameter Type Description
$id ****
$identifyBy string

See Also:


getFields

Returns subscriber fields

Subscriber::getFields(  $id, string $identifyBy = "email" ): array

Parameters:

Parameter Type Description
$id ****
$identifyBy string

See Also:


update

Updates subscriber

Subscriber::update(  $id,  $subscriber ): array

Parameters:

Parameter Type Description
$id ****
$subscriber ****

See Also:


addTags

Adds tags to subscriber

Subscriber::addTags(  $id, array $tags, string $identifyBy = 'email' ): array

Parameters:

Parameter Type Description
$id ****
$tags array
$identifyBy string

See Also:


getTags

Returns subscriber tags

Subscriber::getTags(  $id, string $identifyBy = "email" ): array

Parameters:

Parameter Type Description
$id ****
$identifyBy string

See Also:


deleteTag

Removes subscriber tags

Subscriber::deleteTag(  $id,  $tag, string $identifyBy = "email" ): array

Parameters:

Parameter Type Description
$id ****
$tag ****
$identifyBy string

See Also:


delete

Subscriber::delete( integer|string $id, string $identifiedBy = 'email' ): array

Parameters:

Parameter Type Description
$id integer|string User identifier to delete
$identifiedBy string Identifier type

Return Value:

Server response

See Also:


deleteMultiple

Subscriber::deleteMultiple( array $subscribers ): array

Parameters:

Parameter Type Description
$subscribers array

import

Subscriber::import( string $filename, array $mappings, array $tags ): array

Parameters:

Parameter Type Description
$filename string Name of the file stored on s3
$mappings array Mappings for the columns
$tags array Tags to import to

Return Value:

Response data


Suppression

  • Full name: \Rule\ApiWrapper\Api\V2\Suppression\Suppression
  • Parent class: \Rule\ApiWrapper\Api\Api

__construct

Create api instance

Suppression::__construct( \Rule\ApiWrapper\Client\Client $client )

Parameters:

Parameter Type Description
$client \Rule\ApiWrapper\Client\Client HTTP client implementation for api

getClient

Get http client

Suppression::getClient(  ): \Rule\ApiWrapper\Client\Client

getList

Returns suppression list

Suppression::getList( integer $limit = 100 ): array

Parameters:

Parameter Type Description
$limit integer

See Also:


create

Creates new Suppression

Suppression::create( array $suppressions ): array

Parameters:

Parameter Type Description
$suppressions array

See Also:


Tag

  • Full name: \Rule\ApiWrapper\Api\V2\Tag\Tag
  • Parent class: \Rule\ApiWrapper\Api\Api

__construct

Create api instance

Tag::__construct( \Rule\ApiWrapper\Client\Client $client )

Parameters:

Parameter Type Description
$client \Rule\ApiWrapper\Client\Client HTTP client implementation for api

getClient

Get http client

Tag::getClient(  ): \Rule\ApiWrapper\Client\Client

getList

Get list of tags

Tag::getList( integer $limit = 100 ): array

Parameters:

Parameter Type Description
$limit integer

See Also:


delete

Delete tag by id

Tag::delete(  $id ): array

Parameters:

Parameter Type Description
$id ****

See Also:


clear

Clear associations between subscriber and tag

Tag::clear(  $id ): array

Parameters:

Parameter Type Description
$id ****

See Also:


Template

  • Full name: \Rule\ApiWrapper\Api\V2\Template\Template
  • Parent class: \Rule\ApiWrapper\Api\Api

__construct

Create api instance

Template::__construct( \Rule\ApiWrapper\Client\Client $client )

Parameters:

Parameter Type Description
$client \Rule\ApiWrapper\Client\Client HTTP client implementation for api

getClient

Get http client

Template::getClient(  ): \Rule\ApiWrapper\Client\Client

getList

Get list of templates

Template::getList(  ): array

See Also:


get

Get template by id

Template::get(  $id ): array

Parameters:

Parameter Type Description
$id ****

See Also:


Transaction

  • Full name: \Rule\ApiWrapper\Api\V2\Transaction\Transaction
  • Parent class: \Rule\ApiWrapper\Api\Api

__construct

Create api instance

Transaction::__construct( \Rule\ApiWrapper\Client\Client $client )

Parameters:

Parameter Type Description
$client \Rule\ApiWrapper\Client\Client HTTP client implementation for api

getClient

Get http client

Transaction::getClient(  ): \Rule\ApiWrapper\Client\Client

send

Send transaction

Transaction::send( array $transaction ): array

Parameters:

Parameter Type Description
$transaction array

See Also:



This document was automatically generated from source code comments on 2017-07-17 using phpDocumentor and cvuorinen/phpdoc-markdown-public