Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrUnauthorized is returned when the API rejects our token. Higher-level commands can suggest re-running `norcube login`.
Functions ¶
This section is empty.
Types ¶
type AuthClient ¶
type AuthClient struct {
BaseURL string
HTTP *http.Client
Token func(ctx context.Context) (string, error)
}
AuthClient talks to the auth service (/auth/me, /organizations, ...). It expects the caller to provide a valid Bearer token via Authorization.
func NewAuthClient ¶
func (*AuthClient) CreateOrganization ¶
func (c *AuthClient) CreateOrganization(ctx context.Context, name string, slug *string) (*Organization, error)
CreateOrganization creates a new org with the given name. slug is optional — when nil or empty the server derives one from the name. The caller becomes the owner. Returns the new org's id, slug, and canonicalised name.
The server returns the new org wrapped in {"organization": {...}} — we unwrap so the caller gets the same Organization shape that ListOrganizations hands back.
func (*AuthClient) ListOrganizations ¶
func (c *AuthClient) ListOrganizations(ctx context.Context) ([]Organization, error)
Directories
¶
| Path | Synopsis |
|---|---|
|
Package apierror renders non-2xx API responses into error messages that are actually useful for debugging.
|
Package apierror renders non-2xx API responses into error messages that are actually useful for debugging. |
|
Package langsync provides primitives to interact with the openapi HTTP API.
|
Package langsync provides primitives to interact with the openapi HTTP API. |
|
Package snapdb provides primitives to interact with the openapi HTTP API.
|
Package snapdb provides primitives to interact with the openapi HTTP API. |
Click to show internal directories.
Click to hide internal directories.