Documentation
¶
Overview ¶
Package graph provides an HTTP client for Microsoft Graph API calls with built-in safety enforcement and incremental consent support.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckSafety ¶
CheckSafety enforces the write protection policy.
Default behavior (allowWrites=false): only GET, HEAD, OPTIONS are allowed. With --allow-writes: POST, PUT, PATCH are additionally allowed. DELETE is always rejected.
func FormatError ¶
FormatError returns a user-friendly error message from a Graph API response.
func ParseRequiredScopes ¶
ParseRequiredScopes attempts to extract required permission scopes from a 403 Forbidden response body. Graph API error messages often contain the required scopes in the error message text.
Types ¶
type CallOptions ¶
type CallOptions struct {
Method string
URL string // Can be a full URL or a relative path (e.g. "/me")
Body string
Headers map[string]string
APIVersion string
Select string
Filter string
Top int
Expand string
OrderBy string
Scopes []string // Extra scopes to request
}
CallOptions configures a single Graph API request.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Graph API HTTP client.
type GraphError ¶
type GraphError struct {
Error struct {
Code string `json:"code"`
Message string `json:"message"`
InnerError *struct {
Date string `json:"date"`
RequestID string `json:"request-id"`
ClientRequestID string `json:"client-request-id"`
} `json:"innerError,omitempty"`
} `json:"error"`
}
GraphError represents a Microsoft Graph API error response.
func ParseGraphError ¶
func ParseGraphError(body string) *GraphError
ParseGraphError parses a Graph API error response body.