rest

package
v0.0.0-...-d933f62 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package rest implement the callback required by the user package

Package rest implement the callback required by the user package

Package rest implement the callback required by the user package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(service ServiceInterface) *rest

New return a new rest instance

Types

type RequestDTO

type RequestDTO struct {
	Username string `json:"username"`
	Email    string `json:"email" binding:"required,email"`
	Password string `json:"password" binding:"required,min=8"`
}

RequestDTO is the object to map JSON request body

type RequestDTOCheckCredentials

type RequestDTOCheckCredentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
	AuthType string `json:"auth_type"`
}

RequestDTOCheckCredentials is the object to map JSON request body for login requests

type RequestDTOPutEmail

type RequestDTOPutEmail struct {
	Email    string `json:"email" binding:"required,email"`
	NewEmail string `json:"new_email" binding:"required,email"`
	Password string `json:"password" binding:"required,min=8"`
}

RequestDTOPutEmail is the object to map JSON request body for requests to edit the email of a user

type RequestDTOPutPassword

type RequestDTOPutPassword struct {
	Email       string `json:"email" binding:"required,email"`
	Password    string `json:"password" binding:"required,min=8"`
	NewPassword string `json:"new_password" binding:"required,min=8"`
}

RequestDTOPutPassword is the object to map JSON request body for requests to edit the email of a user

type RequestDTOWithProfile

type RequestDTOWithProfile struct {
	Username  string `json:"username"`
	Email     string `json:"email" binding:"required,email"`
	Password  string `json:"password" binding:"required,min=8"`
	FirstName string `json:"first_name" binding:"required,min=2"`
	LastName  string `json:"last_name" binding:"required,min=2"`
	Birthday  string `json:"birthday" binding:"required,min=10"`
}

RequestDTOWithProfile is the object to map JSON request body when a profile is added to the request

type ResponseDTO

type ResponseDTO struct {
	Username string `json:"username"`
	Email    string `json:"email"`
}

ResponseDTO is the object to map JSON response body

type ResponseDTOUserInfo

type ResponseDTOUserInfo struct {
	UserId uint   `json:"user_id"`
	Email  string `json:"email"`
}

ResponseDTOUserInfo is the object to map JSON response body of a request to get user basic info

type ResponseDTOWithProfile

type ResponseDTOWithProfile struct {
	PublicId  string `json:"profile_id"`
	Username  string `json:"username"`
	Email     string `json:"email"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Birthday  string `json:"birthday"`
}

ResponseDTOWithProfile is the object to map JSON response body when a profile is added to the response

type ServiceInterface

type ServiceInterface interface {
	GetResourceOwnerId(email string) uint
	Add(RequestDTO) (ResponseDTO, *servicehelper.Error)
	Retrieve(string) (ResponseDTO, *servicehelper.Error)
	EditEmail(RequestDTOPutEmail) (ResponseDTO, *servicehelper.Error)
	EditPassword(RequestDTOPutPassword) (ResponseDTO, *servicehelper.Error)
	Remove(string) *servicehelper.Error
	CheckCredentials(RequestDTOCheckCredentials) (ResponseDTOUserInfo, *servicehelper.Error)
	AddWithProfile(profile RequestDTOWithProfile) (ResponseDTOWithProfile, *servicehelper.Error)
	RetrieveWithProfile(email string) (ResponseDTOWithProfile, *servicehelper.Error)
	IsThatTheUserId(email string, userIdToCheck uint) (bool, *servicehelper.Error)
	RetrieveUserInfoByEmail(email string) (resDTO ResponseDTOUserInfo, error *servicehelper.Error)
	RetrieveUserInfoByUserId(userId uint) (resDTO ResponseDTOUserInfo, error *servicehelper.Error)
}

ServiceInterface is the model for the service package of user

Jump to

Keyboard shortcuts

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