swagger

package module
v0.0.0-...-24f4f6b Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: MIT Imports: 13 Imported by: 0

README

Go API client for swagger

API for posting hosts and waiting for hosts

Overview

This API client was originally generated by the swagger-codegen project.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build date: 2016-08-25T21:39:23.027Z
  • Build package: class io.swagger.codegen.languages.GoClientCodegen

Swagger will likely be published at some point, or converted to RAML. Currently very out of date as files were patched by hand after generation as the early version of the generator did not produce very nice code.

It's still not very nice.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
}

func (*APIClient) CallAPI

func (c *APIClient) CallAPI(path string, method string,
	postBody interface{},
	headerParams map[string]string,
	queryParams url.Values,
	formParams map[string]string,
	fileName string,
	fileBytes []byte) (*resty.Response, error)

func (*APIClient) ParameterToString

func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string

func (*APIClient) SelectHeaderAccept

func (c *APIClient) SelectHeaderAccept(accepts []string) string

func (*APIClient) SelectHeaderContentType

func (c *APIClient) SelectHeaderContentType(contentTypes []string) string

type APIEntry

type APIEntry struct {
	Uri    string `json:"uri,omitempty"`
	GameId int32  `json:"game_id,omitempty"`
}

type APIResponse

type APIResponse struct {
	*http.Response
	Message string `json:"message,omitempty"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type ChallongeDelta

type ChallongeDelta struct {
	Added    *ChallongeDetails   `json:"added,omitempty"`
	Removed  *ChallongeDetails   `json:"removed,omitempty"`
	Modified []*ChallongeDetails `json:"modified,omitempty"`
}

type ChallongeDetails

type ChallongeDetails struct {
	ID       uint64 `json:"id,omitempty"`
	PID      uint64 `json:"player_id,omitempty"`
	ApiKey   string `json:"api_key,omitempty"`
	Username string `json:"username,omitempty"`
	Email    string `json:"email,omitempty"`
}

type Configuration

type Configuration struct {
	UserName     string            `json:"userName,omitempty"`
	Password     string            `json:"password,omitempty"`
	APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"`
	APIKey       map[string]string `json:"APIKey,omitempty"`

	DebugFile     string            `json:"debugFile,omitempty"`
	OAuthToken    string            `json:"oAuthToken,omitempty"`
	Timeout       int               `json:"timeout,omitempty"`
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	AccessToken   string            `json:"accessToken,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	APIClient     APIClient         `json:"APIClient,omitempty"`
	// contains filtered or unexported fields
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

func (*Configuration) GenDefaultHeaders

func (c *Configuration) GenDefaultHeaders() map[string]string

func (*Configuration) GetAPIKeyWithPrefix

func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string

func (*Configuration) GetBasicAuthEncodedString

func (c *Configuration) GetBasicAuthEncodedString() string

func (*Configuration) GetDebug

func (c *Configuration) GetDebug() bool

func (*Configuration) SetDebug

func (c *Configuration) SetDebug(enable bool)

type DefaultMessages

type DefaultMessages struct {
	Game Game `json:"game,omitempty"`

	// Default message when hosting a game.
	DefaultHost string `json:"default_host,omitempty"`

	// Default message when waiting for someone else to host a game.
	DefaultWait string `json:"default_wait,omitempty"`

	// String to use instead of 'is hosting' when showing in hosting lists.
	IsHosting string `json:"is_hosting,omitempty"`

	// String to use instead of 'playing vs' when showing in hosting lists.
	IsPlaying string `json:"is_playing,omitempty"`
}

type Delta

type Delta struct {
	IPPort     []string        `json:"ip,omitempty"`
	IPv4       []string        `json:"ipv4,omitempty"`
	IPv6       []string        `json:"ipv6,omitempty"`
	Port       []uint16        `json:"port,omitempty"`
	Challonge  *ChallongeDelta `json:"challonge,omitempty"`
	StaticIP   []uint8         `json:"ip_lock,omitempty"`
	Password   []string        `json:"password,omitempty"`
	JoinNotify []uint8         `json:"join_notify,omitempty"`
	Gender     []string        `json:"preferred_gender,omitempty"`
	Avatar     []string        `json:"avatar,omitempty"`
	Nick       []string        `json:"nick,omitempty"`
	PVsMsg     []string        `json:"playing_vs_message,omitempty"`
	HostMsg    []string        `json:"hosting_message,omitempty"`
}

type Game

type Game struct {

	// Unique identifier for a supported game
	Id int32 `json:"id,omitempty"`

	// Unique short-name identifier that can be used in urls.
	UrlShortName string `json:"url_short_name,omitempty"`

	// Name of the game.
	Name string `json:"name,omitempty"`

	// Name of the game according to Discord.
	DiscordName string `json:"discord_name,omitempty"`

	// Main URL for info on the game.
	Url string `json:"url,omitempty"`

	// Default port used by the game
	Port uint16 `json:"port,omitempty"`

	// API Entries
	APIs []APIEntry `json:"api_entries,omitempty"`

	// Protcols understood by the game
	Protocols []string `json:"protocols,omitempty"`
}

type GameCheckInfo

type GameCheckInfo struct {
	Address  string   `json:"address,omitempty"`
	Status   string   `json:"status,omitempty"`
	Version  string   `json:"version,omitempty"`
	Spectate int      `json:"spectate,omitempty"` // one of y(es) n(o) or u(nknown)
	Opponent string   `json:"opponent,omitempty"`
	Profiles []string `json:"profiles,omitempty"`
	Error    string   `json:"error,omitempty"`
}

type GameCheckResult

type GameCheckResult struct {
	Request  string        `json:"request,omitempty"`
	HostPort string        `json:"hostport,omitempty"`
	Info     GameCheckInfo `json:"result,omitempty"`
	Error    string        `json:"error,omitempty"`
}

type GamePing

type GamePing struct {
	Request  string `json:"request,omitempty"`
	HostPort string `json:"hostport,omitempty"`
	Result   string `json:"result,omitempty"`
	TimeNS   uint64 `json:"timeNS,omitempty"`
}

type GamesApi

type GamesApi struct {
	Configuration Configuration
}

func NewGamesApi

func NewGamesApi() *GamesApi

func NewGamesApiWithBasePath

func NewGamesApiWithBasePath(basePath string) *GamesApi

func (GamesApi) GamesGet

func (a GamesApi) GamesGet(gameId string) ([]Game, *APIResponse, error)

*

  • Games API
  • The games endpoint returns information about the supported games of this hosting system. *
  • @param gameId Game to look up.
  • @return []Game

type Host

type Host struct {
	BaseInfo Waiter `json:"base_info,omitempty"`
	// Check History if requested
	Checks []*StatusCheckResult `json:"checks,omitempty"`

	// IPv4 the host is on.
	Ipv4 string `json:"ipv4,omitempty"`

	// IPv6 Address the host is on.
	Ipv6 string `json:"ipv6,omitempty"`

	// Port the host is on.
	Port uint16 `json:"port,omitempty"`

	// Whether the host can be spectated.
	Spectateable string `json:"spectateable,omitempty"`

	// Version of the game api being hosted.
	Version string `json:"version,omitempty"`

	// Privacy flags associated  with this host.
	Flags []string `json:"flags,omitempty"`

	Opponent User `json:"opponent,omitempty"`

	// Whether the opponent joined privately.
	OpPrivate bool `json:"op_private,omitempty"`
}

type HostList

type HostList struct {
	Hosts []HosterStatus `json:"hosts,omitempty"`

	Waits []WaiterStatus `json:"waits,omitempty"`
}

type HosterStatus

type HosterStatus struct {
	Host Host `json:"host,omitempty"`

	Status StatusCheckResult `json:"status,omitempty"`
}

type HostsApi

type HostsApi struct {
	Configuration Configuration
}

func NewHostsApi

func NewHostsApi() *HostsApi

func NewHostsApiWithBasePath

func NewHostsApiWithBasePath(basePath string) *HostsApi

func (HostsApi) CheckHost

func (a HostsApi) CheckHost(game string, ip net.IP, port int, retries uint8, full bool) (*StatusCheckResult, *APIResponse, error)

*

  • Host check
  • Check whether a given host is active or not *
  • @param offset Offset the list of returned results by this amount. Default is zero.
  • @param limit Number of items to retrieve. Default is 5, maximum is 100.
  • @return *UserHistory

func (HostsApi) DeclareHost

func (a HostsApi) DeclareHost(userId uint64, game, announcer string, message string, ip net.IP, port int) (*HosterStatus, *APIResponse, error)

*

  • Post host
  • This is used post that someone is hosting a game. *

func (HostsApi) DeclareWait

func (a HostsApi) DeclareWait(userId uint64, game, announcer string, length time.Duration, message string) (*HosterStatus, *APIResponse, error)

*

  • Post wait

func (HostsApi) GamesGameIdHostHostIdPost

func (a HostsApi) GamesGameIdHostHostIdPost(gameId string, hostId string, checkInfo StatusUpdate) (*StatusCheckResult, *APIResponse, error)

*

  • Hosts API
  • The hosts endpoint returns information about games currently being hosted and known about by the system. *
  • @param gameId Game to look for hosts under.
  • @param status Status(es) of hosts to return. If not given, the default is Wait, Play, Relay.
  • @param hoster Name or part of a name of a hoster.
  • @param country Countries for a host.
  • @return *HostList

func (HostsApi) GamesGameIdHostsGet

func (a HostsApi) GamesGameIdHostsGet(gameId string, details string, status []string, hoster string, country []string) (*HostList, *APIResponse, error)

*

  • Hosts API
  • The hosts endpoint returns information about games currently being hosted and known about by the system. *
  • @param gameId Game to look for hosts under.
  • @param status Status(es) of hosts to return. If not given, the default is Wait, Play, Relay.
  • @param hoster Name or part of a name of a hoster.
  • @param country Countries for a host.
  • @return *HostList

func (HostsApi) HistoryGet

func (a HostsApi) HistoryGet(offset int32, limit int32) (*UserHistory, *APIResponse, error)

*

  • User Activity
  • The User Activity endpoint returns data about a user's hosts. *
  • @param offset Offset the list of returned results by this amount. Default is zero.
  • @param limit Number of items to retrieve. Default is 5, maximum is 100.
  • @return *UserHistory

type Identity

type Identity struct {

	// Latitude component of the location
	PlayerID   uint64    `json:"player_id,omitempty"`
	Credential string    `json:"credential,omitempty"`
	Created    time.Time `json:"date,omitempty"`
	Nick       string    `json:"nick,omitempty"`
	AuthRealm  Realm     `json:"location,omitempty"`
	// Longitutde component of the location
	AuthTypes []string `json:"auth,omitempty"`
}

type Location

type Location struct {

	// Latitude component of the location
	Lat float64 `json:"lat,omitempty"`

	// Longitutde component of the location
	Long float64 `json:"long,omitempty"`
}

type ModelError

type ModelError struct {
	Code int32 `json:"code,omitempty"`

	Message string `json:"message,omitempty"`

	Fields string `json:"fields,omitempty"`
}

type Realm

type Realm struct {

	// Latitude component of the location
	ID   uint16 `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	// Longitutde component of the location
	AuthTypes []string `json:"auth,omitempty"`
}

type StatusCheckResult

type StatusCheckResult struct {
	// Check id
	Id uint64 `json:"id,omitempty"`

	// Current Status of this host.
	Status string `json:"status,omitempty"`

	// Is spectateable?
	CanSpec string `json:"can_spec"`

	// Confused version string; needs to be fixed
	Version string `json:"roll"`

	// Last time this was verified.
	LastCheck time.Time `json:"last_check,omitempty"`

	// First time of this status result.
	CheckDate time.Time `json:"check_date,omitempty"`

	// Profile name of player one, if known.
	P1Profile string `json:"p1Profile,omitempty"`

	// Profile name of player two, if known.
	P2Profile string `json:"p2Profile,omitempty"`
}

type StatusUpdate

type StatusUpdate struct {
	LastCheckId  uint64    `json:"last_check_id"`
	Status       string    `json:"status"`
	OpponentAddr string    `json:"opponent_ip,omitempty"`
	OpponentId   uint64    `json:"opponent_id,omitempty"`
	CheckDate    time.Time `json:"check_data"`
	NewVers      *string   `json:"vers,omitempty"`
	CanSpec      *bool     `json:"spec,omitempty"`
	Prof1Name    *string   `json:"p1_prof,omitempty"`
	Prof2Name    *string   `json:"p2_prof,omitempty"`
}

type User

type User struct {

	// Unique identifier for the user
	Id uint64 `json:"id,omitempty"`

	// Nickname for the user
	Nick string `json:"nick,omitempty"`

	Location Location `json:"location,omitempty"`

	// The most recently seen IPv4 for the user
	Ipv4 string `json:"ipv4,omitempty"`

	// The most recently seen IPv6 for the user
	Ipv6 string `json:"ipv6,omitempty"`

	// Static IP?
	StaticIP bool `json:"static_ip,omitempty"`

	// Priv level e.g. user/admin/super
	PrivLevel string `json:"privs,omitempty"`

	// User's preferred port to host on
	Port int `json:"preferred_port,omitempty"`

	// Preferred Gender for the user
	Gender string `json:"gender,omitempty"`

	// Whether the user will be named in host lists as an opponent
	Private bool `json:"private,omitempty"`

	// Want Join Notification ?
	JoinNotify bool `json:"join_notification,omitempty"`

	// Password for the user.
	HasPassword bool `json:"password_set,omitempty"`

	// Creation time for the user record.
	Created time.Time `json:"created,omitempty"`

	// Email address of the user.
	Email string `json:"email,omitempty"`

	// Avatar URL of the user.
	Picture string `json:"picture,omitempty"`

	// Known Identities for the user
	Credentials []*Identity `json:"identities,omitempty"`

	// Challonge Information
	ChallongeInfo []*ChallongeDetails `json:"challonge,omitempty"`

	DefaultMessages []DefaultMessages `json:"default_messages,omitempty"`
}

type UserDelta

type UserDelta struct {
	Delta      *Delta `json:"delta,omitempty"`
	Registered string `json:"registered,omitempty"`
	Player     User   `json:"player,omitempty"`
}

type UserHistory

type UserHistory struct {

	// Position in pagination.
	Offset int32 `json:"offset,omitempty"`

	// Number of items to retrieve (100 max).
	Limit int32 `json:"limit,omitempty"`

	// Total number of items available.
	Count int32 `json:"count,omitempty"`

	Hosts HostList `json:"hosts,omitempty"`
}

type UsersApi

type UsersApi struct {
	Configuration Configuration
}

func NewUsersApi

func NewUsersApi() *UsersApi

func NewUsersApiWithBasePath

func NewUsersApiWithBasePath(basePath string) *UsersApi

func (UsersApi) HistoryGet

func (a UsersApi) HistoryGet(userId string, since, before *time.Time, seePrivate bool, limit int32) ([]Host, *APIResponse, error)

*

  • User Activity
  • The User Activity endpoint returns data about a user's hosts. *
  • @param offset Offset the list of returned results by this amount. Default is zero.
  • @param limit Number of items to retrieve. Default is 5, maximum is 100.
  • @return Array of found Host objects.

func (UsersApi) MeGet

func (a UsersApi) MeGet() (*User, *APIResponse, error)

*

  • User Profile
  • The User Profile endpoint returns information about the user that has authorized with the application. *
  • @return *User

func (UsersApi) UpdateUser

func (a UsersApi) UpdateUser(userId string, postBody map[string]string) (UserDelta, *APIResponse, error)

func (UsersApi) UserCreate

func (a UsersApi) UserCreate(credential, backendNick string, ip net.IP, port int) (UserDelta, *APIResponse, error)

func (UsersApi) UserGet

func (a UsersApi) UserGet(userId string) (User, *APIResponse, error)

*

  • Users API
  • Grab information on a specific user. *
  • @param userId A specific user-id or username to query.
  • @return User

func (UsersApi) UsersGet

func (a UsersApi) UsersGet(userId string, name string, country string) ([]User, *APIResponse, error)

*

  • Users API
  • The Users endpoint returns information about the Users of the system. The response includes the display name and other details about each user. Not all information is public for a given user. *
  • @param userId A specific user-id or username to query.
  • @param name Name or part of of a name of the user.
  • @param country Country of the user.
  • @return []User

func (UsersApi) UsersGetWithChallonge

func (a UsersApi) UsersGetWithChallonge() ([]User, *APIResponse, error)

* func (a UsersApi) UsersGetWithChallonge() ([]User, *APIResponse, error) {

  • Users API
  • The Users endpoint returns information about the Users of the system. The response includes the display name and other details about each user. Not all information is public for a given user. *
  • @return []User

type Waiter

type Waiter struct {

	// Unique identifier for a given waiting host.
	Id uint64 `json:"id,omitempty"`

	User User `json:"user,omitempty"`

	// Hosting/waiting message.
	Message string `json:"message,omitempty"`

	// Name of the person involved.
	DisplayName string `json:"display_name,omitempty"`

	// Who this waiter joined, if known.
	JoinedID int64 `json:"joined_id,omitempty"`

	// Time when the host appeared.
	Started time.Time `json:"wait_until,omitempty"`

	// How long this waiter will advertise until
	WaitUntil time.Time `json:"started,omitempty"`

	// Whether this is a host or somebody waiting.
	IsHosting bool `json:"is_hosting,omitempty"`

	Game Game `json:"game,omitempty"`
}

type WaiterStatus

type WaiterStatus struct {
	Waiter Waiter `json:"waiter,omitempty"`

	Status StatusCheckResult `json:"status,omitempty"`
}

Jump to

Keyboard shortcuts

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