odata

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorAddedObjectReferencesAlreadyExist   = "One or more added object references already exist"
	ErrorConflictingObjectPresentInDirectory = "A conflicting object with one or more of the specified property values is present in the directory"
	ErrorRemovedObjectReferencesDoNotExist   = "One or more removed object references do not exist"
	ErrorServicePrincipalInvalidAppId        = "The appId '.+' of the service principal does not reference a valid application object."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction added in v0.18.0

type Direction string
const (
	Ascending  Direction = "asc"
	Descending Direction = "desc"
)

type Error

type Error struct {
	Code            *string          `json:"code"`
	Date            *string          `json:"date"`
	Message         *string          `json:"-"`
	RawMessage      *json.RawMessage `json:"message"` // sometimes a string, sometimes an object :/
	ClientRequestId *string          `json:"client-request-id"`
	RequestId       *string          `json:"request-id"`

	InnerError *Error `json:"innerError"` // nested errors

	Details *[]struct {
		Code   *string `json:"code"`
		Target *string `json:"target"`
	} `json:"details"`

	Values *[]struct {
		Item  string `json:"item"`
		Value string `json:"value"`
	} `json:"values"`
}

Error is used to unmarshal an API error message.

func (Error) Match added in v0.12.0

func (e Error) Match(errorText string) bool

func (Error) String

func (e Error) String() string

func (*Error) UnmarshalJSON

func (e *Error) UnmarshalJSON(data []byte) error

type Expand added in v0.18.0

type Expand struct {
	Relationship string
	Select       []string
}

func (Expand) String added in v0.18.0

func (e Expand) String() (val string)

type Format added in v0.18.0

type Format string
const (
	FormatJson Format = "json"
	FormatAtom Format = "atom"
	FormatXml  Format = "xml"
)

type OData

type OData struct {
	Context      *string `json:"@odata.context"`
	MetadataEtag *string `json:"@odata.metadataEtag"`
	Type         *string `json:"@odata.type"`
	Count        *string `json:"@odata.count"`
	NextLink     *string `json:"@odata.nextLink"`
	Delta        *string `json:"@odata.delta"`
	DeltaLink    *string `json:"@odata.deltaLink"`
	Id           *string `json:"@odata.id"`
	Etag         *string `json:"@odata.etag"`

	Error *Error `json:"-"`

	Value *[]json.RawMessage `json:"value"`
}

OData is used to unmarshall OData metadata from an API response.

func FromResponse

func FromResponse(resp *http.Response) (*OData, error)

FromResponse parses an http.Response and returns an unmarshalled OData If no odata is present in the response, or the content type is invalid, returns nil

func (*OData) UnmarshalJSON

func (o *OData) UnmarshalJSON(data []byte) error

type OrderBy added in v0.18.0

type OrderBy struct {
	Field     string
	Direction Direction
}

func (OrderBy) String added in v0.18.0

func (o OrderBy) String() (val string)

type Query added in v0.18.0

type Query struct {
	// Count includes a count of the total number of items in a collection alongside the page of data values
	Count bool

	// Expand includes the expanded resource or collection referenced by a single relationship
	Expand Expand

	// Filter retrieves just a subset of a collection, or relationships like members, memberOf, transitiveMembers, and transitiveMemberOf
	Filter string

	// Format specifies the media format of the items returned
	Format Format

	// OrderBy specify the sort order of the items returned
	OrderBy OrderBy

	// Search restricts the results of a request to match a search criterion
	Search string // complicated

	// Select returns a set of properties that are different than the default set for an individual resource or a collection of resources
	Select []string

	// Skip sets the number of items to skip at the start of a collection
	Skip int

	// Top specifies the page size of the result set
	Top int
}

func (Query) Values added in v0.18.0

func (q Query) Values() url.Values

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL