user

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BlockEndpoint = "block_users"

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockAction

type BlockAction string
const (
	BlockActionBlock       BlockAction = "block"
	BlockActionUnblock     BlockAction = "unblock"
	BlockActionListBlocked BlockAction = "list"
)

type BlockBaseClient

type BlockBaseClient struct {
	Sender whttp.Sender[BlockBaseRequest]
}

BlockBaseClient is a base client meaning it can be used with changing configurations to send block requests. compared to the BlockClient which is used to send block requests with a fixed configuration.

func (*BlockBaseClient) Send

func (b *BlockBaseClient) Send(ctx context.Context, reader config.Reader, request *BlockBaseRequest) (
	*BlockBaseResponse, error,
)

type BlockBaseRequest

type BlockBaseRequest struct {
	MessagingProduct string                   `json:"messaging_product,omitempty"`
	BlockUsers       []Identifier             `json:"block_users,omitempty"`
	BlockAction      BlockAction              `json:"-"`
	ListOptions      *ListBlockedUsersOptions `json:"-"`
}

func NewBlockBaseRequest

func NewBlockBaseRequest(action BlockAction, options ...BlockBaseRequestOption) *BlockBaseRequest

type BlockBaseRequestOption

type BlockBaseRequestOption func(*BlockBaseRequest)

func WithBlockUsersBaseRequestListAfter

func WithBlockUsersBaseRequestListAfter(after string) BlockBaseRequestOption

func WithBlockUsersBaseRequestListBefore

func WithBlockUsersBaseRequestListBefore(before string) BlockBaseRequestOption

func WithBlockUsersBaseRequestListLimit

func WithBlockUsersBaseRequestListLimit(limit int) BlockBaseRequestOption

func WithBlockUsersBaseRequestNumbers

func WithBlockUsersBaseRequestNumbers(numbers []string) BlockBaseRequestOption

type BlockBaseResponse

type BlockBaseResponse struct {
	MessagingProduct string             `json:"messaging_product"`
	Data             []BlockedUsersData `json:"data"`
	BlockUsers       *BlockUsers        `json:"block_users"`
	Paging           *whttp.Paging      `json:"paging"`
	Error            *werrors.Error     `json:"error,omitempty"`
}

func (*BlockBaseResponse) BlockUsersResponse

func (base *BlockBaseResponse) BlockUsersResponse() *BlockResponse

func (*BlockBaseResponse) ListResponse

func (base *BlockBaseResponse) ListResponse() *ListBlockedUsersResponse

type BlockClient

type BlockClient struct {
	Config config.Reader
	Base   *BlockBaseClient
}

func NewBlockClient

func NewBlockClient(reader config.Reader, sender whttp.Sender[BlockBaseRequest]) *BlockClient

func (*BlockClient) Block

func (b *BlockClient) Block(ctx context.Context, numbers []string) (*BlockResponse, error)

func (*BlockClient) ListBlocked

func (*BlockClient) Send

func (b *BlockClient) Send(ctx context.Context, request *BlockBaseRequest) (
	*BlockBaseResponse, error,
)

func (*BlockClient) Unblock

func (b *BlockClient) Unblock(ctx context.Context, numbers []string) (*BlockResponse, error)

type BlockResponse

type BlockResponse struct {
	MessagingProduct string         `json:"messaging_product"`
	BlockUsers       *BlockUsers    `json:"block_users"`
	Error            *werrors.Error `json:"error,omitempty"`
}

type BlockResult

type BlockResult struct {
	Input  string          `json:"input"`
	WaID   string          `json:"wa_id"`
	Errors []werrors.Error `json:"errors,omitempty"`
}

type BlockService

type BlockService interface {
	Block(ctx context.Context, numbers []string) (*BlockResponse, error)
	Unblock(ctx context.Context, numbers []string) (*BlockResponse, error)
	ListBlocked(ctx context.Context, request *ListBlockedUsersOptions) (*ListBlockedUsersResponse, error)
}

type BlockUserParams

type BlockUserParams struct {
	Numbers []string
	Action  BlockAction
}

type BlockUsers

type BlockUsers struct {
	AddedUsers  []BlockResult `json:"added_users"`
	FailedUsers []BlockResult `json:"failed_users,omitempty"`
}

type BlockedUser

type BlockedUser struct {
	Input string `json:"input"`
	WaID  string `json:"wa_id"`
}

type BlockedUsersData

type BlockedUsersData struct {
	BlockUsers []BlockResult `json:"block_users"`
}

type Identifier

type Identifier struct {
	User string `json:"user"`
}

type ListBlockedUsersOptions

type ListBlockedUsersOptions struct {
	Limit  *int
	After  *string
	Before *string
}

type ListBlockedUsersResponse

type ListBlockedUsersResponse struct {
	MessagingProduct string             `json:"messaging_product"`
	BlockUsers       *BlockUsers        `json:"block_users"`
	Data             []BlockedUsersData `json:"data"`
	Paging           *whttp.Paging      `json:"paging"`
	Error            *werrors.Error     `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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