api

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	AccessToken string
}

func NewClient

func NewClient() *Client

func (*Client) CheckIn

func (c *Client) CheckIn() string

func (*Client) DownloadNodes

func (c *Client) DownloadNodes() error

func (*Client) GetUserInfo

func (c *Client) GetUserInfo() (UserProfile, error)

func (*Client) IsNodeExists added in v1.0.4

func (c *Client) IsNodeExists() (bool, error)

func (*Client) IsTokenValid added in v1.0.4

func (c *Client) IsTokenValid() bool

func (*Client) Login

func (c *Client) Login(username string, password string) (string, error)

func (*Client) Logout

func (c *Client) Logout() error

func (*Client) UpdateNodes added in v1.0.4

func (c *Client) UpdateNodes() error

type Config

type Config struct {
	AccessToken string `yaml:"accessToken"`
}

type ErrorResponse

type ErrorResponse struct {
	ErrorCode    int    `json:"error_code"`
	ErrorMessage string `json:"error_message"`
}

type LoginRequest

type LoginRequest struct {
	Username    string `json:"username"`
	Password    string `json:"password"`
	OS          string `json:"os"`
	DeviceName  string `json:"device_name"`
	DeviceModel string `json:"device_model"`
	FromType    int    `json:"from_type"`
}

type LoginResponse

type LoginResponse struct {
	AccessToken string      `json:"access_token"`
	Code        int         `json:"code"`
	ExpiredAt   int         `json:"expired_at"`
	ExpiresIn   int         `json:"expires_in"`
	Id          int         `json:"id"`
	Message     string      `json:"message"`
	Ret         int         `json:"ret"`
	Success     bool        `json:"success"`
	TokenType   string      `json:"token_type"`
	User        UserProfile `json:"user"`
	Username    string      `json:"username"`
}

type LogoutResponse

type LogoutResponse struct {
	Success bool   `json:"success"`
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type PostMetadata

type PostMetadata struct {
	OS          string `json:"os"`
	DeviceName  string `json:"device_name"`
	DeviceModel string `json:"device_model"`
	FromType    int    `json:"from_type"`
}

type UserProfile

type UserProfile struct {
	Id               int      `json:"id"`
	Nickname         string   `json:"nickname"`
	Account          string   `json:"account"`
	Port             int      `json:"port"`
	Passwd           string   `json:"passwd"`
	Uuid             string   `json:"uuid"`
	TransferEnable   int      `json:"transfer_enable"`
	U                int      `json:"u"`
	D                int      `json:"d"`
	T                int      `json:"t"`
	Enable           int      `json:"enable"`
	SpeedLimit       int      `json:"speed_limit"`
	Credit           int      `json:"credit"`
	Balance          int      `json:"balance"`
	ExpiredAt        string   `json:"expired_at"`
	BanTime          int      `json:"ban_time"`
	Level            int      `json:"level"`
	IsAdmin          int      `json:"is_admin"`
	Group            any      `json:"group"`
	LastLogin        int      `json:"last_login"`
	ResetTime        int      `json:"reset_time"`
	InviteNum        any      `json:"invite_num"`
	Status           int      `json:"status"`
	Sublink          string   `json:"sublink"`
	SubCode          string   `json:"sub_code"`
	Clashsub         string   `json:"clashsub"`
	ClashSublinkPath string   `json:"clash_sublink_path"`
	LabelList        []string `json:"label_list"`
	TopLabel         string   `json:"top_label"`
}

Jump to

Keyboard shortcuts

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