GraphCollectionRequest extends GraphRequest
Class GraphCollectionRequest
Tags
Table of Contents
- $accessToken : string
- A valid access token
- $apiVersion : string
- The API version to use ("v1.0", "beta")
- $baseUrl : string
- The base url to call
- $deltaLink : string
- The delta link to use in calling /delta a subsequent time
- $end : bool
- True if the user has reached the end of the collection
- $endpoint : string
- The endpoint to call
- $headers : mixed
- An array of headers to send with the request
- $http_errors : bool
- Request options to decide if Guzzle Client should throw exceptions when http code is 4xx or 5xx
- $nextLink : string
- The next link to use in calling a new page of results
- $originalEndpoint : string
- The endpoint that the user called (with query parameters)
- $originalReturnType : object
- The return type that the user specified
- $pageSize : int
- The size of page to divide the collection into
- $proxyPort : string
- The proxy port to use. Null to disable
- $proxyVerifySSL : bool
- Whether SSL verification should be used for proxy requests
- $requestBody : string
- The body of the request (optional)
- $requestType : object
- The type of request to make ("GET", "POST", etc.)
- $returnsStream : bool
- True if the response should be returned as a stream
- $returnType : object
- The return type to cast the response as
- $timeout : int
- The timeout, in seconds
- __construct() : mixed
- Constructs a new GraphCollectionRequest object
- addHeaders() : $this
- Adds custom headers to the request
- attachBody() : $this
- Attach a body to the request. Will JSON encode any Microsoft\Graph\Model objects as well as arrays
- count() : int
- Gets the number of entries in the collection
- download() : null
- Download a file from OneDrive to a given location
- execute() : mixed
- Executes the HTTP request using Guzzle
- executeAsync() : mixed
- Executes the HTTP request asynchronously using Guzzle
- getApiVersion() : string
- Gets the API version in use for the request
- getBaseUrl() : string
- Gets the Base URL the request is made to
- getBody() : mixed
- Get the body of the request
- getDeltaLink() : string|null
- Gets a delta link to use with subsequent calls to /delta
- getHeaders() : array<string|int, mixed>
- Get the request headers
- getPage() : array<string|int, mixed>
- Gets the next page of results
- getReturnsStream() : bool
- Gets whether request returns a stream or not
- getTimeout() : int
- Gets the timeout value of the request
- isEnd() : bool
- Gets whether the user has reached the end of the collection
- processPageCallReturn() : mixed
- Clean up after making a page call request
- setAccessToken() : $this
- Sets a new accessToken
- setHttpErrors() : $this
- Sets a http errors option
- setPageCallInfo() : GraphCollectionRequest
- Sets the required query information to get a new page
- setPageSize() : GraphCollectionRequest
- Sets the number of results to return with each call to "getPage()"
- setReturnType() : $this
- Sets the return type of the response object
- setTimeout() : $this
- Sets the timeout limit of the cURL request
- upload() : mixed
- Upload a file to OneDrive from a given location
- createGuzzleClient() : Client
- Create a new Guzzle client To allow for user flexibility, the client is not reused. This allows the user to set and change headers on a per-request basis
- getConcatenator() : string
- Checks whether the endpoint currently contains query parameters and returns the relevant concatenator for the new query string
- _getDefaultHeaders() : array<string|int, mixed>
- Get a list of headers for the request
- _getRequestUrl() : string
- Get the concatenated request URL
Properties
$accessToken
A valid access token
protected
string
$accessToken
$apiVersion
The API version to use ("v1.0", "beta")
protected
string
$apiVersion
$baseUrl
The base url to call
protected
string
$baseUrl
$deltaLink
The delta link to use in calling /delta a subsequent time
protected
string
$deltaLink
$end
True if the user has reached the end of the collection
protected
bool
$end
$endpoint
The endpoint to call
protected
string
$endpoint
$headers
An array of headers to send with the request
protected
mixed
$headers
$http_errors
Request options to decide if Guzzle Client should throw exceptions when http code is 4xx or 5xx
protected
bool
$http_errors
$nextLink
The next link to use in calling a new page of results
protected
string
$nextLink
$originalEndpoint
The endpoint that the user called (with query parameters)
protected
string
$originalEndpoint
$originalReturnType
The return type that the user specified
protected
object
$originalReturnType
$pageSize
The size of page to divide the collection into
protected
int
$pageSize
$proxyPort
The proxy port to use. Null to disable
protected
string
$proxyPort
$proxyVerifySSL
Whether SSL verification should be used for proxy requests
protected
bool
$proxyVerifySSL
$requestBody
The body of the request (optional)
protected
string
$requestBody
$requestType
The type of request to make ("GET", "POST", etc.)
protected
object
$requestType
$returnsStream
True if the response should be returned as a stream
protected
bool
$returnsStream
$returnType
The return type to cast the response as
protected
object
$returnType
$timeout
The timeout, in seconds
protected
int
$timeout
Methods
__construct()
Constructs a new GraphCollectionRequest object
public
__construct(string $requestType, string $endpoint, string $accessToken, string $baseUrl, string $apiVersion[, string $proxyPort = null ][, bool $proxyVerifySSL = false ]) : mixed
Parameters
- $requestType : string
-
The HTTP verb for the request ("GET", "POST", "PUT", etc.)
- $endpoint : string
-
The URI of the endpoint to hit
- $accessToken : string
-
A valid access token
- $baseUrl : string
-
The base URL of the request
- $apiVersion : string
-
The version of the API to call
- $proxyPort : string = null
-
The url where to proxy through
- $proxyVerifySSL : bool = false
-
Whether the proxy requests should perform SSL verification
Tags
Return values
mixed —addHeaders()
Adds custom headers to the request
public
addHeaders(array<string|int, mixed> $headers) : $this
Parameters
- $headers : array<string|int, mixed>
-
An array of custom headers
Return values
$this —object
attachBody()
Attach a body to the request. Will JSON encode any Microsoft\Graph\Model objects as well as arrays
public
attachBody(mixed $obj) : $this
Parameters
- $obj : mixed
-
The object to include in the request
Return values
$this —object
count()
Gets the number of entries in the collection
public
count() : int
Tags
Return values
int —the number of entries
download()
Download a file from OneDrive to a given location
public
download(string $path[, mixed $client = null ]) : null
Parameters
- $path : string
-
The path to download the file to
- $client : mixed = null
-
The client to use in the request
Tags
Return values
null —execute()
Executes the HTTP request using Guzzle
public
execute([mixed $client = null ]) : mixed
Parameters
- $client : mixed = null
-
The client to use in the request
Tags
Return values
mixed —object or array of objects of class $returnType
executeAsync()
Executes the HTTP request asynchronously using Guzzle
public
executeAsync([mixed $client = null ]) : mixed
Parameters
- $client : mixed = null
-
The client to use in the request
Return values
mixed —object or array of objects of class $returnType
getApiVersion()
Gets the API version in use for the request
public
getApiVersion() : string
Return values
string —getBaseUrl()
Gets the Base URL the request is made to
public
getBaseUrl() : string
Return values
string —getBody()
Get the body of the request
public
getBody() : mixed
Return values
mixed —request body of any type
getDeltaLink()
Gets a delta link to use with subsequent calls to /delta
public
getDeltaLink() : string|null
Return values
string|null —The delta link
getHeaders()
Get the request headers
public
getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed> —of headers
getPage()
Gets the next page of results
public
getPage() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —of objects of class $returnType
getReturnsStream()
Gets whether request returns a stream or not
public
getReturnsStream() : bool
Return values
bool —getTimeout()
Gets the timeout value of the request
public
getTimeout() : int
Return values
int —isEnd()
Gets whether the user has reached the end of the collection
public
isEnd() : bool
Return values
bool —The end
processPageCallReturn()
Clean up after making a page call request
public
processPageCallReturn(GraphResponse $response) : mixed
Parameters
- $response : GraphResponse
-
The GraphResponse returned after making a page call
Return values
mixed —result of the call, formatted according to the returnType set by the user
setAccessToken()
Sets a new accessToken
public
setAccessToken(string $accessToken) : $this
Parameters
- $accessToken : string
-
A valid access token to validate the Graph call
Return values
$this —object
setHttpErrors()
Sets a http errors option
public
setHttpErrors(string $http_errors) : $this
Parameters
- $http_errors : string
-
A bool option to the Graph call
Return values
$this —object
setPageCallInfo()
Sets the required query information to get a new page
public
setPageCallInfo() : GraphCollectionRequest
Return values
GraphCollectionRequest —setPageSize()
Sets the number of results to return with each call to "getPage()"
public
setPageSize(int $pageSize) : GraphCollectionRequest
Parameters
- $pageSize : int
-
The page size
Tags
Return values
GraphCollectionRequest —object
setReturnType()
Sets the return type of the response object
public
setReturnType(mixed $returnClass) : $this
Parameters
- $returnClass : mixed
-
The object class to use
Return values
$this —object
setTimeout()
Sets the timeout limit of the cURL request
public
setTimeout(int $timeout) : $this
Parameters
- $timeout : int
-
The timeout in seconds
Return values
$this —object
upload()
Upload a file to OneDrive from a given location
public
upload(string $path[, mixed $client = null ]) : mixed
Parameters
- $path : string
-
The path of the file to upload
- $client : mixed = null
-
The client to use in the request
Tags
Return values
mixed —DriveItem or array of DriveItems
createGuzzleClient()
Create a new Guzzle client To allow for user flexibility, the client is not reused. This allows the user to set and change headers on a per-request basis
protected
createGuzzleClient() : Client
If a proxyPort was passed in the constructor, all requests will be forwared through this proxy.
Return values
Client —The new client
getConcatenator()
Checks whether the endpoint currently contains query parameters and returns the relevant concatenator for the new query string
protected
getConcatenator() : string
Return values
string —"?" or "&"
_getDefaultHeaders()
Get a list of headers for the request
private
_getDefaultHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed> —The headers for the request
_getRequestUrl()
Get the concatenated request URL
private
_getRequestUrl() : string
Return values
string —request URL