Documentation
¶
Index ¶
- type Config
- type CreateKeyRequest
- type CreateKeyResponse
- type CreateRootKeyRequest
- type CreateRootKeyResponse
- type DeleteKeyRequest
- type DeleteKeyResponse
- type ErrorCode
- type ErrorResponse
- type GetApiRequest
- type GetApiResponse
- type GetKeyRequest
- type GetKeyResponse
- type ListKeysRequest
- type ListKeysResponse
- type Server
- type UpdateKeyRequest
- type UpdateKeyResponse
- type VerifyKeyErrorResponse
- type VerifyKeyRequest
- type VerifyKeyResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Logger logging.Logger
KeyCache cache.Cache[entities.Key]
// The ApiCache uses the KeyAuthId as cache key, not an apiId
ApiCache cache.Cache[entities.Api]
Database database.Database
Ratelimit ratelimit.Ratelimiter
GlobalRatelimit ratelimit.Ratelimiter
Tracer trace.Tracer
// Potentially the user does not have tinybird set up or does not want to use it
// simply pass in nil in that case
Tinybird *tinybird.Tinybird
UnkeyAppAuthToken string
UnkeyWorkspaceId string
UnkeyApiId string
UnkeyKeyAuthId string
Region string
Kafka *kafka.Kafka
Version string
}
type CreateKeyRequest ¶
type CreateKeyRequest struct {
ApiId string `json:"apiId" validate:"required"`
Prefix string `json:"prefix"`
Name string `json:"name"`
ByteLength int `json:"byteLength"`
OwnerId string `json:"ownerId"`
Meta map[string]any `json:"meta"`
Expires int64 `json:"expires"`
Ratelimit *struct {
Type string `json:"type"`
Limit int64 `json:"limit"`
RefillRate int64 `json:"refillRate"`
RefillInterval int64 `json:"refillInterval"`
} `json:"ratelimit"`
// ForWorkspaceId is used internally when the frontend wants to create a new root key.
// Therefore we might not want to add this field to our docs.
ForWorkspaceId string `json:"forWorkspaceId"`
// How often this key may be used
// `undefined`, `0` or negative to disable
Remaining int64 `json:"remaining,omitempty"`
}
type CreateKeyResponse ¶
type CreateRootKeyRequest ¶
type CreateRootKeyRequest struct {
Name string `json:"name"`
Expires int64 `json:"expires"`
// ForWorkspaceId is used internally when the frontend wants to create a new root key.
// Therefore we might not want to add this field to our docs.
ForWorkspaceId string `json:"forWorkspaceId" validate:"required"`
}
type CreateRootKeyResponse ¶
type DeleteKeyRequest ¶
type DeleteKeyRequest struct {
KeyId string `json:"keyId" validate:"required"`
}
type DeleteKeyResponse ¶
type DeleteKeyResponse struct {
}
type ErrorResponse ¶
type GetApiRequest ¶
type GetApiRequest struct {
ApiId string `json:"apiId" validate:"required"`
}
type GetApiResponse ¶
type GetKeyRequest ¶
type GetKeyRequest struct {
KeyId string `validate:"required"`
}
type GetKeyResponse ¶
type GetKeyResponse = keyResponse
type ListKeysRequest ¶
type ListKeysResponse ¶
type ListKeysResponse struct {
Keys []keyResponse `json:"keys"`
Total int `json:"total"`
}
type UpdateKeyRequest ¶
type UpdateKeyRequest struct {
KeyId string `json:"keyId" validate:"required"`
Name nullish[string] `json:"name"`
OwnerId nullish[string] `json:"ownerId"`
Meta nullish[map[string]any] `json:"meta"`
Expires nullish[int64] `json:"expires"`
Ratelimit nullish[struct {
Type string `json:"type" validate:"required"`
Limit int64 `json:"limit" validate:"required"`
RefillRate int64 `json:"refillRate" validate:"required"`
RefillInterval int64 `json:"refillInterval" validate:"required"`
}] `json:"ratelimit"`
Remaining nullish[int64] `json:"remaining"`
}
type UpdateKeyResponse ¶
type UpdateKeyResponse struct{}
type VerifyKeyErrorResponse ¶
type VerifyKeyErrorResponse struct {
ErrorResponse
Valid bool `json:"valid"`
Ratelimit *ratelimitResponse `json:"ratelimit,omitempty"`
}
type VerifyKeyRequest ¶
type VerifyKeyRequest struct {
Key string `json:"key"`
}
type VerifyKeyResponse ¶
type VerifyKeyResponse struct {
Valid bool `json:"valid"`
OwnerId string `json:"ownerId,omitempty"`
Meta map[string]any `json:"meta,omitempty"`
Expires int64 `json:"expires,omitempty"`
Remaining *int64 `json:"remaining,omitempty"`
Ratelimit *ratelimitResponse `json:"ratelimit,omitempty"`
Code string `json:"code,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.