types

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

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 CreateApiKeyResponse struct {
	RawApiKey string  `json:"raw_api_key"`
	ApiKey    *ApiKey `json:"api_key"`
}

type DeleteApiKeyResponse

type DeleteApiKeyResponse struct {
	Message string `json:"message"`
}

type GetAllApiKeysResponse

type GetAllApiKeysResponse struct {
	Items []*ApiKey `json:"items"`
	Total int       `json:"total"`
	Page  int       `json:"page"`
	Limit int       `json:"limit"`
}

type GetApiKeyResponse

type GetApiKeyResponse struct {
	ApiKey *ApiKey `json:"api_key"`
}

type GetApiKeysRequest

type GetApiKeysRequest struct {
	OwnerType *string
	OwnerID   *string
	Page      int
	Limit     int
}

type UpdateApiKeyData

type UpdateApiKeyData struct {
	Name                 *string
	Enabled              *bool
	RateLimitEnabled     *bool
	RateLimitTimeWindow  *int
	RateLimitMaxRequests *int
	LastRequestedAt      *time.Time
	ExpiresAt            *time.Time
	Permissions          []string
	Metadata             map[string]any
}

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

type VerifyApiKeyResult struct {
	Valid  bool
	ApiKey *ApiKey
}

Jump to

Keyboard shortcuts

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