server

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	V1ItemRoute string = "/v1/item"
)
View Source
const (
	V1LinkRoute string = "/v1/link"
)
View Source
const (
	V1PlayerRoute string = "/v1/player"
)
View Source
const (
	V1RoomRoute string = "/v1/room"
)

Variables

This section is empty.

Functions

func NewItemFilter

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

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

func NewLinkFilter

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

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

func NewPlayerFilter

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

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

func NewRoomFilter

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

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

func TranslateItem

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

TranslateItem translates an asset item to a network item.

func TranslateItemRequest

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

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

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

TranslateLink translates an asset link to a network link.

func TranslateLinkRequest

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

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

func TranslatePlayer

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

TranslatePlayer translates an arcade player to a network player.

func TranslatePlayerRequest

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

TranslatesPlayerRequest translates a network request to an asset player request.

func TranslateRoom

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

TranslateRoom translates an asset room to a network room.

func TranslateRoomRequest

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

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

Types

type ItemStorage

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

type ItemsService

type ItemsService struct {
	Storage ItemStorage
}

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(context.Context)

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 LinkStorage

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

type LinksService

type LinksService struct {
	Storage LinkStorage
}

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(context.Context)

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 PlayerStorage

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

type PlayersService

type PlayersService struct {
	Storage PlayerStorage
}

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(context.Context)

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 RoomStorage

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

type RoomsService

type RoomsService struct {
	Storage RoomStorage
}

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(context.Context)

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