Documentation
¶
Index ¶
- Constants
- Variables
- func CreateBatchRequestItemDiscriminator(serialization.ParseNode) (serialization.Parsable, error)
- func CreateBatchResponseDiscriminator(serialization.ParseNode) (serialization.Parsable, error)
- func DeRegisterError(key string) error
- func GetBatchResponseById[T serialization.Parsable](resp BatchResponse, itemId string, constructor absser.ParsableFactory) (T, error)
- func GetDefaultClient(options *GraphClientOptions, middleware ...khttp.Middleware) *nethttp.Client
- func GetDefaultMiddlewaresWithOptions(options *GraphClientOptions) []khttp.Middleware
- func GetErrorFactoryFromRegistry(key string) (abstractions.ErrorMappings, bool)
- func RegisterError(key string, value abstractions.ErrorMappings) error
- type BatchItem
- type BatchRequest
- type BatchRequestCollection
- type BatchResponse
- type GraphClientOptions
- type GraphRequestAdapterBase
- func NewGraphRequestAdapterBase(authenticationProvider absauth.AuthenticationProvider, ...) (*GraphRequestAdapterBase, error)
- func NewGraphRequestAdapterBaseWithParseNodeFactory(authenticationProvider absauth.AuthenticationProvider, ...) (*GraphRequestAdapterBase, error)
- func NewGraphRequestAdapterBaseWithParseNodeFactoryAndSerializationWriterFactory(authenticationProvider absauth.AuthenticationProvider, ...) (*GraphRequestAdapterBase, error)
- func NewGraphRequestAdapterBaseWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient(authenticationProvider absauth.AuthenticationProvider, ...) (*GraphRequestAdapterBase, error)
- type GraphTelemetryHandler
- type PageIterator
- func (pI *PageIterator[T]) GetOdataDeltaLink() *string
- func (pI *PageIterator[T]) GetOdataNextLink() *string
- func (pI *PageIterator[T]) Iterate(context context.Context, callback func(pageItem T) bool) error
- func (pI *PageIterator[T]) SetHeaders(headers *abstractions.RequestHeaders)
- func (pI *PageIterator[T]) SetReqOptions(reqOptions []abstractions.RequestOption)
- type PageResult
- type PageWithOdataDeltaLink
- type PageWithOdataNextLink
- type RequestBody
- type RequestHeader
Constants ¶
const BatchRequestErrorRegistryKey = "BATCH_REQUEST_ERROR_REGISTRY_KEY"
const MaxBatchRequests = 4
const PageIteratorErrorRegistryKey = "PAGE_ITERATOR_ERROR_REGISTRY_KEY"
Variables ¶
var CoreVersion = "1.3.2"
* The SDK version x-release-please-start-version
var ReplacementPairs = map[string]string{"/users/me-token-to-replace": "/me"}
Functions ¶
func CreateBatchRequestItemDiscriminator ¶
func CreateBatchRequestItemDiscriminator(serialization.ParseNode) (serialization.Parsable, error)
CreateBatchRequestItemDiscriminator creates a new instance of the appropriate class based on discriminator value
func CreateBatchResponseDiscriminator ¶
func CreateBatchResponseDiscriminator(serialization.ParseNode) (serialization.Parsable, error)
CreateBatchResponseDiscriminator creates a new instance of the appropriate class based on discriminator value
func DeRegisterError ¶
func GetBatchResponseById ¶
func GetBatchResponseById[T serialization.Parsable](resp BatchResponse, itemId string, constructor absser.ParsableFactory) (T, error)
GetBatchResponseById returns the response of the batch request item with the given id.
func GetDefaultClient ¶
func GetDefaultClient(options *GraphClientOptions, middleware ...khttp.Middleware) *nethttp.Client
GetDefaultClient creates a new http client with a preconfigured middleware pipeline
func GetDefaultMiddlewaresWithOptions ¶
func GetDefaultMiddlewaresWithOptions(options *GraphClientOptions) []khttp.Middleware
GetDefaultMiddlewaresWithOptions creates a default slice of middleware for the Graph Client.
func GetErrorFactoryFromRegistry ¶
func GetErrorFactoryFromRegistry(key string) (abstractions.ErrorMappings, bool)
func RegisterError ¶
func RegisterError(key string, value abstractions.ErrorMappings) error
Types ¶
type BatchItem ¶
type BatchItem interface { serialization.Parsable GetId() *string SetId(value *string) GetMethod() *string SetMethod(value *string) GetUrl() *string SetUrl(value *string) GetHeaders() RequestHeader SetHeaders(value RequestHeader) GetBody() RequestBody SetBody(value RequestBody) GetDependsOn() []string SetDependsOn(value []string) GetStatus() *int32 SetStatus(value *int32) DependsOnItem(item BatchItem) }
BatchItem is an instance of the BatchRequest payload to be later serialized to a json payload
type BatchRequest ¶
type BatchRequest interface { serialization.Parsable GetRequests() []BatchItem SetRequests(requests []BatchItem) AddBatchRequestStep(reqInfo abstractions.RequestInformation) (BatchItem, error) Send(ctx context.Context, adapter abstractions.RequestAdapter) (BatchResponse, error) }
BatchRequest models all the properties of a batch request
func NewBatchRequest ¶
func NewBatchRequest(adapter abstractions.RequestAdapter) BatchRequest
NewBatchRequest creates an instance of BatchRequest
type BatchRequestCollection ¶
type BatchRequestCollection struct {
// contains filtered or unexported fields
}
func NewBatchRequestCollection ¶
func NewBatchRequestCollection(adapter abstractions.RequestAdapter) *BatchRequestCollection
NewBatchRequestCollection creates an instance of a BatchRequestCollection with a default request limit
func NewBatchRequestCollectionWithLimit ¶
func NewBatchRequestCollectionWithLimit(adapter abstractions.RequestAdapter, batchLimit int) *BatchRequestCollection
NewBatchRequestCollectionWithLimit creates an instance of a BatchRequestCollection with a defined limit in requests
func (*BatchRequestCollection) AddBatchRequestStep ¶
func (b *BatchRequestCollection) AddBatchRequestStep(reqInfo abstractions.RequestInformation) (BatchItem, error)
AddBatchRequestStep converts RequestInformation to a BatchItem and adds it to a BatchRequestCollection
func (*BatchRequestCollection) Send ¶
func (b *BatchRequestCollection) Send(ctx context.Context, adapter abstractions.RequestAdapter) (BatchResponse, error)
Send serializes and sends the batch request to the server
type BatchResponse ¶
type BatchResponse interface { serialization.Parsable GetResponses() []BatchItem SetResponses(responses []BatchItem) AddResponses(responses []BatchItem) GetResponseById(itemId string) BatchItem GetFailedResponses() map[string]int32 GetStatusCodes() map[string]int32 }
BatchResponse instance of batch request result payload
func NewBatchResponse ¶
func NewBatchResponse() BatchResponse
type GraphClientOptions ¶
GraphClientOptions represents a combination of GraphServiceVersion and GraphServiceLibraryVersion
GraphServiceVersion is version of the targeted service. GraphServiceLibraryVersion is the version of the service library
type GraphRequestAdapterBase ¶
type GraphRequestAdapterBase struct {
khttp.NetHttpRequestAdapter
}
GraphRequestAdapterBase is the core service used by GraphServiceClient to make requests to Microsoft Graph.
func NewGraphRequestAdapterBase ¶
func NewGraphRequestAdapterBase(authenticationProvider absauth.AuthenticationProvider, clientOptions GraphClientOptions) (*GraphRequestAdapterBase, error)
NewGraphRequestAdapterBase creates a new GraphRequestAdapterBase with the given parameters
func NewGraphRequestAdapterBaseWithParseNodeFactory ¶
func NewGraphRequestAdapterBaseWithParseNodeFactory(authenticationProvider absauth.AuthenticationProvider, clientOptions GraphClientOptions, parseNodeFactory absser.ParseNodeFactory) (*GraphRequestAdapterBase, error)
NewGraphRequestAdapterBaseWithParseNodeFactory creates a new GraphRequestAdapterBase with the given parameters
func NewGraphRequestAdapterBaseWithParseNodeFactoryAndSerializationWriterFactory ¶
func NewGraphRequestAdapterBaseWithParseNodeFactoryAndSerializationWriterFactory(authenticationProvider absauth.AuthenticationProvider, clientOptions GraphClientOptions, parseNodeFactory absser.ParseNodeFactory, serializationWriterFactory absser.SerializationWriterFactory) (*GraphRequestAdapterBase, error)
NewGraphRequestAdapterBaseWithParseNodeFactoryAndSerializationWriterFactory creates a new GraphRequestAdapterBase with the given parameters
func NewGraphRequestAdapterBaseWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient ¶
func NewGraphRequestAdapterBaseWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient(authenticationProvider absauth.AuthenticationProvider, clientOptions GraphClientOptions, parseNodeFactory absser.ParseNodeFactory, serializationWriterFactory absser.SerializationWriterFactory, httpClient *nethttp.Client) (*GraphRequestAdapterBase, error)
NewGraphRequestAdapterBaseWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient creates a new GraphRequestAdapterBase with the given parameters
type GraphTelemetryHandler ¶
type GraphTelemetryHandler struct {
// contains filtered or unexported fields
}
GraphTelemetryHandler is a middleware handler that adds telemetry headers to requests.
func NewGraphTelemetryHandler ¶
func NewGraphTelemetryHandler(options *GraphClientOptions) *GraphTelemetryHandler
NewGraphTelemetryHandler creates a new GraphTelemetryHandler.
type PageIterator ¶
type PageIterator[T interface{}] struct {
// contains filtered or unexported fields
}
PageIterator represents an iterator object that can be used to get subsequent pages of a collection.
func NewPageIterator ¶
func NewPageIterator[T interface{}](res interface{}, reqAdapter abstractions.RequestAdapter, constructorFunc serialization.ParsableFactory) (*PageIterator[T], error)
NewPageIterator creates an iterator instance
It has three parameters. res is the graph response from the initial request and represents the first page. reqAdapter is used for getting the next page and constructorFunc is used for serializing next page's response to the specified type.
func (*PageIterator[T]) GetOdataDeltaLink ¶
func (pI *PageIterator[T]) GetOdataDeltaLink() *string
GetOdataDeltaLink returns the @odata.deltaLink value in current paged result.
func (*PageIterator[T]) GetOdataNextLink ¶
func (pI *PageIterator[T]) GetOdataNextLink() *string
GetOdataNextLink returns the @odata.nextLink value in the current page result.
func (*PageIterator[T]) Iterate ¶
func (pI *PageIterator[T]) Iterate(context context.Context, callback func(pageItem T) bool) error
Iterate traverses all pages and enumerates all items in the current page and returns an error if something goes wrong.
Iterate receives a callback function which is called with each item in the current page as an argument. The callback function returns a boolean. To traverse and enumerate all pages always return true and to pause traversal and enumeration return false from the callback.
Example
pageIterator, err := NewPageIterator(resp, reqAdapter, parsableFactory) callbackFunc := func (pageItem interface{}) bool { fmt.Println(page item.GetDisplayName()) return true } err := pageIterator.Iterate(context.Background(), callbackFunc)
func (*PageIterator[T]) SetHeaders ¶
func (pI *PageIterator[T]) SetHeaders(headers *abstractions.RequestHeaders)
SetHeaders provides headers for requests made to get subsequent pages
Headers in the initial request -- request to get the first page -- are not included in subsequent page requests.
func (*PageIterator[T]) SetReqOptions ¶
func (pI *PageIterator[T]) SetReqOptions(reqOptions []abstractions.RequestOption)
SetReqOptions provides configuration for handlers during requests for subsequent pages
type PageResult ¶
type PageResult[T interface{}] struct {
// contains filtered or unexported fields
}
PageResult represents a page object built from a graph response object
type PageWithOdataDeltaLink ¶
type PageWithOdataDeltaLink interface {
GetOdataDeltaLink() *string
}
PageWithOdataDeltaLink represents a contract with the GetOdataDeltaLink() method
type PageWithOdataNextLink ¶
type PageWithOdataNextLink interface {
GetOdataNextLink() *string
}
PageWithOdataNextLink represents a contract with the GetOdataNextLink() method
type RequestBody ¶
type RequestBody map[string]interface{}
RequestBody is a type alias for http request bodies
func (RequestBody) GetFieldDeserializers ¶
func (br RequestBody) GetFieldDeserializers() map[string]func(serialization.ParseNode) error
GetFieldDeserializers the deserialization information for the current model
func (RequestBody) Serialize ¶
func (br RequestBody) Serialize(writer serialization.SerializationWriter) error
Serialize serializes information the current object
type RequestHeader ¶
RequestHeader is a type alias for http request headers
func (RequestHeader) GetFieldDeserializers ¶
func (br RequestHeader) GetFieldDeserializers() map[string]func(serialization.ParseNode) error
GetFieldDeserializers the deserialization information for the current model
func (RequestHeader) Serialize ¶
func (br RequestHeader) Serialize(writer serialization.SerializationWriter) error
Serialize serializes information the current object