-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRequestAdapter.php
121 lines (110 loc) · 4.86 KB
/
RequestAdapter.php
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
namespace Microsoft\Kiota\Abstractions;
use Microsoft\Kiota\Abstraction\Promise\Promise;
use Microsoft\Kiota\Abstractions\Serialization\ParseNodeFactory;
use Microsoft\Kiota\Abstractions\Serialization\SerializationWriterFactory;
use Microsoft\Kiota\Abstractions\Store\BackingStoreFactory;
use Microsoft\Kiota\Abstractions\Serialization\Parsable;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
/**
* Service responsible for translating abstract Request Info into concrete native HTTP requests.
*/
interface RequestAdapter {
/**
* Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model.
* @template T of Parsable
* @template V of Parsable
* @param RequestInformation $requestInfo the request info to execute.
* @param array{class-string<T>,string} $targetCallable the model to deserialize the response into.
* @param array<string, array{class-string<V>, string}>|null $errorMappings
* @return Promise<T|null> with the deserialized response model.
*/
public function sendAsync(
RequestInformation $requestInfo,
array $targetCallable,
?array $errorMappings = null
): Promise;
/**
* Gets the serialization writer factory currently in use for the HTTP core service.
* @return SerializationWriterFactory the serialization writer factory currently in use for the HTTP core service.
*/
public function getSerializationWriterFactory(): SerializationWriterFactory;
/**
* Gets the Parse Node Factory in use
*
* @return ParseNodeFactory
*/
public function getParseNodeFactory(): ParseNodeFactory;
/**
* Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection.
* @template T of Parsable
* @template V of Parsable
* @param RequestInformation $requestInfo the request info to execute.
* @param array{class-string<T>,string} $targetCallable the callable representing object creation logic.
* @param array<string, array{class-string<V>, string}>|null $errorMappings
* @return Promise<array<T>|null> with the deserialized response model collection.
*/
public function sendCollectionAsync(
RequestInformation $requestInfo,
array $targetCallable,
?array $errorMappings = null
): Promise;
/**
* Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model.
* @template T of Parsable
* @param RequestInformation $requestInfo
* @param string $primitiveType e.g. int, bool
* @param array<string, array{class-string<T>, string}>|null $errorMappings
* @return Promise<mixed|StreamInterface>
*/
public function sendPrimitiveAsync(
RequestInformation $requestInfo,
string $primitiveType,
?array $errorMappings = null
): Promise;
/**
* Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model collection.
* @template T of Parsable
* @param RequestInformation $requestInfo
* @param string $primitiveType e.g. int, bool
* @param array<string, array{class-string<T>, string}>|null $errorMappings
* @return Promise<array<mixed>|null>
*/
public function sendPrimitiveCollectionAsync(
RequestInformation $requestInfo,
string $primitiveType,
?array $errorMappings = null
): Promise;
/**
* Executes the HTTP request specified by the given RequestInformation with no return content.
* @template T of Parsable
* @param RequestInformation $requestInfo
* @param array<string, array{class-string<T>, string}>|null $errorMappings
* @return Promise<null>
*/
public function sendNoContentAsync(RequestInformation $requestInfo, ?array $errorMappings = null): Promise;
/**
* Enables the backing store proxies for the SerializationWriters and ParseNodes in use.
* @param BackingStoreFactory $backingStoreFactory The backing store factory to use.
*/
public function enableBackingStore(BackingStoreFactory $backingStoreFactory): void;
/**
* Sets The base url for every request.
* @param string $baseUrl The base url for every request.
*/
public function setBaseUrl(string $baseUrl): void;
/**
* Gets The base url for every request.
* @return string The base url for every request.
*/
public function getBaseUrl(): string;
/**
* Converts RequestInformation object to an authenticated(containing auth header) PSR-7 Request Object.
*
* @param RequestInformation $requestInformation
* @return Promise<RequestInterface>
*/
public function convertToNative(RequestInformation $requestInformation): Promise;
}