service

package
v0.6.2-0...-436338d Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConflictItem

type ConflictItem struct {
	UnsavedItem *model.Item `json:"unsaved_item,omitempty"`
	ServerItem  *model.Item `json:"server_item,omitempty"`
	Type        string      `json:"type"`
}

A ConflictItem is an object containing an item that can't be saved caused by conflicts.

type LoginParams

type LoginParams struct {
	Params
	Email    string `json:"email"`
	Password string `json:"password"`
}

LoginParams are used to login a user.

type M

type M map[string]interface{}

M is an arbitrary map.

type Params

type Params struct {
	APIVersion string `json:"api"` // Since 20190520
	UserAgent  string
	Session    *model.Session
}

Params are the basic fields used in requests.

type RegisterParams

type RegisterParams struct {
	Params
	Email                string `json:"email"`
	RegistrationPassword string `json:"password"`
	PasswordNonce        string `json:"pw_nonce"`
	PasswordCost         int    `json:"pw_cost"` // Before 202000115
	Version              string `json:"version"`
	Created              string `json:"created"`     // Since 20200115
	Identifier           string `json:"identifier"`  // Since 20200115
	Origination          string `json:"origination"` // Since 20200115
}

RegisterParams are used to register a user.

type Render

type Render interface{}

A Render is an arbitrary payload serializable in JSON by the API.

type SyncParams

type SyncParams struct {
	Params
	ComputeIntegrity bool          `json:"compute_integrity"`
	Limit            int           `json:"limit"`
	SyncToken        string        `json:"sync_token"`
	CursorToken      string        `json:"cursor_token"`
	ContentType      string        `json:"content_type"` // optional, only return items of these type if present
	Items            []*model.Item `json:"items"`
}

A SyncParams is used when a client want to sync items.

type SyncService

type SyncService interface {
	// Execute performs the synchronisation.
	Execute() error
}

A SyncService is a service used for syncing items.

func NewSync

func NewSync(db database.Client, user *model.User, params SyncParams) (s SyncService)

NewSync instantiates a new Sync service.

type UnsavedItem

type UnsavedItem struct {
	Item  *model.Item `json:"item"`
	Error errorItem   `json:"error"`
}

An UnsavedItem is an object containing an item that can't be saved.

type UpdatePasswordParams

type UpdatePasswordParams struct {
	UpdateUserParams
	Identifier      string `json:"identifier"`
	CurrentPassword string `json:"current_password"`
	NewPassword     string `json:"new_password"`
}

UpdatePasswordParams are used to update user's password.

type UpdateUserParams

type UpdateUserParams struct {
	Params
	PasswordCost  int    `json:"pw_cost"`
	PasswordNonce string `json:"pw_nonce"`
	PasswordSalt  string `json:"pw_salt"`
	Version       string `json:"version"`
}

UpdateUserParams are used to update a user.

type UserService

type UserService interface {
	Register(params RegisterParams) (Render, error)
	Login(params LoginParams) (Render, error)
	Update(user *model.User, params UpdateUserParams) (Render, error)
	Password(user *model.User, params UpdatePasswordParams) (Render, error)
}

A UserService is a service used for handle API versioning of the user.

func NewUser

func NewUser(db database.Client, sessions session.Manager, version string) (s UserService)

NewUser returns a new UserService.

Jump to

Keyboard shortcuts

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