admin

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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 NewClient

func NewClient(cfg Config) (*Client, error)

NewClient constructs a Client with sensible defaults.

func (*Client) CreateClient

CreateClient creates a new client.

func (*Client) DeleteClient

func (c *Client) DeleteClient(ctx context.Context, id string) error

DeleteClient removes a client.

func (*Client) GetClient

func (c *Client) GetClient(ctx context.Context, id string) (*ClientResponse, error)

GetClient returns a single client by ID.

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 Config

type Config struct {
	BaseURL  string
	APIKey   string
	Insecure bool
	Timeout  time.Duration
}

Config holds construction parameters for Client.

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.

Jump to

Keyboard shortcuts

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