Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) CreateClient(ctx context.Context, req CreateClientRequest) (*ClientWithSecretResponse, error)
- func (c *Client) DeleteClient(ctx context.Context, id string) error
- func (c *Client) GetClient(ctx context.Context, id string) (*ClientResponse, error)
- func (c *Client) ListClients(ctx context.Context) ([]ClientResponse, error)
- func (c *Client) RotateClientSecret(ctx context.Context, id string) (*ClientWithSecretResponse, error)
- func (c *Client) UpdateClient(ctx context.Context, id string, req UpdateClientRequest) (*ClientResponse, error)
- type ClientResponse
- type ClientWithSecretResponse
- type Config
- type CreateClientRequest
- type UpdateClientRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBaseURLMissing = errors.New("base URL is required") ErrRequestFailed = errors.New("request failed") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps access to the schwab-proxy admin HTTP API.
func (*Client) CreateClient ¶
func (c *Client) CreateClient(ctx context.Context, req CreateClientRequest) (*ClientWithSecretResponse, error)
CreateClient creates a new client.
func (*Client) DeleteClient ¶
DeleteClient removes a client.
func (*Client) ListClients ¶
func (c *Client) ListClients(ctx context.Context) ([]ClientResponse, error)
ListClients returns all clients.
func (*Client) RotateClientSecret ¶
func (c *Client) RotateClientSecret(ctx context.Context, id string) (*ClientWithSecretResponse, error)
RotateClientSecret rotates and returns a new plaintext secret once.
func (*Client) UpdateClient ¶
func (c *Client) UpdateClient(ctx context.Context, id string, req UpdateClientRequest) (*ClientResponse, error)
UpdateClient updates fields on an existing client.
type ClientResponse ¶
type ClientResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
RedirectURI string `json:"redirect_uri"`
Scopes []string `json:"scopes"`
Active bool `json:"active"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
ClientResponse matches API response (without secret).
type ClientWithSecretResponse ¶
type ClientWithSecretResponse struct {
ClientResponse
Secret string `json:"secret"`
}
ClientWithSecretResponse includes the secret (only on create).
type CreateClientRequest ¶
type CreateClientRequest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
RedirectURI string `json:"redirect_uri"`
Scopes []string `json:"scopes,omitempty"`
}
CreateClientRequest mirrors the API payload.
type UpdateClientRequest ¶
type UpdateClientRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
RedirectURI *string `json:"redirect_uri,omitempty"`
Scopes *[]string `json:"scopes,omitempty"`
Active *bool `json:"active,omitempty"`
}
UpdateClientRequest mirrors the API payload with optional fields.
Click to show internal directories.
Click to hide internal directories.