Documentation
¶
Index ¶
- Constants
- type BlockAction
- type BlockBaseClient
- type BlockBaseRequest
- type BlockBaseRequestOption
- func WithBlockUsersBaseRequestListAfter(after string) BlockBaseRequestOption
- func WithBlockUsersBaseRequestListBefore(before string) BlockBaseRequestOption
- func WithBlockUsersBaseRequestListLimit(limit int) BlockBaseRequestOption
- func WithBlockUsersBaseRequestNumbers(numbers []string) BlockBaseRequestOption
- type BlockBaseResponse
- type BlockClient
- func (b *BlockClient) Block(ctx context.Context, numbers []string) (*BlockResponse, error)
- func (b *BlockClient) ListBlocked(ctx context.Context, request *ListBlockedUsersOptions) (*ListBlockedUsersResponse, error)
- func (b *BlockClient) Send(ctx context.Context, request *BlockBaseRequest) (*BlockBaseResponse, error)
- func (b *BlockClient) Unblock(ctx context.Context, numbers []string) (*BlockResponse, error)
- type BlockResponse
- type BlockResult
- type BlockService
- type BlockUserParams
- type BlockUsers
- type BlockedUser
- type BlockedUsersData
- type Identifier
- type ListBlockedUsersOptions
- type ListBlockedUsersResponse
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 (b *BlockClient) ListBlocked(ctx context.Context, request *ListBlockedUsersOptions) ( *ListBlockedUsersResponse, error, )
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 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 BlockedUsersData ¶
type BlockedUsersData struct {
BlockUsers []BlockResult `json:"block_users"`
}
type Identifier ¶
type Identifier struct {
User string `json:"user"`
}
type ListBlockedUsersOptions ¶
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"`
}
Click to show internal directories.
Click to hide internal directories.