server

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	V1ItemsRoute string = "/v1/items"
)
View Source
const (
	V1LinksRoute string = "/v1/links"
)
View Source
const (
	V1PlayersRoute string = "/v1/players"
)
View Source
const (
	V1RoomsRoute string = "/v1/rooms"
)

Variables

This section is empty.

Functions

func NewItemFilter

func NewItemFilter(r *http.Request) (assets.ItemFilter, error)

NewItemFilter creates an assets items filter from the the given request's query parameters.

func NewLinkFilter

func NewLinkFilter(r *http.Request) (assets.LinkFilter, error)

NewLinkFilter creates an assets links filter from the the given request's URL query parameters.

func NewPlayerFilter

func NewPlayerFilter(r *http.Request) (assets.PlayerFilter, error)

NewPlayerFilter creates an assets players filter from the given request's URL query parameters.

func NewRoomFilter

func NewRoomFilter(r *http.Request) (assets.RoomFilter, error)

NewRoomFilter creates an assets rooms filter from the given request's URL query parameters.

func TranslateItem

func TranslateItem(i *assets.Item) rest.Item

TranslateItem translates an assets item to a network item.

func TranslateItemRequest

func TranslateItemRequest(i rest.ItemRequest) (assets.ItemChange, error)

TranslateItemRequest translates a network asset item request to an assets item request.

func TranslateLink(l *assets.Link) rest.Link

TranslateLink translates an asset link to a network link.

func TranslateLinkRequest

func TranslateLinkRequest(l rest.LinkRequest) (assets.LinkChange, error)

TranslateLinkRequest translates a network link request to an assets link request.

func TranslatePlayer

func TranslatePlayer(p *assets.Player) rest.Player

TranslatePlayer translates an arcade player to a network player.

func TranslatePlayerRequest

func TranslatePlayerRequest(p rest.PlayerRequest) (assets.PlayerChange, error)

TranslatesPlayerRequest translates a network request to an assets player request.

func TranslateRoom

func TranslateRoom(r *assets.Room) rest.Room

TranslateRoom translates an assets room to a network room.

func TranslateRoomRequest

func TranslateRoomRequest(r rest.RoomRequest) (assets.RoomChange, error)

TranslateRoomRequest translates a network room request to an assets room request.

Types

type ItemManager

ItemManager defines the expected behavior of the item manager in the domain layer.

type ItemsService

type ItemsService struct {
	Manager ItemManager
}

ItemService services item related network requests.

func (ItemsService) Create

func (s ItemsService) Create(w http.ResponseWriter, r *http.Request)

Create handles a request to create an item.

func (ItemsService) Get

Get handles a request to retrieve an item.

func (ItemsService) List

List handles a request to retrieve multiple items.

func (ItemsService) Name

func (ItemsService) Name() string

Name returns the name of the service.

func (ItemsService) Register

func (s ItemsService) Register(router *mux.Router)

Register sets up the http handler for this service with the given router.

func (ItemsService) Remove

func (s ItemsService) Remove(w http.ResponseWriter, r *http.Request)

Remove handles a request to remove an item.

func (ItemsService) Shutdown

func (ItemsService) Shutdown()

Shutdown is a no-op since there no long running processes for this service.

func (ItemsService) Update

func (s ItemsService) Update(w http.ResponseWriter, r *http.Request)

Update handles a request to update an item.

type LinkManager

LinkManager defines the expected behavior of the link manager in the domain layer.

type LinksService

type LinksService struct {
	Manager LinkManager
}

LinkService services link related network requests.

func (LinksService) Create

func (s LinksService) Create(w http.ResponseWriter, r *http.Request)

Create handles a request to create a link.

func (LinksService) Get

Get handles a request to retrieve a link.

func (LinksService) List

List handles a request to retrieve multiple links.

func (LinksService) Name

func (LinksService) Name() string

Name returns the name of the service.

func (LinksService) Register

func (s LinksService) Register(router *mux.Router)

Register sets up the http handler for this service with the given router.

func (LinksService) Remove

func (s LinksService) Remove(w http.ResponseWriter, r *http.Request)

Remove handles a request to remove a link.

func (LinksService) Shutdown

func (LinksService) Shutdown()

Shutdown is a no-op since there no long running processes for this service.

func (LinksService) Update

func (s LinksService) Update(w http.ResponseWriter, r *http.Request)

Update handles a request to update a link.

type PlayerManager

PlayerManager defines the expected behavior of the player manager in the domain layer.

type PlayersService

type PlayersService struct {
	Manager PlayerManager
}

PlayerService services player related network requests.

func (PlayersService) Create

func (s PlayersService) Create(w http.ResponseWriter, r *http.Request)

Create handles a request to create a player.

func (PlayersService) Get

Get handles a request to retrieve a player.

func (PlayersService) List

List handles a request to retrieve multiple players.

func (PlayersService) Name

func (PlayersService) Name() string

Name returns the name of the service.

func (PlayersService) Register

func (s PlayersService) Register(router *mux.Router)

Register sets up the http handler for this service with the given router.

func (PlayersService) Remove

func (s PlayersService) Remove(w http.ResponseWriter, r *http.Request)

Remove handles a request to remove a player.

func (PlayersService) Shutdown

func (PlayersService) Shutdown()

Shutdown is a no-op since there no long running processes for this service.

func (PlayersService) Update

func (s PlayersService) Update(w http.ResponseWriter, r *http.Request)

Update handles a request to update a player.

type RoomManager

RoomManager defines the expected behavior of the room manager in the domain layer.

type RoomsService

type RoomsService struct {
	Manager RoomManager
}

RoomService services room related network requests.

func (RoomsService) Create

func (s RoomsService) Create(w http.ResponseWriter, r *http.Request)

Create handles a request to create a room.

func (RoomsService) Get

Get handles a request to retrieve a room.

func (RoomsService) List

List handles a request to retrieve multiple rooms.

func (RoomsService) Name

func (RoomsService) Name() string

Name returns the name of the service.

func (RoomsService) Register

func (s RoomsService) Register(router *mux.Router)

Register sets up the http handler for this service with the given router.

func (RoomsService) Remove

func (s RoomsService) Remove(w http.ResponseWriter, r *http.Request)

Remove handles a request to remove a room.

func (RoomsService) Shutdown

func (RoomsService) Shutdown()

Shutdown is a no-op since there no long running processes for this service.

func (RoomsService) Update

func (s RoomsService) Update(w http.ResponseWriter, r *http.Request)

Update handles a request to update a room.

Jump to

Keyboard shortcuts

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