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

Methods

__construct()

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

Constructs a new Graph Request object

Parameters

string $requestType

The HTTP method to use, e.g. "GET" or "POST"

string $endpoint

The Graph endpoint to call

string $accessToken

A valid access token to validate the Graph call

string $baseUrl

The base URL to call

string $apiVersion

The API version to use

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)

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