officialaccount

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(cfg Config) (*Client, error)

func (*Client) AccessTokenProvider

func (c *Client) AccessTokenProvider() core.AccessTokenProvider

func (*Client) Config

func (c *Client) Config() Config

func (*Client) GetJssdkSign

func (c *Client) GetJssdkSign(ctx context.Context, req JssdkSignRequest) (JssdkSignResponse, error)

func (*Client) GetTicket

func (c *Client) GetTicket(ctx context.Context, req GetTicketRequest) (string, error)

func (*Client) RefreshTicket

func (c *Client) RefreshTicket(ctx context.Context, ticketType TicketType) (string, error)

type Config

type Config struct {
	AppID      string
	AppSecret  string
	Cache      core.Cache
	HTTPClient *http.Client
	Logger     *slog.Logger
	BaseURL    string
}

type GetTicketRequest

type GetTicketRequest struct {
	Type TicketType
}

type JssdkSignRequest

type JssdkSignRequest struct {
	URL string
}

type JssdkSignResponse

type JssdkSignResponse struct {
	AppID     string `json:"appId"`
	Timestamp int64  `json:"timestamp"`
	NonceStr  string `json:"nonceStr"`
	Signature string `json:"signature"`
}

type TicketType

type TicketType string
const (
	TicketTypeJSAPI  TicketType = "jsapi"
	TicketTypeWxCard TicketType = "wx_card"
)

type TypedRequest

type TypedRequest[T any] = core.TypedRequest[T]

func Request

func Request[T any](c *Client) *TypedRequest[T]

Jump to

Keyboard shortcuts

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