Documentation ¶
Index ¶
- Constants
- Variables
- func StatusCode(err error) int
- type AuthService
- type AuthorizationError
- type Award
- type BadRequestError
- type Cheevo
- type CheevosService
- type FieldError
- type Invitation
- type InvitationExpiredError
- type Membership
- type Model
- type Organization
- type RosterService
- type User
- type ValidationError
Constants ¶
View Source
const InvitationCodeLength = 32
Variables ¶
View Source
var InvitationValidFor = time.Hour
Functions ¶
func StatusCode ¶
Types ¶
type AuthService ¶
type AuthorizationError ¶
type AuthorizationError struct {
// contains filtered or unexported fields
}
func NewAuthorizationError ¶
func NewAuthorizationError(cause error, msg string) AuthorizationError
func (AuthorizationError) Error ¶
func (ae AuthorizationError) Error() string
func (AuthorizationError) Message ¶
func (ae AuthorizationError) Message() string
type BadRequestError ¶
type BadRequestError struct {
// contains filtered or unexported fields
}
func NewBadRequestError ¶
func NewBadRequestError(err error) BadRequestError
func (BadRequestError) Error ¶
func (bre BadRequestError) Error() string
func (BadRequestError) Message ¶
func (bre BadRequestError) Message() string
type Cheevo ¶
type Cheevo struct { // A unique identifer for the cheevo. ID string // The short name for the cheevo. Name string // A description of the act that the achievement is recognizing. Description string OrganizationID string }
Cheevo represents an achievement that can be awarded to a user by authorized members of an organization.
type CheevosService ¶
type FieldError ¶
type Invitation ¶
func (*Invitation) Expired ¶
func (i *Invitation) Expired() bool
func (*Invitation) Model ¶
func (i *Invitation) Model() string
func (*Invitation) Normalize ¶
func (i *Invitation) Normalize()
func (*Invitation) Validate ¶
func (i *Invitation) Validate() error
type InvitationExpiredError ¶
type InvitationExpiredError struct{}
func (InvitationExpiredError) Error ¶
func (iee InvitationExpiredError) Error() string
func (InvitationExpiredError) Message ¶
func (ieee InvitationExpiredError) Message() string
type Membership ¶
func (*Membership) Model ¶
func (m *Membership) Model() string
func (*Membership) Validate ¶
func (m *Membership) Validate() error
type Organization ¶
type Organization struct { // A unique identifier for the organization. ID string // The name of the organization. Name string OwnerID string }
Organization represents a group of users belonging to a related parent entity. This may be an actual organization or simply a group of friends who want to recognize each other for significant events. An organization also acts as a boundary for managing cheevos, since every cheevo is "owned" by an organization and can only be granted to members of that organization.
func (*Organization) Model ¶
func (o *Organization) Model() string
func (*Organization) Normalize ¶
func (o *Organization) Normalize()
func (*Organization) Validate ¶
func (o *Organization) Validate() error
type RosterService ¶
type RosterService interface { AcceptInvitation(ctx context.Context, userID, code string) error CreateOrganization(ctx context.Context, name, ownerID string) (*Organization, error) DeclineInvitation(ctx context.Context, code string) error GetInvitation(ctx context.Context, id string) (*Invitation, error) InviteUserToOrganization(ctx context.Context, email, orgID string) (*Invitation, error) IsMember(ctx context.Context, orgID, userID string) error RefreshInvitation(ctx context.Context, id string) (*Invitation, error) }
type User ¶
type User struct { // A unique identifier for the user. ID string // The username for display. Username string }
User represents a single user of the system. A user can be a member of many organizations, but they are all tied to the same underlying account.
type ValidationError ¶
type ValidationError struct { Model string FieldErrors []FieldError }
func NewValidationError ¶
func NewValidationError(model string, fieldErrors []FieldError) ValidationError
func ValidationErrorFromError ¶
func ValidationErrorFromError(err error) (ValidationError, bool)
func (ValidationError) Error ¶
func (ve ValidationError) Error() string
func (ValidationError) FindFieldError ¶
func (ve ValidationError) FindFieldError(name string) (FieldError, bool)
func (ValidationError) Message ¶
func (ve ValidationError) Message() string
Click to show internal directories.
Click to hide internal directories.