Documentation

AbstractGraphClient
in package

Class BaseClient

Base class to be extended by Graph client classes in v1 and beta packages

Tags
copyright

2021 Microsoft Corporation

license

https://opensource.org/licenses/MIT MIT License

link
https://developer.microsoft.com/graph

Table of Contents

$accessToken  : string
The access_token provided after authenticating with Microsoft Graph (required)
$httpClient  : HttpClientInterface
HttpClient to use for requests
$nationalCloud  : string
Host to use as the base URL and for authentication
__construct()  : mixed
BaseClient constructor.
createCollectionRequest()  : GraphCollectionRequest
Creates a new collection request object with the given Graph information
createRequest()  : GraphRequest
Creates a new request object with the given Graph information
getAccessToken()  : string
getApiVersion()  : string
Returns API version used in the service library
getHttpClient()  : HttpClientInterface
getNationalCloud()  : string
getSdkVersion()  : string
Return SDK version used in the service library client.
setAccessToken()  : $this
Sets the access token. A valid access token is required to run queries against Graph

Properties

$accessToken

The access_token provided after authenticating with Microsoft Graph (required)

private string $accessToken

$nationalCloud

Host to use as the base URL and for authentication

private string $nationalCloud = MicrosoftGraphCoreNationalCloud::GLOBAL

Methods

__construct()

BaseClient constructor.

public __construct([string|null $nationalCloud = NationalCloud::GLOBAL ][, HttpClientInterface|null $httpClient = null ]) : mixed

Creates a Graph client object used to make requests to the Graph API

Parameters
$nationalCloud : string|null = NationalCloud::GLOBAL

if null defaults to "https://graph.microsoft.com"

$httpClient : HttpClientInterface|null = null

if null creates default Guzzle client

Tags
throws
GraphClientException
Return values
mixed

createCollectionRequest()

Creates a new collection request object with the given Graph information

public createCollectionRequest(string $requestType, string $endpoint) : GraphCollectionRequest
Parameters
$requestType : string

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

$endpoint : string

The Graph endpoint to call

Tags
throws
GraphClientException
Return values
GraphCollectionRequest

The request object, which can be used to make queries against Graph

createRequest()

Creates a new request object with the given Graph information

public createRequest(string $requestType, string $endpoint) : GraphRequest
Parameters
$requestType : string

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

$endpoint : string

The Graph endpoint to call

Tags
throws
GraphClientException
Return values
GraphRequest

The request object, which can be used to make queries against Graph

getApiVersion()

Returns API version used in the service library

public abstract getApiVersion() : string
Return values
string

getSdkVersion()

Return SDK version used in the service library client.

public abstract getSdkVersion() : string
Return values
string

setAccessToken()

Sets the access token. A valid access token is required to run queries against Graph

public setAccessToken(string $accessToken) : $this
Parameters
$accessToken : string

The user's access token, retrieved from MS auth

Return values
$this

object

Search results