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: 8 Imported by: 0

Documentation

Overview

Package rest implement the callback required by the profile package

Package rest implement the callback required by the profile 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 {
	PublicId          string `json:"profile_id" binding:"required,min=16"`
	FirstName         string `json:"first_name" binding:"required,min=2"`
	LastName          string `json:"last_name" binding:"required,min=2"`
	ProfilePictureUrl string `json:"profile_picture_url" binding:"required,url"`
	Birthday          string `json:"birthday" binding:"required,min=10"`
}

RequestDTO is the object to map JSON request body

type RequestDTOCreation

type RequestDTOCreation struct {
	PublicId          string `json:"profile_id"`
	FirstName         string `json:"first_name" binding:"required,min=2"`
	LastName          string `json:"last_name" binding:"required,min=2"`
	Email             string `json:"email" binding:"required,email"`
	ProfilePictureUrl string `json:"profile_picture_url"`
	Birthday          string `json:"birthday" binding:"required,min=10"`
}

RequestDTOCreation is the object to map JSON request body of a profile creation request

type ResponseDTO

type ResponseDTO struct {
	PublicId          string `json:"profile_id"`
	FirstName         string `json:"first_name"`
	LastName          string `json:"last_name"`
	Email             string `json:"email"`
	ProfilePictureUrl string `json:"profile_picture_url"`
	Birthday          string `json:"birthday"`
	OrderAmount       uint   `json:"order_amount"`
}

ResponseDTO is the object to map JSON response body

type ResponseDTOUserInfo

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

ResponseDTOUserInfo is the object to map JSON response body when requesting basic user info

type ServiceInterface

type ServiceInterface interface {
	GetResourceOwnerId(email string) uint
	Add(creation RequestDTOCreation) (ResponseDTO, *servicehelper.Error)
	Retrieve(string) (ResponseDTO, *servicehelper.Error)
	Edit(RequestDTO) (ResponseDTO, *servicehelper.Error)
	Remove(string) *servicehelper.Error
	IsThatTheUserId(string, uint) (bool, *servicehelper.Error)
}

ServiceInterface is the model for the service package of profile

Jump to

Keyboard shortcuts

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