api

package
v0.0.0-...-82d4c7b Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const UserIDContextKey = "userID"

Variables

This section is empty.

Functions

func DecodeID

func DecodeID(tokenStr string) (int64, error)

func DecodeJSONBody

func DecodeJSONBody(w http.ResponseWriter, r *http.Request, dst any) error

func JWTMiddleware

func JWTMiddleware(noAuthRoutes []NoAuthRoute, next http.Handler) http.Handler

func SetupHandler

func SetupHandler() http.Handler

func SignID

func SignID(id int64) (string, error)

func UserIDFromContext

func UserIDFromContext(r *http.Request) (int64, error)

Types

type CachedFileInfo

type CachedFileInfo struct {
	URL         string
	ContentType string
}

type Claims

type Claims struct {
	Id int64 `json:"id"`
}

type CreatePackJobHandler

type CreatePackJobHandler struct {
	// contains filtered or unexported fields
}

func NewCreatePackJobHandler

func NewCreatePackJobHandler(
	cfg *config.Config,
	req *CreatePackRequest,
) *CreatePackJobHandler

func (*CreatePackJobHandler) GetJobType

func (h *CreatePackJobHandler) GetJobType() string

func (*CreatePackJobHandler) Handle

func (h *CreatePackJobHandler) Handle(
	ctx context.Context,
	r *http.Request,
	progress func(done, total int, message string),
) (any, error)

type CreatePackRequest

type CreatePackRequest struct {
	UserID       int64              `json:"-"`
	PackName     string             `json:"pack_name"`
	Title        string             `json:"title"`
	Emotes       []emote.EmoteInput `json:"emotes"`
	IsPublic     bool               `json:"is_public"`
	HasWatermark bool               `json:"has_watermark"`
}

type CreatePackResponse

type CreatePackResponse struct {
	PackURL string `json:"pack_url"`
}

type DeletePackResponse

type DeletePackResponse struct {
	Success bool `json:"success"`
}

type DetectedStreamContext

type DetectedStreamContext struct {
	Writer      http.ResponseWriter
	Data        []byte
	ContentType string
}

type EditPackJobHandler

type EditPackJobHandler struct {
	// contains filtered or unexported fields
}

func NewEditPackJobHandler

func NewEditPackJobHandler(
	cfg *config.Config,
	req *EditPackRequest,
) *EditPackJobHandler

func (*EditPackJobHandler) GetJobType

func (h *EditPackJobHandler) GetJobType() string

func (*EditPackJobHandler) Handle

func (h *EditPackJobHandler) Handle(
	ctx context.Context,
	r *http.Request,
	progress func(done, total int, message string),
) (any, error)

type EditPackRequest

type EditPackRequest struct {
	UserID          int64                   `json:"-"`
	PackName        string                  `json:"-"`
	UpdatedTitle    *string                 `json:"updated_title,omitempty"`
	UpdatedIsPublic *bool                   `json:"updated_is_public,omitempty"`
	DeletedStickers []string                `json:"deleted_stickers"`
	AddedStickers   []emote.EmoteInput      `json:"added_stickers"`
	EmojiUpdates    []StickerEmojiUpdate    `json:"emoji_updates"`
	PositionUpdates []StickerPositionUpdate `json:"position_updates"`
}

type FileStreamRequest

type FileStreamRequest struct {
	Writer   http.ResponseWriter
	FileInfo *CachedFileInfo
	FileID   string
}

type GetFileResponse

type GetFileResponse struct {
	Ok     bool `json:"ok"`
	Result struct {
		FileID       string `json:"file_id"`
		FileUniqueID string `json:"file_unique_id"`
		FilePath     string `json:"file_path"`
		FileSize     int    `json:"file_size"`
	} `json:"result"`
}

type GetPacksResponse

type GetPacksResponse struct {
	Packs []telegram.PackPreview `json:"packs"`
	Total int                    `json:"total"`
}

type NoAuthRoute

type NoAuthRoute struct {
	Path        string
	Method      string
	PrefixMatch bool
}

type StickerEmojiUpdate

type StickerEmojiUpdate struct {
	ID     string   `json:"id"`
	Emojis []string `json:"emojis"`
}

type StickerPositionUpdate

type StickerPositionUpdate struct {
	ID       string `json:"id"`
	Position int    `json:"position"`
}

type StickerSetResponse

type StickerSetResponse struct {
	telegram.StickerSet
	IsPublic bool `json:"is_public"`
}

type StreamContext

type StreamContext struct {
	Writer  http.ResponseWriter
	Data    []byte
	FileID  string
	FileURL string
}

Jump to

Keyboard shortcuts

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