-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathBaseGraphRequestAdapter.php
More file actions
48 lines (43 loc) · 2.01 KB
/
Copy pathBaseGraphRequestAdapter.php
File metadata and controls
48 lines (43 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Copyright (c) Microsoft Corporation. All Rights Reserved.
* Licensed under the MIT License. See License in the project root
* for license information.
*/
namespace Microsoft\Graph\Core;
use GuzzleHttp\Client;
use Microsoft\Graph\Core\Middleware\Option\GraphTelemetryOption;
use Microsoft\Kiota\Abstractions\Authentication\AnonymousAuthenticationProvider;
use Microsoft\Kiota\Abstractions\Authentication\AuthenticationProvider;
use Microsoft\Kiota\Abstractions\Serialization\ParseNodeFactory;
use Microsoft\Kiota\Abstractions\Serialization\SerializationWriterFactory;
use Microsoft\Kiota\Http\GuzzleRequestAdapter;
/**
* Class BaseGraphRequestAdapter
*
* @package Microsoft\Graph\Core
* @copyright 2022 Microsoft Corporation
* @license https://opensource.org/licenses/MIT MIT License
* @link https://developer.microsoft.com/graph
*/
class BaseGraphRequestAdapter extends GuzzleRequestAdapter
{
/**
* @param GraphTelemetryOption $telemetryOption
* @param AuthenticationProvider|null $authenticationProvider
* @param ParseNodeFactory|null $parseNodeFactory
* @param SerializationWriterFactory|null $serializationWriterFactory
* @param Client|null $guzzleClient
*/
public function __construct(GraphTelemetryOption $telemetryOption,
?AuthenticationProvider $authenticationProvider = null,
?ParseNodeFactory $parseNodeFactory = null,
?SerializationWriterFactory $serializationWriterFactory = null,
?Client $guzzleClient = null)
{
$authenticationProvider = ($authenticationProvider) ?? new AnonymousAuthenticationProvider();
$guzzleClient = ($guzzleClient) ?? GraphClientFactory::setTelemetryOption($telemetryOption)::create();
parent::__construct($authenticationProvider, $parseNodeFactory, $serializationWriterFactory, $guzzleClient);
$this->setBaseUrl('https://graph.microsoft.com/'.$telemetryOption->getApiVersion());
}
}