Versions in this module Expand all Collapse all v0 v0.0.1 Dec 27, 2024 Changes in this version + var ErrInvalidResponse = errors.New("invalid response") + func EnvIsTruthy(key string) bool + type AuthMethod struct + AuthProviders []AuthProvider + EmailPassword bool + OnlyVerified bool + UsernamePassword bool + type AuthMethodsResponse struct + AuthProviders []providerInfo + EmailPassword bool + MFA mfaResponse + OAuth2 oauth2Response + OTP otpResponse + Password passwordResponse + UsernamePassword bool + type AuthProvider struct + AuthURL string + CodeChallenge string + CodeChallengeMethod string + CodeVerifier string + DisplayName string + Name string + State string + type AuthRefreshResponse struct + Record struct{ ... } + Token string + type AuthWithOauth2Response struct + Token string + type AuthWithPasswordResponse struct + Record Record + Token string + type Backup struct + func (b Backup) Create(key ...string) error + func (b Backup) Delete(key string) error + func (b Backup) FullList() ([]ResponseBackupFullList, error) + func (b Backup) GetDownloadURL(token string, key string) (string, error) + func (b Backup) Restore(key string) error + func (b Backup) Upload(key string, reader io.Reader) error + type Client struct + func NewClient(url string, opts ...ClientOption) *Client + func (c *Client) AuthStore() authStore + func (c *Client) Authorize() error + func (c *Client) Backup() Backup + func (c *Client) Create(collection string, body any) (ResponseCreate, error) + func (c *Client) Delete(collection string, id string) error + func (c *Client) Files() Files + func (c *Client) FullList(collection string, params ParamsList) (ResponseList[map[string]any], error) + func (c *Client) Get(path string, result any, onRequest func(*resty.Request), ...) error + func (c *Client) List(collection string, params ParamsList) (ResponseList[map[string]any], error) + func (c *Client) One(collection string, id string) (map[string]any, error) + func (c *Client) OneTo(collection string, id string, result any) error + func (c *Client) Update(collection string, id string, body any) error + type ClientOption func(*Client) + func WithAdminEmailPassword(email, password string) ClientOption + func WithAdminEmailPassword22(email, password string) ClientOption + func WithAdminToken(token string) ClientOption + func WithAdminToken22(token string) ClientOption + func WithRestDebug() ClientOption + func WithSseDebug() ClientOption + func WithUserEmailPassword(email, password string) ClientOption + func WithUserEmailPasswordAndCollection(email, password, collection string) ClientOption + func WithUserToken(token string) ClientOption + type Collection struct + BaseCollectionPath string + Name string + func CollectionSet[T any](client *Client, collection string) *Collection[T] + func (c *Collection[T]) AuthRefresh() (AuthRefreshResponse, error) + func (c *Collection[T]) AuthWithOAuth2Code(provider string, code string, codeVerifier string, redirectURL string) (AuthWithOauth2Response, error) + func (c *Collection[T]) AuthWithPassword(username string, password string) (AuthWithPasswordResponse, error) + func (c *Collection[T]) ConfirmEmailChange(emailChangeToken string, password string) error + func (c *Collection[T]) ConfirmPasswordReset(passwordResetToken string, password string, passwordConfirm string) error + func (c *Collection[T]) ConfirmVerification(verificationToken string) error + func (c *Collection[T]) Create(body T) (ResponseCreate, error) + func (c *Collection[T]) Delete(id string) error + func (c *Collection[T]) FullList(params ParamsList) (ResponseList[T], error) + func (c *Collection[T]) List(params ParamsList) (ResponseList[T], error) + func (c *Collection[T]) ListAuthMethods() (AuthMethodsResponse, error) + func (c *Collection[T]) ListAuthMethods22() (AuthMethod, error) + func (c *Collection[T]) ListExternalAuths22(recordID string) ([]ExternalAuthRequest, error) + func (c *Collection[T]) One(id string) (T, error) + func (c *Collection[T]) OneWithParams(id string, params ParamsList) (T, error) + func (c *Collection[T]) RequestEmailChange(newEmail string) error + func (c *Collection[T]) RequestPasswordReset(email string) error + func (c *Collection[T]) RequestVerification(email string) error + func (c *Collection[T]) Subscribe(targets ...string) (*Stream[T], error) + func (c *Collection[T]) SubscribeWith(opts SubscribeOptions, targets ...string) (*Stream[T], error) + func (c *Collection[T]) UnlinkExternalAuth22(recordID string, provider string) error + func (c *Collection[T]) Update(id string, body T) error + type CreateRequest struct + Name string + type Event struct + Action string + Error error + Record T + type ExternalAuthRequest struct + CollectionID string + Created string + ID string + Provider string + ProviderID string + RecordID string + Updated string + type Files struct + func (f Files) GetToken() (string, error) + type ParamsList struct + Expand string + Fields string + Filters string + Page int + Size int + Sort string + type Record struct + Avatar string + CollectionID string + CollectionName string + Created string + Email string + EmailVisibility bool + ID string + Name string + Updated string + Username string + Verified bool + type ResponseBackupFullList struct + Key string + Modified string + Size int + type ResponseCreate struct + Created string + Field string + ID string + Updated string + type ResponseGetToken struct + Token string + type ResponseList struct + Items []T + Page int + PerPage int + TotalItems int + TotalPages int + type Stream struct + func (s *Stream[T]) Events() <-chan Event[T] + func (s *Stream[T]) Ready() <-chan struct{} + func (s *Stream[T]) Unsubscribe() + func (s *Stream[T]) WaitAuthReady() error + type SubscribeOptions struct + ReconnectStrategy backoff.BackOff + type SubscriptionsSet struct + ClientID string + Subscriptions []string