graph

package
v1.91.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package graph holds what the Microsoft Graph client packages share: the base URL, escaped path construction, and @odata.nextLink pagination.

Index

Constants

View Source
const Domain = "graph.microsoft.com"

Variables

View Source
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 IsStatus

func IsStatus(err error, statusCode int) bool

IsStatus reports whether err stems from a response with the status code.

func NextLinkOr

func NextLinkOr(firstUrl string) func(nextLink string) string

NextLinkOr makes a rest.ListPaginated URL function: the first page is firstUrl, later pages the absolute @odata.nextLink of the previous one.

func ODataString

func ODataString(s string) string

ODataString escapes s for use inside a single-quoted OData string literal.

func PathSegments

func PathSegments(path string) []string

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

func (*PathBuilder) Url

func (b *PathBuilder) Url(baseUrl *url.URL, query url.Values) string

Url resolves the built path against baseUrl.

Jump to

Keyboard shortcuts

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