Documentation
¶
Overview ¶
Package server provides utility functions to make it easier to integrate Cord into your application.
For more information about the Cord-specific terms used here, see the concepts documentation at https://docs.cord.com/concepts/.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientAuthToken ¶
func ClientAuthToken(appID string, secret []byte, data ClientAuthTokenData) (string, error)
ClientAuthToken returns a client auth token suitable for authenticating a user to Cord.
func ServerAuthToken ¶
ServerAuthToken returns a server auth token suitable for authenticating requests to Cord's REST API (see https://docs.cord.com/rest/).
Types ¶
type ClientAuthTokenData ¶
type ClientAuthTokenData struct { UserID string OrganizationID string UserDetails *UserDetails OrganizationDetails *OrganizationDetails }
ClientAuthTokenData is the data that can be supplied in a client auth token.
type OrganizationDetails ¶
type OrganizationDetails struct { Name string `json:"name"` Status Status `json:"status,omitempty"` Members []string `json:"members,omitempty"` }
OrganizationDetails contains the information about an organization that needs to be synced to Cord. Any values that are left at their zero value are not sent except Name, which is required.
type Status ¶
type Status int
A Status is the state of a user or organization.
func (Status) MarshalJSON ¶
MarshalJSON marshals a Status to its text format
type UserDetails ¶
type UserDetails struct { Email string `json:"email"` Name string `json:"name,omitempty"` ProfilePictureURL string `json:"profile_picture_url,omitempty"` Status Status `json:"status,omitempty"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` }
UserDetails contains the information about a user that needs to be synced to Cord. Any values that are left at their zero value are not sent except Email, which is required.