Documentation
¶
Index ¶
- Constants
- type ApiKey
- type ApiKeyPluginConfig
- type CreateApiKeyRequest
- type CreateApiKeyResponse
- type DeleteApiKeyResponse
- type GetAllApiKeysResponse
- type GetApiKeyResponse
- type GetApiKeysRequest
- type UpdateApiKeyData
- type UpdateApiKeyRequest
- type UpdateApiKeyResponse
- type VerifyApiKeyRequest
- type VerifyApiKeyResponse
- type VerifyApiKeyResult
Constants ¶
View Source
const ( OwnerTypeUser = "user" OwnerTypeOrganization = "organization" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiKey ¶
type ApiKey struct {
bun.BaseModel `bun:"table:api_keys"`
ID string `json:"id" bun:"column:id,pk"`
KeyHash string `json:"key_hash" bun:"column:key_hash"`
Name string `json:"name" bun:"column:name"`
OwnerType string `json:"owner_type" bun:"column:owner_type"`
OwnerID string `json:"owner_id" bun:"column:owner_id"`
Start string `json:"start" bun:"column:start"`
Last string `json:"last" bun:"column:last"`
Prefix *string `json:"prefix" bun:"column:prefix"`
Enabled bool `json:"enabled" bun:"column:enabled"`
RateLimitEnabled bool `json:"rate_limit_enabled" bun:"column:rate_limit_enabled"`
LastRequestedAt *time.Time `json:"last_requested_at" bun:"column:last_requested_at"`
ExpiresAt *time.Time `json:"expires_at" bun:"column:expires_at"`
Permissions []string `json:"permissions" bun:"column:permissions"`
Metadata map[string]any `json:"metadata" bun:"column:metadata"`
CreatedAt time.Time `json:"created_at" bun:"column:created_at,default:current_timestamp"`
UpdatedAt time.Time `json:"updated_at" bun:"column:updated_at,default:current_timestamp"`
}
type ApiKeyPluginConfig ¶
type ApiKeyPluginConfig struct {
AllowOrgKeys bool `json:"allow_org_keys" toml:"allow_org_keys"`
DefaultPrefix string `json:"default_prefix" toml:"default_prefix"`
Header string `json:"header" toml:"header"`
AutoCleanup bool `json:"auto_cleanup" toml:"auto_cleanup"`
CleanupInterval time.Duration `json:"cleanup_interval" toml:"cleanup_interval"`
}
func (*ApiKeyPluginConfig) ApplyDefaults ¶
func (c *ApiKeyPluginConfig) ApplyDefaults()
type CreateApiKeyRequest ¶
type CreateApiKeyRequest struct {
Name string `json:"name"`
OwnerType string `json:"owner_type"`
OwnerID string `json:"owner_id"`
Prefix *string `json:"prefix,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
RateLimitEnabled *bool `json:"rate_limit_enabled,omitempty"`
RateLimitTimeWindow *int `json:"rate_limit_time_window,omitempty"`
RateLimitMaxRequests *int `json:"rate_limit_max_requests,omitempty"`
Permissions []string `json:"permissions,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
func (*CreateApiKeyRequest) Validate ¶
func (r *CreateApiKeyRequest) Validate() error
type CreateApiKeyResponse ¶
type DeleteApiKeyResponse ¶
type DeleteApiKeyResponse struct {
Message string `json:"message"`
}
type GetAllApiKeysResponse ¶
type GetApiKeyResponse ¶
type GetApiKeyResponse struct {
ApiKey *ApiKey `json:"api_key"`
}
type GetApiKeysRequest ¶
type UpdateApiKeyData ¶
type UpdateApiKeyRequest ¶
type UpdateApiKeyRequest struct {
Name *string `json:"name,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
RateLimitEnabled *bool `json:"rate_limit_enabled,omitempty"`
RateLimitTimeWindow *int `json:"rate_limit_time_window,omitempty"`
RateLimitMaxRequests *int `json:"rate_limit_max_requests,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
Permissions []string `json:"permissions,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
func (*UpdateApiKeyRequest) Validate ¶
func (r *UpdateApiKeyRequest) Validate() error
type UpdateApiKeyResponse ¶
type UpdateApiKeyResponse struct {
ApiKey *ApiKey `json:"api_key"`
}
type VerifyApiKeyRequest ¶
type VerifyApiKeyRequest struct {
Key string `json:"key"`
}
func (*VerifyApiKeyRequest) Validate ¶
func (r *VerifyApiKeyRequest) Validate() error
type VerifyApiKeyResponse ¶
type VerifyApiKeyResponse struct {
ApiKey *ApiKey `json:"api_key"`
}
type VerifyApiKeyResult ¶
Click to show internal directories.
Click to hide internal directories.