tests

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiscordAPIDefaultVersion = 10
	DiscordAPIDefaultLimit   = 1

	StatusOK = 200
)
View Source
const (
	VKAPIDefaultVersion    = 5.199
	VKAPICommunityRPSLimit = 19
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscordAPI

type DiscordAPI struct {
	Client  *botsgo.Client
	Version int
	Token   string
	// contains filtered or unexported fields
}

func NewDiscordAPI

func NewDiscordAPI(token string) (*DiscordAPI, error)

func (*DiscordAPI) Call

func (api *DiscordAPI) Call(method, path string, response any) error

func (*DiscordAPI) GetMessage

func (api *DiscordAPI) GetMessage(channelID int, messageID int) (DiscordAPIMessage, error)

type DiscordAPIMessage

type DiscordAPIMessage struct {
	Code      int    `json:"code,omitempty"`
	Message   string `json:"message,omitempty"`
	ID        string `json:"ID,omitempty"`
	ChannelID string `json:"channel_id,omitempty"`
}

type ErrorParam

type ErrorParam struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

type VKAPI

type VKAPI struct {
	Client  *botsgo.Client
	Version float64
	Token   string
	Limit   int
	// contains filtered or unexported fields
}

func NewVKAPI

func NewVKAPI(token string) (*VKAPI, error)

func (*VKAPI) Call

func (api *VKAPI) Call(queryParams string, response any) error

func (*VKAPI) GetUser

func (api *VKAPI) GetUser(userID int) ([]VKAPIUser, *VKAPIError)

type VKAPIError

type VKAPIError struct {
	Code    int          `json:"error_code,omitempty"`
	Message string       `json:"error_msg,omitempty"`
	Params  []ErrorParam `json:"request_params,omitempty"`
}

type VKAPIUser

type VKAPIUser struct {
	ID      int    `json:"id,omitempty"`
	Name    string `json:"first_name,omitempty"`
	Surname string `json:"last_name,omitempty"`
}

type VKAPIUsers

type VKAPIUsers struct {
	Error *VKAPIError `json:"error,omitempty"`
	Users []VKAPIUser `json:"response,omitempty"`
}

Jump to

Keyboard shortcuts

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