Documentation
¶
Index ¶
- func GenerateKey() string
- type APIRoleUpdateRequest
- type CreateRequest
- type Handler
- func (h *Handler) Create(c *app.Context, req CreateRequest) (api.Created[models.Token], error)
- func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)
- func (h *Handler) Get(c *app.Context, req api.IDPathRequest) (models.Token, error)
- func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[ListResponse], error)
- func (h *Handler) Update(c *app.Context, req UpdateRequest) (models.Token, error)
- type ListRequest
- type ListResponse
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
func GenerateKey() string
Types ¶
type APIRoleUpdateRequest ¶ added in v0.0.16
type APIRoleUpdateRequest struct {
Mode models.APIRoleMode `json:"api_role_mode"`
RoleIDs []uint `json:"api_role_ids"`
}
type CreateRequest ¶
type CreateRequest struct {
UserID uint `json:"user_id"`
Name string `json:"name" binding:"required"`
Key string `json:"key"`
TemplateID *uint `json:"template_id"`
ExpiredAt int64 `json:"expired_at"`
Models string `json:"models"`
TraceEnabled bool `json:"trace_enabled"`
TraceMode string `json:"trace_mode"`
BYOKOnly bool `json:"byok_only"`
AllowedChannelIDs *[]uint `json:"allowed_channel_ids"`
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) Delete ¶
func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)
func (*Handler) List ¶
func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[ListResponse], error)
type ListRequest ¶
type ListRequest struct {
api.PaginationQuery
Search string `form:"search"`
UserID string `form:"user_id"`
TokenID *uint `form:"token_id"`
Status string `form:"status"`
UsableOnly bool `form:"usable_only"`
APIRoleMode string `form:"api_role_mode"`
APIServiceID *uint `form:"api_service_id"`
APIRouteID *uint `form:"api_route_id"`
}
type ListResponse ¶ added in v0.0.16
ListResponse is the Token list DTO. It adds the owner display information needed by administrative pickers without changing single-Token responses.
type UpdateRequest ¶
type UpdateRequest struct {
ID string `uri:"id" binding:"required"`
Fields map[string]any `json:"-"`
}
func (*UpdateRequest) SetBodyMap ¶
func (r *UpdateRequest) SetBodyMap(fields map[string]any)
Click to show internal directories.
Click to hide internal directories.