xbot

package
v0.0.0-...-37ba3fc Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	APIOrigin string // injection to be testable
	Token     string
	Client    Client // injection to be observable // TODO move all logging into client middleware?
}

func (*Bot) API

func (b *Bot) API(ctx context.Context, request *Request) ([]byte, error)

func (*Bot) Download

func (b *Bot) Download(ctx context.Context, path string, stream io.Writer) error

type Client

type Client interface {
	Do(r *http.Request) (*http.Response, error)
}

type Request

type Request struct {
	Method      string
	ContentType string
	Body        []byte
}

func RequestFromBinary

func RequestFromBinary(data []byte, userID int64) (*Request, error)

func RequestStruct

func RequestStruct(method string, x any) (*Request, error)

Jump to

Keyboard shortcuts

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