kwork

package
v0.0.0-...-0d13a33 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	Success  bool                   `json:"success"`
	Error    string                 `json:"error,omitempty"`
	Response map[string]interface{} `json:"response,omitempty"`
}

APIResponse общий формат ответа API

type Bot

type Bot struct {
	*Client
	// contains filtered or unexported fields
}

Bot представляет бота Kwork

func NewBot

func NewBot(cfg Config) (*Bot, error)

NewBot создает нового бота

func (*Bot) MessageHandler

func (b *Bot) MessageHandler(text string, onStart bool, textContains string, handler HandlerFunc)

MessageHandler регистрирует обработчик сообщений

func (*Bot) Run

func (b *Bot) Run(ctx context.Context) error

Run запускает бота

type Client

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

Client представляет клиент Kwork API

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient создает новый клиент Kwork

func (*Client) Close

func (c *Client) Close()

Close закрывает клиент

func (*Client) DeleteMessage

func (c *Client) DeleteMessage(ctx context.Context, messageID int) error

DeleteMessage удаляет сообщение

func (*Client) GetAllDialogs

func (c *Client) GetAllDialogs(ctx context.Context) ([]types.Dialog, error)

GetAllDialogs получает все диалоги

func (*Client) GetCategories

func (c *Client) GetCategories(ctx context.Context) ([]types.Category, error)

GetCategories получает категории

func (*Client) GetConnects

func (c *Client) GetConnects(ctx context.Context) (*types.Connects, error)

GetConnects получает информацию о коннектах

func (*Client) GetDialogWithUser

func (c *Client) GetDialogWithUser(ctx context.Context, username string) ([]types.InboxMessage, error)

GetDialogWithUser получает диалог с пользователем по имени

func (*Client) GetMe

func (c *Client) GetMe(ctx context.Context) (*types.Actor, error)

GetMe получает профиль текущего пользователя

func (*Client) GetNotifications

func (c *Client) GetNotifications(ctx context.Context) (map[string]interface{}, error)

GetNotifications получает уведомления

func (*Client) GetPayerOrders

func (c *Client) GetPayerOrders(ctx context.Context) (map[string]interface{}, error)

GetPayerOrders получает заказы заказчика

func (*Client) GetProjects

func (c *Client) GetProjects(ctx context.Context, params ProjectsParams) ([]types.Project, error)

GetProjects получает проекты с биржи

func (*Client) GetToken

func (c *Client) GetToken(ctx context.Context) (string, error)

GetToken получает токен авторизации

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, userID int) (*types.User, error)

GetUser получает профиль пользователя по ID

func (*Client) GetWorkerOrders

func (c *Client) GetWorkerOrders(ctx context.Context) (map[string]interface{}, error)

GetWorkerOrders получает заказы работника

func (*Client) MessageListener

func (c *Client) MessageListener(ctx context.Context, messageChan chan<- *types.Message) error

MessageListener слушает сообщения через WebSocket

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, userID int, text string) error

SendMessage отправляет сообщение пользователю

func (*Client) SetOffline

func (c *Client) SetOffline(ctx context.Context) error

SetOffline устанавливает статус оффлайн

func (*Client) SetTyping

func (c *Client) SetTyping(ctx context.Context, recipientID int) error

SetTyping устанавливает статус "печатает" для получателя

type Config

type Config struct {
	Login     string
	Password  string
	PhoneLast string
	ProxyURL  string
}

Config конфигурация клиента

type Handler

type Handler struct {
	Func         HandlerFunc
	Text         string
	OnStart      bool
	TextContains string
}

Handler представляет обработчик сообщения

type HandlerFunc

type HandlerFunc func(ctx context.Context, msg *types.Message) error

HandlerFunc функция-обработчик сообщения

type ProjectsParams

type ProjectsParams struct {
	CategoriesIDs    []int
	PriceFrom        int
	PriceTo          int
	HiringFrom       int
	KworksFilterFrom int
	KworksFilterTo   int
	Page             int
	Query            string
}

ProjectsParams параметры для получения проектов

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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