Documentation
¶
Index ¶
Constants ¶
View Source
const (
UserPath = "user"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListProvider ¶
type ListProvider[Q QueryRequest, L any] interface { // List fetches the configured collection path with the encoded query request and decodes the response as L. List(query Q, opts ...js.FetchOption) *Promise[L] }
ListProvider fetches collection resources using a typed query request.
func NewListProvider ¶
func NewListProvider[Q QueryRequest, L any](base *url.URL, path string) ListProvider[Q, L]
NewListProvider creates a new list provider with query type Q, list response type L, and a collection path.
type Promise ¶
type Promise[T any] struct { // contains filtered or unexported fields }
Promise represents a typed asynchronous result.
type Provider ¶
type Provider[K any, M any, R any] interface { // Get fetches key and decodes the response as R. Get(key K, opts ...js.FetchOption) *Promise[R] // Post marshals body as JSON, posts to the configured resource path, and decodes the response as R. Post(body M, opts ...js.FetchOption) *Promise[R] // Patch marshals body as JSON, patches key, and decodes the response as R. Patch(key K, body M, opts ...js.FetchOption) *Promise[R] // Delete sends a DELETE to key and decodes any response body as R. Delete(key K, opts ...js.FetchOption) *Promise[R] // Key derives the resource key from a response value. Key(value R) (K, error) }
Provider fetches data from a remote source and returns typed async results.
type QueryRequest ¶
QueryRequest represents a typed collection query that can be encoded into URL values.
type UserListProvider ¶
type UserListProvider = ListProvider[schema.UserListRequest, schema.UserList]
UserListProvider is a concrete list provider for schema.User resources.
type UserProvider ¶
type UserProvider struct {
UserResourceProvider
UserListProvider
}
func NewUserProvider ¶
func NewUserProvider(base *url.URL) *UserProvider
NewUserProvider creates a provider for schema.User resources and collections.
Click to show internal directories.
Click to hide internal directories.