server

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(method string, endpoint string, handler Handler)

Add route to server

func Setup

func Setup(version string, developmentMode bool) error

Setup server endpoints

func Start

func Start(address string, ready chan bool) error

Start the server with given address. Server will serve static resource files by default. Add routes before starting it for more endpoints

func Use

func Use(middleware Middleware)

Use middleware in routers

Types

type Context

type Context struct {
	URI        string
	Request    *http.Request
	Response   http.ResponseWriter
	StatusCode int
}

Context struct

func (*Context) Bind

func (c *Context) Bind(destination any) error

Bind body JSON data into destination JSON struct

func (*Context) Error

func (c *Context) Error(err error) error

Error output response error

func (*Context) Header

func (c *Context) Header(key string, value string)

Header set the HTTP response header

func (*Context) JSON

func (c *Context) JSON(content any) error

JSON output response content as JSON

func (*Context) Status

func (c *Context) Status(code int) *Context

Status set the status code for HTTP response

func (*Context) String

func (c *Context) String(content string) error

String output response content as string

type Handler

type Handler func(context *Context) error

Handle function

func Match

func Match(method string, endpoint string) Handler

Match route with given method and endpoint and return its handler

type LaunchShortcutData added in v0.0.20

type LaunchShortcutData struct {
	AppID    uint   `json:"appId"`
	Launcher string `json:"launcher"`
}

Launch shortcut data

type LaunchShortcutResult added in v0.0.20

type LaunchShortcutResult struct {
	Status string `json:"status"`
	Error  string `json:"error"`
}

Launch shortcut result

type LoadLibraryResult

type LoadLibraryResult struct {
	Status           string `json:"status"`
	Error            string `json:"error"`
	SteamPath        string `json:"steamPath"`
	UserConfigPath   string `json:"userConfigPath"`
	UserArtworksPath string `json:"userArtworksPath"`
}

Load library result

type Middleware

type Middleware = func(next Handler) Handler

Middleware function

type ModifyShortcutData

type ModifyShortcutData struct {
	Action        string `json:"action"`
	AppID         uint   `json:"appId"`
	AppName       string `json:"appName"`
	StartDir      string `json:"startDir"`
	Exe           string `json:"exe"`
	LaunchOptions string `json:"launchOptions"`
	IconURL       string `json:"iconUrl"`
	LogoURL       string `json:"logoUrl"`
	CoverURL      string `json:"coverUrl"`
	BannerURL     string `json:"bannerUrl"`
	HeroURL       string `json:"heroUrl"`
}

Modify shortcut data

type ModifyShortcutResult added in v0.0.16

type ModifyShortcutResult struct {
	Status string `json:"status"`
	Error  string `json:"error"`
}

Modify shortcut result

type OpenLinkData added in v0.0.20

type OpenLinkData struct {
	Link string `json:"link"`
}

Open link data

type OpenLinkResult added in v0.0.20

type OpenLinkResult struct {
	Status string `json:"status"`
	Error  string `json:"error"`
}

Open link result

type ProcessROMsData

type ProcessROMsData struct {
	Platforms   []string `json:"platforms"`
	Preferences []string `json:"preferences"`
	Rebuild     bool     `json:"rebuild"`
}

Process ROMs data

type ProcessROMsResult added in v0.0.16

type ProcessROMsResult struct {
	Status string `json:"status"`
	Error  string `json:"error"`
}

Process ROMS result

type Route

type Route struct {
	Method   string
	Endpoint string
	Handler  Handler
}

Route struct

type RunInstallData

type RunInstallData struct {
	Programs []string `json:"programs"`
}

Run install data

type RunInstallResult added in v0.0.16

type RunInstallResult struct {
	Status string `json:"status"`
	Error  string `json:"error"`
}

Run install result

type RunSetupData

type RunSetupData struct {
	UseSymlink  bool   `json:"useSymlink"`
	StoragePath string `json:"storagePath"`
}

Run setup data

type RunSetupResult added in v0.0.16

type RunSetupResult struct {
	Status string `json:"status"`
	Error  string `json:"error"`
}

Run setup result

type SaveLibraryResult added in v0.0.16

type SaveLibraryResult struct {
	Status string `json:"status"`
	Error  string `json:"error"`
}

Save library result

type ScrapeDataResult added in v0.0.16

type ScrapeDataResult struct {
	Status string                `json:"status"`
	Error  string                `json:"error"`
	Result *scraper.ScrapeResult `json:"result"`
}

Scrape data result

Jump to

Keyboard shortcuts

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