actions

package
v0.0.0-...-e0d4dcd Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ENV = envy.Get("GO_ENV", "development")

ENV is used to help switch settings based on where the application is being run. Default is "development".

Functions

func App

func App() *buffalo.App

App is where all routes and middleware for buffalo should be defined. This is the nerve center of your application.

Routing, middleware, groups, etc... are declared TOP -> DOWN. This means if you add a middleware to `app` *after* declaring a group, that group will NOT have that new middleware. The same is true of resource declarations as well.

It also means that routes are checked in the order they are declared. `ServeFiles` is a CATCH-ALL route, so it should always be placed last in the route declarations, as it will prevent routes declared after it to never be called.

func AuthCreate

func AuthCreate(c buffalo.Context) error

AuthCreate attempts to log the user in with an existing account. HTTP Method: POST Expected Data:

JSON Object:
 {
   "email": string,
   "password": string
 }

Return:

401 with verrs
202 with JWT token

func AuthDestroy

func AuthDestroy(c buffalo.Context) error

AuthDestroy clears the session and logs a user out HTTP Method: DELETE Expected Data:

Header: Authorization

Return:

417 with verrs
202

func AuthGenerateToken

func AuthGenerateToken(u *models.User) (string, error)

func CharactersCreate

func CharactersCreate(c buffalo.Context) error

URI: /v1/characters/new Method: POST Data:

Name: string
Description: string

Return:

Success:  201, return Character JSON
Error:    409, 500, with errors

func CharactersDestroy

func CharactersDestroy(c buffalo.Context) error

func CharactersList

func CharactersList(c buffalo.Context) error

URI: /v1/characters/ Method: GET Data:

None

Return:

Success:  200, return List: Character JSON
Error:    409, with errors

func CharactersShow

func CharactersShow(c buffalo.Context) error

URI: /v1/characters/:id Method: GET Data:

id

Return:

Success:  200, return Character JSON
Error:    409, with errors

func CharactersUpdate

func CharactersUpdate(c buffalo.Context) error

URI: /v1/characters/:id Method: POST Data:

Name: string
Description: string

Return:

Success:  200, return Character JSON
Error:    409, with errors

func HomeHandler

func HomeHandler(c buffalo.Context) error

HomeHandler is a default handler to serve up a home page.

func UsersCreate

func UsersCreate(c buffalo.Context) error

UsersCreate registers a new user with the application. HTTP Method: POST Expected Data:

JSON Object:
 {
   "email": string,
   "password": string
 }

Return:

401 with verrs
201 with JWT token

Types

type CampaignsResource

type CampaignsResource struct {
	buffalo.Resource
}

CampaignsResource is the resource for the Campaign model

func (CampaignsResource) Create

func (v CampaignsResource) Create(c buffalo.Context) error

Create adds a Campaign to the DB. This function is mapped to the path POST /campaigns

func (CampaignsResource) Destroy

func (v CampaignsResource) Destroy(c buffalo.Context) error

Destroy deletes a Campaign from the DB. This function is mapped to the path DELETE /campaigns/{campaign_id} This API should zero out fields associated with the campaign (characters) This API should destroy all child elements (quests, maps) This API should accept the destroy command, any UI should implement a user check ("Are you sure?")

func (CampaignsResource) List

List gets all Campaigns. This function is mapped to the path GET /campaigns

func (CampaignsResource) Show

Show gets the data for one Campaign. This function is mapped to the path GET /campaigns/{campaign_id}

func (CampaignsResource) Update

func (v CampaignsResource) Update(c buffalo.Context) error

Update changes a Campaign in the DB. This function is mapped to the path PUT /campaigns/{campaign_id}

type LevelsResource

type LevelsResource struct {
	buffalo.Resource
}

LevelsResource is the resource for the Level model

func (LevelsResource) Create

func (v LevelsResource) Create(c buffalo.Context) error

Create adds a Level to the DB. This function is levelped to the path POST /levels

func (LevelsResource) Destroy

func (v LevelsResource) Destroy(c buffalo.Context) error

Destroy deletes a Level from the DB. This function is levelped to the path DELETE /levels/{level_id}

func (LevelsResource) List

func (v LevelsResource) List(c buffalo.Context) error

List gets all Levels. This function is levelped to the path GET /levels/{quest_id}

func (LevelsResource) Show

func (v LevelsResource) Show(c buffalo.Context) error

Show gets the data for one Level. This function is levelped to the path GET /levels/{level_id}

func (LevelsResource) Update

func (v LevelsResource) Update(c buffalo.Context) error

Update changes a Level in the DB. This function is levelped to the path PUT /levels/{level_id}

type MapsResource

type MapsResource struct {
	buffalo.Resource
}

MapsResource is the resource for the Map model

func (MapsResource) Create

func (v MapsResource) Create(c buffalo.Context) error

Create adds a Map to the DB. This function is mapped to the path POST /maps

func (MapsResource) Destroy

func (v MapsResource) Destroy(c buffalo.Context) error

Destroy deletes a Map from the DB. This function is mapped to the path DELETE /maps/{map_id}

func (MapsResource) List

func (v MapsResource) List(c buffalo.Context) error

List gets all Maps. This function is mapped to the path GET /maps/{quest_id}

func (MapsResource) Show

func (v MapsResource) Show(c buffalo.Context) error

Show gets the data for one Map. This function is mapped to the path GET /maps/{map_id}

func (MapsResource) Update

func (v MapsResource) Update(c buffalo.Context) error

Update changes a Map in the DB. This function is mapped to the path PUT /maps/{map_id}

type QuestsResource

type QuestsResource struct {
	buffalo.Resource
}

QuestsResource is the resource for the Quest model

func (QuestsResource) Create

func (v QuestsResource) Create(c buffalo.Context) error

Create adds a Quest to the DB. This function is mapped to the path POST /quests

func (QuestsResource) Destroy

func (v QuestsResource) Destroy(c buffalo.Context) error

Destroy deletes a Quest from the DB. This function is mapped to the path DELETE /quests/{quest_id} This API should destroy all child elements (maps) This API should accept the destroy command, any UI should implement a user check ("Are you sure?")

func (QuestsResource) List

func (v QuestsResource) List(c buffalo.Context) error

List gets all Quests. This function is mapped to the path GET /quests/{campaign_id}

func (QuestsResource) Show

func (v QuestsResource) Show(c buffalo.Context) error

Show gets the data for one Quest. This function is mapped to the path GET /quests/{quest_id}

func (QuestsResource) Update

func (v QuestsResource) Update(c buffalo.Context) error

Update changes a Quest in the DB. This function is mapped to the path PUT /quests/{quest_id}

type TileCategoriesResource

type TileCategoriesResource struct {
	buffalo.Resource
}

TileCategorysResource is the resource for the TileCategory model

func (TileCategoriesResource) Create

Create adds a TileCategory to the DB. This function is tile_categoryped to the path POST /tile_categorys

func (TileCategoriesResource) Destroy

Destroy deletes a TileCategory from the DB. This function is tile_categoryped to the path DELETE /tile_categorys/{tile_category_id}

func (TileCategoriesResource) List

List gets all TileCategorys. This function is tile_categoryped to the path GET /tile_categorys/{tile category id}

func (TileCategoriesResource) Show

Show gets the data for one TileCategory. This function is tile_categoryped to the path GET /tile_categorys/{tile_category_id}

func (TileCategoriesResource) Update

Update changes a TileCategory in the DB. This function is tile_categoryped to the path PUT /tile_categorys/{tile_category_id}

Jump to

Keyboard shortcuts

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