api

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const BaseURL = "https://api.revenuecat.com/v2"

BaseURL is the RevenueCat API v2 base URL

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int    `json:"-"`
	Type       string `json:"type"`
	Message    string `json:"message"`
	Param      string `json:"param,omitempty"`
	DocURL     string `json:"doc_url,omitempty"`
}

APIError represents a structured error from the RevenueCat API

func (*APIError) Error

func (e *APIError) Error() string

type Client

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

Client wraps the RevenueCat API client

func NewClient

func NewClient(projectID string, timeout time.Duration) (*Client, error)

NewClient creates a new API client

func (*Client) Context

func (c *Client) Context() (context.Context, context.CancelFunc)

Context returns a context with timeout

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string) error

Delete performs a DELETE request

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, body interface{}, result interface{}) error

Do executes an API request

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, result interface{}) error

Get performs a GET request

func (*Client) GetProjectID

func (c *Client) GetProjectID() string

GetProjectID returns the project ID

func (*Client) ListAll

func (c *Client) ListAll(ctx context.Context, path string, limit int, collector func(json.RawMessage) error) error

ListAll fetches all pages and collects items

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, path string, body, result interface{}) error

Patch performs a PATCH request

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body, result interface{}) error

Post performs a POST request

type ListResponse

type ListResponse struct {
	Items      json.RawMessage `json:"items"`
	NextPage   string          `json:"next_page,omitempty"`
	URL        string          `json:"url,omitempty"`
	TotalCount int             `json:"total_count,omitempty"`
}

ListResponse represents a paginated list response

Jump to

Keyboard shortcuts

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