api

package
v1.0.27 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API represents the API server for account linking

func NewAPI

func NewAPI(apiKey string) *API

NewAPI creates a new API instance

func (*API) GetLinkedAccount

func (api *API) GetLinkedAccount(discordID string) (*LinkedAccount, bool)

GetLinkedAccount retrieves a linked account by Discord ID

func (*API) GetLinkedAccountByTelegram

func (api *API) GetLinkedAccountByTelegram(telegramID string) (*LinkedAccount, bool)

GetLinkedAccountByTelegram retrieves a linked account by Telegram ID

func (*API) Start

func (api *API) Start(addr string) error

Start starts the API server

type IssueCodeRequest

type IssueCodeRequest struct {
	DiscordID  string `json:"discord_id"`
	TelegramID string `json:"telegram_id,omitempty"` // Optional pre-binding
}

IssueCodeRequest represents the request to issue a linking code

type IssueCodeResponse

type IssueCodeResponse struct {
	Success bool   `json:"success"`
	Code    string `json:"code,omitempty"`
	Error   string `json:"error,omitempty"`
}

IssueCodeResponse represents the response from issuing a code

type LinkCode

type LinkCode struct {
	Code       string    `json:"code"`
	DiscordID  string    `json:"discord_id"`
	TelegramID string    `json:"telegram_id,omitempty"` // Optional pre-binding
	ExpiresAt  time.Time `json:"expires_at"`
	Used       bool      `json:"used"`
	CreatedAt  time.Time `json:"created_at"`
}

LinkCode represents a verification code for linking Discord and Telegram accounts

type LinkedAccount

type LinkedAccount struct {
	DiscordID  string    `json:"discord_id"`
	TelegramID string    `json:"telegram_id"`
	LinkedAt   time.Time `json:"linked_at"`
}

LinkedAccount represents a linked Discord-Telegram account

type VerifyCodeRequest

type VerifyCodeRequest struct {
	Code       string `json:"code"`
	TelegramID string `json:"telegram_id"`
}

VerifyCodeRequest represents the request to verify a linking code

type VerifyCodeResponse

type VerifyCodeResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
	Error   string `json:"error,omitempty"`
}

VerifyCodeResponse represents the response from verifying a code

Jump to

Keyboard shortcuts

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