admin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PairingCode      = "code"
	PairingQR        = "qr"
	PairingConnected = "connected"
	PairingFailed    = "failed"
)

Variables

This section is empty.

Functions

func Handler

func Handler(deps Deps) http.Handler

Types

type AccessView

type AccessView struct {
	Name      string   `json:"name"`
	Kind      string   `json:"kind"`
	ReadOnly  bool     `json:"read_only"`
	Approval  string   `json:"approval"`
	Accounts  []string `json:"accounts"`
	CreatedAt string   `json:"created_at"`
}

type AccountStatus

type AccountStatus struct {
	AccountView
	Messages   int64 `json:"messages"`
	MediaBytes int64 `json:"media_bytes"`
}

type AccountView

type AccountView struct {
	Name        string `json:"name"`
	Phone       string `json:"phone"`
	ProfileName string `json:"profile_name"`
	Description string `json:"description"`
	State       string `json:"state"`

	RetentionMonths  int  `json:"retention_months"`
	RetentionDefault bool `json:"retention_default"`
}

type AddAccountRequest

type AddAccountRequest struct {
	Name        string `json:"name"`
	Phone       string `json:"phone"`
	Description string `json:"description"`
	QR          bool   `json:"qr"`
}

type Client

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

func Dial

func Dial(socketPath string) *Client

func (*Client) Access

func (c *Client) Access(ctx context.Context) ([]AccessView, error)

func (*Client) Account

func (c *Client) Account(ctx context.Context, name string) (AccountView, error)

func (*Client) Accounts

func (c *Client) Accounts(ctx context.Context) ([]AccountView, error)

func (*Client) AddAccount

func (c *Client) AddAccount(ctx context.Context, req AddAccountRequest, progress func(PairingEvent)) (AccountView, error)

func (*Client) CloseIdleConnections

func (c *Client) CloseIdleConnections()

func (*Client) CreateToken

func (c *Client) CreateToken(ctx context.Context, req CreateTokenRequest) (CreatedToken, error)

func (*Client) DescribeAccount

func (c *Client) DescribeAccount(ctx context.Context, name, description string) (AccountView, error)

func (*Client) Password

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

func (*Client) RemoveAccount

func (c *Client) RemoveAccount(ctx context.Context, name string) (RemovedAccount, error)

func (*Client) RevokeAccess

func (c *Client) RevokeAccess(ctx context.Context, name string) (AccessView, error)

func (*Client) SetAccess

func (c *Client) SetAccess(ctx context.Context, name string, req SetAccessRequest) (AccessView, error)

func (*Client) SetRetention

func (c *Client) SetRetention(ctx context.Context, name string, months int) (AccountView, error)

func (*Client) Status

func (c *Client) Status(ctx context.Context) (StatusView, error)

type CreateTokenRequest

type CreateTokenRequest struct {
	Name                string   `json:"name"`
	Accounts            []string `json:"accounts"`
	AllExistingAccounts bool     `json:"all_existing_accounts"`
	ReadOnly            bool     `json:"read_only"`
	Approval            string   `json:"approval,omitempty"`
}

type CreatedToken

type CreatedToken struct {
	Access AccessView `json:"access"`
	Token  string     `json:"token"`
}

type Deps

type Deps struct {
	Store                  *store.Store
	Accounts               *accounts.Manager
	Clock                  clock.Clock
	Grants                 GrantEvents
	Audit                  *audit.Logger
	OwnerPassword          string
	Media                  DiskUsage
	Retention              RetentionPasses
	DefaultRetentionMonths int
}

type DescribeAccountRequest

type DescribeAccountRequest struct {
	Description string `json:"description"`
}

type DiskUsage

type DiskUsage interface {
	AccountBytes(accountID int64) (int64, error)
}

type Error

type Error struct {
	Status  int
	Message string
}

func (*Error) Error

func (e *Error) Error() string

type GrantEvents

type GrantEvents interface {
	GrantChanged(ctx context.Context, grantID int64)
	GrantRevoked(grantID int64)
}

type PairingEvent

type PairingEvent struct {
	Event   string       `json:"event"`
	Code    string       `json:"code,omitempty"`
	QR      string       `json:"qr,omitempty"`
	Account *AccountView `json:"account,omitempty"`
	Error   string       `json:"error,omitempty"`
}

type RemovedAccount

type RemovedAccount struct {
	Account AccountView `json:"account"`
	Warning string      `json:"warning,omitempty"`
}

type RetentionPasses

type RetentionPasses interface {
	LastPass() retention.Pass
}

type RetentionView

type RetentionView struct {
	Running         bool   `json:"running"`
	StartedAt       string `json:"started_at,omitempty"`
	FinishedAt      string `json:"finished_at,omitempty"`
	DeletedMessages int    `json:"deleted_messages"`
	DeletedFiles    int    `json:"deleted_files"`
}

type SetAccessRequest

type SetAccessRequest struct {
	Accounts            []string `json:"accounts"`
	AllExistingAccounts bool     `json:"all_existing_accounts"`
	Approval            string   `json:"approval,omitempty"`
}

type SetRetentionRequest

type SetRetentionRequest struct {
	Months int `json:"months"`
}

type StatusView

type StatusView struct {
	Accounts  []AccountStatus `json:"accounts"`
	Retention RetentionView   `json:"retention"`
}

Jump to

Keyboard shortcuts

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