models

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type Identity

type Identity struct {
	Type     IdentityType `bson:"type" json:"type" binding:"required"`
	Value    string       `bson:"value" json:"value" binding:"required"`
	Verified bool         `bson:"verified" json:"verified"`
}

type IdentityType

type IdentityType string
const (
	PhoneNumber  IdentityType = "phone_number"
	EmailAddress IdentityType = "email_address"
)

type Referral

type Referral struct {
	ID        bson.ObjectId `bson:"_id" json:"id"`
	Code      string        `bson:"code" json:"code"`
	Created   time.Time     `bson:"created" json:"created"`
	Remaining int           `bson:"remaining" json:"remaining"`
	Requester string        `bson:"requester" json:"requester"`
}

type ReferralRequest

type ReferralRequest struct {
	Key         string
	Count       int
	Limit       int
	RequestedBy string
}

type ReferralResponse

type ReferralResponse struct {
	Response
	RefCodes []string `json:"ref_codes,omitempty"`
}

func (*ReferralResponse) Read

func (r *ReferralResponse) Read(body io.ReadCloser) error

type Registration

type Registration struct {
	Username string    `json:"username" binding:"required"`
	Password string    `json:"password" binding:"required"`
	Identity *Identity `json:"identity" binding:"required"`
	Referral string    `json:"ref_code" binding:"required"`
}

type Response

type Response struct {
	Status  int      `json:"status,omitempty"`
	Session *Session `json:"session,omitempty"`
	Error   *string  `json:"error,omitempty"`
	Id      *string  `json:"id,omitempty"`
}

func (*Response) Read

func (r *Response) Read(body io.ReadCloser) error

type Session

type Session struct {
	AccessToken      string `json:"access_token"`
	ExpiresAt        int64  `json:"expires_at"`
	RefreshToken     string `json:"refresh_token"`
	RefreshExpiresAt int64  `json:"refresh_expires_at"`
	SubjectId        string `json:"subject_id"`
	TokenType        string `json:"token_type"`
}

type User

type User struct {
	ID         bson.ObjectId `bson:"_id" json:"id"`
	Username   string        `bson:"username" json:"username"`
	Password   string        `bson:"password" json:"password"`
	Created    time.Time     `bson:"created" json:"created"`
	LastSeen   time.Time     `bson:"last_seen" json:"last_seen"`
	Identities []Identity    `bson:"identities" json:"identities"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL