token_template

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

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

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

List returns all token templates (admin, all statuses).

func (*Handler) ListEnabled

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 PreviewResponse struct {
	TemplateID   uint          `json:"template_id"`
	TemplateName string        `json:"template_name"`
	Total        int           `json:"total"`
	Changed      int           `json:"changed"`
	Unchanged    int           `json:"unchanged"`
	Items        []PreviewItem `json:"items"`
}

type SyncRequest added in v0.0.10

type SyncRequest struct {
	ID     string   `uri:"id" binding:"required"`
	Fields []string `json:"fields"`
}

type SyncResponse

type SyncResponse struct {
	TemplateID       uint `json:"template_id"`
	Synced           int  `json:"synced"`
	SkippedUnchanged int  `json:"skipped_unchanged"`
}

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)

Jump to

Keyboard shortcuts

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