odata

package
v0.20231127.1195240 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MPL-2.0 Imports: 10 Imported by: 10,800

Documentation

Index

Constants

View Source
const (
	ErrorAddedObjectReferencesAlreadyExist      = "One or more added object references already exist"
	ErrorCannotDeleteOrUpdateEnabledEntitlement = "Permission (scope or role) cannot be deleted or updated unless disabled first"
	ErrorConflictingObjectPresentInDirectory    = "A conflicting object with one or more of the specified property values is present in the directory"
	ErrorNotValidReferenceUpdate                = "Not a valid reference update"
	ErrorPropertyValuesAreInvalid               = "One or more property values specified are invalid"
	ErrorResourceDoesNotExist                   = "Resource '.+' does not exist or one of its queried reference-property objects are not present"
	ErrorRemovedObjectReferencesDoNotExist      = "One or more removed object references do not exist"
	ErrorServicePrincipalAppInOtherTenant       = "When using this permission, the backing application of the service principal being created must in the local tenant"
	ErrorServicePrincipalInvalidAppId           = "The appId '.+' of the service principal does not reference a valid application object"
	ErrorUnknownUnsupportedQuery                = "UnknownError: Unsupported Query"
)

ODataVersion describes the highest OData spec version supported by this package

Variables

This section is empty.

Functions

func EscapeSingleQuote added in v0.20231018.1165214

func EscapeSingleQuote(qparam string) string

EscapeSingleQuote replaces all occurrences of single quote, with 2 single quotes. For requests that use single quotes, if any parameter values also contain single quotes, those must be double escaped; otherwise, the request will fail due to invalid syntax. https://docs.microsoft.com/en-us/graph/query-parameters#escaping-single-quotes

Types

type ConsistencyLevel

type ConsistencyLevel string

ConsistencyLevel is included in the API request headers when making advanced data queries

const (
	ConsistencyLevelEventual ConsistencyLevel = "eventual"
)

type CustomPager added in v0.20230810.1112551

type CustomPager interface {
	// NextPageLink returns a *Link describing the URI for the next page of results, it should also clear any state
	// before returning, so that subsequent pages do not inherit the URI from the previous page.
	NextPageLink() *Link
}

CustomPager handles custom paging for paginated API responses that do not follow the OData 4.0 standard for JSON services. The underlying type should support unmarshalling a JSON response

type Direction

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    *[]ErrorDetails  `json:"-"`
	RawDetails *json.RawMessage `json:"details"` // should be an array, but sometimes an object :S

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

Error is used to unmarshal an API error message.

func (Error) Match

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 ErrorDetails added in v0.20230704.1182735

type ErrorDetails struct {
	Code   *string `json:"code"`
	Target *string `json:"target"`
}

type Expand

type Expand struct {
	Relationship string
	Select       []string
}

func (Expand) String

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

type Format

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

type Id

type Id string

Id describes the ID of an OData entity.

func (Id) MarshalJSON

func (id Id) MarshalJSON() ([]byte, error)

func (*Id) UnmarshalJSON

func (id *Id) UnmarshalJSON(data []byte) error
type Link string

Link describes a URI obtained from an OData annotation.

func NextLinkFromCustomPager added in v0.20230810.1112551

func NextLinkFromCustomPager(resp *http.Response, pager CustomPager) (*Link, error)

NextLinkFromCustomPager unmarshalls a *http.Response into the provided CustomPager and invokes its NextPageLink method

func (*Link) UnmarshalJSON

func (l *Link) UnmarshalJSON(data []byte) error

type Metadata

type Metadata string

Metadata specifies the level of control information desired in the response for an API request and is appended to the Accept header

const (
	MetadataFull    Metadata = "full"
	MetadataMinimal Metadata = "minimal"
	MetadataNone    Metadata = "none"
)

type OData

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

	Error *Error `json:"-"`

	Value interface{} `json:"value"`
}

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

func FromResponse

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

FromResponse parses a 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

type OrderBy struct {
	Field     string
	Direction Direction
}

func (OrderBy) String

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

type Query

type Query struct {
	// ConsistencyLevel sets the corresponding http header
	ConsistencyLevel ConsistencyLevel

	// Metadata indicates how much control information is requested (services assume "minimal" when not specified)
	Metadata Metadata

	// 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

	// DeltaToken is used to query a delta endpoint
	DeltaToken string
}

Query describes OData query parameters that can be included in an API request.

func (Query) AppendHeaders

func (q Query) AppendHeaders(header http.Header) http.Header

AppendHeaders returns the provided http.Header map with OData specific headers appended, for use in requests

func (Query) AppendValues

func (q Query) AppendValues(values url.Values) url.Values

AppendValues returns the provided url.Values map with OData specific query parameters appended, for use in requests

func (Query) Headers

func (q Query) Headers() http.Header

Headers returns a http.Header map containing OData specific headers

func (Query) Values

func (q Query) Values() url.Values

Values returns a url.Values map containing OData specific query parameters

type ShortType

type ShortType = string

ShortType is the unqualified data type for an entity

const (
	ShortTypeAccessPackage                               ShortType = "accessPackage"
	ShortTypeAccessPackageAssignmentPolicy               ShortType = "accessPackageAssignmentPolicy"
	ShortTypeAccessPackageCatalog                        ShortType = "accessPackageCatalog"
	ShortTypeAccessPackageResourceRequest                ShortType = "accessPackageResourceRequest"
	ShortTypeAccessPackageQuestion                       ShortType = "accessPackageQuestion"
	ShortTypeAccessPackageTextInputQuestion              ShortType = "accessPackageTextInputQuestion"
	ShortTypeAccessPackageMultipleChoiceQuestion         ShortType = "accessPackageMultipleChoiceQuestion"
	ShortTypeAdministrativeUnit                          ShortType = "administrativeUnit"
	ShortTypeApplication                                 ShortType = "application"
	ShortTypeConditionalAccessPolicy                     ShortType = "conditionalAccessPolicy"
	ShortTypeConnectedOrganizationMembers                ShortType = "connectedOrganizationMembers"
	ShortTypeConnectionInfo                              ShortType = "connectionInfo"
	ShortTypeCountryNamedLocation                        ShortType = "countryNamedLocation"
	ShortTypeDevice                                      ShortType = "device"
	ShortTypeDirectoryRole                               ShortType = "directoryRole"
	ShortTypeDirectoryRoleTemplate                       ShortType = "directoryRoleTemplate"
	ShortTypeDomain                                      ShortType = "domain"
	ShortTypeEmailAuthenticationMethod                   ShortType = "emailAuthenticationMethod"
	ShortTypeExternalSponsors                            ShortType = "externalSponsors"
	ShortTypeFido2AuthenticationMethod                   ShortType = "fido2AuthenticationMethod"
	ShortTypeGroup                                       ShortType = "group"
	ShortTypeGroupMembers                                ShortType = "groupMembers"
	ShortTypeIpNamedLocation                             ShortType = "ipNamedLocation"
	ShortTypeInternalSponsors                            ShortType = "internalSponsors"
	ShortTypeNamedLocation                               ShortType = "namedLocation"
	ShortTypeMicrosoftAuthenticatorAuthenticationMethod  ShortType = "microsoftAuthenticatorAuthenticationMethod"
	ShortTypeOrganization                                ShortType = "organization"
	ShortTypePasswordAuthenticationMethod                ShortType = "passwordAuthenticationMethod"
	ShortTypePhoneAuthenticationMethod                   ShortType = "phoneAuthenticationMethod"
	ShortTypeRequestorManager                            ShortType = "requestorManager"
	ShortTypeServicePrincipal                            ShortType = "servicePrincipal"
	ShortTypeSingleUser                                  ShortType = "singleUser"
	ShortTypeSocialIdentityProvider                      ShortType = "socialIdentityProvider"
	ShortTypeTemporaryAccessPassAuthenticationMethod     ShortType = "temporaryAccessPassAuthenticationMethod"
	ShortTypeUser                                        ShortType = "user"
	ShortTypeWindowsHelloForBusinessAuthenticationMethod ShortType = "windowsHelloForBusinessAuthenticationMethod"
)

type Type

type Type = string

Type is the namespace-qualified data type for an entity

const (
	TypeAccessPackage                                    Type = "#microsoft.graph.accessPackage"
	TypeAccessPackageAssignmentPolicy                    Type = "#microsoft.graph.accessPackageAssignmentPolicy"
	TypeAccessPackageCatalog                             Type = "#microsoft.graph.accessPackageCatalog"
	TypeAccessPackageMultipleChoiceQuestion              Type = "#microsoft.graph.accessPackageMultipleChoiceQuestion"
	TypeAccessPackageQuestion                            Type = "#microsoft.graph.accessPackageQuestion"
	TypeAccessPackageResourceRequest                     Type = "#microsoft.graph.accessPackageResourceRequest"
	TypeAccessPackageTextInputQuestion                   Type = "#microsoft.graph.accessPackageTextInputQuestion"
	TypeActiveDirectoryWindowsAutopilotDeploymentProfile Type = "#microsoft.graph.activeDirectoryWindowsAutopilotDeploymentProfile"
	TypeAdministrativeUnit                               Type = "#microsoft.graph.administrativeUnit"
	TypeAndroidForWorkApp                                Type = "#microsoft.graph.androidForWorkApp"
	TypeAndroidLobApp                                    Type = "#microsoft.graph.androidLobApp"
	TypeAndroidManagedStoreApp                           Type = "#microsoft.graph.androidManagedStoreApp"
	TypeAndroidManagedStoreWebApp                        Type = "#microsoft.graph.androidManagedStoreWebApp"
	TypeAndroidStoreApp                                  Type = "#microsoft.graph.androidStoreApp"
	TypeApplication                                      Type = "#microsoft.graph.application"
	TypeAzureActiveDirectoryTenant                       Type = "#microsoft.graph.azureActiveDirectoryTenant"
	TypeAzureADWindowsAutopilotDeploymentProfile         Type = "#microsoft.graph.azureADWindowsAutopilotDeploymentProfile"
	TypeConditionalAccessPolicy                          Type = "#microsoft.graph.conditionalAccessPolicy"
	TypeConnectedOrganizationMembers                     Type = "#microsoft.graph.connectedOrganizationMembers"
	TypeConnectionInfo                                   Type = "#microsoft.graph.connectionInfo"
	TypeCountryNamedLocation                             Type = "#microsoft.graph.countryNamedLocation"
	TypeDevice                                           Type = "#microsoft.graph.device"
	TypeDirectoryRole                                    Type = "#microsoft.graph.directoryRole"
	TypeDirectoryRoleTemplate                            Type = "#microsoft.graph.directoryRoleTemplate"
	TypeDomain                                           Type = "#microsoft.graph.domain"
	TypeDomainIdentitySource                             Type = "#microsoft.graph.domainIdentitySource"
	TypeEmailAuthenticationMethod                        Type = "#microsoft.graph.emailAuthenticationMethod"
	TypeExternalDomainFederation                         Type = "#microsoft.graph.externalDomainFederation"
	TypeExternalSponsors                                 Type = "#microsoft.graph.externalSponsors"
	TypeFido2AuthenticationMethod                        Type = "#microsoft.graph.fido2AuthenticationMethod"
	TypeGroup                                            Type = "#microsoft.graph.group"
	TypeGroupMembers                                     Type = "#microsoft.graph.groupMembers"
	TypeInternalSponsors                                 Type = "#microsoft.graph.internalSponsors"
	TypeIOSLobApp                                        Type = "#microsoft.graph.iosLobApp"
	TypeIOSiPadOSWebClip                                 Type = "#microsoft.graph.iosiPadOSWebClip"
	TypeIOSStoreApp                                      Type = "#microsoft.graph.iosStoreApp"
	TypeIOSVppApp                                        Type = "#microsoft.graph.iosVppApp"
	TypeIpNamedLocation                                  Type = "#microsoft.graph.ipNamedLocation"
	TypeMacOSDmgApp                                      Type = "#microsoft.graph.macOSDmgApp"
	TypeMacOSLobApp                                      Type = "#microsoft.graph.macOSLobApp"
	TypeMacOSMdatpApp                                    Type = "#microsoft.graph.macOSMdatpApp"
	TypeMacOSMicrosoftDefenderApp                        Type = "#microsoft.graph.macOSMicrosoftDefenderApp"
	TypeMacOSMicrosoftEdgeApp                            Type = "#microsoft.graph.macOSMicrosoftEdgeApp"
	TypeMacOSOfficeSuiteApp                              Type = "#microsoft.graph.macOSOfficeSuiteApp"
	TypeMacOsVppApp                                      Type = "#microsoft.graph.macOsVppApp"
	TypeManagedAndroidLobApp                             Type = "#microsoft.graph.managedAndroidLobApp"
	TypeManagedAndroidStoreApp                           Type = "#microsoft.graph.managedAndroidStoreApp"
	TypeManagedIOSLobApp                                 Type = "#microsoft.graph.managedIOSLobApp"
	TypeManagedIOSStoreApp                               Type = "#microsoft.graph.managedIOSStoreApp"
	TypeMicrosoftAuthenticatorAuthenticationMethod       Type = "#microsoft.graph.microsoftAuthenticatorAuthenticationMethod"
	TypeMicrosoftStoreForBusinessApp                     Type = "#microsoft.graph.microsoftStoreForBusinessApp"
	TypeNamedLocation                                    Type = "#microsoft.graph.namedLocation"
	TypeOfficeSuiteApp                                   Type = "#microsoft.graph.officeSuiteApp"
	TypeOrganization                                     Type = "#microsoft.graph.organization"
	TypePasswordAuthenticationMethod                     Type = "#microsoft.graph.passwordAuthenticationMethod"
	TypePhoneAuthenticationMethod                        Type = "#microsoft.graph.phoneAuthenticationMethod"
	TypeRequestorManager                                 Type = "#microsoft.graph.requestorManager"
	TypeServicePrincipal                                 Type = "#microsoft.graph.servicePrincipal"
	TypeSingleUser                                       Type = "#microsoft.graph.singleUser"
	TypeSocialIdentityProvider                           Type = "#microsoft.graph.socialIdentityProvider"
	TypeTemporaryAccessPassAuthenticationMethod          Type = "#microsoft.graph.temporaryAccessPassAuthenticationMethod"
	TypeUser                                             Type = "#microsoft.graph.user"
	TypeWebApp                                           Type = "#microsoft.graph.webApp"
	TypeWinGetApp                                        Type = "#microsoft.graph.winGetApp"
	TypeWin32LobApp                                      Type = "#microsoft.graph.win32LobApp"
	TypeWindowsAppX                                      Type = "#microsoft.graph.windowsAppX"
	TypeWindowsHelloForBusinessAuthenticationMethod      Type = "#microsoft.graph.windowsHelloForBusinessAuthenticationMethod"
	TypeWindowsMicrosoftEdgeApp                          Type = "#microsoft.graph.windowsMicrosoftEdgeApp"
	TypeWindowsMobileMSI                                 Type = "#microsoft.graph.windowsMobileMSI"
	TypeWindowsPhone81AppX                               Type = "#microsoft.graph.windowsPhone81AppX"
	TypeWindowsPhone81AppXBundle                         Type = "#microsoft.graph.windowsPhone81AppXBundle"
	TypeWindowsPhone81StoreApp                           Type = "#microsoft.graph.windowsPhone81StoreApp"
	TypeWindowsPhoneXAP                                  Type = "#microsoft.graph.windowsPhoneXAP"
	TypeWindowsStoreApp                                  Type = "#microsoft.graph.windowsStoreApp"
	TypeWindowsUniversalAppX                             Type = "#microsoft.graph.windowsUniversalAppX"
	TypeWindowsWebApp                                    Type = "#microsoft.graph.windowsWebApp"
)

Jump to

Keyboard shortcuts

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