Documentation
¶
Index ¶
- type CreateRequest
- type Handler
- func (h *Handler) Create(c *app.Context, req CreateRequest) (api.Created[models.TokenTemplate], error)
- func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)
- func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[models.TokenTemplate], error)
- func (h *Handler) ListEnabled(c *app.Context, req ListRequest) (api.PaginatedResponse[models.TokenTemplate], error)
- func (h *Handler) Sync(c *app.Context, req SyncRequest) (SyncResponse, error)
- func (h *Handler) SyncPreview(c *app.Context, req SyncRequest) (PreviewResponse, error)
- func (h *Handler) Update(c *app.Context, req UpdateRequest) (models.TokenTemplate, error)
- type ListRequest
- type PreviewItem
- type PreviewResponse
- type SyncRequest
- type SyncResponse
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRequest ¶
type CreateRequest struct {
Name string `json:"name" binding:"required"`
Models string `json:"models"`
ExpiryDays int `json:"expiry_days"`
Status int `json:"status"`
AllowedChannelIDs *[]uint `json:"allowed_channel_ids"`
AllowedGroupIDs *[]uint `json:"allowed_group_ids"`
BYOKOnly bool `json:"byok_only"`
}
type Handler ¶
type Handler struct{}
func (*Handler) Create ¶
func (h *Handler) Create(c *app.Context, req CreateRequest) (api.Created[models.TokenTemplate], error)
Create creates a new token template.
func (*Handler) Delete ¶
func (h *Handler) Delete(c *app.Context, req api.IDPathRequest) (api.StatusResponse, error)
Delete deletes a token template by ID.
func (*Handler) List ¶
func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[models.TokenTemplate], error)
List returns all token templates (admin, all statuses).
func (*Handler) ListEnabled ¶
func (h *Handler) ListEnabled(c *app.Context, req ListRequest) (api.PaginatedResponse[models.TokenTemplate], error)
ListEnabled returns only enabled token templates (user-facing).
func (*Handler) Sync ¶
func (h *Handler) Sync(c *app.Context, req SyncRequest) (SyncResponse, error)
func (*Handler) SyncPreview ¶
func (h *Handler) SyncPreview(c *app.Context, req SyncRequest) (PreviewResponse, error)
func (*Handler) Update ¶
func (h *Handler) Update(c *app.Context, req UpdateRequest) (models.TokenTemplate, error)
Update updates a token template by ID.
type ListRequest ¶
type ListRequest struct {
api.PaginationQuery
Search string `form:"search"`
Status string `form:"status"`
}
type PreviewItem ¶
type PreviewItem struct {
TokenID uint `json:"token_id"`
TokenName string `json:"token_name"`
ModelsBefore string `json:"models_before"`
ModelsAfter string `json:"models_after"`
ChannelsBefore []uint `json:"channels_before"`
ChannelsAfter []uint `json:"channels_after"`
BYOKOnlyBefore bool `json:"byok_only_before"`
BYOKOnlyAfter bool `json:"byok_only_after"`
}
type PreviewResponse ¶
type SyncRequest ¶ added in v0.0.10
type SyncResponse ¶
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.