Documentation
¶
Overview ¶
Package graph holds what the Microsoft Graph client packages share: the base URL, escaped path construction, and @odata.nextLink pagination.
Index ¶
Constants ¶
const Domain = "graph.microsoft.com"
Variables ¶
var DefaultBaseUrl = &url.URL{Scheme: "https", Host: Domain}
Functions ¶
func Extract ¶
func Extract[T any](response *ListResponse[T]) ([]T, string)
Extract adapts ListResponse to rest.ListPaginated, the next link standing in for the page token.
func NextLinkOr ¶
NextLinkOr makes a rest.ListPaginated URL function: the first page is firstUrl, later pages the absolute @odata.nextLink of the previous one.
func ODataString ¶
ODataString escapes s for use inside a single-quoted OData string literal.
func PathSegments ¶
PathSegments splits a "/"-separated path into its non-empty segments.
Types ¶
type ListResponse ¶
type ListResponse[T any] struct { Value []T `json:"value,omitzero"` NextLink string `json:"@odata.nextLink,omitzero"` }
ListResponse is the envelope of a Graph collection.
type PathBuilder ¶
type PathBuilder struct {
// contains filtered or unexported fields
}
PathBuilder builds a URL path whose literal parts (Graph's ":" path addressing, OData function syntax) are kept verbatim while the parts taken from callers are escaped, keeping Path and RawPath in step.
func (*PathBuilder) Escaped ¶
func (b *PathBuilder) Escaped(s string) *PathBuilder
func (*PathBuilder) EscapedPath ¶
func (b *PathBuilder) EscapedPath(path string) *PathBuilder
EscapedPath escapes each "/"-separated segment of a drive-relative path, dropping empty segments so that leading, trailing and doubled slashes are harmless.
func (*PathBuilder) Literal ¶
func (b *PathBuilder) Literal(s string) *PathBuilder