Properties

$api_key_id

$api_key_id : \ChapterThree\AppleNewsAPI\PublisherAPI\(string)

Type

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) — PublisherAPI API Key ID.

$api_key_secret

$api_key_secret : \ChapterThree\AppleNewsAPI\PublisherAPI\(string)

Type

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) — PublisherAPI Secret Key.

$endpoint

$endpoint : \ChapterThree\AppleNewsAPI\PublisherAPI\(string)

Type

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) — PublisherAPI Endpoint base URL.

$client

$client : \ChapterThree\AppleNewsAPI\PublisherAPI\(object)

Type

\ChapterThree\AppleNewsAPI\PublisherAPI\(object) — HTTP client class.

$path

$path : \ChapterThree\AppleNewsAPI\PublisherAPI\(string)

Type

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) — Endpoint path.

$method

$method : \ChapterThree\AppleNewsAPI\PublisherAPI\(string)

Type

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) — HTTP Method (GET/DELETE/POST).

$path_args

$path_args : \ChapterThree\AppleNewsAPI\PublisherAPI\(array)

Type

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) — Endpoint path variables to replace.

$datetime

$datetime : \ChapterThree\AppleNewsAPI\PublisherAPI\(datetime)

Type

\ChapterThree\AppleNewsAPI\PublisherAPI\(datetime) — ISO 8601 datetime.

$valid_mimes

$valid_mimes : \ChapterThree\AppleNewsAPI\PublisherAPI\(array)

Type

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) — Valid values for resource part Content-Type.

Methods

__construct()

__construct(\ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $key, \ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $secret, \ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $endpoint) 

Initialize variables needed in the communication with the API.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $key

API Key.

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $secret

API Secret Key.

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $endpoint

API endpoint URL.

setHTTPClient()

setHTTPClient() 

Setup HTTP client to make requests.

get()

get(\ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $path, \ChapterThree\AppleNewsAPI\PublisherAPI\(array)  $path_args, \ChapterThree\AppleNewsAPI\PublisherAPI\(array)  $data) : object

Create GET request to a specified endpoint.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $path

Path to API endpoint.

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) $path_args

Endpoint path arguments to replace tokens in the path.

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) $data

Raw content of the request or associative array to pass to endpoints.

Returns

object —

Preprocessed structured object.

post()

post(\ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $path, \ChapterThree\AppleNewsAPI\PublisherAPI\(array)  $path_args, \ChapterThree\AppleNewsAPI\PublisherAPI\(array)  $data) : object

Create POST request to a specified endpoint.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $path

Path to API endpoint.

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) $path_args

Endpoint path arguments to replace tokens in the path.

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) $data

Raw content of the request or associative array to pass to endpoints.

Returns

object —

Preprocessed structured object.

delete()

delete(\ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $path, \ChapterThree\AppleNewsAPI\PublisherAPI\(array)  $path_args, \ChapterThree\AppleNewsAPI\PublisherAPI\(array)  $data) : object

Create DELETE request to a specified endpoint.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $path

Path to API endpoint.

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) $path_args

Endpoint path arguments to replace tokens in the path.

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) $data

Raw content of the request or associative array to pass to endpoints.

Returns

object —

Preprocessed structured object and returns 204 No Content on success, with no response body.

__get()

__get(\ChapterThree\AppleNewsAPI\PublisherAPI\(mixed)  $name) 

Implements __get().

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(mixed) $name

Property name.

__set()

__set(\ChapterThree\AppleNewsAPI\PublisherAPI\(mixed)  $name, \ChapterThree\AppleNewsAPI\PublisherAPI\(mixed)  $value) 

Implements __set().

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(mixed) $name

Property name.

\ChapterThree\AppleNewsAPI\PublisherAPI\(mixed) $value

Property value.

__isset()

__isset(\ChapterThree\AppleNewsAPI\PublisherAPI\(mixed)  $name) 

Implements __isset().

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(mixed) $name

Property name.

__unset()

__unset(\ChapterThree\AppleNewsAPI\PublisherAPI\(mixed)  $name) 

Implements __unset().

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(mixed) $name

Property name.

triggerError()

triggerError(\ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $message, \ChapterThree\AppleNewsAPI\PublisherAPI\(const)  $message_type = E_USER_NOTICE) 

Error handler.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $message

Error message to display.

\ChapterThree\AppleNewsAPI\PublisherAPI\(const) $message_type

Predefined Constants

hhmac()

hhmac(\ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $string, \ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $api_key_secret) : \ChapterThree\AppleNewsAPI\PublisherAPI\(string)

Generate HMAC cryptographic hash.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $string

Message to be hashed.

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $api_key_secret

Shared secret key used for generating the HMAC.

Returns

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) —

Authorization token used in the HTTP headers.

auth()

auth(\ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $string = '') : \ChapterThree\AppleNewsAPI\PublisherAPI\(string)

Create canonical version of the request as a byte-wise concatenation.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $string

String to concatenate (see POST method).

Returns

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) —

HMAC cryptographic hash

path()

path() : \ChapterThree\AppleNewsAPI\PublisherAPI\(string)

Generate HTTP request URL.

Returns

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) —

URL to create request.

initVars()

initVars(\ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $method, \ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $path, \ChapterThree\AppleNewsAPI\PublisherAPI\(array)  $path_args, \ChapterThree\AppleNewsAPI\PublisherAPI\(array)  $data) 

Initialize variables needed to make a request.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $method

Request method (POST/GET/DELETE).

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $path

Path to API endpoint.

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) $path_args

Endpoint path arguments to replace tokens in the path.

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) $data

Data to pass to the endpoint.

setHeaders()

setHeaders(\ChapterThree\AppleNewsAPI\PublisherAPI\(array)  $headers = array()) 

Set HTTP headers.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) $headers

Associative array [header field name => value].

unsetHeaders()

unsetHeaders(\ChapterThree\AppleNewsAPI\PublisherAPI\(array)  $headers = array()) 

Remove specified header names from HTTP request.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(array) $headers

Associative array [header1, header2, ..., headerN].

request()

request(\ChapterThree\AppleNewsAPI\PublisherAPI\(array|\ChapterThree\AppleNewsAPI\PublisherAPI\string)  $data) : \ChapterThree\AppleNewsAPI\PublisherAPI\(object)

Create HTTP request.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(array|\ChapterThree\AppleNewsAPI\PublisherAPI\string) $data

Raw content of the request or associative array to pass to endpoints.

Returns

\ChapterThree\AppleNewsAPI\PublisherAPI\(object) —

HTTP Response object.

response()

response(\ChapterThree\AppleNewsAPI\PublisherAPI\(object)  $response) : \ChapterThree\AppleNewsAPI\PublisherAPI\(object)

Preprocess HTTP response.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(object) $response

Structured object.

Returns

\ChapterThree\AppleNewsAPI\PublisherAPI\(object) —

HTTP Response object.

onSuccessfulResponse()

onSuccessfulResponse(\ChapterThree\AppleNewsAPI\PublisherAPI\(object)  $response) 

Callback for successful HTTP response.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(object) $response

HTTP Response object.

onErrorResponse()

onErrorResponse(\ChapterThree\AppleNewsAPI\PublisherAPI\(int)  $error_code, \ChapterThree\AppleNewsAPI\PublisherAPI\(string)  $error_message, \ChapterThree\AppleNewsAPI\PublisherAPI\(object)  $response) 

Callback for error HTTP response.

Parameters

\ChapterThree\AppleNewsAPI\PublisherAPI\(int) $error_code

HTTP status code.

\ChapterThree\AppleNewsAPI\PublisherAPI\(string) $error_message

HTTP status message.

\ChapterThree\AppleNewsAPI\PublisherAPI\(object) $response

Structured object.