Menu

## AbstractGraphClient
in package

AbstractGraphClient.php : 23

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

AbstractGraphClient.php : 31

The access_token provided after authenticating with Microsoft Graph (required)

`private string $accessToken`

#### $httpClient

AbstractGraphClient.php : 43

HttpClient to use for requests

`private HttpClientInterface $httpClient = null`

#### $nationalCloud

AbstractGraphClient.php : 37

Host to use as the base URL and for authentication

`private string $nationalCloud = MicrosoftGraphCoreNationalCloud::GLOBAL`

### Methods

#### __construct()

AbstractGraphClient.php : 55

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()

AbstractGraphClient.php : 130

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()

AbstractGraphClient.php : 110

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

#### getAccessToken()

AbstractGraphClient.php : 80
`public getAccessToken() : string`

##### Return values

string —

#### getApiVersion()

AbstractGraphClient.php : 151

Returns API version used in the service library

`public abstract getApiVersion() : string`

##### Return values

string —

#### getHttpClient()

AbstractGraphClient.php : 95
`public getHttpClient() : HttpClientInterface`

##### Return values

HttpClientInterface —

#### getNationalCloud()

AbstractGraphClient.php : 87
`public getNationalCloud() : string`

##### Return values

string —

#### getSdkVersion()

AbstractGraphClient.php : 144

Return SDK version used in the service library client.

`public abstract getSdkVersion() : string`

##### Return values

string —

#### setAccessToken()

AbstractGraphClient.php : 71

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