users

package
v0.0.0-...-1ad76dd Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserPostStruct

type UserPostStruct struct {
	User struct {
		Email    string   `json:"email"`
		Nickname string   `json:"nickname"`
		About    string   `json:"about"`
		Address  []string `json:"address"`
		ZIP      string   `json:"zip"`
		City     string   `json:"city"`
		Country  string   `json:"country"`
	} `json:"user"`
}

UserPostStruct holds all values of an incoming POST request

type UserResource

type UserResource struct {
	smolder.Resource
}

UserResource is the resource responsible for /users

func (*UserResource) Get

func (r *UserResource) Get(context smolder.APIContext, request *restful.Request, response *restful.Response, params map[string][]string)

Get sends out items matching the query parameters

func (*UserResource) GetAuthRequired

func (r *UserResource) GetAuthRequired() bool

GetAuthRequired returns true because all requests need authentication

func (*UserResource) GetByIDs

func (r *UserResource) GetByIDs(context smolder.APIContext, request *restful.Request, response *restful.Response, ids []string)

GetByIDs sends out all items matching a set of IDs

func (*UserResource) GetByIDsAuthRequired

func (r *UserResource) GetByIDsAuthRequired() bool

GetByIDsAuthRequired returns true because all requests need authentication

func (*UserResource) GetDoc

func (r *UserResource) GetDoc() string

GetDoc returns the description of this API endpoint

func (*UserResource) GetParams

func (r *UserResource) GetParams() []*restful.Parameter

GetParams returns the parameters supported by this API endpoint

func (*UserResource) Post

func (r *UserResource) Post(context smolder.APIContext, data interface{}, request *restful.Request, response *restful.Response)

Post processes an incoming POST (create) request

func (*UserResource) PostAuthRequired

func (r *UserResource) PostAuthRequired() bool

PostAuthRequired returns true because all requests need authentication

func (*UserResource) PostDoc

func (r *UserResource) PostDoc() string

PostDoc returns the description of this API endpoint

func (*UserResource) PostParams

func (r *UserResource) PostParams() []*restful.Parameter

PostParams returns the parameters supported by this API endpoint

func (*UserResource) Reads

func (r *UserResource) Reads() interface{}

Reads returns the model that will be read by POST, PUT & PATCH operations

func (*UserResource) Register

func (r *UserResource) Register(container *restful.Container, config smolder.APIConfig, context smolder.APIContextFactory)

Register this resource with the container to setup all the routes

func (*UserResource) Returns

func (r *UserResource) Returns() interface{}

Returns returns the model that will be returned

func (*UserResource) Validate

func (r *UserResource) Validate(context smolder.APIContext, data interface{}, request *restful.Request) error

Validate checks an incoming request for data errors

type UserResponse

type UserResponse struct {
	smolder.Response

	Users []userInfoResponse `json:"users,omitempty"`
	// contains filtered or unexported fields
}

UserResponse is the common response to 'user' requests

func (*UserResponse) AddUser

func (r *UserResponse) AddUser(user *db.User)

AddUser adds a user to the response

func (*UserResponse) EmptyResponse

func (r *UserResponse) EmptyResponse() interface{}

EmptyResponse returns an empty API response for this endpoint if there's no data to respond with

func (*UserResponse) Init

func (r *UserResponse) Init(context smolder.APIContext)

Init a new response

Jump to

Keyboard shortcuts

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