Documentation
¶
Index ¶
- Constants
- type BaseClient
- func (c *BaseClient) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error)
- func (c *BaseClient) Delete(ctx context.Context, qrCodeID string) (*SuccessResponse, error)
- func (c *BaseClient) Get(ctx context.Context, qrCodeID string) (*Information, error)
- func (c *BaseClient) List(ctx context.Context) (*ListResponse, error)
- func (c *BaseClient) Update(ctx context.Context, req *UpdateRequest) (*SuccessResponse, error)
- type BaseRequest
- type BaseSender
- type Client
- func (c *Client) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error)
- func (c *Client) Delete(ctx context.Context, qrCodeID string) (*SuccessResponse, error)
- func (c *Client) Get(ctx context.Context, qrCodeID string) (*Information, error)
- func (c *Client) List(ctx context.Context) (*ListResponse, error)
- func (c *Client) Update(ctx context.Context, req *UpdateRequest) (*SuccessResponse, error)
- type CreateRequest
- type CreateResponse
- type ImageFormat
- type Information
- type ListResponse
- type Response
- type Sender
- type SenderFunc
- type SenderMiddleware
- type Service
- type SuccessResponse
- type UpdateRequest
Constants ¶
View Source
const ( ErrCreateQRCode = whatsapp.Error("failed to create qr code") ErrGetQRCode = whatsapp.Error("failed to get qr code") ErrListQRCode = whatsapp.Error("failed to list qr codes") ErrDeleteQRCode = whatsapp.Error("failed to delete qr code") ErrUpdateQRCode = whatsapp.Error("failed to update qr code") )
View Source
const Endpoint = "message_qrdls"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseClient ¶
func NewBaseClient ¶
func NewBaseClient(s whttp.AnySender, reader config.Reader, middlewares ...SenderMiddleware) *BaseClient
func (*BaseClient) Create ¶
func (c *BaseClient) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error)
func (*BaseClient) Delete ¶
func (c *BaseClient) Delete(ctx context.Context, qrCodeID string) (*SuccessResponse, error)
func (*BaseClient) Get ¶
func (c *BaseClient) Get(ctx context.Context, qrCodeID string) (*Information, error)
func (*BaseClient) List ¶
func (c *BaseClient) List(ctx context.Context) (*ListResponse, error)
func (*BaseClient) Update ¶
func (c *BaseClient) Update(ctx context.Context, req *UpdateRequest) (*SuccessResponse, error)
type BaseRequest ¶
type BaseSender ¶
func (*BaseSender) Send ¶
func (sender *BaseSender) Send(ctx context.Context, conf *config.Config, req *BaseRequest) (*Response, error)
type Client ¶
func NewClient ¶
func NewClient(ctx context.Context, reader config.Reader, sender Sender, middlewares ...SenderMiddleware, ) (*Client, error)
NewClient ...
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error)
func (*Client) Update ¶
func (c *Client) Update(ctx context.Context, req *UpdateRequest) (*SuccessResponse, error)
type CreateRequest ¶
type CreateRequest struct { PrefilledMessage string `json:"prefilled_message"` ImageFormat ImageFormat `json:"generate_qr_image"` }
type CreateResponse ¶
type CreateResponse struct { Code string `json:"code"` PrefilledMessage string `json:"prefilled_message"` DeepLinkURL string `json:"deep_link_url"` QRImageURL string `json:"qr_image_url"` }
func Create ¶ added in v0.0.5
func Create(ctx context.Context, sender Sender, conf *config.Config, req *CreateRequest) (*CreateResponse, error)
type ImageFormat ¶
type ImageFormat string
const ( ImageFormatPNG ImageFormat = "PNG" ImageFormatSVG ImageFormat = "SVG" )
type Information ¶
type ListResponse ¶
type ListResponse struct {
Data []*Information `json:"data,omitempty"`
}
type Response ¶
type Response struct { Data []*Information `json:"data,omitempty"` Success bool `json:"success"` Code string `json:"code"` PrefilledMessage string `json:"prefilled_message"` DeepLinkURL string `json:"deep_link_url"` QRImageURL string `json:"qr_image_url"` }
func (*Response) CreateResponse ¶
func (response *Response) CreateResponse() *CreateResponse
func (*Response) ListResponse ¶
func (response *Response) ListResponse() *ListResponse
type SenderFunc ¶
func (SenderFunc) Send ¶
func (fn SenderFunc) Send(ctx context.Context, conf *config.Config, req *BaseRequest) (*Response, error)
type SenderMiddleware ¶
type SenderMiddleware func(senderFunc SenderFunc) SenderFunc
type Service ¶
type Service interface { Get(ctx context.Context, qrCodeID string) (*Information, error) List(ctx context.Context) (*ListResponse, error) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) Delete(ctx context.Context, qrCodeID string) (*SuccessResponse, error) Update(ctx context.Context, req *UpdateRequest) (*SuccessResponse, error) }
type SuccessResponse ¶
type SuccessResponse struct {
Success bool `json:"success"`
}
func Update ¶ added in v0.0.5
func Update(ctx context.Context, sender Sender, conf *config.Config, req *UpdateRequest) (*SuccessResponse, error)
type UpdateRequest ¶
type UpdateRequest struct { QRCodeID string `json:"-"` PrefilledMessage string `json:"prefilled_message,omitempty"` ImageFormat ImageFormat `json:"generate_qr_image,omitempty"` }
Click to show internal directories.
Click to hide internal directories.