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
$_appName
protected
string
$_appName
$_appVersion
protected
string
$_appVersion
$_auth
protected
Auth
$_auth
$_client
protected
Client
$_client
$_clientId
protected
string
$_clientId
$_clientSecret
protected
string
$_clientSecret
$_server
protected
string
$_server
$_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 = ''
auth()
public
auth() : Auth
Return values
AuthauthUrl()
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
stringcreateUrl()
public
createUrl([string $path = '' ][, array<string|int, mixed> $options = [] ]) : string
Parameters
- $path : string = ''
- $options : array<string|int, mixed> = []
Return values
stringdelete()
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
Return values
ApiResponseget()
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
Return values
ApiResponseinflateRequest()
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
Return values
RequestInterfaceloggedIn()
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
Return values
ApiResponselogout()
public
logout() : ApiResponse
Tags
Return values
ApiResponseparseAuthRedirectUrl()
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
Return values
ApiResponsepost()
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
Return values
ApiResponseput()
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
Return values
ApiResponserefresh()
Attempt to request new access and refresh tokens using the existing refresh token.
public
refresh() : ApiResponse
Tags
Return values
ApiResponsesendRequest()
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
Return values
ApiResponseapiKey()
protected
apiKey() : string
Return values
stringauthHeader()
protected
authHeader() : string
Return values
stringensureAuthentication()
protected
ensureAuthentication() : void
Tags
requestToken()
protected
requestToken([string $path = '' ][, array<string|int, mixed> $body = [] ]) : ApiResponse
Parameters
- $path : string = ''
- $body : array<string|int, mixed> = []