Documentation
¶
Index ¶
- Constants
- Variables
- func GetRedirectURIs() []string
- type Client
- func (c *Client) ExchangeCode(code, redirectURI, codeVerifier string, creds *types.ClientCredentials) (*types.TokenSet, error)
- func (c *Client) RefreshToken(refreshToken string, creds *types.ClientCredentials) (*types.TokenSet, error)
- func (c *Client) Register(redirectURI string, scopes []string) (*types.ClientCredentials, error)
- type RegistrationRequest
- type RegistrationResponse
- type TokenRequest
- type TokenResponse
Constants ¶
const ( // DCRClientName is the client name used during registration // Matches datadog-api-claude-plugin for compatibility DCRClientName = "datadog-api-claude-plugin" )
Constants from TypeScript PR #84 for compatibility
Variables ¶
var DCRRedirectPorts = []int{8000, 8080, 8888, 9000}
DCRRedirectPorts are the specific ports to register for OAuth callbacks Must match TypeScript PR #84 for compatibility
Functions ¶
func GetRedirectURIs ¶
func GetRedirectURIs() []string
GetRedirectURIs returns the standard redirect URIs for the given ports
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles Dynamic Client Registration with Datadog
func NewClientWithHTTPClient ¶
NewClientWithHTTPClient creates a new DCR client with a custom HTTP client This is primarily used for testing with mock servers
func (*Client) ExchangeCode ¶
func (c *Client) ExchangeCode(code, redirectURI, codeVerifier string, creds *types.ClientCredentials) (*types.TokenSet, error)
ExchangeCode exchanges an authorization code for tokens Matches TypeScript PR #84 - uses form-encoded data, no client_secret (public client)
func (*Client) RefreshToken ¶
func (c *Client) RefreshToken(refreshToken string, creds *types.ClientCredentials) (*types.TokenSet, error)
RefreshToken refreshes an access token using a refresh token Matches TypeScript PR #84 - uses form-encoded data, no client_secret (public client)
type RegistrationRequest ¶
type RegistrationRequest struct {
ClientName string `json:"client_name"`
RedirectURIs []string `json:"redirect_uris"`
GrantTypes []string `json:"grant_types"`
}
RegistrationRequest represents a DCR registration request (RFC 7591) Matches TypeScript PR #84 format for compatibility
type RegistrationResponse ¶
type RegistrationResponse struct {
ClientID string `json:"client_id"`
ClientName string `json:"client_name"`
RedirectURIs []string `json:"redirect_uris"`
TokenEndpointAuthMethod string `json:"token_endpoint_auth_method"`
GrantTypes []string `json:"grant_types"`
Scope string `json:"scope,omitempty"`
}
RegistrationResponse represents a DCR registration response Matches TypeScript PR #84 format for compatibility Note: Public clients (token_endpoint_auth_method: 'none') don't receive client_secret
type TokenRequest ¶
type TokenRequest struct {
GrantType string `json:"grant_type"`
Code string `json:"code,omitempty"`
RedirectURI string `json:"redirect_uri,omitempty"`
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
CodeVerifier string `json:"code_verifier,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"`
}
TokenRequest represents an OAuth2 token request
type TokenResponse ¶
type TokenResponse struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int64 `json:"expires_in"`
RefreshToken string `json:"refresh_token,omitempty"`
Scope string `json:"scope,omitempty"`
}
TokenResponse represents an OAuth2 token response