apitype

package
v0.0.0-...-83163f7 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JsKeyApiKey      = "apiKey"
	JsKeyAssignees   = "assignees"
	JsKeyCreated     = "created"
	JsKeyCreator     = "creator"
	JsKeyDeleted     = "deleted"
	JsKeyDescription = "description"
	JsKeyDeviceId    = "deviceId"
	JsKeyDeviceName  = "deviceName"
	JsKeyDisplayName = "displayName"
	JsKeyEmail       = "email"
	JsKeyId          = "id"
	JsKeyLastLogin   = "lastLogin"
	JsKeyName        = "name"
	JsKeyPassword    = "password"
	JsKeyPosition    = "position"
	JsKeyProviders   = "providers"
	JsKeySince       = "since"
	JsKeySteps       = "steps"
	JsKeySupports    = "supports"
	JsKeyTask        = "task"
	JsKeyTaskId      = "taskId"
	JsKeyToken       = "token"
	JsKeyTrusted     = "trusted"
	JsKeyUpdated     = "updated"
	JsKeyUserId      = "userId"
)

JSON object key name constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	ApiKey apitoken.Token128
}

AuthResponse defines the response body for a successful authentication request.

func (AuthResponse) IsNil

func (a AuthResponse) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (AuthResponse) MarshalJSONObject

func (a AuthResponse) MarshalJSONObject(enc *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*AuthResponse) NKeys

func (a *AuthResponse) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*AuthResponse) UnmarshalJSONObject

func (a *AuthResponse) UnmarshalJSONObject(dec *gojay.Decoder, s string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type AutoAuth

type AutoAuth struct {

	// UserId is the database Id for the user record to which the device that is
	// attempting auth belongs.
	UserId uint64

	// DeviceId is a 128bit token generated by the device.
	//
	// This value is not used for the web app as auto-auth is not allowed for that
	// context.
	//
	// For phone apps, this will be generated on first launch per user/per device.
	DeviceId apitoken.Token128

	// Token is a 256bit token provided to the device by the HTTP API.
	Token apitoken.Token256
}

AutoAuth defines the request body for automatic/device authentication requests.

func (*AutoAuth) IsNil

func (a *AutoAuth) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (*AutoAuth) MarshalJSONObject

func (a *AutoAuth) MarshalJSONObject(e *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (AutoAuth) NKeys

func (a AutoAuth) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*AutoAuth) UnmarshalJSONObject

func (a *AutoAuth) UnmarshalJSONObject(dec *gojay.Decoder, s string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type DeviceDetails

type DeviceDetails struct {

	// Id is the sequential datastore ID assigned to this device record.
	Id uint64

	// DeviceId is a token generated by a phone app to identify that phone and
	// enable automatic authentication for that device.
	DeviceId apitoken.Token128

	// DeviceName is the reported name of the device/browser.
	DeviceName string

	// DisplayName is an optional, custom, user provided name for the device.
	DisplayName string

	// LastLogin contains the last login time for a device.
	LastLogin time.Time

	// Trusted contains details about the "trust" status for a device.
	Trusted *DeviceTrust
}

DeviceDetails defines the available information about a user device.

A device may be from either the web app or the phone app.

func (*DeviceDetails) IsNil

func (d *DeviceDetails) IsNil() bool

func (*DeviceDetails) MarshalJSONObject

func (d *DeviceDetails) MarshalJSONObject(e *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*DeviceDetails) NKeys

func (d *DeviceDetails) NKeys() int

func (*DeviceDetails) UnmarshalJSONObject

func (d *DeviceDetails) UnmarshalJSONObject(e *gojay.Decoder, k string) error

type DeviceList

type DeviceList []DeviceDetails

func (DeviceList) IsNil

func (d DeviceList) IsNil() bool

func (DeviceList) MarshalJSONArray

func (d DeviceList) MarshalJSONArray(e *gojay.Encoder)

func (*DeviceList) UnmarshalJSONArray

func (d *DeviceList) UnmarshalJSONArray(e *gojay.Decoder) error

type DeviceTrust

type DeviceTrust struct {
	Since time.Time
}

func (*DeviceTrust) IsNil

func (d *DeviceTrust) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (*DeviceTrust) MarshalJSONObject

func (d *DeviceTrust) MarshalJSONObject(e *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*DeviceTrust) NKeys

func (d *DeviceTrust) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*DeviceTrust) UnmarshalJSONObject

func (d *DeviceTrust) UnmarshalJSONObject(e *gojay.Decoder, s string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type DeviceTrustResponse

type DeviceTrustResponse struct {
	Token apitoken.Token256
}

func (DeviceTrustResponse) IsNil

func (t DeviceTrustResponse) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (*DeviceTrustResponse) MarshalJSONObject

func (t *DeviceTrustResponse) MarshalJSONObject(e *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*DeviceTrustResponse) NKeys

func (t *DeviceTrustResponse) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*DeviceTrustResponse) UnmarshalJSONObject

func (t *DeviceTrustResponse) UnmarshalJSONObject(d *gojay.Decoder, s string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type LoginRequest

type LoginRequest struct {
	Email    string
	Password passwd.Password
}

LoginRequest defines the body of an authentication request to the HTTP service using user credentials.

func (*LoginRequest) IsNil

func (l *LoginRequest) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (*LoginRequest) MarshalJSONObject

func (l *LoginRequest) MarshalJSONObject(enc *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*LoginRequest) NKeys

func (l *LoginRequest) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*LoginRequest) UnmarshalJSONObject

func (l *LoginRequest) UnmarshalJSONObject(dec *gojay.Decoder, s string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type PasswordResetRequest

type PasswordResetRequest struct {

	// Database ID of the user record to update.
	UserId uint64

	// Password reset token (will have been sent to the user's email)
	Token apitoken.Token256

	// New password value
	Password passwd.Password
}

PasswordResetRequest defines the body of a request to the HTTP service to update a user's password to the given value.

func (*PasswordResetRequest) IsNil

func (p *PasswordResetRequest) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (*PasswordResetRequest) MarshalJSONObject

func (p *PasswordResetRequest) MarshalJSONObject(enc *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*PasswordResetRequest) NKeys

func (p *PasswordResetRequest) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*PasswordResetRequest) UnmarshalJSONObject

func (p *PasswordResetRequest) UnmarshalJSONObject(d *gojay.Decoder, s string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type RequestPasswordResetRequest

type RequestPasswordResetRequest struct {
	Email string
}

RequestPasswordResetRequest defines the body of a request to the HTTP server to send a password reset to the given email (provided that email is attached to a known user).

func (*RequestPasswordResetRequest) IsNil

func (r *RequestPasswordResetRequest) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (*RequestPasswordResetRequest) MarshalJSONObject

func (r *RequestPasswordResetRequest) MarshalJSONObject(enc *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*RequestPasswordResetRequest) NKeys

func (r *RequestPasswordResetRequest) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*RequestPasswordResetRequest) UnmarshalJSONObject

func (r *RequestPasswordResetRequest) UnmarshalJSONObject(d *gojay.Decoder, s string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type StepCreateRequest

type StepCreateRequest struct {
	Description string
	Position    uint16
}

func (*StepCreateRequest) IsNil

func (s *StepCreateRequest) IsNil() bool

func (*StepCreateRequest) MarshalJSONObject

func (s *StepCreateRequest) MarshalJSONObject(e *gojay.Encoder)

func (*StepCreateRequest) NKeys

func (s *StepCreateRequest) NKeys() int

func (*StepCreateRequest) UnmarshalJSONObject

func (s *StepCreateRequest) UnmarshalJSONObject(d *gojay.Decoder, k string) error

type StepDetails

type StepDetails struct {
	Id          uint64
	Task        TaskDetails
	Description string
	Position    uint16
	Creator     UserMeta
	Created     time.Time
	Updated     time.Time
	Deleted     *time.Time
}

func (StepDetails) IsNil

func (s StepDetails) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (StepDetails) MarshalJSONObject

func (s StepDetails) MarshalJSONObject(e *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*StepDetails) NKeys

func (*StepDetails) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*StepDetails) UnmarshalJSONObject

func (s *StepDetails) UnmarshalJSONObject(d *gojay.Decoder, k string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type StepList

type StepList []StepMeta

func (StepList) IsNil

func (s StepList) IsNil() bool

func (StepList) MarshalJSONArray

func (s StepList) MarshalJSONArray(e *gojay.Encoder)

func (*StepList) UnmarshalJSONArray

func (s *StepList) UnmarshalJSONArray(d *gojay.Decoder) error

type StepMeta

type StepMeta struct {
	Id          uint64
	TaskId      uint64
	Description string
	Position    uint16
}

func (StepMeta) IsNil

func (s StepMeta) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (StepMeta) MarshalJSONObject

func (s StepMeta) MarshalJSONObject(e *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*StepMeta) NKeys

func (s *StepMeta) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*StepMeta) UnmarshalJSONObject

func (s *StepMeta) UnmarshalJSONObject(d *gojay.Decoder, k string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type TaskCreateRequest

type TaskCreateRequest struct {
	Name        string
	Description string
}

func (*TaskCreateRequest) IsNil

func (t *TaskCreateRequest) IsNil() bool

func (*TaskCreateRequest) MarshalJSONObject

func (t *TaskCreateRequest) MarshalJSONObject(e *gojay.Encoder)

func (*TaskCreateRequest) NKeys

func (t *TaskCreateRequest) NKeys() int

func (*TaskCreateRequest) UnmarshalJSONObject

func (t *TaskCreateRequest) UnmarshalJSONObject(d *gojay.Decoder, k string) error

type TaskDetails

type TaskDetails struct {
	TaskMeta

	// User provided description of the task.
	Description string

	// User metadata for the user that created the task.
	Creator UserMeta

	// User metadata for the users to whom this task is assigned.
	//
	// This value will only be populated with users that the current user is
	// marked as a provider for.
	//
	// If the current user is not a provider, the task has no assignees, or the
	// task is self assigned, this field will be omitted by the server.
	Assignees UserList

	// An optional list of steps that make up the current task.
	Steps StepList

	// Timestamp of when this task was created.
	Created time.Time

	// Timestamp of when this task was last updated.
	Updated time.Time

	// Optional timestamp of when this task was deleted (only present if the task
	// actually has been deleted).
	Deleted *time.Time
}

TaskDetails represents a "full" task object.

func (TaskDetails) IsNil

func (s TaskDetails) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (*TaskDetails) MarshalJSONObject

func (s *TaskDetails) MarshalJSONObject(enc *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*TaskDetails) NKeys

func (s *TaskDetails) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*TaskDetails) UnmarshalJSONObject

func (s *TaskDetails) UnmarshalJSONObject(d *gojay.Decoder, k string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type TaskList

type TaskList []TaskMeta

func (TaskList) IsNil

func (l TaskList) IsNil() bool

func (TaskList) MarshalJSONArray

func (l TaskList) MarshalJSONArray(e *gojay.Encoder)

func (*TaskList) UnmarshalJSONArray

func (l *TaskList) UnmarshalJSONArray(d *gojay.Decoder) error

type TaskMeta

type TaskMeta struct {

	// Database ID for the task record.
	Id uint64

	// User provided name for the task.
	Name string
}

TaskMeta represents a minimal representation of a task.

func (TaskMeta) IsNil

func (s TaskMeta) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (*TaskMeta) MarshalJSONObject

func (s *TaskMeta) MarshalJSONObject(enc *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*TaskMeta) NKeys

func (s *TaskMeta) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*TaskMeta) UnmarshalJSONObject

func (s *TaskMeta) UnmarshalJSONObject(d *gojay.Decoder, k string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type UserCreateRequest

type UserCreateRequest struct {
	Email       string
	DisplayName string
	Password    string
}

func (*UserCreateRequest) IsNil

func (u *UserCreateRequest) IsNil() bool

func (*UserCreateRequest) MarshalJSONObject

func (u *UserCreateRequest) MarshalJSONObject(e *gojay.Encoder)

func (*UserCreateRequest) NKeys

func (u *UserCreateRequest) NKeys() int

func (*UserCreateRequest) UnmarshalJSONObject

func (u *UserCreateRequest) UnmarshalJSONObject(d *gojay.Decoder, s string) error

type UserDetails

type UserDetails struct {
	UserMeta

	Email     string
	Providers UserList
	Supports  UserList
	Created   time.Time
}

UserDetails defines the info available for a specific user record.

func (UserDetails) IsNil

func (u UserDetails) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (UserDetails) MarshalJSONObject

func (u UserDetails) MarshalJSONObject(e *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*UserDetails) NKeys

func (u *UserDetails) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*UserDetails) UnmarshalJSONObject

func (u *UserDetails) UnmarshalJSONObject(d *gojay.Decoder, s string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

type UserList

type UserList []UserMeta

UserList is a list of user metadata for 0 or more users.

func (UserList) IsNil

func (u UserList) IsNil() bool

func (UserList) MarshalJSONArray

func (u UserList) MarshalJSONArray(e *gojay.Encoder)

func (*UserList) UnmarshalJSONArray

func (u *UserList) UnmarshalJSONArray(d *gojay.Decoder) error

type UserMeta

type UserMeta struct {

	// Database ID for the user record.
	Id uint64

	// User display name / nickname.
	DisplayName string
}

UserMeta defines a base representation of a user record.

func (UserMeta) IsNil

func (u UserMeta) IsNil() bool

IsNil implements the gojay MarshalerJSONObject interface.

func (UserMeta) MarshalJSONObject

func (u UserMeta) MarshalJSONObject(e *gojay.Encoder)

MarshalJSONObject implements the gojay MarshalerJSONObject interface.

func (*UserMeta) NKeys

func (u *UserMeta) NKeys() int

NKeys implements the gojay UnmarshalerJSONObject interface.

func (*UserMeta) UnmarshalJSONObject

func (u *UserMeta) UnmarshalJSONObject(d *gojay.Decoder, s string) error

UnmarshalJSONObject implements the gojay UnmarshalerJSONObject interface.

Jump to

Keyboard shortcuts

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