api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int    `json:"-"`
	Message    string `json:"message"`
	Code       int    `json:"code,omitempty"`
	Type       string `json:"type,omitempty"`
	Version    string `json:"version,omitempty"`
}

APIError represents a structured error from the Appwrite API

func (*APIError) Error

func (e *APIError) Error() string

type Client

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

Client wraps the Appwrite 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) GetEndpoint

func (c *Client) GetEndpoint() string

GetEndpoint returns the API endpoint

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, itemsKey string, collector func(json.RawMessage) error) error

ListAll fetches all pages using offset-based pagination

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

func (*Client) Put

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

Put performs a PUT request

type ListResponse

type ListResponse struct {
	Total int             `json:"total"`
	Items json.RawMessage `json:"-"`
}

ListResponse represents a paginated list response from Appwrite

Jump to

Keyboard shortcuts

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