Documentation
¶
Overview ¶
Package abstractions provides the base infrastructure for the Kiota-generated SDKs to function. It defines multiple concepts related to abstract HTTP requests, serialization, and authentication. These concepts can then be implemented independently without tying the SDKs to any specific implementation. Kiota also provides default implementations for these concepts. Checkout: - github.com/microsoft/kiota/authentication/go/azure - github.com/microsoft/kiota/http/go/nethttp - github.com/microsoft/kiota/serialization/go/json
Index ¶
- Variables
- func CollectionApply[T any, R interface{}](collection []T, mutator func(t T) R) []R
- func CollectionCast[R interface{}, T any](items []T) []R
- func CollectionStructCast[R interface{}, T any](items []T) []R
- func CollectionValueCast[R interface{}, T any](items []T) []R
- func ConfigureRequestInformation[T any](request *RequestInformation, config *RequestConfiguration[T])
- func CopyMap[T comparable, R interface{}](items map[T]R) map[T]R
- func CopyStringMap(items map[string]string) map[string]string
- func EnableBackingStoreForParseNodeFactory(factory s.ParseNodeFactory) s.ParseNodeFactory
- func EnableBackingStoreForSerializationWriterFactory(factory s.SerializationWriterFactory) s.SerializationWriterFactory
- func GetValueOrDefault[T interface{}](source func() *T, defaultValue T) T
- func InvokeParsableAction(action serialization.ParsableAction, parsable serialization.Parsable)
- func InvokeParsableWriter(writer serialization.ParsableWriter, parsable serialization.Parsable, ...) error
- func RegisterDefaultDeserializer(metaFactory func() s.ParseNodeFactory)
- func RegisterDefaultSerializer(metaFactory func() s.SerializationWriterFactory)
- func SetBoolValue(setter func(t *bool)) serialization.NodeParser
- func SetByteArrayValue(setter func(t []byte)) serialization.NodeParser
- func SetByteValue(setter func(t *byte)) serialization.NodeParser
- func SetCollectionOfEnumValues[T interface{}](parser serialization.EnumFactory, setter func(t []T)) serialization.NodeParser
- func SetCollectionOfObjectValues[T interface{}](ctor serialization.ParsableFactory, setter func(t []T)) serialization.NodeParser
- func SetCollectionOfPrimitiveValue[T interface{}](source func(targetType string) ([]interface{}, error), targetType string, ...) error
- func SetCollectionOfPrimitiveValues[T interface{}](targetType string, setter func(t []T)) serialization.NodeParser
- func SetCollectionOfReferencedEnumValue[T interface{}](source func(parser serialization.EnumFactory) ([]interface{}, error), ...) error
- func SetCollectionOfReferencedPrimitiveValue[T interface{}](source func(targetType string) ([]interface{}, error), targetType string, ...) error
- func SetCollectionValue[T interface{}](...) error
- func SetDateOnlyValue(setter func(t *serialization.DateOnly)) serialization.NodeParser
- func SetEnumValue[T interface{}](parser serialization.EnumFactory, setter func(t *T)) serialization.NodeParser
- func SetFloat32Value(setter func(t *float32)) serialization.NodeParser
- func SetFloat64Value(setter func(t *float64)) serialization.NodeParser
- func SetISODurationValue(setter func(t *serialization.ISODuration)) serialization.NodeParser
- func SetInt32Value(setter func(t *int32)) serialization.NodeParser
- func SetInt64Value(setter func(t *int64)) serialization.NodeParser
- func SetInt8Value(setter func(t *int8)) serialization.NodeParser
- func SetObjectValue[T interface{}](ctor serialization.ParsableFactory, setter func(t T)) serialization.NodeParser
- func SetObjectValueFromSource[T interface{}](...) error
- func SetReferencedEnumValue[T interface{}](source func(parser serialization.EnumFactory) (interface{}, error), ...) error
- func SetStringValue(setter func(t *string)) serialization.NodeParser
- func SetTimeOnlyValue(setter func(t *serialization.TimeOnly)) serialization.NodeParser
- func SetTimeValue(setter func(t *time.Time)) serialization.NodeParser
- func SetUUIDValue(setter func(t *uuid.UUID)) serialization.NodeParser
- func SetValue[T interface{}](source func() (*T, error), setter func(t *T)) error
- type ApiError
- type ApiErrorable
- type BaseRequestBuilder
- type DefaultQueryParameters
- type ErrorMappings
- type HttpMethod
- type MultipartBody
- type RequestAdapter
- type RequestConfiguration
- type RequestHandlerOption
- type RequestHeaders
- func (r *RequestHeaders) Add(key string, value string, additionalValues ...string)
- func (r *RequestHeaders) AddAll(other *RequestHeaders)
- func (r *RequestHeaders) Clear()
- func (r *RequestHeaders) ContainsKey(key string) bool
- func (r *RequestHeaders) Get(key string) []string
- func (r *RequestHeaders) ListKeys() []string
- func (r *RequestHeaders) Remove(key string)
- func (r *RequestHeaders) RemoveValue(key string, value string)
- func (r *RequestHeaders) TryAdd(key string, value string) bool
- type RequestInformation
- func (request *RequestInformation) AddQueryParameters(source any)
- func (request *RequestInformation) AddRequestOptions(options []RequestOption)
- func (request *RequestInformation) GetRequestOptions() []RequestOption
- func (request *RequestInformation) GetUri() (*u.URL, error)
- func (request *RequestInformation) SetContentFromParsable(ctx context.Context, requestAdapter RequestAdapter, contentType string, ...) error
- func (request *RequestInformation) SetContentFromParsableCollection(ctx context.Context, requestAdapter RequestAdapter, contentType string, ...) error
- func (request *RequestInformation) SetContentFromScalar(ctx context.Context, requestAdapter RequestAdapter, contentType string, ...) error
- func (request *RequestInformation) SetContentFromScalarCollection(ctx context.Context, requestAdapter RequestAdapter, contentType string, ...) error
- func (request *RequestInformation) SetStreamContent(content []byte)
- func (request *RequestInformation) SetStreamContentAndContentType(content []byte, contentType string)
- func (request *RequestInformation) SetUri(url u.URL)
- type RequestOption
- type RequestOptionKey
- type ResponseHandler
- type ResponseHeaders
- func (r *ResponseHeaders) Add(key string, value string, additionalValues ...string)
- func (r *ResponseHeaders) AddAll(other *ResponseHeaders)
- func (r *ResponseHeaders) Clear()
- func (r *ResponseHeaders) ContainsKey(key string) bool
- func (r *ResponseHeaders) Get(key string) []string
- func (r *ResponseHeaders) ListKeys() []string
- func (r *ResponseHeaders) Remove(key string)
- func (r *ResponseHeaders) RemoveValue(key string, value string)
Constants ¶
This section is empty.
Variables ¶
var ResponseHandlerOptionKey = RequestOptionKey{
Key: "ResponseHandlerOptionKey",
}
Functions ¶
func CollectionApply ¶ added in v0.11.0
func CollectionApply[T any, R interface{}](collection []T, mutator func(t T) R) []R
CollectionApply applies an operation to every element of the slice and returns a result of the modified collection
is a slice of all the elementents to be mutated
mutator applies an operation to the collection and returns a response of type `R`
func CollectionCast ¶ added in v0.11.0
func CollectionCast[R interface{}, T any](items []T) []R
CollectionCast casts a collection of values from any type T to given type R
func CollectionStructCast ¶ added in v0.11.0
func CollectionStructCast[R interface{}, T any](items []T) []R
CollectionStructCast casts a collection of values from any type T to given type R
Value cast can be used to cast memory addresses to the value of the pointer
func CollectionValueCast ¶ added in v0.11.0
func CollectionValueCast[R interface{}, T any](items []T) []R
CollectionValueCast casts a collection of values from any type T to given type R
Value cast can be used to cast memory addresses to the value of the pointer
func ConfigureRequestInformation ¶ added in v1.5.0
func ConfigureRequestInformation[T any](request *RequestInformation, config *RequestConfiguration[T])
func CopyMap ¶ added in v0.18.0
func CopyMap[T comparable, R interface{}](items map[T]R) map[T]R
CopyMap returns a copy of map[string]string
func CopyStringMap ¶ added in v0.18.0
CopyStringMap returns a copy of map[string]string
func EnableBackingStoreForParseNodeFactory ¶ added in v0.17.0
func EnableBackingStoreForParseNodeFactory(factory s.ParseNodeFactory) s.ParseNodeFactory
EnableBackingStoreForParseNodeFactory Enables the backing store on default parse nodes factories and the given parse node factory.
func EnableBackingStoreForSerializationWriterFactory ¶ added in v0.17.0
func EnableBackingStoreForSerializationWriterFactory(factory s.SerializationWriterFactory) s.SerializationWriterFactory
EnableBackingStoreForSerializationWriterFactory Enables the backing store on default serialization writers and the given serialization writer.
func GetValueOrDefault ¶ added in v0.11.0
func GetValueOrDefault[T interface{}](source func() *T, defaultValue T) T
GetValueOrDefault Converts a Pointer to a value or returns a default value
func InvokeParsableAction ¶ added in v0.17.0
func InvokeParsableAction(action serialization.ParsableAction, parsable serialization.Parsable)
InvokeParsableAction nil safe execution of ParsableAction
func InvokeParsableWriter ¶ added in v0.17.0
func InvokeParsableWriter(writer serialization.ParsableWriter, parsable serialization.Parsable, serializer serialization.SerializationWriter) error
InvokeParsableWriter executes the ParsableAction in a nil safe way
func RegisterDefaultDeserializer ¶
func RegisterDefaultDeserializer(metaFactory func() s.ParseNodeFactory)
RegisterDefaultDeserializer registers the default deserializer to the registry singleton to be used by the request adapter.
func RegisterDefaultSerializer ¶
func RegisterDefaultSerializer(metaFactory func() s.SerializationWriterFactory)
RegisterDefaultSerializer registers the default serializer to the registry singleton to be used by the request adapter.
func SetBoolValue ¶ added in v0.11.0
func SetBoolValue(setter func(t *bool)) serialization.NodeParser
SetBoolValue returns a boolean prototype for deserialization
func SetByteArrayValue ¶ added in v0.11.0
func SetByteArrayValue(setter func(t []byte)) serialization.NodeParser
SetByteArrayValue returns a []byte prototype for deserialization
func SetByteValue ¶ added in v0.11.0
func SetByteValue(setter func(t *byte)) serialization.NodeParser
SetByteValue returns a byte prototype for deserialization
func SetCollectionOfEnumValues ¶ added in v0.11.0
func SetCollectionOfEnumValues[T interface{}](parser serialization.EnumFactory, setter func(t []T)) serialization.NodeParser
SetCollectionOfEnumValues returns an enum prototype for deserialization
func SetCollectionOfObjectValues ¶ added in v0.11.0
func SetCollectionOfObjectValues[T interface{}](ctor serialization.ParsableFactory, setter func(t []T)) serialization.NodeParser
SetCollectionOfObjectValues returns an objects collection prototype for deserialization
func SetCollectionOfPrimitiveValue ¶ added in v0.11.0
func SetCollectionOfPrimitiveValue[T interface{}](source func(targetType string) ([]interface{}, error), targetType string, setter func(t []T)) error
SetCollectionOfPrimitiveValue is a utility function that receives a collection of primitives , targetType and applies the result of the factory to a setter
source is any function that receives a `EnumFactory` and returns an interface or error targetType is a string representing the type of result setter is a recipient of the function results
func SetCollectionOfPrimitiveValues ¶ added in v0.11.0
func SetCollectionOfPrimitiveValues[T interface{}](targetType string, setter func(t []T)) serialization.NodeParser
SetCollectionOfPrimitiveValues returns a primitive's collection prototype for deserialization
func SetCollectionOfReferencedEnumValue ¶ added in v0.11.0
func SetCollectionOfReferencedEnumValue[T interface{}](source func(parser serialization.EnumFactory) ([]interface{}, error), parser serialization.EnumFactory, setter func(t []*T)) error
SetCollectionOfReferencedEnumValue is a utility function that receives an enum collection source , EnumFactory and applies a de-referenced result of the factory to a setter
source is any function that receives a `EnumFactory` and returns an interface or error parser is an EnumFactory setter is a recipient of the function results
func SetCollectionOfReferencedPrimitiveValue ¶ added in v0.11.0
func SetCollectionOfReferencedPrimitiveValue[T interface{}](source func(targetType string) ([]interface{}, error), targetType string, setter func(t []T)) error
SetCollectionOfReferencedPrimitiveValue is a utility function that receives a collection of primitives , targetType and applies the re-referenced result of the factory to a setter
source is any function that receives a `EnumFactory` and returns an interface or error parser is an EnumFactory setter is a recipient of the function results
func SetCollectionValue ¶ added in v0.11.0
func SetCollectionValue[T interface{}](source func(ctor serialization.ParsableFactory) ([]serialization.Parsable, error), ctor serialization.ParsableFactory, setter func(t []T)) error
SetCollectionValue is a utility function that receives a collection that can be cast to Parsable and a function that expects the results
source is any function that receives a `ParsableFactory` and returns a slice of Parsable or error ctor is a ParsableFactory setter is a recipient of the function results
func SetDateOnlyValue ¶ added in v0.11.0
func SetDateOnlyValue(setter func(t *serialization.DateOnly)) serialization.NodeParser
SetDateOnlyValue returns a DateOnly prototype for deserialization
func SetEnumValue ¶ added in v0.11.0
func SetEnumValue[T interface{}](parser serialization.EnumFactory, setter func(t *T)) serialization.NodeParser
SetEnumValue returns a Enum prototype for deserialization
func SetFloat32Value ¶ added in v0.11.0
func SetFloat32Value(setter func(t *float32)) serialization.NodeParser
SetFloat32Value returns a float32 prototype for deserialization
func SetFloat64Value ¶ added in v0.11.0
func SetFloat64Value(setter func(t *float64)) serialization.NodeParser
SetFloat64Value returns a float64 prototype for deserialization
func SetISODurationValue ¶ added in v0.11.0
func SetISODurationValue(setter func(t *serialization.ISODuration)) serialization.NodeParser
SetISODurationValue returns a ISODuration prototype for deserialization
func SetInt32Value ¶ added in v0.11.0
func SetInt32Value(setter func(t *int32)) serialization.NodeParser
SetInt32Value returns a int32 prototype for deserialization
func SetInt64Value ¶ added in v0.11.0
func SetInt64Value(setter func(t *int64)) serialization.NodeParser
SetInt64Value returns a int64 prototype for deserialization
func SetInt8Value ¶ added in v0.11.0
func SetInt8Value(setter func(t *int8)) serialization.NodeParser
SetInt8Value Returns an int8 prototype for deserialization
func SetObjectValue ¶ added in v0.11.0
func SetObjectValue[T interface{}](ctor serialization.ParsableFactory, setter func(t T)) serialization.NodeParser
SetObjectValue returns an object prototype for deserialization
func SetObjectValueFromSource ¶ added in v0.11.0
func SetObjectValueFromSource[T interface{}](source func(ctor serialization.ParsableFactory) (serialization.Parsable, error), ctor serialization.ParsableFactory, setter func(t T)) error
SetObjectValueFromSource takes a generic source with a discriminator receiver, reads value and writes it to a setter
`source func() (*T, error)` is a generic getter with possible error response. `setter func(t *T)` generic function that can write a value from the source
func SetReferencedEnumValue ¶ added in v0.11.0
func SetReferencedEnumValue[T interface{}](source func(parser serialization.EnumFactory) (interface{}, error), parser serialization.EnumFactory, setter func(t *T)) error
SetReferencedEnumValue is a utility function that receives an enum getter , EnumFactory and applies a de-referenced result of the factory to a setter
source is any function that receives a `EnumFactory` and returns an interface or error parser is an EnumFactory setter is a recipient of the function results
func SetStringValue ¶ added in v0.11.0
func SetStringValue(setter func(t *string)) serialization.NodeParser
SetStringValue returns a string prototype for deserialization
func SetTimeOnlyValue ¶ added in v0.11.0
func SetTimeOnlyValue(setter func(t *serialization.TimeOnly)) serialization.NodeParser
SetTimeOnlyValue returns a TimeOnly prototype for deserialization
func SetTimeValue ¶ added in v0.11.0
func SetTimeValue(setter func(t *time.Time)) serialization.NodeParser
SetTimeValue returns a time.Time prototype for deserialization
func SetUUIDValue ¶ added in v0.11.0
func SetUUIDValue(setter func(t *uuid.UUID)) serialization.NodeParser
SetUUIDValue returns a DateOnly prototype for deserialization
Types ¶
type ApiError ¶
type ApiError struct { Message string ResponseStatusCode int ResponseHeaders *ResponseHeaders }
ApiError is the parent type for errors thrown by the client when receiving failed responses to its requests
func (*ApiError) GetResponseHeaders ¶ added in v1.7.0
func (e *ApiError) GetResponseHeaders() *ResponseHeaders
func (*ApiError) GetStatusCode ¶ added in v1.7.0
func (*ApiError) SetResponseHeaders ¶ added in v1.5.2
func (e *ApiError) SetResponseHeaders(ResponseHeaders *ResponseHeaders)
func (*ApiError) SetStatusCode ¶ added in v1.5.2
type ApiErrorable ¶ added in v1.5.2
type ApiErrorable interface { SetResponseHeaders(ResponseHeaders *ResponseHeaders) SetStatusCode(ResponseStatusCode int) GetResponseHeaders() *ResponseHeaders GetStatusCode() int }
type BaseRequestBuilder ¶ added in v0.19.0
type BaseRequestBuilder struct { // Path parameters for the request PathParameters map[string]string // The request adapter to use to execute the requests. RequestAdapter RequestAdapter // Url template to use to build the URL for the current request builder UrlTemplate string }
BaseRequestBuilder is the base class for all request builders.
func NewBaseRequestBuilder ¶ added in v0.19.0
func NewBaseRequestBuilder(requestAdapter RequestAdapter, urlTemplate string, pathParameters map[string]string) *BaseRequestBuilder
NewBaseRequestBuilder creates a new BaseRequestBuilder instance.
type DefaultQueryParameters ¶ added in v1.5.0
type DefaultQueryParameters struct { }
DefaultQueryParameters is a placeholder for operations without any query parameter documented.
type ErrorMappings ¶
type ErrorMappings map[string]s.ParsableFactory
ErrorMappings is a mapping of status codes to error types factories.
type HttpMethod ¶
type HttpMethod int
Represents the HTTP method used by a request.
const ( // The HTTP GET method. GET HttpMethod = iota // The HTTP POST method. POST // The HTTP PATCH method. PATCH // The HTTP DELETE method. DELETE // The HTTP OPTIONS method. OPTIONS // The HTTP CONNECT method. CONNECT // The HTTP PUT method. PUT // The HTTP TRACE method. TRACE // The HTTP HEAD method. HEAD )
func (HttpMethod) String ¶
func (m HttpMethod) String() string
String returns the string representation of the HTTP method.
type MultipartBody ¶ added in v1.2.0
type MultipartBody interface { serialization.Parsable // AddOrReplacePart adds or replaces a part in the multipart body. AddOrReplacePart(name string, contentType string, content any) error // GetPartValue gets the value of a part in the multipart body. GetPartValue(name string) (any, error) // RemovePart removes a part from the multipart body. RemovePart(name string) error // SetRequestAdapter sets the request adapter to use for serialization. SetRequestAdapter(requestAdapter RequestAdapter) // GetRequestAdapter gets the request adapter to use for serialization. GetRequestAdapter() RequestAdapter // GetBoundary returns the boundary used in the multipart body. GetBoundary() string }
MultipartBody represents a multipart body for a request or a response.
func NewMultipartBody ¶ added in v1.2.0
func NewMultipartBody() MultipartBody
type RequestAdapter ¶
type RequestAdapter interface { // Send executes the HTTP request specified by the given RequestInformation and returns the deserialized response model. Send(context context.Context, requestInfo *RequestInformation, constructor s.ParsableFactory, errorMappings ErrorMappings) (s.Parsable, error) // SendEnum executes the HTTP request specified by the given RequestInformation and returns the deserialized response model. SendEnum(context context.Context, requestInfo *RequestInformation, parser s.EnumFactory, errorMappings ErrorMappings) (any, error) // SendCollection executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. SendCollection(context context.Context, requestInfo *RequestInformation, constructor s.ParsableFactory, errorMappings ErrorMappings) ([]s.Parsable, error) // SendEnumCollection executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. SendEnumCollection(context context.Context, requestInfo *RequestInformation, parser s.EnumFactory, errorMappings ErrorMappings) ([]any, error) // SendPrimitive executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model. SendPrimitive(context context.Context, requestInfo *RequestInformation, typeName string, errorMappings ErrorMappings) (any, error) // SendPrimitiveCollection executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model collection. SendPrimitiveCollection(context context.Context, requestInfo *RequestInformation, typeName string, errorMappings ErrorMappings) ([]any, error) // SendNoContent executes the HTTP request specified by the given RequestInformation with no return content. SendNoContent(context context.Context, requestInfo *RequestInformation, errorMappings ErrorMappings) error // GetSerializationWriterFactory returns the serialization writer factory currently in use for the request adapter service. GetSerializationWriterFactory() s.SerializationWriterFactory // EnableBackingStore enables the backing store proxies for the SerializationWriters and ParseNodes in use. EnableBackingStore(factory store.BackingStoreFactory) // SetBaseUrl sets the base url for every request. SetBaseUrl(baseUrl string) // GetBaseUrl gets the base url for every request. GetBaseUrl() string // ConvertToNativeRequest converts the given RequestInformation into a native HTTP request. ConvertToNativeRequest(context context.Context, requestInfo *RequestInformation) (any, error) }
RequestAdapter is the service responsible for translating abstract RequestInformation into native HTTP requests.
type RequestConfiguration ¶ added in v1.5.0
type RequestConfiguration[T any] struct { // Request headers Headers *RequestHeaders // Request options Options []RequestOption // Query parameters QueryParameters *T }
RequestConfiguration represents a set of options to be used when making HTTP requests.
type RequestHandlerOption ¶ added in v0.9.1
type RequestHandlerOption interface { GetResponseHandler() ResponseHandler SetResponseHandler(responseHandler ResponseHandler) GetKey() RequestOptionKey }
RequestHandlerOption represents an abstract provider for ResponseHandler
func NewRequestHandlerOption ¶ added in v0.9.1
func NewRequestHandlerOption() RequestHandlerOption
NewRequestHandlerOption creates a new RequestInformation object with default values.
type RequestHeaders ¶ added in v0.15.0
type RequestHeaders struct {
// contains filtered or unexported fields
}
RequestHeaders represents a collection of request headers
func NewRequestHeaders ¶ added in v0.15.0
func NewRequestHeaders() *RequestHeaders
NewRequestHeaders creates a new RequestHeaders
func (*RequestHeaders) Add ¶ added in v0.15.0
Add adds a new header or append a new value to an existing header
func (*RequestHeaders) AddAll ¶ added in v0.15.0
func (r *RequestHeaders) AddAll(other *RequestHeaders)
AddAll adds all headers from the other headers
func (*RequestHeaders) Clear ¶ added in v0.15.0
func (r *RequestHeaders) Clear()
Clear clear all headers
func (*RequestHeaders) ContainsKey ¶ added in v0.15.0
ContainsKey check if the key exists in the headers
func (*RequestHeaders) ListKeys ¶ added in v0.15.0
func (r *RequestHeaders) ListKeys() []string
ListKeys returns all the keys in the headers
func (*RequestHeaders) Remove ¶ added in v0.15.0
func (r *RequestHeaders) Remove(key string)
Remove removes the specific header and all its values
func (*RequestHeaders) RemoveValue ¶ added in v0.15.0
RemoveValue remove the value for the specific header
type RequestInformation ¶
type RequestInformation struct { // The HTTP method of the request. Method HttpMethod // The Request Headers. Headers *RequestHeaders // The Query Parameters of the request. // Deprecated: use QueryParametersAny instead QueryParameters map[string]string // The Query Parameters of the request. QueryParametersAny map[string]any // The Request Body. Content []byte // The path parameters to use for the URL template when generating the URI. // Deprecated: use PathParametersAny instead PathParameters map[string]string // The path parameters to use for the URL template when generating the URI. PathParametersAny map[string]any // The Url template for the current request. UrlTemplate string // contains filtered or unexported fields }
RequestInformation represents an abstract HTTP request.
func NewRequestInformation ¶
func NewRequestInformation() *RequestInformation
NewRequestInformation creates a new RequestInformation object with default values.
func NewRequestInformationWithMethodAndUrlTemplateAndPathParameters ¶ added in v1.5.0
func NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(method HttpMethod, urlTemplate string, pathParameters map[string]string) *RequestInformation
NewRequestInformationWithMethodAndUrlTemplateAndPathParameters creates a new RequestInformation object with the specified method and URL template and path parameters.
func (*RequestInformation) AddQueryParameters ¶
func (request *RequestInformation) AddQueryParameters(source any)
AddQueryParameters adds the query parameters to the request by reading the properties from the provided object.
func (*RequestInformation) AddRequestOptions ¶
func (request *RequestInformation) AddRequestOptions(options []RequestOption)
AddRequestOptions adds an option to the request to be read by the middleware infrastructure.
func (*RequestInformation) GetRequestOptions ¶
func (request *RequestInformation) GetRequestOptions() []RequestOption
GetRequestOptions returns the options for this request. Options are unique by type. If an option of the same type is added twice, the last one wins.
func (*RequestInformation) GetUri ¶
func (request *RequestInformation) GetUri() (*u.URL, error)
GetUri returns the URI of the request.
func (*RequestInformation) SetContentFromParsable ¶
func (request *RequestInformation) SetContentFromParsable(ctx context.Context, requestAdapter RequestAdapter, contentType string, item s.Parsable) error
SetContentFromParsable sets the request body from a model with the specified content type.
func (*RequestInformation) SetContentFromParsableCollection ¶ added in v0.14.0
func (request *RequestInformation) SetContentFromParsableCollection(ctx context.Context, requestAdapter RequestAdapter, contentType string, items []s.Parsable) error
SetContentFromParsableCollection sets the request body from a model with the specified content type.
func (*RequestInformation) SetContentFromScalar ¶ added in v0.6.0
func (request *RequestInformation) SetContentFromScalar(ctx context.Context, requestAdapter RequestAdapter, contentType string, item interface{}) error
SetContentFromScalar sets the request body from a scalar value with the specified content type.
func (*RequestInformation) SetContentFromScalarCollection ¶ added in v0.14.0
func (request *RequestInformation) SetContentFromScalarCollection(ctx context.Context, requestAdapter RequestAdapter, contentType string, items []interface{}) error
SetContentFromScalarCollection sets the request body from a scalar value with the specified content type.
func (*RequestInformation) SetStreamContent ¶
func (request *RequestInformation) SetStreamContent(content []byte)
SetStreamContent sets the request body to a binary stream. Deprecated: Use SetStreamContentAndContentType instead.
func (*RequestInformation) SetStreamContentAndContentType ¶ added in v1.3.0
func (request *RequestInformation) SetStreamContentAndContentType(content []byte, contentType string)
SetStreamContentAndContentType sets the request body to a binary stream with the specified content type.
func (*RequestInformation) SetUri ¶
func (request *RequestInformation) SetUri(url u.URL)
SetUri updates the URI for the request from a raw URL.
type RequestOption ¶
type RequestOption interface { // GetKey returns the key to store the current option under. GetKey() RequestOptionKey }
Represents a request option.
type RequestOptionKey ¶
type RequestOptionKey struct { // The unique key for the option. Key string }
RequestOptionKey represents a key to store a request option under.
type ResponseHandler ¶
type ResponseHandler func(response interface{}, errorMappings ErrorMappings) (interface{}, error)
ResponseHandler handler to implement when a request's response should be handled a specific way.
type ResponseHeaders ¶ added in v0.20.0
type ResponseHeaders struct {
// contains filtered or unexported fields
}
ResponseHeaders represents a collection of response headers
func NewResponseHeaders ¶ added in v0.20.0
func NewResponseHeaders() *ResponseHeaders
NewResponseHeaders creates a new ResponseHeaders
func (*ResponseHeaders) Add ¶ added in v0.20.0
Add adds a new header or append a new value to an existing header
func (*ResponseHeaders) AddAll ¶ added in v0.20.0
func (r *ResponseHeaders) AddAll(other *ResponseHeaders)
AddAll adds all headers from the other headers
func (*ResponseHeaders) Clear ¶ added in v0.20.0
func (r *ResponseHeaders) Clear()
Clear clear all headers
func (*ResponseHeaders) ContainsKey ¶ added in v0.20.0
ContainsKey check if the key exists in the headers
func (*ResponseHeaders) ListKeys ¶ added in v0.20.0
func (r *ResponseHeaders) ListKeys() []string
ListKeys returns all the keys in the headers
func (*ResponseHeaders) Remove ¶ added in v0.20.0
func (r *ResponseHeaders) Remove(key string)
Remove removes the specific header and all its values
func (*ResponseHeaders) RemoveValue ¶ added in v0.20.0
RemoveValue remove the value for the specific header