-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph_request_adapter.go
74 lines (64 loc) · 3.69 KB
/
graph_request_adapter.go
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
package msgraphbetasdkgo
import (
nethttp "net/http"
absauth "github.com/microsoft/kiota-abstractions-go/authentication"
absser "github.com/microsoft/kiota-abstractions-go/serialization"
core "github.com/microsoftgraph/msgraph-sdk-go-core"
)
var clientOptions = core.GraphClientOptions{
GraphServiceVersion: "beta", //v1 doesn't include the service version in the telemetry header
GraphServiceLibraryVersion: "0.30.0",
}
// GetDefaultClientOptions returns the default client options used by the GraphRequestAdapterBase and the middleware.
func GetDefaultClientOptions() core.GraphClientOptions {
return clientOptions
}
// GraphRequestAdapter is the core service used by GraphServiceClient to make requests to Microsoft Graph.
type GraphRequestAdapter struct {
core.GraphRequestAdapterBase
}
// NewGraphRequestAdapter creates a new GraphRequestAdapter with the given parameters
// Parameters:
// authenticationProvider: the provider used to authenticate requests
// Returns:
// a new GraphRequestAdapter
func NewGraphRequestAdapter(authenticationProvider absauth.AuthenticationProvider) (*GraphRequestAdapter, error) {
return NewGraphRequestAdapterWithParseNodeFactory(authenticationProvider, nil)
}
// NewGraphRequestAdapterWithParseNodeFactory creates a new GraphRequestAdapter with the given parameters
// Parameters:
// authenticationProvider: the provider used to authenticate requests
// parseNodeFactory: the factory used to create parse nodes
// Returns:
// a new GraphRequestAdapter
func NewGraphRequestAdapterWithParseNodeFactory(authenticationProvider absauth.AuthenticationProvider, parseNodeFactory absser.ParseNodeFactory) (*GraphRequestAdapter, error) {
return NewGraphRequestAdapterWithParseNodeFactoryAndSerializationWriterFactory(authenticationProvider, parseNodeFactory, nil)
}
// NewGraphRequestAdapterWithParseNodeFactoryAndSerializationWriterFactory creates a new GraphRequestAdapter with the given parameters
// Parameters:
// authenticationProvider: the provider used to authenticate requests
// parseNodeFactory: the factory used to create parse nodes
// serializationWriterFactory: the factory used to create serialization writers
// Returns:
// a new GraphRequestAdapter
func NewGraphRequestAdapterWithParseNodeFactoryAndSerializationWriterFactory(authenticationProvider absauth.AuthenticationProvider, parseNodeFactory absser.ParseNodeFactory, serializationWriterFactory absser.SerializationWriterFactory) (*GraphRequestAdapter, error) {
return NewGraphRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient(authenticationProvider, parseNodeFactory, serializationWriterFactory, nil)
}
// NewGraphRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient creates a new GraphRequestAdapter with the given parameters
// Parameters:
// authenticationProvider: the provider used to authenticate requests
// parseNodeFactory: the factory used to create parse nodes
// serializationWriterFactory: the factory used to create serialization writers
// httpClient: the client used to send requests
// Returns:
// a new GraphRequestAdapter
func NewGraphRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient(authenticationProvider absauth.AuthenticationProvider, parseNodeFactory absser.ParseNodeFactory, serializationWriterFactory absser.SerializationWriterFactory, httpClient *nethttp.Client) (*GraphRequestAdapter, error) {
baseAdapter, err := core.NewGraphRequestAdapterBaseWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient(authenticationProvider, clientOptions, parseNodeFactory, serializationWriterFactory, httpClient)
if err != nil {
return nil, err
}
result := &GraphRequestAdapter{
GraphRequestAdapterBase: *baseAdapter,
}
return result, nil
}