api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidJSON                   = "invalid_json"
	ErrInvalidRequestURL             = "invalid_request_url"
	ErrInvalidRequest                = "invalid_request"
	ErrValidationError               = "validation_error"
	ErrMissingVersion                = "missing_version"
	ErrUnauthorized                  = "unauthorized"
	ErrRestrictedResource            = "restricted_resource"
	ErrObjectNotFound                = "object_not_found"
	ErrConflictError                 = "conflict_error"
	ErrRateLimited                   = "rate_limited"
	ErrInternalServerError           = "internal_server_error"
	ErrServiceUnavailable            = "service_unavailable"
	ErrDatabaseConnectionUnavailable = "database_connection_unavailable"
	ErrGatewayTimeout                = "gateway_timeout"
)

Notion API error codes.

Variables

This section is empty.

Functions

func IsRetryable

func IsRetryable(err error) bool

IsRetryable reports whether the error represents a retryable condition.

func ParseError

func ParseError(resp *resty.Response) error

ParseError extracts an APIError from a resty response. Returns nil if the response indicates success (2xx).

Types

type Client

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

Client wraps resty for Notion API calls with rate limiting and retry.

func NewClient

func NewClient(token string) *Client

NewClient creates a configured Notion API client.

func (*Client) Delete

func (c *Client) Delete(path string) (*resty.Response, error)

Delete performs a DELETE request.

func (*Client) Get

func (c *Client) Get(path string) (*resty.Response, error)

Get performs a GET request to the given path.

func (*Client) Patch

func (c *Client) Patch(path string, body interface{}) (*resty.Response, error)

Patch performs a PATCH request with a JSON body.

func (*Client) Post

func (c *Client) Post(path string, body interface{}) (*resty.Response, error)

Post performs a POST request with a JSON body.

type PageIterator

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

PageIterator provides cursor-based pagination over Notion list endpoints.

func NewPageIterator

func NewPageIterator(client *Client, path string, body map[string]interface{}) *PageIterator

NewPageIterator creates an iterator for a POST-based paginated endpoint. body can be nil for endpoints with no request body.

func (*PageIterator) HasMore

func (p *PageIterator) HasMore() bool

HasMore reports whether more pages remain.

func (*PageIterator) Next

func (p *PageIterator) Next() ([]byte, error)

Next fetches the next page of results as raw JSON bytes. Returns nil, nil when no more pages.

Jump to

Keyboard shortcuts

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