Documentation

GraphService
in package

This is the GraphService.

The main service that gets and sets data in Office 365.

Table of Contents

$authService  : AuthenticationServiceInterface
Drupal\o365\AuthenticationServiceInterface definition.
$cacheBackend  : CacheBackendInterface
The cache baclend service.
$logger  : LoggerChannelInterface
The modules logger.
$messenger  : O365LoggerServiceInterface
The logger service.
__construct()  : mixed
Constructs a new GraphService object.
getCollectionData()  : false|GraphCollectionRequest
Get a collection of data.
getCurrentUserId()  : bool|string
Determine the office user ID.
getGraphData()  : mixed
Get data from the MS GraphAPI.
sendGraphData()  : mixed
Send data to the MS GraphAPI.
getData()  : array<string|int, mixed>|false|string|null
Generic method to get or send data to the Graph endpoints.

Properties

$cacheBackend

The cache baclend service.

protected CacheBackendInterface $cacheBackend

$logger

The modules logger.

protected LoggerChannelInterface $logger

Methods

__construct()

Constructs a new GraphService object.

public __construct(AuthenticationServiceInterface $authenticationService, O365LoggerServiceInterface $messenger, CacheBackendInterface $cacheBackend, LoggerChannelFactoryInterface $loggerChannelFactory) : mixed
Parameters
$authenticationService : AuthenticationServiceInterface

The AuthenticationServiceInterface definition.

$messenger : O365LoggerServiceInterface

The O365LoggerServiceInterface definition.

$cacheBackend : CacheBackendInterface

The CacheBackendInterface definition.

$loggerChannelFactory : LoggerChannelFactoryInterface

The logger channel factory. Used to log to the watchdog.

Return values
mixed

getCollectionData()

Get a collection of data.

public getCollectionData(string $endpoint[, false|string $returnType = FALSE ][, false|string $version = FALSE ]) : false|GraphCollectionRequest
Parameters
$endpoint : string

The graph endpoint we want data from.

$returnType : false|string = FALSE

The return type we want to get.

$version : false|string = FALSE

The version of the graph api that is used.

Tags
throws
TempStoreException
throws
IdentityProviderException
throws
GraphException
Return values
false|GraphCollectionRequest

The collection request.

getCurrentUserId()

Determine the office user ID.

public getCurrentUserId() : bool|string
Return values
bool|string

The ID or FALSE if not logged in via Office.

getGraphData()

Get data from the MS GraphAPI.

public getGraphData(string $endpoint[, string $type = 'GET' ][, bool $raw = FALSE ][, string|bool $version = FALSE ][, string|bool $returnType = FALSE ]) : mixed
Parameters
$endpoint : string

The graph endpoint we want data from.

$type : string = 'GET'

The type of request we want to do.

$raw : bool = FALSE

This determines if we want a raw body or not.

$version : string|bool = FALSE

The version of the graph api that is used.

$returnType : string|bool = FALSE

The return type we want to get.

Tags
throws
TempStoreException
throws
IdentityProviderException|GuzzleException
Return values
mixed

The data retrieved from the Graph API.

sendGraphData()

Send data to the MS GraphAPI.

public sendGraphData(string $endpoint[, array<string|int, mixed> $data = [] ][, string $type = 'POST' ][, bool $raw = FALSE ][, string|bool $version = FALSE ]) : mixed
Parameters
$endpoint : string

The graph endpoint we want data from.

$data : array<string|int, mixed> = []

Sent data.

$type : string = 'POST'

The type of request we want to do.

$raw : bool = FALSE

This determines if we want a raw body or not.

$version : string|bool = FALSE

The version of the graph api that is used.

Tags
throws
TempStoreException
throws
IdentityProviderException|GuzzleException
Return values
mixed

The data retrieved from the Graph API.

getData()

Generic method to get or send data to the Graph endpoints.

private getData(string $endpoint[, string $type = 'GET' ][, bool $raw = FALSE ][, string|bool $version = FALSE ][, array<string|int, mixed> $data = [] ][, string|bool $returnType = FALSE ]) : array<string|int, mixed>|false|string|null
Parameters
$endpoint : string

The graph endpoint we want data from.

$type : string = 'GET'

The type of request we want to do.

$raw : bool = FALSE

This determines if we want a raw body or not.

$version : string|bool = FALSE

The version of the graph api that is used.

$data : array<string|int, mixed> = []

Sent data.

$returnType : string|bool = FALSE

The return type we want to get.

Tags
throws
TempStoreException
throws
GuzzleException
throws
IdentityProviderException
Return values
array<string|int, mixed>|false|string|null

The retrieved data from the GRAPH API.

Search results