controller

package
v0.0.0-...-d92562b Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppController

type AppController struct {
	// contains filtered or unexported fields
}

AppController holds the repo connection and auth service

func NewAppController

func NewAppController(userRepo repo.IAppRepo, auth auth.IAuth) *AppController

NewAppController returns a new controller for the app

func (*AppController) AddTask

func (c *AppController) AddTask(ctx *gin.Context)

swagger:operation POST /api/secured/tasks AddTask

AddTask adds a task --- produces: - application/json parameters:

  • name: x-access-token in: header description: the access token type: string
  • name: body in: body description: the task to be added schema: $ref: '#/definitions/Task'

responses:

'201':
  description: successful operation
  schema:
   $ref: '#/definitions/Response'
'400':
  description: invalid request
  schema:
   $ref: '#/definitions/Response'
'500':
  description: internal server error
  schema:
   $ref: '#/definitions/Response'
'401':
  description: unauthorized access
  schema:
   $ref: '#/definitions/Response'

func (*AppController) GetTask

func (c *AppController) GetTask(ctx *gin.Context)

swagger:operation GET /api/secured/tasks/:taskId GetTask

GetTask gets a task for the logged in user --- produces: - application/json parameters:

  • name: x-access-token in: header description: the access token type: string

responses:

'200':
  description: successful operation
  schema:
   $ref: '#/definitions/Response'
'400':
  description: invalid request
  schema:
   $ref: '#/definitions/Response'
'500':
  description: internal server error
  schema:
   $ref: '#/definitions/Response'
'401':
  description: unauthorized access
  schema:
   $ref: '#/definitions/Response'

func (*AppController) GetTasks

func (c *AppController) GetTasks(ctx *gin.Context)

swagger:operation GET /api/secured/tasks GetTasks

GetTasks gets tasks for the logged in user --- produces: - application/json parameters:

  • name: x-access-token in: header description: the access token type: string
  • name: lastId in: query description: the id of the last task in the response type: string
  • name: limit in: query description: the page size value type: integer

responses:

'200':
  description: successful operation
  schema:
   $ref: '#/definitions/Response'
'400':
  description: invalid request
  schema:
   $ref: '#/definitions/Response'
'500':
  description: internal server error
  schema:
   $ref: '#/definitions/Response'
'401':
  description: unauthorized access
  schema:
   $ref: '#/definitions/Response'

func (*AppController) Login

func (c *AppController) Login(ctx *gin.Context)

swagger:operation POST /api/aut/login Login

Login holds the functionality for login --- produces: - application/json parameters:

  • name: body in: body description: the login obj schema: $ref: '#/definitions/LoginRequest'

responses:

'200':
  description: successful operation
  schema:
   $ref: '#/definitions/Response'
'400':
  description: invalid request
  schema:
   $ref: '#/definitions/Response'
'500':
  description: internal server error
  schema:
   $ref: '#/definitions/LoginResponse'

func (*AppController) Register

func (c *AppController) Register(ctx *gin.Context)

swagger:operation POST /api/aut/register Register

Register holds the functionality for registration --- produces: - application/json parameters:

  • name: body in: body description: the register obj schema: $ref: '#/definitions/RegisterRequest'

responses:

'201':
  description: successful operation
  schema:
   $ref: '#/definitions/Response'
'400':
  description: invalid request
  schema:
   $ref: '#/definitions/Response'
'500':
  description: internal server error
  schema:
   $ref: '#/definitions/Response'

type IAppController

type IAppController interface {
	Register(ctx *gin.Context)
	Login(ctx *gin.Context)

	GetTasks(ctx *gin.Context)
	GetTask(ctx *gin.Context)
	AddTask(ctx *gin.Context)
}

IAppController is the main interface for app controllers

Jump to

Keyboard shortcuts

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