Documentation
¶
Index ¶
- func IsSessionExpired(err error) bool
- type APIError
- type Client
- func (c *Client) BaseURL() string
- func (c *Client) BotID() string
- func (c *Client) DoGet(ctx context.Context, rawURL string, result any) error
- func (c *Client) Doer() HTTPDoer
- func (c *Client) GetConfig(ctx context.Context, userID, contextToken string) (*types.GetConfigResponse, error)
- func (c *Client) GetUpdates(ctx context.Context, buf string) (*types.GetUpdatesResponse, error)
- func (c *Client) GetUploadURL(ctx context.Context, req *types.GetUploadURLRequest) (*types.GetUploadURLResponse, error)
- func (c *Client) SendMessage(ctx context.Context, req *types.SendMessageRequest) (*types.SendMessageResponse, error)
- func (c *Client) SendTyping(ctx context.Context, userID, ticket string, status int) error
- type ClientOption
- type HTTPDoer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSessionExpired ¶
IsSessionExpired returns true if the error indicates a session expiration (errcode -14).
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the low-level iLink HTTP API client.
func NewClient ¶
func NewClient(creds *types.Credentials, opts ...ClientOption) *Client
NewClient creates an authenticated client from credentials.
func NewUnauthenticatedClient ¶
func NewUnauthenticatedClient(opts ...ClientOption) *Client
NewUnauthenticatedClient creates a client for the login flow (no auth token).
func (*Client) GetConfig ¶
func (c *Client) GetConfig(ctx context.Context, userID, contextToken string) (*types.GetConfigResponse, error)
GetConfig fetches bot config (typing_ticket) for a user.
func (*Client) GetUpdates ¶
GetUpdates long-polls for new messages.
func (*Client) GetUploadURL ¶
func (c *Client) GetUploadURL(ctx context.Context, req *types.GetUploadURLRequest) (*types.GetUploadURLResponse, error)
GetUploadURL gets a signed upload URL from the iLink API.
func (*Client) SendMessage ¶
func (c *Client) SendMessage(ctx context.Context, req *types.SendMessageRequest) (*types.SendMessageResponse, error)
SendMessage sends a message to a user.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption configures the Client.
func WithBaseURL ¶
func WithBaseURL(url string) ClientOption
WithBaseURL sets a custom base URL for the iLink API.
func WithHTTPDoer ¶
func WithHTTPDoer(doer HTTPDoer) ClientOption
WithHTTPDoer sets a custom HTTP client (for testing or custom transport).
Click to show internal directories.
Click to hide internal directories.