Help us shape the future of Go! Take the 2026 Go Developer Survey

dto

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package dto holds the support module's contract: the requests and responses of the ticket, announcement, document, ads and marketing endpoints. The Go package keeps the name dto so the Swagger schema names (dto.*) stay stable.

Index

Constants

View Source
const (
	MaxTicketTitleLength       = 255
	MaxTicketDescriptionLength = 10000
	MaxTicketFollowLength      = 65535
)

The bounds below keep a reply inside its TEXT column and the mirror into the Telegram admin group finite: a follow may be an inline image, so its content is bounded by the column, a title by its VARCHAR(255) column.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ads

type Ads struct {
	Id          int    `json:"id"`
	Title       string `json:"title"`
	Type        string `json:"type"`
	Content     string `json:"content"`
	Description string `json:"description"`
	TargetURL   string `json:"target_url"`
	StartTime   int64  `json:"start_time"`
	EndTime     int64  `json:"end_time"`
	Status      int    `json:"status"`
	CreatedAt   int64  `json:"created_at"`
	UpdatedAt   int64  `json:"updated_at"`
}

type Announcement

type Announcement struct {
	Id        int64  `json:"id"`
	Title     string `json:"title"`
	Content   string `json:"content"`
	Show      *bool  `json:"show"`
	Pinned    *bool  `json:"pinned"`
	Popup     *bool  `json:"popup"`
	CreatedAt int64  `json:"created_at"`
	UpdatedAt int64  `json:"updated_at"`
}

type BatchDeleteDocumentRequest

type BatchDeleteDocumentRequest struct {
	Ids []int64 `json:"ids" validate:"required"`
}

type BatchSendEmailTask

type BatchSendEmailTask struct {
	Id      int64  `json:"id"`
	Subject string `json:"subject"`
	Content string `json:"content"`
	// Recipients lists the first recorded recipients, one per line, and
	// says how many more there are; RecipientCount is the whole audience,
	// the additional addresses included.
	Recipients        string `json:"recipients"`
	RecipientCount    int64  `json:"recipient_count"`
	Scope             int8   `json:"scope"`
	RegisterStartTime int64  `json:"register_start_time"`
	RegisterEndTime   int64  `json:"register_end_time"`
	Additional        string `json:"additional"`
	Scheduled         int64  `json:"scheduled"`
	Interval          uint8  `json:"interval"`
	Limit             uint64 `json:"limit"`
	Status            uint8  `json:"status"`
	Errors            string `json:"errors"`
	Total             uint64 `json:"total"`
	Current           uint64 `json:"current"`
	CreatedAt         int64  `json:"created_at"`
	UpdatedAt         int64  `json:"updated_at"`
}

type CreateAdsRequest

type CreateAdsRequest struct {
	Title       string `json:"title"`
	Type        string `json:"type"`
	Content     string `json:"content"`
	Description string `json:"description"`
	TargetURL   string `json:"target_url"`
	StartTime   int64  `json:"start_time"`
	EndTime     int64  `json:"end_time"`
	Status      int    `json:"status"`
}

type CreateAnnouncementRequest

type CreateAnnouncementRequest struct {
	Title   string `json:"title" validate:"required"`
	Content string `json:"content" validate:"required"`
}

type CreateBatchSendEmailTaskRequest

type CreateBatchSendEmailTaskRequest struct {
	Subject           string `json:"subject" validate:"required"`
	Content           string `json:"content" validate:"required"`
	Scope             int8   `json:"scope" validate:"required,oneof=1 2 3 4 5"`
	RegisterStartTime int64  `json:"register_start_time,omitempty" validate:"gte=0"`
	RegisterEndTime   int64  `json:"register_end_time,omitempty" validate:"gte=0"`
	Additional        string `json:"additional,omitempty"`
	Scheduled         int64  `json:"scheduled,omitempty" validate:"gte=0"`
	Interval          uint8  `json:"interval,omitempty"`
	Limit             uint64 `json:"limit,omitempty"`
}

type CreateDocumentRequest

type CreateDocumentRequest struct {
	Title   string   `json:"title" validate:"required"`
	Content string   `json:"content" validate:"required"`
	Tags    []string `json:"tags,omitempty" `
	Show    *bool    `json:"show"`
}

type CreateQuotaTaskRequest

type CreateQuotaTaskRequest struct {
	Subscribers  []int64 `json:"subscribers" validate:"dive,gt=0"`
	IsActive     *bool   `json:"is_active"`
	StartTime    int64   `json:"start_time" validate:"gte=0"`
	EndTime      int64   `json:"end_time" validate:"gte=0"`
	ResetTraffic bool    `json:"reset_traffic"`
	Days         uint64  `json:"days"`
	GiftType     uint8   `json:"gift_type" validate:"oneof=0 1 2"`
	GiftValue    uint64  `json:"gift_value"`
}

type CreateTicketFollowRequest

type CreateTicketFollowRequest struct {
	TicketId int64  `json:"ticket_id" validate:"required,gt=0"`
	From     string `json:"from" validate:"required,max=255"`
	Type     uint8  `json:"type" validate:"required,oneof=1 2"`
	Content  string `json:"content" validate:"required,max=65535"`
}

type CreateUserTicketFollowRequest

type CreateUserTicketFollowRequest struct {
	TicketId int64 `json:"ticket_id" validate:"required,gt=0"`
	// From is ignored: the author is always the ticket owner.
	From    string `json:"from" validate:"max=255"`
	Type    uint8  `json:"type" validate:"oneof=0 1 2"`
	Content string `json:"content" validate:"required,max=65535"`
}

type CreateUserTicketRequest

type CreateUserTicketRequest struct {
	Title       string `json:"title" validate:"required,max=255"`
	Description string `json:"description" validate:"max=10000"`
}

type DeleteAdsRequest

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

type DeleteAnnouncementRequest

type DeleteAnnouncementRequest struct {
	Id int64 `json:"id" validate:"required"`
}

type DeleteDocumentRequest

type DeleteDocumentRequest struct {
	Id int64 `json:"id" validate:"required"`
}

type Document

type Document struct {
	Id        int64    `json:"id"`
	Title     string   `json:"title"`
	Content   string   `json:"content"`
	Tags      []string `json:"tags"`
	Show      bool     `json:"show"`
	CreatedAt int64    `json:"created_at"`
	UpdatedAt int64    `json:"updated_at"`
}

type Follow

type Follow struct {
	Id        int64  `json:"id"`
	TicketId  int64  `json:"ticket_id"`
	From      string `json:"from"`
	Type      uint8  `json:"type"`
	Content   string `json:"content"`
	CreatedAt int64  `json:"created_at"`
}

type GetAdsDetailRequest

type GetAdsDetailRequest struct {
	Id int64 `form:"id"`
}

type GetAdsListRequest

type GetAdsListRequest struct {
	Page   int    `form:"page" validate:"required,gt=0"`
	Size   int    `form:"size" validate:"required,gt=0,lte=100"`
	Status *int   `form:"status,omitempty"`
	Search string `form:"search,omitempty"`
}

type GetAdsListResponse

type GetAdsListResponse struct {
	Total int64 `json:"total"`
	List  []Ads `json:"list"`
}

type GetAdsRequest

type GetAdsRequest struct {
	Device   string `form:"device"`
	Position string `form:"position"`
}

type GetAdsResponse

type GetAdsResponse struct {
	List []Ads `json:"list"`
}

type GetAnnouncementListRequest

type GetAnnouncementListRequest struct {
	Page   int64  `form:"page" validate:"required,gt=0"`
	Size   int64  `form:"size" validate:"required,gt=0,lte=100"`
	Show   *bool  `form:"show,omitempty"`
	Pinned *bool  `form:"pinned,omitempty"`
	Popup  *bool  `form:"popup,omitempty"`
	Search string `form:"search,omitempty"`
}

type GetAnnouncementListResponse

type GetAnnouncementListResponse struct {
	Total int64          `json:"total"`
	List  []Announcement `json:"list"`
}

type GetAnnouncementRequest

type GetAnnouncementRequest struct {
	Id int64 `form:"id" validate:"required"`
}

type GetBatchSendEmailTaskListRequest

type GetBatchSendEmailTaskListRequest struct {
	Page   int    `form:"page" validate:"omitempty,gt=0"`
	Size   int    `form:"size" validate:"omitempty,gt=0,lte=100"`
	Scope  *int8  `form:"scope,omitempty" validate:"omitempty,oneof=1 2 3 4 5"`
	Status *uint8 `form:"status,omitempty" validate:"omitempty,oneof=0 1 2 3 4 5"`
}

type GetBatchSendEmailTaskListResponse

type GetBatchSendEmailTaskListResponse struct {
	Total int64                `json:"total"`
	List  []BatchSendEmailTask `json:"list"`
}

type GetBatchSendEmailTaskStatusRequest

type GetBatchSendEmailTaskStatusRequest struct {
	Id int64 `json:"id" validate:"required,gt=0"`
}

type GetBatchSendEmailTaskStatusResponse

type GetBatchSendEmailTaskStatusResponse struct {
	Status  uint8  `json:"status"`
	Current int64  `json:"current"`
	Total   int64  `json:"total"`
	Errors  string `json:"errors"`
}

type GetDocumentDetailRequest

type GetDocumentDetailRequest struct {
	Id int64 `json:"id" validate:"required"`
}

type GetDocumentListRequest

type GetDocumentListRequest struct {
	Page   int64  `form:"page" validate:"required,gt=0"`
	Size   int64  `form:"size" validate:"required,gt=0,lte=100"`
	Tag    string `form:"tag,omitempty"`
	Search string `form:"search,omitempty"`
}

type GetDocumentListResponse

type GetDocumentListResponse struct {
	Total int64      `json:"total"`
	List  []Document `json:"list"`
}

type GetPreSendEmailCountRequest

type GetPreSendEmailCountRequest struct {
	Scope             int8   `json:"scope" validate:"required,oneof=1 2 3 4 5"`
	RegisterStartTime int64  `json:"register_start_time,omitempty"`
	RegisterEndTime   int64  `json:"register_end_time,omitempty"`
	Additional        string `json:"additional,omitempty"`
}

type GetPreSendEmailCountResponse

type GetPreSendEmailCountResponse struct {
	Count int64 `json:"count"`
}

type GetTicketListRequest

type GetTicketListRequest struct {
	Page   int64  `form:"page" validate:"required,gt=0"`
	Size   int64  `form:"size" validate:"required,gt=0,lte=100"`
	UserId int64  `form:"user_id,omitempty"`
	Status *uint8 `form:"status,omitempty"`
	Search string `form:"search,omitempty"`
}

type GetTicketListResponse

type GetTicketListResponse struct {
	Total int64    `json:"total"`
	List  []Ticket `json:"list"`
}

type GetTicketRequest

type GetTicketRequest struct {
	Id int64 `form:"id" validate:"required"`
}

type GetUserTicketDetailRequest

type GetUserTicketDetailRequest struct {
	Id int64 `form:"id" validate:"required"`
}

type GetUserTicketListRequest

type GetUserTicketListRequest struct {
	Page   int    `form:"page" validate:"required,gt=0"`
	Size   int    `form:"size" validate:"required,gt=0,lte=100"`
	Status *uint8 `form:"status,omitempty"`
	Search string `form:"search,omitempty"`
}

type GetUserTicketListResponse

type GetUserTicketListResponse struct {
	Total int64    `json:"total"`
	List  []Ticket `json:"list"`
}

type QueryAnnouncementRequest

type QueryAnnouncementRequest struct {
	Page   int   `form:"page" validate:"required,gt=0"`
	Size   int   `form:"size" validate:"required,gt=0,lte=100"`
	Pinned *bool `form:"pinned"`
	Popup  *bool `form:"popup"`
}

type QueryAnnouncementResponse

type QueryAnnouncementResponse struct {
	Total int64          `json:"total"`
	List  []Announcement `json:"announcements"`
}

type QueryDocumentDetailRequest

type QueryDocumentDetailRequest struct {
	Id int64 `form:"id" validate:"required"`
}

type QueryDocumentListResponse

type QueryDocumentListResponse struct {
	Total int64      `json:"total"`
	List  []Document `json:"list"`
}

type QueryQuotaTaskListRequest

type QueryQuotaTaskListRequest struct {
	Page   int    `form:"page" validate:"omitempty,gt=0"`
	Size   int    `form:"size" validate:"omitempty,gt=0,lte=100"`
	Status *uint8 `form:"status,omitempty" validate:"omitempty,oneof=0 1 2 3 4 5"`
}

type QueryQuotaTaskListResponse

type QueryQuotaTaskListResponse struct {
	Total int64       `json:"total"`
	List  []QuotaTask `json:"list"`
}

type QueryQuotaTaskPreCountRequest

type QueryQuotaTaskPreCountRequest struct {
	Subscribers []int64 `json:"subscribers"`
	IsActive    *bool   `json:"is_active"`
	StartTime   int64   `json:"start_time" validate:"gte=0"`
	EndTime     int64   `json:"end_time" validate:"gte=0"`
}

type QueryQuotaTaskPreCountResponse

type QueryQuotaTaskPreCountResponse struct {
	Count int64 `json:"count"`
}

type QuotaTask

type QuotaTask struct {
	Id           int64   `json:"id"`
	Subscribers  []int64 `json:"subscribers"`
	IsActive     *bool   `json:"is_active"`
	StartTime    int64   `json:"start_time"`
	EndTime      int64   `json:"end_time"`
	ResetTraffic bool    `json:"reset_traffic"`
	Days         uint64  `json:"days"`
	GiftType     uint8   `json:"gift_type"`
	GiftValue    uint64  `json:"gift_value"`
	Objects      []int64 `json:"objects"` // UserSubscribe IDs
	Status       uint8   `json:"status"`
	Total        int64   `json:"total"`
	Current      int64   `json:"current"`
	Errors       string  `json:"errors"`
	CreatedAt    int64   `json:"created_at"`
	UpdatedAt    int64   `json:"updated_at"`
}

type StaffTicketUpdateCommand added in v1.21.0

type StaffTicketUpdateCommand struct {
	TicketId int64
	// Reply, when not empty, is appended as a staff text follow and moves the
	// ticket to Waiting, exactly like a reply from the admin panel.
	Reply string
	// From is the reply's author as stored on the follow.
	From string
	// Status is the status to move the ticket to when there is no reply.
	Status uint8
	// FromMirror reports that the change was made inside the channel the
	// ticket notifier mirrors to (the ticket's Telegram topic). That channel
	// already shows it, so the notifier is skipped instead of echoing the
	// change back.
	FromMirror bool
}

StaffTicketUpdateCommand is an internal, trusted contract for a ticket change staff make outside the admin panel: today the Telegram bot's /rp, /close and /reopen commands and its ticket topics. It must NOT be bound to an HTTP request; the caller has already authenticated the administrator.

type StaffTicketUpdateResult added in v1.21.0

type StaffTicketUpdateResult struct {
	PreviousStatus uint8
}

StaffTicketUpdateResult describes the ticket before the update applied.

type StopBatchSendEmailTaskRequest

type StopBatchSendEmailTaskRequest struct {
	Id int64 `json:"id" validate:"required,gt=0"`
}

type Ticket

type Ticket struct {
	Id          int64    `json:"id"`
	Title       string   `json:"title"`
	Description string   `json:"description"`
	UserId      int64    `json:"user_id"`
	Follows     []Follow `json:"follow,omitempty"`
	Status      uint8    `json:"status"`
	CreatedAt   int64    `json:"created_at"`
	UpdatedAt   int64    `json:"updated_at"`
}

type UpdateAdsRequest

type UpdateAdsRequest struct {
	Id          int64  `json:"id"`
	Title       string `json:"title"`
	Type        string `json:"type"`
	Content     string `json:"content"`
	Description string `json:"description"`
	TargetURL   string `json:"target_url"`
	StartTime   int64  `json:"start_time"`
	EndTime     int64  `json:"end_time"`
	Status      int    `json:"status"`
}

type UpdateAnnouncementRequest

type UpdateAnnouncementRequest struct {
	Id      int64  `json:"id" validate:"required"`
	Title   string `json:"title"`
	Content string `json:"content"`
	Show    *bool  `json:"show"`
	Pinned  *bool  `json:"pinned"`
	Popup   *bool  `json:"popup"`
}

type UpdateDocumentRequest

type UpdateDocumentRequest struct {
	Id      int64    `json:"id" validate:"required"`
	Title   string   `json:"title" validate:"required"`
	Content string   `json:"content" validate:"required"`
	Tags    []string `json:"tags,omitempty" `
	Show    *bool    `json:"show"`
}

type UpdateTicketStatusRequest

type UpdateTicketStatusRequest struct {
	Id     int64  `json:"id" validate:"required"`
	Status *uint8 `json:"status" validate:"required"`
}

type UpdateUserTicketStatusRequest

type UpdateUserTicketStatusRequest struct {
	Id     int64  `json:"id" validate:"required"`
	Status *uint8 `json:"status" validate:"required"`
}

Jump to

Keyboard shortcuts

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