Skip to content
Mike Russell edited this page Jun 12, 2017 · 4 revisions

Namespace

SugarAPI\SDK\Endpoint\

Interface

SugarAPI\SDK\Endpoint\Interfaces\EndpointInterface

Abstracts

Methods

setOptions();

Set any options on the Endpoint that are needed to manage the url, data, requests, response any logic really

Arguments

Name Type Description
$options array An array of options

Returns

Type Description
self The current Endpoint Object for method chaining

setData();

Sets the data on the Endpoint Object. This can be either the exact data that will be passed to the Request object, or a shorthand or altered set of data, that is then configured and passed to the Request

Arguments

Name Type Description
$data array An array of data which will be parsed and passed to the Request

Returns

Type Description
self The current Endpoint Object for method chaining

setUrl($url);

Set the full URL that the Endpoint submits data to

Arguments

Name Type Description
$url string The full URL the Endpoint submits data to

Returns

Type Description
self The current Endpoint Object for method chaining

setRequest();

Set the Request Object used by the Endpoint

Arguments

Name Type Description
$Request SugarAPI\SDK\Request\Interfaces\RequestInterface The Request Object that is to be used by the Endpoint

Returns

Type Description
self The current Endpoint Object for method chaining

setResponse(ResponseInterface $Response);

Set the Response Object used by the Endpoint

Arguments

Name Type Description
$Request SugarAPI\SDK\Response\Interfaces\ResponseInterface The Response Object that is to be used by the Endpoint

Returns

Type Description
self The current Endpoint Object for method chaining

setAuth();

Configure authentication on the Endpoint. In Sugar's REST API, this is used to store just the 'access_token' on the Endpoint, which can then be properly added to the Header of the Request.

Arguments

Name Type Description
$token mixed The necessary authentication information that needs to be added to the Request

Returns

Type Description
self The current Endpoint Object for method chaining

authRequired();

Check if Authentication is required for this API Endpoint

Returns

Type Description
boolean Whether or not authentication is required for this API Endpoint

execute();

Execute the Endpoint Object, by sending the fully configured Request to the API Endpoint.

Returns

Type Description
self The current Endpoint Object for method chaining

getOptions();

Get the options configured on the Endpoint

Returns

Type Description
array The options configured on the Endpoint Object

getUrl();

Get the full URL being used by the Endpoint

Returns

Type Description
string The URL configured on the Endpoint Object

getData();

Get the data URL being used by the Endpoint

Returns

Type Description
array The data configured on the Endpoint Object

getResponse();

Get the Response Object being used by the Endpoint

Returns

Type Description
SugarAPI\SDK\Response\Interfaces\ResponseInterface The Response Object being used on the Endpoint Object

getRequest();

Get the Request Object being used by the Endpoint

Returns

Type Description
SugarAPI\SDK\Request\Interfaces\RequestInterface The Request Object being used on the Endpoint Object

Implementations

Usage