darkapi

package
v1.63.0-a.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ApiRoute = "/api"

Variables

This section is empty.

Functions

func GetAmmos

func GetAmmos(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Ammos @Tags ammos @Accept json @Produce json @Success 200 {array} configs_export.Ammo @Router /api/ammos [get]

func GetBases

func GetBases(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of NPC Bases @Tags bases @Accept json @Produce json @Success 200 {array} configs_export.Base @Router /api/npc_bases [get]

func GetCMs

func GetCMs(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of CounterMeasure @Tags counter_measures @Accept json @Produce json @Success 200 {array} configs_export.CounterMeasure @Router /api/counter_measures [get]

func GetCommodities

func GetCommodities(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Commodities @Tags commodities @Accept json @Produce json @Success 200 {array} configs_export.Commodity @Router /api/commodities [get]

func GetEngines

func GetEngines(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Engines @Tags engines @Accept json @Produce json @Success 200 {array} configs_export.Engine @Router /api/engines [get]

func GetFactions

func GetFactions(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Factions @Tags factions @Accept json @Produce json @Success 200 {array} configs_export.Faction @Router /api/factions [get]

func GetGuns

func GetGuns(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Guns @Tags guns @Accept json @Produce json @Success 200 {array} configs_export.Gun @Router /api/guns [get]

func GetHashes

func GetHashes(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Hashes @Tags hashes @Accept json @Produce json @Success 200 {object} Hashes @Router /api/hashes [get]

func GetItemsT

func GetItemsT[T any](webapp *web.Web, items []T) func(w http.ResponseWriter, r *http.Request)

func GetMines

func GetMines(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Mines @Tags mines @Accept json @Produce json @Success 200 {array} configs_export.Gun @Router /api/mines [get]

func GetMissiles

func GetMissiles(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Missiles @Tags guns @Accept json @Produce json @Success 200 {array} configs_export.Gun @Router /api/missiles [get]

func GetOreFields

func GetOreFields(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Mining Operations @Tags bases @Accept json @Produce json @Success 200 {array} configs_export.Base @Router /api/mining_operations [get]

func GetPoBs

func GetPoBs(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Player Owned Bases @Description in difference to Disco API, it is enriched with Nicknames/Infocard Names,Region names @Description Sector coordinates, and extra information written in Infocard (totally reflecting Darkstat itself) @Tags player_owned_bases @Accept json @Produce json @Success 200 {array} configs_export.PoB @Router /api/pobs [get]

func GetPobGoods

func GetPobGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary PoB Goods @Tags player_owned_bases @Accept json @Produce json @Success 200 {array} configs_export.PoBGood @Router /api/pob_goods [get]

func GetScanners

func GetScanners(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Scanners @Tags scanners @Accept json @Produce json @Success 200 {array} configs_export.Scanner @Router /api/scanners [get]

func GetShields

func GetShields(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Shields @Tags shields @Accept json @Produce json @Success 200 {array} configs_export.Shield @Router /api/shields [get]

func GetShips

func GetShips(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Ships @Tags ships @Accept json @Produce json @Success 200 {array} configs_export.Ship @Router /api/ships [get]

func GetThrusters

func GetThrusters(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Thrusters @Tags thrusters @Accept json @Produce json @Success 200 {array} configs_export.Thruster @Router /api/thrusters [get]

func GetTractors

func GetTractors(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of tractors @Tags tractors @Accept json @Produce json @Success 200 {array} configs_export.Tractor @Router /api/tractors [get]

func JsonResponseHeader

func JsonResponseHeader(w *http.ResponseWriter)

func PostAmmoMarketGoods

func PostAmmoMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Ammo Market Goods @Tags ammos @Accept json @Produce json @Param request body []string true "Array of ammo nicknames as input, for example [dsy_annihilator_torpedo_ammo]" @Success 200 {array} MarketGoodResp @Router /api/ammos/market_goods [post]

func PostAmmoTechcompatibilities

func PostAmmoTechcompatibilities(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Ammos Tech compats @Tags ammos @Accept json @Produce json @Param request body []string true "Array of ammo nicknames as input" @Success 200 {array} TechCompatResp @Router /api/ammos/tech_compats [post]

func PostBaseMarketGoods

func PostBaseMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of NPC Bases Market Goods @Tags bases @Accept json @Produce json @Param request body []cfg.BaseUniNick true "Array of npc base nicknames as input, for example [li01_01_base]" example("li01_01_base") @Success 200 {array} MarketGoodResp @Router /api/npc_bases/market_goods [post]

func PostCMsMarketGoods

func PostCMsMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of CounterMeasure Market Goods @Tags counter_measures @Accept json @Produce json @Param request body []string true "Array of counter nicknames as input, for example [ge_s_cm_01]" @Success 200 {array} MarketGoodResp @Router /api/counter_measures/market_goods [post]

func PostCMsTechcompatibilities

func PostCMsTechcompatibilities(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of CounterMeasure Tech compats @Tags counter_measures @Accept json @Produce json @Param request body []string true "Array of counter measure nicknames as input" @Success 200 {array} TechCompatResp @Router /api/counter_measures/tech_compats [post]

func PostCommodityMarketGoods

func PostCommodityMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Commodities Market Goods @Tags commodities @Accept json @Produce json @Param request body []string true "Array of commodity nicknames as input, for example [commodity_military_salvage]" example("commodity_military_salvage") @Success 200 {array} MarketGoodResp @Router /api/commodities/market_goods [post]

func PostEnginesMarketGoods

func PostEnginesMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Engine Market Goods @Tags engines @Accept json @Produce json @Param request body []string true "Array of engines nicknames as input, for example [ge_kfr_engine_01_add]" @Success 200 {array} MarketGoodResp @Router /api/engines/market_goods [post]

func PostEnginesTechcompatibilities

func PostEnginesTechcompatibilities(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Engine Tech compats @Tags engines @Accept json @Produce json @Param request body []string true "Array of engines nicknames as input" @Success 200 {array} TechCompatResp @Router /api/engines/tech_compats [post]

func PostGraphPaths

func PostGraphPaths(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary List of time measurements between two NPC bases/PoBs/Ore fields and etc. @Description You query by nicknames of objects from which base/pob/ore fields to which one @Description You receive result how many seconds it takes to reach destination for Transport, Frigate and Freighter @Description If destination is not reachable, you get time equal to Maximum of int32 = 9223372036854775807 @Tags graph @Accept json @Produce json @Param request body []GraphPathReq true "Request body" @Success 200 {array} GraphPathsResp @Router /api/graph/paths [post]

func PostGunsMarketGoods

func PostGunsMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Guns Market Goods @Tags guns @Accept json @Produce json @Param request body []string true "Array of ship nicknames as input, for example [ai_bomber]" example("ai_bomber") @Success 200 {array} MarketGoodResp @Router /api/guns/market_goods [post]

func PostGunsTechcompatibilities

func PostGunsTechcompatibilities(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Guns Tech compats @Tags guns @Accept json @Produce json @Param request body []string true "Array of gun nicknames as input, for example [ai_bomber]" example("ai_bomber") @Success 200 {array} TechCompatResp @Router /api/guns/tech_compats [post]

func PostItemsMarketGoodsT

func PostItemsMarketGoodsT[T Marketable](webapp *web.Web, items []T) func(w http.ResponseWriter, r *http.Request)

func PostItemsTechCompatT

func PostItemsTechCompatT[T TechCompatable](webapp *web.Web, items []T) func(w http.ResponseWriter, r *http.Request)

func PostMinesMarketGoods

func PostMinesMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Mines Market Goods @Tags mines @Accept json @Produce json @Param request body []string true "Array of mine nicknames as input, for example [mine02_mark02]" @Success 200 {array} MarketGoodResp @Router /api/mines/market_goods [post]

func PostMinesTechcompatibilities

func PostMinesTechcompatibilities(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Mines Tech compats @Tags mines @Accept json @Produce json @Param request body []string true "Array of gun nicknames as input, for example [ai_bomber]" example("ai_bomber") @Success 200 {array} TechCompatResp @Router /api/mines/tech_compats [post]

func PostMissilesMarketGoods

func PostMissilesMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Missiles Market Goods @Tags guns @Accept json @Produce json @Param request body []string true "Array of ship nicknames as input, for example [fc_or_gun01_mark02]" @Success 200 {array} MarketGoodResp @Router /api/missiles/market_goods [post]

func PostMissilesTechcompatibilities

func PostMissilesTechcompatibilities(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Missiles Tech compats @Tags guns @Accept json @Produce json @Param request body []string true "Array of missile nicknames as input, for example [fc_or_gun01_mark02]" @Success 200 {array} TechCompatResp @Router /api/missiles/tech_compats [post]

func PostScannersMarketGoods

func PostScannersMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Scanners Market Goods @Tags scanners @Accept json @Produce json @Param request body []string true "Array of ammo nicknames as input, for example [dsy_annihilator_torpedo_ammo]" @Success 200 {array} MarketGoodResp @Router /api/scanners/market_goods [post]

func PostScannersTechcompatibilities

func PostScannersTechcompatibilities(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Scanners Tech compats @Tags scanners @Accept json @Produce json @Param request body []string true "Array of ammo nicknames as input" @Success 200 {array} TechCompatResp @Router /api/scanners/tech_compats [post]

func PostShieldsMarketGoods

func PostShieldsMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Shields Market Goods @Tags shields @Accept json @Produce json @Param request body []string true "Array of ammo nicknames as input, for example [ai_shield_hf]" @Success 200 {array} MarketGoodResp @Router /api/shields/market_goods [post]

func PostShieldsTechcompatibilities

func PostShieldsTechcompatibilities(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Shields Tech compats @Tags shields @Accept json @Produce json @Param request body []string true "Array of ammo nicknames as input" @Success 200 {array} TechCompatResp @Router /api/shields/tech_compats [post]

func PostShipMarketGoods

func PostShipMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Ship Market Goods @Tags ships @Accept json @Produce json @Param request body []string true "Array of ship nicknames as input, for example [ai_bomber]" example("ai_bomber") @Success 200 {array} MarketGoodResp @Router /api/ships/market_goods [post]

func PostShipTechcompatibilities

func PostShipTechcompatibilities(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Ship Tech compats @Tags ships @Accept json @Produce json @Param request body []string true "Array of ship nicknames as input, for example [ai_bomber]" example("ai_bomber") @Success 200 {array} TechCompatResp @Router /api/ships/tech_compats [post]

func PostThrustersMarketGoods

func PostThrustersMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Thrusters Market Goods @Tags thrusters @Accept json @Produce json @Param request body []string true "Array of thrusters nicknames as input, for example [dsy_thruster_bd]" @Success 200 {array} MarketGoodResp @Router /api/thrusters/market_goods [post]

func PostThrustersTechcompatibilities

func PostThrustersTechcompatibilities(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Thrusters Tech compats @Tags thrusters @Accept json @Produce json @Param request body []string true "Array of thrusters nicknames as input" @Success 200 {array} TechCompatResp @Router /api/thrusters/tech_compats [post]

func PostTractorMarketGoods

func PostTractorMarketGoods(webapp *web.Web, api *Api) *registry.Endpoint

ShowAccount godoc @Summary Getting list of Tractor Market Goods @Tags tractors @Accept json @Produce json @Param request body []string true "Array of ship nicknames as input, for example [dsy_license_srp_28]" @Success 200 {array} MarketGoodResp @Router /api/tractors/market_goods [post]

func RegisterApiRoutes

func RegisterApiRoutes(w *web.Web, app_data *router.AppData) *web.Web

func ReturnJson

func ReturnJson(w *http.ResponseWriter, data any)

Types

type Api

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

type GraphPathReq

type GraphPathReq struct {
	From string `json:"from" example:"li01_01_base"` // Write NPC base nickname, or PoB nickname (Name in base64 encoding) or Ore field name
	To   string `json:"to" example:"br01_01_base"`   // Write NPC base nickname, or PoB nickname (Name in base64 encoding) or Ore field name
}

type GraphPathTime

type GraphPathTime struct {
	Transport *cfg.SecondsI `json:"transport"` // time in seconds
	Frigate   *cfg.SecondsI `json:"frigate"`   // time in seconds
	Freighter *cfg.SecondsI `json:"freighter"` // time in seconds
}

type GraphPathsResp

type GraphPathsResp struct {
	Route GraphPathReq   `json:"route"` // writes requested input
	Time  *GraphPathTime `json:"time,omitempty"`
	Error *string        `json:"error,omitempty"` // writes error if requesting not existing nicknames in from/to fields
}

type Hashes

type Hashes struct {
	NicknameToHash map[string]flhash.HashCode `json:"nickname_to_hash"`
}

type MarketGoodResp

type MarketGoodResp struct {
	MarketGoods []*configs_export.MarketGood `json:"market_goods"`
	Nickname    string                       `json:"nickname"`
	Error       *string                      `json:"error"`
}

type Marketable

type Marketable interface {
	Nicknamable
	GetBases() map[cfg.BaseUniNick]*configs_export.MarketGood
}

type Nicknamable

type Nicknamable interface {
	GetNickname() string
}

type TechCompatResp

type TechCompatResp struct {
	TechCompat *configs_export.DiscoveryTechCompat `json:"tech_compat"`
	Nickname   string                              `json:"nickname"`
	Error      *string                             `json:"error"`
}

type TechCompatable

type TechCompatable interface {
	Nicknamable
	GetDiscoveryTechCompat() *configs_export.DiscoveryTechCompat
}

Jump to

Keyboard shortcuts

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