Properties

$accessToken

$accessToken : string

A valid access token

Type

string

$apiVersion

$apiVersion : string

The API version to use ("v1.0", "beta")

Type

string

$baseUrl

$baseUrl : string

The base url to call

Type

string

$endpoint

$endpoint : string

The endpoint to call

Type

string

$guzzleClient

$guzzleClient : \Microsoft\Graph\Http\GuzzleHttp\Guzzle\Client

The Guzzle client used to make the HTTP request

Type

\Microsoft\Graph\Http\GuzzleHttp\Guzzle\Client

$headers

$headers : \Microsoft\Graph\Http\array(string

An array of headers to send with the request

Type

\Microsoft\Graph\Http\array(string — => string)

$requestBody

$requestBody : string

The body of the request (optional)

Type

string

$requestType

$requestType : string

The type of request to make ("GET", "POST", etc.)

Type

string

$returnsStream

$returnsStream : boolean

True if the response should be returned as a stream

Type

boolean

$returnType

$returnType : \Microsoft\Graph\Http\Microsoft\Graph\Model

The return type to cast the response as

Type

\Microsoft\Graph\Http\Microsoft\Graph\Model

$timeout

$timeout : string

The timeout, in seconds

Type

string

$pageSize

$pageSize : integer

The size of page to divide the collection into

Type

integer

$skipToken

$skipToken : string

The skip token to use in calling a new page of results

Type

string

$end

$end : boolean

True if the user has reached the end of the collection

Type

boolean

$originalEndpoint

$originalEndpoint : string

The endoint that the user called (with query parameters)

Type

string

$originalReturnType

$originalReturnType : string

The return type that the user specified

Type

string

Methods

__construct()

__construct(string  $requestType, string  $endpoint, string  $accessToken, string  $baseUrl, string  $apiVersion) 

Constructs a new GraphCollectionRequest object

Parameters

string $requestType

The HTTP verb for the request ("GET", "POST", "PUT", etc.)

string $endpoint

The URI of the endpoint to hit

string $accessToken

A valid access token

string $baseUrl

The base URL of the request

string $apiVersion

The version of the API to call

setReturnType()

setReturnType(mixed  $returnClass) : \Microsoft\Graph\Http\The

Sets the return type of the response object

Parameters

mixed $returnClass

The object class to use

Returns

\Microsoft\Graph\Http\The —

GraphRequest object

addHeaders()

addHeaders(array  $headers) : \Microsoft\Graph\Http\The

Adds custom headers to the request

Parameters

array $headers

An array of custom headers

Returns

\Microsoft\Graph\Http\The —

request object

getHeaders()

getHeaders() : \Microsoft\Graph\Http\$headers

Get the request headers

Returns

\Microsoft\Graph\Http\$headers —

An array of headers

attachBody()

attachBody(mixed  $obj) : \Microsoft\Graph\Http\The

Attach a body to the request. Will JSON encode any Microsoft\Graph\Model objects as well as arrays

Parameters

mixed $obj

The object to include in the request

Returns

\Microsoft\Graph\Http\The —

request object

getBody()

getBody() : \Microsoft\Graph\Http\Request

Get the body of the request

Returns

\Microsoft\Graph\Http\Request —

body of any type

setTimeout()

setTimeout(string  $timeout) : \Microsoft\Graph\Http\The

Sets the timeout limit of the cURL request

Parameters

string $timeout

The timeout in ms

Returns

\Microsoft\Graph\Http\The —

request object

execute()

execute(mixed  $client = null) : \Microsoft\Graph\Http\An

Executes the HTTP request using Guzzle

Parameters

mixed $client

The client to use in the request

Returns

\Microsoft\Graph\Http\An —

object or array of objects of class $returnType

executeAsync()

executeAsync(mixed  $client = null) : \Microsoft\Graph\Http\An

Executes the HTTP request asynchronously using Guzzle

Parameters

mixed $client

The client to use in the request

Returns

\Microsoft\Graph\Http\An —

object or array of objects of class $returnType

download()

download(string  $path, mixed  $client = null) : null

Download a file from OneDrive to a given location

Parameters

string $path

The path to download the file to

mixed $client

The client to use in the request

Returns

null

upload()

upload(string  $path, mixed  $client = null) : \Microsoft\Graph\Http\An

Upload a file to OneDrive from a given location

Parameters

string $path

The path of the file to upload

mixed $client

The client to use in the request

Returns

\Microsoft\Graph\Http\An —

object or array of objects (DriveItems)

count()

count() : \Microsoft\Graph\Http\The

Gets the number of entries in the collection

Returns

\Microsoft\Graph\Http\The —

number of entries

setPageSize()

setPageSize(integer  $pageSize) : \Microsoft\Graph\Http\the

Sets the number of results to return with each call to "getPage()"

Parameters

integer $pageSize

The page size

Returns

\Microsoft\Graph\Http\the —

GraphCollectionRequest object

getPage()

getPage(boolean  $prev = false) : \Microsoft\Graph\Http\An

Gets the next page of results

Parameters

boolean $prev

When true, get the previous page

Returns

\Microsoft\Graph\Http\An —

array of objects of class $returnType

setPageCallInfo()

setPageCallInfo(boolean  $prev) : \Microsoft\Graph\Http\The

Sets the required query information to get a new page

Parameters

boolean $prev

Set to true for the previous page

Returns

\Microsoft\Graph\Http\The —

GraphCollectionRequest

processPageCallReturn()

processPageCallReturn(\Microsoft\Graph\Http\GraphResponse  $response) : \Microsoft\Graph\Http\The

Clean up after making a page call request

Parameters

\Microsoft\Graph\Http\GraphResponse $response

The GraphResponse returned after making a page call

Returns

\Microsoft\Graph\Http\The —

result of the call, formatted according to the returnType set by the user

getPrevPage()

getPrevPage() : \Microsoft\Graph\Http\An

Gets the previous page of results from the collection

Returns

\Microsoft\Graph\Http\An —

array of objects of class $returnType

isEnd()

isEnd() : boolean

Gets whether the user has reached the end of the collection

Returns

boolean —

The end

getConcatenator()

getConcatenator() : \Microsoft\Graph\Http\"?"

Checks whether the endpoint currently contains query parameters and returns the relevant concatenator for the new query string

Returns

\Microsoft\Graph\Http\"?" —

or "&"

_getDefaultHeaders()

_getDefaultHeaders() : array

Get a list of headers for the request

Returns

array —

The headers for the request

_getRequestUrl()

_getRequestUrl() : \Microsoft\Graph\Http\The

Get the concatenated request URL

Returns

\Microsoft\Graph\Http\The —

request URL