Versions in this module Expand all Collapse all v0 v0.3.0 Sep 28, 2026 Changes in this version + func SameOrigin(a, b *url.URL) bool type BulkFailure + Code apierr.Code type Client + func (c *Client) SiteGet(ctx context.Context, sr SiteRequest) (*SiteResult, error) type Request + NoRedirect bool + Secrets []string + URL string + type SiteRequest struct + Secrets []string + URL string + type SiteResult struct + BodyExcerpt string + Cookies []*http.Cookie + CrossOrigin bool + HTTP *Response + Location string + Status int v0.2.0 Sep 23, 2026 v0.1.0 Sep 17, 2026 Changes in this version + const AuthCollectionAuto + const AuthModeAPIKey + const AuthModeAnonymous + const AuthModeJWT + const BulkChunk + const DefaultAcceptLang + const DefaultConcurrency + const DefaultMaxAttempts + const DefaultMaxBodyBytes + const DefaultMaxBulk + const DefaultMaxRetries + const DefaultMaxUploadSize + const DefaultTimeout + const DefaultUploadTimeout + const FormURLEncoded + const GlobalsPrefix + const HeaderAcceptLanguage + const HeaderAuthorization + const HeaderMethodOverride + const HeaderPoweredBy + const HeaderRequestID + const HeaderRetryAfter + const MaxConcurrency + const RetryAfterCap + const RetryBase + const RetryCap + const SchemeBearer + const SchemeJWT + const StaleEndpoints + const StaleQueryPath + const StaleRouteMissing + const URLBudget + const UploadPartFields + const UploadPartFile + func AssertIdentity(id *Identity) error + func CheckUploadCollection(collection string, isUpload *bool) error + func FilenameChanged(sent string, doc Doc) (string, bool) + func GlobalPath(slug string) string + func GraphQLErrorMessages(errs []GraphQLError) []string + func IntrospectionBlocked(in GraphQLRequest, res *GraphQLResult) bool + func IsReadOnlyGraphQL(doc string) bool + func LimitReader(r io.Reader, max int64) io.Reader + func NormalizePath(p string) string + func ParseRetryAfter(v string, now time.Time) (time.Duration, bool) + func Permission(entry any, permission string) (permitted bool, known bool) + func ReactiveRequested(ctx context.Context) bool + func SentPaths(data map[string]any) map[string]bool + func WithReactiveInvalidation(ctx context.Context) context.Context + type AccessResult struct + CanAccessAdmin bool + Collections map[string]any + Globals map[string]any + HTTP *Response + Raw []byte + func (a *AccessResult) Can(collection, permission string) (bool, bool) + func (a *AccessResult) CanGlobal(slug, permission string) (bool, bool) + func (a *AccessResult) GlobalSlugs() []string + func (a *AccessResult) Slugs() []string + type Budget struct + func NewBudget(n int) *Budget + func (b *Budget) Remaining() int64 + func (b *Budget) Take() bool + type BulkFailure struct + ID any + Message string + type BulkPlan struct + Count int + IDs []any + type BulkResult struct + Chunks int + Docs []Doc + Errors []BulkFailure + FailedChunk int + HTTP *Response + Message string + Raw []byte + func (b *BulkResult) IDs() []any + type ClassifyContext struct + Collection string + IncludeRaw bool + NoRedact bool + SentPaths map[string]bool + UploadCollection bool + type Client struct + func New(cfg Config) (*Client, error) + func (c *Client) APIPath() string + func (c *Client) Access(ctx context.Context, opts ...Option) (*AccessResult, error) + func (c *Client) AdoptAPIPath(apiPath, graphQLPath string) + func (c *Client) AnonymousAccess(ctx context.Context, opts ...Option) (*AccessResult, error) + func (c *Client) AuthCollection() string + func (c *Client) AuthMode() string + func (c *Client) BaseURL() string + func (c *Client) Budget() *Budget + func (c *Client) Concurrency() int + func (c *Client) Config() Config + func (c *Client) Count(ctx context.Context, collection string, p query.Params, opts ...Option) (int, *Response, error) + func (c *Client) Create(ctx context.Context, collection string, data map[string]any, p query.Params, ...) (*WriteResult, error) + func (c *Client) Delete(ctx context.Context, collection, id string, p query.Params, opts ...Option) (*WriteResult, error) + func (c *Client) DeleteByIDs(ctx context.Context, collection string, ids []any, p query.Params, ...) (*BulkResult, error) + func (c *Client) DeleteWhereUnsafe(ctx context.Context, collection string, where query.Where, p query.Params, ...) (*BulkResult, error) + func (c *Client) Do(ctx context.Context, req *Request) (*Response, error) + func (c *Client) DocAccess(ctx context.Context, collection, id string, opts ...Option) (Doc, error) + func (c *Client) Download(ctx context.Context, collection, filename string, w io.Writer, opts ...Option) (*Response, error) + func (c *Client) Duplicate(ctx context.Context, collection, id string, p query.Params, opts ...Option) (*WriteResult, error) + func (c *Client) ErrorFor(req *Request, resp *Response) *apierr.Error + func (c *Client) Find(ctx context.Context, collection string, p query.Params, opts ...Option) (*ListResult, error) + func (c *Client) FindPages(ctx context.Context, collection string, p query.Params, max int, ...) error + func (c *Client) Get(ctx context.Context, collection, id string, p query.Params, opts ...Option) (Doc, *Response, error) + func (c *Client) GlobalGet(ctx context.Context, slug string, p query.Params, opts ...Option) (Doc, *Response, error) + func (c *Client) GlobalUpdate(ctx context.Context, slug string, data map[string]any, p query.Params, ...) (*WriteResult, error) + func (c *Client) GraphQL(ctx context.Context, in GraphQLRequest, opts ...Option) (*GraphQLResult, error) + func (c *Client) GraphQLPath() string + func (c *Client) Init(ctx context.Context, slug string, opts ...Option) (*InitResult, error) + func (c *Client) LastRequestID() string + func (c *Client) Login(ctx context.Context, in LoginInput, opts ...Option) (*LoginResult, error) + func (c *Client) Logout(ctx context.Context, collection string, opts ...Option) error + func (c *Client) Me(ctx context.Context, collection string, opts ...Option) (*Identity, error) + func (c *Client) PlanBulk(ctx context.Context, collection string, where query.Where, maxDocs int, ...) (*BulkPlan, error) + func (c *Client) ProbeIdentity(ctx context.Context, candidate string, opts ...Option) (*Identity, error) + func (c *Client) RefreshToken(ctx context.Context, collection string, opts ...Option) (*LoginResult, error) + func (c *Client) ResolveIDs(ctx context.Context, collection string, where query.Where, count int, ...) ([]any, error) + func (c *Client) ResolveIDsScoped(ctx context.Context, collection string, p query.Params, count int, ...) ([]any, error) + func (c *Client) Restore(ctx context.Context, collection, id string, p query.Params, opts ...Option) (*WriteResult, error) + func (c *Client) Stats() Stats + func (c *Client) Trash(ctx context.Context, collection, id, deletedAt string, p query.Params, ...) (*WriteResult, error) + func (c *Client) URLFor(req *Request) string + func (c *Client) Update(ctx context.Context, collection, id string, data map[string]any, ...) (*WriteResult, error) + func (c *Client) UpdateByIDs(ctx context.Context, collection string, ids []any, data map[string]any, ...) (*BulkResult, error) + func (c *Client) Upload(ctx context.Context, in UploadInput, opts ...Option) (*WriteResult, error) + func (c *Client) VersionGet(ctx context.Context, target VersionTarget, versionID string, p query.Params, ...) (Doc, *Response, error) + func (c *Client) VersionRestore(ctx context.Context, target VersionTarget, versionID string, p query.Params, ...) (*WriteResult, error) + func (c *Client) VersionsList(ctx context.Context, target VersionTarget, p query.Params, opts ...Option) (*ListResult, bool, error) + func (c *Client) WithAuthCollection(collection string) *Client + func (c *Client) WithCredential(mode, collection, credential string) *Client + type Config struct + APIPath string + AcceptLanguage string + AuthCollection string + AuthMode string + AuthScheme string + BaseURL string + Budget *Budget + Concurrency int + Credential string + GraphQLPath string + Headers map[string]string + IdentityVerified bool + InsecureSkipVerify bool + Invalidator Invalidator + Logger *slog.Logger + MaxBodyBytes int64 + MaxRetries int + Now func() time.Time + Rand func() float64 + RequestID func() string + RoundTripper http.RoundTripper + Sleep func(ctx context.Context, d time.Duration) error + Timeout time.Duration + UploadTimeout time.Duration + UserAgent string + type Doc map[string]any + func (d Doc) ID() any + func (d Doc) IDString() string + type GraphQLError struct + Extensions map[string]any + Locations []any + Message string + Path []any + type GraphQLRequest struct + OperationName string + Query string + Variables map[string]any + type GraphQLResult struct + Data json.RawMessage + Errors []GraphQLError + HTTP *Response + Raw []byte + func (g *GraphQLResult) AsError() error + func (g *GraphQLResult) Partial() bool + type Identity struct + CanAccessAdmin bool + Collection string + Exp int64 + HTTP *Response + Raw []byte + Strategy string + Token string + User Doc + UserID any + Verified bool + type InitResult struct + HTTP *Response + Initialized bool + IsAuthCollection bool + type Invalidator interface + Invalidate func(ctx context.Context, sig StaleSignal) (Outcome, error) + type ListResult struct + Docs []Doc + HTTP *Response + Raw []byte + func (l *ListResult) IDs() []any + type LoginInput struct + Collection string + Email string + Password string + Username string + type LoginResult struct + Exp int64 + HTTP *Response + Message string + Token string + User Doc + func (l *LoginResult) Expired(now time.Time, skew time.Duration) bool + func (l *LoginResult) ExpiresAt() time.Time + type Multipart struct + Boundary string + Write func(w io.Writer, boundary string) error + type Option func(*Request) + func WithAuthCollection(slug string) Option + func WithClassify(ctx ClassifyContext) Option + func WithHeader(name, value string) Option + func WithKnownRoute() Option + func WithTimeout(d time.Duration) Option + func WithoutAuth() Option + type Outcome struct + Fields []string + Revalidated bool + type Page struct + HasNextPage bool + HasPrevPage bool + Limit int + NextPage *int + Page int + PagingCounter int + PrevPage *int + TotalDocs int + TotalPages int + type Request struct + Absolute bool + Accept string + AuthCollectionOverride string + Body []byte + Classify ClassifyContext + ContentType string + Header http.Header + KnownRoute bool + Method string + Multipart *Multipart + NoAuth bool + NoOverride bool + Path string + Query string + ReadOnly bool + Sink io.Writer + Timeout time.Duration + type Response struct + Attempts int + Body []byte + Bytes int64 + ContentType string + Duration time.Duration + Header http.Header + Method string + Promoted bool + RequestID string + Retries int + Status int + URL string + func (r *Response) OK() bool + type RetryPolicy struct + Base time.Duration + Cap time.Duration + MaxAttempts int + Rand func() float64 + RetryAfterCap time.Duration + type StaleSignal struct + Idempotent bool + Kind string + Method string + Paths []string + Route string + func DetectStale(resp *Response, knownRoute bool) *StaleSignal + type Stats struct + Bytes int64 + Requests int64 + Retries int64 + type UploadInput struct + Body io.Reader + Collection string + ContentType string + Fields map[string]any + Filename string + Params query.Params + ReplaceID string + type VersionTarget struct + Collection string + Global string + func CollectionTarget(slug string) VersionTarget + func GlobalTarget(slug string) VersionTarget + func (t VersionTarget) IsGlobal() bool + func (t VersionTarget) Slug() string + type WriteResult struct + Doc Doc + HTTP *Response + Message string + Raw []byte