Documentation ¶
Index ¶
- Constants
- Variables
- func QmListString(ss []string) string
- func ResponseTo[T any](resp *http.Response) T
- type AdminRecord
- type Client
- func (c *Client) AdminAuth(username, password string) (*http.Response, error)
- func (c *Client) Auth(endpoint, username, password string) (*http.Response, error)
- func (c *Client) Health() (HealthResponse, error)
- func (c *Client) RecordCreate(name string, opts ...QueryOption) (*http.Response, error)
- func (c *Client) RecordDelete(name string, id string, opts ...QueryOption) (*http.Response, error)
- func (c *Client) RecordGet(name string, id string, opts ...QueryOption) (*http.Response, error)
- func (c *Client) RecordList(name string, opts ...QueryOption) (*http.Response, error)
- func (c *Client) RecordUpdate(name string, id string, opts ...QueryOption) (*http.Response, error)
- func (c *Client) Request(method, url string, opts ...QueryOption) (*http.Response, error)
- func (c *Client) UserAuth(username, password string) (*http.Response, error)
- type Headers
- type HealthResponse
- type Query
- type QueryOption
- func WithAuthorization(token string) QueryOption
- func WithData(data any) QueryOption
- func WithExpand(expand ...string) QueryOption
- func WithFields(fields ...string) QueryOption
- func WithFilters(filters string) QueryOption
- func WithHeaders(headers Headers) QueryOption
- func WithPage(page, perPage int, skipTotal bool) QueryOption
- func WithParams(params ...any) QueryOption
- func WithSort(sort ...string) QueryOption
- type RecordBase
- type Records
- type RequestAuth
- type RequestUserCreate
- type ResponseAdminAuth
- type ResponseAuth
- type ResponseError
- type UserRecord
Constants ¶
View Source
const ( EndpointHealth = "/api/health" EndpointAuthAdmin = "/api/admins/auth-with-password" EndpointAuthUser = "/api/collections/users/auth-with-password" EndpointRecords = "/api/collections/%s/records" EndpointRecordID = "/api/collections/%s/records/%s" )
View Source
const ( QTypeData = "data" QTypeExpand = "expand" QTypeFields = "fields" QTypeFilters = "filters" QTypeHeaders = "headers" QTypePage = "page" QTypeParams = "params" QTypeSort = "sort" )
Variables ¶
View Source
var ErrInvalidStatusCode = errors.New("invalid status code")
Functions ¶
func QmListString ¶
func ResponseTo ¶
Types ¶
type AdminRecord ¶ added in v0.0.2
type Client ¶
func (*Client) Health ¶ added in v0.0.2
func (c *Client) Health() (HealthResponse, error)
func (*Client) RecordCreate ¶
func (*Client) RecordDelete ¶
func (*Client) RecordList ¶
func (*Client) RecordUpdate ¶
type HealthResponse ¶ added in v0.0.2
type Query ¶
type Query struct { Headers map[string]string Params []any Data any DataBytes io.Reader Filters string Sort []string Fields []string Page int PerPage int SkipTotal bool Expand []string }
Query represents a query with various options
func NewQuery ¶
func NewQuery(opts ...QueryOption) *Query
NewQuery creates a new Query with the given options
type QueryOption ¶
type QueryOption func(*Query)
QueryOption is a function type for configuring Query
func WithAuthorization ¶ added in v0.0.2
func WithAuthorization(token string) QueryOption
WithAuthorization adds Authorization header to request
func WithExpand ¶
func WithExpand(expand ...string) QueryOption
WithExpand adds expand options to the query
func WithFilters ¶
func WithFilters(filters string) QueryOption
WithFilters adds filters to the query
func WithHeaders ¶
func WithHeaders(headers Headers) QueryOption
WithHeaders adds headers to the query
func WithPage ¶
func WithPage(page, perPage int, skipTotal bool) QueryOption
WithPage adds pagination to the query
func WithParams ¶
func WithParams(params ...any) QueryOption
WithParams adds parameters to the query
type RecordBase ¶
type RequestAuth ¶
type RequestUserCreate ¶ added in v0.0.2
type ResponseAdminAuth ¶ added in v0.0.2
type ResponseAdminAuth struct { Token string `json:"token"` Admin AdminRecord `json:"admin"` }
type ResponseAuth ¶
type ResponseAuth struct { Token string `json:"token"` Record UserRecord `json:"record"` }
type ResponseError ¶
type UserRecord ¶
type UserRecord struct { ID string `json:"id"` CollectionID string `json:"collectionId"` CollectionName string `json:"collectionName"` Created string `json:"created"` Updated string `json:"updated"` Username string `json:"username"` Name string `json:"name"` Email string `json:"email"` Verified bool `json:"verified"` EmailVisibility bool `json:"emailVisibility"` }
Click to show internal directories.
Click to hide internal directories.