Documentation

Platform
in package

Table of Contents

Constants

ACCESS_TOKEN_TTL  = 3600
API_VERSION  = 'v1.0'
AUTHORIZE_ENDPOINT  = '/restapi/oauth/authorize'
KNOWN_PREFIXES  = array(self::URL_PREFIX, '/rcvideo', '/video', '/webinar', '/team-messaging', '/analytics', '/ai', '/scim', '/cx')
REFRESH_TOKEN_TTL  = 604800
REVOKE_ENDPOINT  = '/restapi/oauth/revoke'
TOKEN_ENDPOINT  = '/restapi/oauth/token'
URL_PREFIX  = '/restapi'

Properties

$_appName  : string
$_appVersion  : string
$_auth  : Auth
$_client  : Client
$_clientId  : string
$_clientSecret  : string
$_server  : string
$_userAgent  : string

Methods

__construct()  : mixed
Platform constructor.
auth()  : Auth
authUrl()  : string
Create and return a URL that can be used for authenticating/logging in to RingCentral.
createUrl()  : string
delete()  : ApiResponse
get()  : ApiResponse
inflateRequest()  : RequestInterface
Convenience helper used for processing requests (even externally created).
loggedIn()  : bool
This function has mixed purposes. On the face of it, it can used to return a boolean value which represents whether or not the platform has been configured with valid authentication tokens.
login()  : ApiResponse
logout()  : ApiResponse
parseAuthRedirectUrl()  : array<string|int, mixed>
patch()  : ApiResponse
post()  : ApiResponse
put()  : ApiResponse
refresh()  : ApiResponse
Attempt to request new access and refresh tokens using the existing refresh token.
sendRequest()  : ApiResponse
Method sends the request (even externally created) to API server using client
apiKey()  : string
authHeader()  : string
ensureAuthentication()  : void
requestToken()  : ApiResponse

Constants

ACCESS_TOKEN_TTL

public mixed ACCESS_TOKEN_TTL = 3600

API_VERSION

public mixed API_VERSION = 'v1.0'

AUTHORIZE_ENDPOINT

public mixed AUTHORIZE_ENDPOINT = '/restapi/oauth/authorize'

KNOWN_PREFIXES

public mixed KNOWN_PREFIXES = array(self::URL_PREFIX, '/rcvideo', '/video', '/webinar', '/team-messaging', '/analytics', '/ai', '/scim', '/cx')

REFRESH_TOKEN_TTL

public mixed REFRESH_TOKEN_TTL = 604800

REVOKE_ENDPOINT

public mixed REVOKE_ENDPOINT = '/restapi/oauth/revoke'

TOKEN_ENDPOINT

public mixed TOKEN_ENDPOINT = '/restapi/oauth/token'

URL_PREFIX

public mixed URL_PREFIX = '/restapi'

Properties

$_appVersion

protected string $_appVersion

$_clientSecret

protected string $_clientSecret

$_userAgent

protected string $_userAgent

Methods

__construct()

Platform constructor.

public __construct(Client $client, string $clientId, string $clientSecret, string $server[, string $appName = '' ][, string $appVersion = '' ]) : mixed
Parameters
$client : Client
$clientId : string
$clientSecret : string
$server : string
$appName : string = ''
$appVersion : string = ''

authUrl()

Create and return a URL that can be used for authenticating/logging in to RingCentral.

public authUrl(array<string|int, mixed> $options) : string
Parameters
$options : array<string|int, mixed>

An array containing information that will be added to the generated URL. $options = [ 'redirectUri' => (string) The callback URI to use once authentication is complete. 'state' => (string) 'brandId' => (string) 'display' => (string) 'prompt' => (string) 'code_challenge' => (string) Used to facilitate PKCE auth flows 'code_challenge_method' => (string) Used to facilitate PKCE auth flows ]

Return values
string

createUrl()

public createUrl([string $path = '' ][, array<string|int, mixed> $options = [] ]) : string
Parameters
$path : string = ''
$options : array<string|int, mixed> = []
Return values
string

delete()

public delete([string $url = '' ][, mixed $body = null ][, array<string|int, mixed> $queryParameters = [] ][, array<string|int, mixed> $headers = [] ][, array<string|int, mixed> $options = [] ]) : ApiResponse
Parameters
$url : string = ''
$body : mixed = null
$queryParameters : array<string|int, mixed> = []
$headers : array<string|int, mixed> = []
$options : array<string|int, mixed> = []
Tags
throws
Exception

If an error occurs parsing the response from the request.

throws
ApiException

If an error occurs making the request.

Return values
ApiResponse

get()

public get([string $url = '' ][, array<string|int, mixed> $queryParameters = [] ][, array<string|int, mixed> $headers = [] ][, array<string|int, mixed> $options = [] ]) : ApiResponse
Parameters
$url : string = ''
$queryParameters : array<string|int, mixed> = []
$headers : array<string|int, mixed> = []
$options : array<string|int, mixed> = []
Tags
throws
Exception

If an error occurs parsing the response from the request.

throws
ApiException

If an error occurs making the request.

Return values
ApiResponse

inflateRequest()

Convenience helper used for processing requests (even externally created).

public inflateRequest(RequestInterface $request[, array<string|int, mixed> $options = [] ]) : RequestInterface

Performs access token refresh if needed. Then adds Authorization header and API server to URI

Parameters
$request : RequestInterface
$options : array<string|int, mixed> = []
Tags
throws
Exception

If an error occurs parsing the response from the refresh request.

throws
ApiException

If an error occurs making the refresh request.

Return values
RequestInterface

loggedIn()

This function has mixed purposes. On the face of it, it can used to return a boolean value which represents whether or not the platform has been configured with valid authentication tokens.

public loggedIn() : bool

However, it also does much more than that. If the access token is expired BUT the refresh token is valid, then this function takes it upon itself to use that refresh token to automatically request brand new tokens, which it then sets and uses.

Return values
bool

True if the access token is value OR it is able to request new tokens successfully, otherwise false

login()

public login(mixed $options) : ApiResponse
Parameters
$options : mixed
Tags
throws
Exception

If it fails to retrieve/parse JSON data from he response.

throws
ApiException

If there is an issue with the token request.

Return values
ApiResponse

parseAuthRedirectUrl()

public parseAuthRedirectUrl(string $url) : array<string|int, mixed>
Parameters
$url : string
Return values
array<string|int, mixed>

patch()

public patch([string $url = '' ][, array<string|int, mixed> $body = null ][, array<string|int, mixed> $queryParameters = [] ][, array<string|int, mixed> $headers = [] ][, array<string|int, mixed> $options = [] ]) : ApiResponse
Parameters
$url : string = ''
$body : array<string|int, mixed> = null
$queryParameters : array<string|int, mixed> = []
$headers : array<string|int, mixed> = []
$options : array<string|int, mixed> = []
Tags
throws
Exception

If an error occurs parsing the response from the request.

throws
ApiException

If an error occurs making the request.

Return values
ApiResponse

post()

public post([string $url = '' ][, array<string|int, mixed> $body = null ][, array<string|int, mixed> $queryParameters = [] ][, array<string|int, mixed> $headers = [] ][, array<string|int, mixed> $options = [] ]) : ApiResponse
Parameters
$url : string = ''
$body : array<string|int, mixed> = null
$queryParameters : array<string|int, mixed> = []
$headers : array<string|int, mixed> = []
$options : array<string|int, mixed> = []
Tags
throws
Exception

If an error occurs parsing the response from the request.

throws
ApiException

If an error occurs making the request.

Return values
ApiResponse

put()

public put([string $url = '' ][, array<string|int, mixed> $body = null ][, array<string|int, mixed> $queryParameters = [] ][, array<string|int, mixed> $headers = [] ][, array<string|int, mixed> $options = [] ]) : ApiResponse
Parameters
$url : string = ''
$body : array<string|int, mixed> = null
$queryParameters : array<string|int, mixed> = []
$headers : array<string|int, mixed> = []
$options : array<string|int, mixed> = []
Tags
throws
Exception

If an error occurs parsing the response from the request.

throws
ApiException

If an error occurs making the request.

Return values
ApiResponse

refresh()

Attempt to request new access and refresh tokens using the existing refresh token.

public refresh() : ApiResponse
Tags
throws
Exception

If it fails to retrieve/parse JSON data from he response.

throws
ApiException

If the existing refresh token is invalid or there is an issue with the request.

Return values
ApiResponse

sendRequest()

Method sends the request (even externally created) to API server using client

public sendRequest(RequestInterface $request[, array<string|int, mixed> $options = [] ]) : ApiResponse
Parameters
$request : RequestInterface
$options : array<string|int, mixed> = []
Tags
throws
Exception

If an error occurs parsing the response from the refresh request as part of inflateRequest()

throws
ApiException

If an error occurs making the refresh request as part of inflateRequest()

Return values
ApiResponse

apiKey()

protected apiKey() : string
Return values
string

authHeader()

protected authHeader() : string
Return values
string

ensureAuthentication()

protected ensureAuthentication() : void
Tags
throws
Exception

If an error occurs parsing the response from the refresh request.

throws
ApiException

If an error occurs making the refresh request.

requestToken()

protected requestToken([string $path = '' ][, array<string|int, mixed> $body = [] ]) : ApiResponse
Parameters
$path : string = ''
$body : array<string|int, mixed> = []
Tags
throws
Exception

If an error occurs parsing the response from the request.

throws
ApiException

If an error occurs making the request.

Return values
ApiResponse

        
On this page

Search results