Documentation ¶
Overview ¶
Package apiv1 provides a JSON API for interacting with accounts.
This package can be imported to get an http.Handler that will provide access for retrieving Accounts, listing Accounts by their ProfileID, adding Accounts, and deleting Accounts.
The lockbox.dev/sessions package is used to authenticate a JWT bearer token for deleting Accounts, retrieving a specific Account, adding new Accounts to an existing profile, or listing Accounts associated with a profile. The bearer token's AccountID will be used as an Account's ID, and that Account's ProfileID must match the ProfileID of the Accounts being acted on or the profile Accounts are being listed for.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIv1 ¶
type APIv1 struct { accounts.Dependencies Log *yall.Logger Sessions sessions.Dependencies }
APIv1 holds all the information that we want to be available for all the functions in the API, things like our logging, metrics, and other telemetry.
func (APIv1) GetAuthToken ¶
GetAuthToken returns the access token associated with the request, or a Response that should be rendered if there's an error.
type Account ¶
type Account struct { ID string `json:"id"` ProfileID string `json:"profileID"` IsRegistration bool `json:"isRegistration"` CreatedAt time.Time `json:"createdAt"` LastSeenAt time.Time `json:"lastSeenAt,omitempty"` LastUsedAt time.Time `json:"lastUsedAt,omitempty"` }
Account is the API representation of an Account. it dictates what the JSON representation of Accounts will be.