gw2api

package
v0.0.0-...-7910d62 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: MIT Imports: 18 Imported by: 4

Documentation

Overview

Package gw2api provides bindings for the Guild Wars 2 v2 API

Using this package is as simple as calling the functions on the API struct Further examples can be found with the function definitions

func main() {
  api := NewGW2Api()
  b, _ := api.Build()
  fmt.Println(b)
}

Index

Examples

Constants

This section is empty.

Variables

View Source
var TableNameTokenInfo = "token_infos"

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Err  string `json:"error"`
	Text string `json:"text`
}

APIError for API errors to unmarshal into.

func (APIError) Error

func (e APIError) Error() string

Error implements the error interface.

type Account

type Account struct {
	Gw2Model
	ID           string         `json:"id" gorm:"type:varchar(64);primary_key:true"`
	Name         string         `json:"name" gorm:"type:varchar(32);NOT NULL"`
	World        int            `json:"world" gorm:"NOT NULL"`
	Age          int            `json:"age" gorm:"NOT NULL"`
	Guilds       pq.StringArray `json:"guilds" gorm:"type:varchar(255)[]"`
	GuildLeader  pq.StringArray `json:"guild_leader" gorm:"type:varchar(255)[]"`
	Access       pq.StringArray `json:"access" gorm:"type:varchar(255)[];NOT NULL"`
	Created      string         `json:"created" gorm:"type:varchar(32); NOT NULL"`
	Commander    bool           `json:"commander"`
	FractalLevel int            `json:"fractal_level"`
	DailyAP      int            `json:"daily_ap"`
	MonthlyAP    int            `json:"monthly_ap"`
	WvWRank      int            `json:"wvw_rank" gorm:"column:wvw_rank"`
}

Account includes all general information

func (*Account) Persist

func (ent *Account) Persist() (err error)

type Achievement

type Achievement struct {
	ID          int      `json:"id"`
	Icon        string   `json:"icon"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Requirement string   `json:"requirement"`
	Type        string   `json:"type"`
	Flags       []string `json:"flags"`
}

Achievement detailed achievement information

type AchievementCategory

type AchievementCategory struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	Order        int    `json:"order"`
	Icon         string `json:"icon"`
	Achievements []int  `json:"achievements"`
	// Either GuildWars2 or HeartOfThorns
	RequiredAccess []string `json:"required_access"`
}

AchievementCategory Category description

type AchievementGroup

type AchievementGroup struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Order       int    `json:"order"`
	Categories  []int  `json:"categories"`
}

AchievementGroup Group description

type AchievementProgress

type AchievementProgress struct {
	ID      int `json:"id"`
	Current int `json:"current"`
	// Max - The amount needed to complete the achievement. Most WvW achievements
	// have this set to -1.
	Max  int  `json:"max"`
	Done bool `json:"done"`
	// Bits - This attribute contains an array of numbers from 0 to 7, giving more
	// specific information on the progress for the achievement. The meaning of
	// each 0-7 value varies with each achievement. (
	Bits []int `json:"bits"`
}

AchievementProgress represents detailed information about the accounts progress on an achievement.

type ArticleListing

type ArticleListing struct {
	ID    int       `json:"id"`
	Buys  []Listing `json:"buys"`
	Sells []Listing `json:"sells"`
}

ArticleListing includes the id of the listing and a list of buys and sells

type ArticlePrice

type ArticlePrice struct {
	ID    int   `json:"id"`
	Buys  Price `json:"buys"`
	Sells Price `json:"sells"`
}

ArticlePrice Listings for a specific item (highest buy, lowest sell)

type Bag

type Bag struct {
	ID        int             `json:"id"`
	Size      int             `json:"size"`
	Inventory []InventoryItem `json:"inventory"`
}

Bag on the character with size and inventory

type BankItem

type BankItem struct {
	ID        int   `json:"id"`
	Count     int   `json:"count"`
	Skin      int   `json:"skin"`
	Upgrades  []int `json:"upgrades"`
	Infusions []int `json:"infusions"`
}

BankItem describes an item stored in the players normal bank

type Bonus

type Bonus struct {
	Owner string `json:"owner"`
	Type  string `json:"type"`
}

Bonus - Map bonuses and current owner indetified by Color/Neutral

type Character

type Character struct {
	Name          string               `json:"name"`
	Race          string               `json:"race"`
	Gender        string               `json:"gender"`
	Profession    string               `json:"profession"`
	Level         int                  `json:"level"`
	Guild         string               `json:"guild"`
	Created       string               `json:"created"`
	Age           int                  `json:"age"`
	Deaths        int                  `json:"deaths"`
	Crafting      []CraftingDiscipline `json:"crafting"`
	Specalization Specalizations       `json:"specalization"`
	Skill         Skills               `json:"skills"`
	Bags          []Bag                `json:"bags"`
	Equipment     []Equipment          `json:"equipment"`
	EquipmentPvP  EquipmentPvP         `json:"equipment_pvp"`
}

Character combines all information about the character

type Color

type Color struct {
	ID      int         `json:"id"`
	Name    string      `json:"name"`
	BaseRGB [3]int      `json:"base_rgb"`
	Cloth   ColorDetail `json:"cloth"`
	Leather ColorDetail `json:"leather"`
	Metal   ColorDetail `json:"metal"`
}

Color with specific values for the three armor types

type ColorDetail

type ColorDetail struct {
	Brightness int     `json:"brightness"`
	Contrast   float32 `json:"contrast"`
	Hue        int     `json:"hue"`
	Saturation float32 `json:"saturation"`
	Lightness  float32 `json:"lightness"`
	RGB        [3]int  `json:"rgb"`
}

ColorDetail per armor type

type Continent

type Continent struct {
	ID            int    `json:"id"`
	Name          string `json:"name"`
	ContinentDims []int  `json:"continent_dims"`
	MinZoom       int    `json:"min_zoom"`
	MaxZoom       int    `json:"max_zoom"`
	Floors        []int  `json:"floors"`
}

Continent information

type CraftingDiscipline

type CraftingDiscipline struct {
	Discipline string `json:"discipline"`
	Rating     int    `json:"rating"`
	Active     bool   `json:"active"`
}

CraftingDiscipline contains information about learned crafting discplines on the character and shows their active state

type Currency

type Currency struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Icon        string `json:"icon"`
	Order       int    `json:"order"`
}

Currency detail struct

type DailyAchievement

type DailyAchievement struct {
	ID          int                   `json:"id"`
	Level       DailyAchievementLevel `json:"level"`
	Requirement []string              `json:"required_access"`
}

DailyAchievement for the gamemode

type DailyAchievementLevel

type DailyAchievementLevel struct {
	Min int `json:"min"`
	Max int `json:"max"`
}

DailyAchievementLevel range for the achievement. Determining if it is visible to a character or not

type DailyAchievements

type DailyAchievements struct {
	PvE      []DailyAchievement `json:"pve"`
	PvP      []DailyAchievement `json:"pvp"`
	WvW      []DailyAchievement `json:"wvw"`
	Fractals []DailyAchievement `json:"fractals"`
	Special  []DailyAchievement `json:"special"`
}

DailyAchievements structured by their gamemode

type DetailSpecialization

type DetailSpecialization struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Elite       bool   `json:"elite"`
	Icon        string `json:"icon"`
	Background  string `json:"background"`
	MinorTraits []int  `json:"minor_traits"`
	MajorTraits []int  `json:"major_traits"`
}

DetailSpecialization spec lines and their traits

type EmblemLayers

type EmblemLayers struct {
	ID     int      `json:"id"`
	Layers []string `json:"layers"`
}

EmblemLayers for the requested Fore/Background

type Equipment

type Equipment struct {
	ID        int    `json:"id"`
	Slot      string `json:"slot"`
	Upgrades  []int  `json:"upgrades"`
	Infusions []int  `json:"infusions"`
	Skin      int    `json:"skin"`
}

Equipment worn by the character

type EquipmentPvP

type EquipmentPvP struct {
	// references PvPAmulets
	Amulet int `json:"amulet"`
	Rune   int `json:"rune"`
	// UI order left to right
	Sigils []int `json:"sigils"`
}

EquipmentPvP selected items in PvP mode

type Exchange

type Exchange struct {
	CoinsPerGem int `json:"coins_per_gem"`
	Quantity    int `json:"quantity"`
}

Exchange with CoinsPerGem and Quantity. Varies on request

type Fact

type Fact struct {
	Text  string     `json:"text"`
	Icon  string     `json:"icon"`
	Type  string     `json:"type"`
	Facts []FactType `json:"facts"`

	// Only as TraitedFact
	RequiresTrait int `json:"requires_trait"`
	Overrides     int `json:"overrides"`
}

Fact associated with a trait or skill

type FactType

type FactType struct {
	//Common fields
	Text        string `json:"text"`
	Type        string `json:"type"`
	Icon        string `json:"icon"`
	Description string `json:"description"`
	Percent     int    `json:"percent"`
	Target      string `json:"target"`
	Duration    int    `json:"duration"`
	Status      string `json:"status"`
	ApplyCount  int    `json:"apply_count"`
	Value       int    `json:"value"`

	// BuffConversionFact
	Source string `json:"source"`

	// ComboFieldFact
	FinisherType string `json:"finisher_type"`

	// DamageFact
	HitCount int `json:"hit_count"`

	// DistanceFact
	Distance int `json:"distance"`

	// PrefixedBuffFact
	Prefix Fact `json:"prefix"`
}

FactType - One of the types a fact can be Set fields depend on the Type

type File

type File struct {
	ID   string `json:"id"`
	Icon string `json:"icon"`
}

File - Id <-> icon

type GW2Api

type GW2Api struct {
	Timeout   time.Duration
	Client    http.Client
	Auth      string
	AuthFlags uint
}

GW2Api is the state holder of the API. It includes authentication information

func NewAuthenticatedGW2Api

func NewAuthenticatedGW2Api(auth string) (api *GW2Api, err error)

NewAuthenticatedGW2Api returns an authenticated GW2Api or an error if authentication failed

Example
var api *GW2Api
var err error
if api, err = NewAuthenticatedGW2Api("<APIKEY>"); err != nil {
	fmt.Printf("Failed to connect to the API: %s", err)
}
if api.HasPermission(PermAccount) {
	var acc Account
	if acc, err = api.Account(); err != nil {
		fmt.Printf("API did not answer correctly: %s", err)
	}
	fmt.Printf("%s\n", acc.Name)
}
Output:

func NewGW2Api

func NewGW2Api() *GW2Api

NewGW2Api returns a simple GW2Api with a HTTP timeout of 15 seconds

Example
api := NewGW2Api()
build, _ := api.Build()
fmt.Printf("%d\n", build)
Output:

func (*GW2Api) Account

func (gw2 *GW2Api) Account() (acc Account, err error)

Account fetches the general account information Requires authentication

func (*GW2Api) AccountAchievements

func (gw2 *GW2Api) AccountAchievements() (achievs []AchievementProgress, err error)

AccountAchievements returns a list of the accounts progress with all known achievements in the game

func (*GW2Api) AccountBank

func (gw2 *GW2Api) AccountBank() (items []BankItem, err error)

AccountBank returns an array of objects, each representing an item slot in the vault. If a slot is empty, it will return null. The amount of slots/bank tabs is implied by the length of the array. Requires authentication

func (*GW2Api) AccountDyes

func (gw2 *GW2Api) AccountDyes() (dyes []int, err error)

AccountDyes returns an array of dyes unlocked by the player. The IDs can be resolved via ColorIds() Requires authentication

func (*GW2Api) AccountMaterials

func (gw2 *GW2Api) AccountMaterials() (items []MaterialItem, err error)

AccountMaterials returns an array of objects, each representing a material that can be stored in the vault. Every material will be returned, even if they have a count of 0 Requires authentication

func (*GW2Api) AccountMinis

func (gw2 *GW2Api) AccountMinis() (minis []int, err error)

AccountMinis returns the ids of all unlocked minis in the accounts collection

func (*GW2Api) AccountSkins

func (gw2 *GW2Api) AccountSkins() (skins []int, err error)

AccountSkins returns an array of skins unlocked by the player. The IDs can be resolved via SkinIds() Requires authentication

func (*GW2Api) AccountWallet

func (gw2 *GW2Api) AccountWallet() (currency []WalletCurrency, err error)

AccountWallet returns an array of currencies owned by the player. The IDs can be resolved via CurrencyIds() Requires authentication

func (*GW2Api) AchievementCategories

func (gw2 *GW2Api) AchievementCategories() (res []int, err error)

AchievementCategories list of all achievement categories

func (*GW2Api) AchievementCategoryIds

func (gw2 *GW2Api) AchievementCategoryIds(lang string, ids ...int) (achievs []AchievementCategory, err error)

AchievementCategoryIds localized achievement categories by id

func (*GW2Api) AchievementGroupIds

func (gw2 *GW2Api) AchievementGroupIds(lang string, ids ...string) (achievs []AchievementGroup, err error)

AchievementGroupIds localized achievement groups by id

func (*GW2Api) AchievementGroups

func (gw2 *GW2Api) AchievementGroups() (res []string, err error)

AchievementGroups list of all achievement groups

func (*GW2Api) AchievementIds

func (gw2 *GW2Api) AchievementIds(lang string, ids ...int) (achievs []Achievement, err error)

AchievementIds localized achievement details via ids

func (*GW2Api) AchievementPages

func (gw2 *GW2Api) AchievementPages(lang string, page, pageSize int) (achievs []Achievement, err error)

AchievementPages returns a paginated list of all achievements. Use it to grab all achievements from the API. Return values are localized to lang

func (*GW2Api) Achievements

func (gw2 *GW2Api) Achievements() (res []int, err error)

Achievements - List of all achievement ids

func (*GW2Api) AchievementsDaily

func (gw2 *GW2Api) AchievementsDaily() (achievs DailyAchievements, err error)

AchievementsDaily returns the daily achievements which can be completed today

func (*GW2Api) AchievementsDailyTomorrow

func (gw2 *GW2Api) AchievementsDailyTomorrow() (achievs DailyAchievements, err error)

AchievementsTomorrow returns the daily achievements which can be completed tomorrow

func (*GW2Api) Build

func (gw2 *GW2Api) Build() (v int, err error)

Build returns the current Guild Wars 2 build

func (*GW2Api) CharacterIds

func (gw2 *GW2Api) CharacterIds(ids ...string) (chars []Character, err error)

CharacterIds requests detailed information about the characters requested via the IDs. The IDs can also be character names as e.g. provided by the Characters() API Call Requires authentication

func (*GW2Api) Characters

func (gw2 *GW2Api) Characters() (res []string, err error)

Characters returns an array of character names associated with the account. The names can be used to request detailed information via CharacterIds() Requires authentication

func (*GW2Api) CharactersPage

func (gw2 *GW2Api) CharactersPage(page, pageSize int) (chars []Character, err error)

CharactersPage allows pagination for the character objects and enables the request of all character objects Requires authentication

func (*GW2Api) ColorIds

func (gw2 *GW2Api) ColorIds(lang string, ids ...int) (colors []Color, err error)

ColorIds fetch localized details on the requested colors

func (*GW2Api) Colors

func (gw2 *GW2Api) Colors() (res []int, err error)

Colors list of color ids

func (*GW2Api) CommerceExchangeCoins

func (gw2 *GW2Api) CommerceExchangeCoins(quantity int64) (res Exchange, err error)

CommerceExchangeCoins returns the amount of gems given for the quantity of gems

func (*GW2Api) CommerceExchangeGems

func (gw2 *GW2Api) CommerceExchangeGems(quantity int) (res Exchange, err error)

CommerceExchangeGems returns the amount of gold given for the quantity of coin

func (*GW2Api) CommerceListingIds

func (gw2 *GW2Api) CommerceListingIds(ids ...int) (articles []ArticleListing, err error)

CommerceListingIds returns the article listings for the provided ids

func (*GW2Api) CommerceListingPages

func (gw2 *GW2Api) CommerceListingPages(page int, pageSize int) (res []ArticleListing, err error)

CommerceListingPages for paginating through all existing listings

func (*GW2Api) CommerceListings

func (gw2 *GW2Api) CommerceListings() (res []int, err error)

CommerceListings returns a list of all current transactions ids

func (*GW2Api) CommercePriceIds

func (gw2 *GW2Api) CommercePriceIds(ids ...int) (artprices []ArticlePrice, err error)

CommercePriceIds returns price information about the requested ids

func (*GW2Api) CommercePrices

func (gw2 *GW2Api) CommercePrices() (res []int, err error)

CommercePrices returns a list of all ids

func (*GW2Api) CommerceTransactionsCurrentBuys

func (gw2 *GW2Api) CommerceTransactionsCurrentBuys() (trans []Transaction, err error)

CommerceTransactionsCurrentBuys returns all current buy orders of the account

func (*GW2Api) CommerceTransactionsCurrentSells

func (gw2 *GW2Api) CommerceTransactionsCurrentSells() (trans []Transaction, err error)

CommerceTransactionsCurrentSells returns all current sell orders of the account

func (*GW2Api) CommerceTransactionsHistoryBuys

func (gw2 *GW2Api) CommerceTransactionsHistoryBuys() (trans []Transaction, err error)

CommerceTransactionsHistoryBuys returns all past buy orders of the account for the last 90 days

func (*GW2Api) CommerceTransactionsHistorySells

func (gw2 *GW2Api) CommerceTransactionsHistorySells() (trans []Transaction, err error)

CommerceTransactionsHistorySells returns all past sell orders of the account for the last 90 days

func (*GW2Api) ContinentFloorRegionMapPois

func (gw2 *GW2Api) ContinentFloorRegionMapPois(continent, floor, region, mapID int) (pois []int, err error)

ContinentFloorRegionMapPois returns all points of interest on the continent, floor, region and map

func (*GW2Api) ContinentFloorRegionMapSectors

func (gw2 *GW2Api) ContinentFloorRegionMapSectors(continent, floor, region, mapID int) (sectors []int, err error)

ContinentFloorRegionMapSectors returns all sectors on the continent, floor, region and map

func (*GW2Api) ContinentFloorRegionMapTasks

func (gw2 *GW2Api) ContinentFloorRegionMapTasks(continent, floor, region, mapID int) (tasks []int, err error)

ContinentFloorRegionMapTasks returns all taskson the continent, floor, region and map

func (*GW2Api) ContinentFloorRegionMaps

func (gw2 *GW2Api) ContinentFloorRegionMaps(continent, floor, region int) (maps []int, err error)

ContinentFloorRegionMaps returns all maps ont he continent, floor and region

func (*GW2Api) ContinentFloorRegions

func (gw2 *GW2Api) ContinentFloorRegions(continent, floor int) (regions []int, err error)

ContinentFloorRegions returns all regions on the continent and floor

func (*GW2Api) ContinentFloors

func (gw2 *GW2Api) ContinentFloors(continent int) (floors []int, err error)

ContinentFloors returns all floor ids on the continent

func (*GW2Api) ContinentIds

func (gw2 *GW2Api) ContinentIds(lang string, ids ...int) (conts []Continent, err error)

ContinentIds returns continent information localized to lang for requested ids

func (*GW2Api) Continents

func (gw2 *GW2Api) Continents() (res []int, err error)

Continents reutns a list of continent ids. Only 1 = Tyria and 2 = Mists for now

func (*GW2Api) Currencies

func (gw2 *GW2Api) Currencies() (res []int, err error)

Currencies list of them

func (*GW2Api) CurrencyIds

func (gw2 *GW2Api) CurrencyIds(lang string, ids ...int) (currencies []Currency, err error)

CurrencyIds localized currency information

func (*GW2Api) FileIds

func (gw2 *GW2Api) FileIds(ids ...string) (files []File, err error)

FileIds grabs the icon names to the id

func (*GW2Api) Files

func (gw2 *GW2Api) Files() (res []string, err error)

Files - List of available icons on the API

func (*GW2Api) GuildEmblemBackgroundIds

func (gw2 *GW2Api) GuildEmblemBackgroundIds(ids ...int) (layers []EmblemLayers, err error)

GuildEmblemBackgroundIds returns the layers for the requested backgrounds

func (*GW2Api) GuildEmblemForegroundIds

func (gw2 *GW2Api) GuildEmblemForegroundIds(ids ...int) (layers []EmblemLayers, err error)

GuildEmblemForegroundIds returns the layers for the requested foregrounds

func (*GW2Api) GuildEmblems

func (gw2 *GW2Api) GuildEmblems() (foreground []int, background []int, err error)

GuildEmblems returns two lists for all emblem layers

func (*GW2Api) GuildLog

func (gw2 *GW2Api) GuildLog(id string) (log []GuildLogEntry, err error)

GuildLog returns up to a 100 of each type of log entry

func (*GW2Api) GuildMembers

func (gw2 *GW2Api) GuildMembers(id string) (member []GuildMember, err error)

GuildMembers returns a list of all members

func (*GW2Api) GuildPermissionIds

func (gw2 *GW2Api) GuildPermissionIds(ids ...string) (guild []GuildPermission, err error)

GuildPermissionIds Names/Description of permissions

func (*GW2Api) GuildPermissions

func (gw2 *GW2Api) GuildPermissions() (res []string, err error)

GuildPermissions Grab them all

func (*GW2Api) GuildPvPTeams

func (gw2 *GW2Api) GuildPvPTeams(id string) (teams []GuildTeam, err error)

GuildPvPTeams returns a list of teams for a guild

func (*GW2Api) GuildRanks

func (gw2 *GW2Api) GuildRanks(id string) (guild []GuildRank, err error)

GuildRanks Show all ranks in the guild

func (*GW2Api) GuildStashes

func (gw2 *GW2Api) GuildStashes(id string) (stash []GuildStash, err error)

GuildStashes returns a list of all guild bank tabs and their content

func (*GW2Api) GuildTreasuries

func (gw2 *GW2Api) GuildTreasuries(id string) (treasury []GuildTreasury, err error)

GuildTreasuries returns a list of all currently needed items for any guild upgrade

func (*GW2Api) GuildUpgradeIds

func (gw2 *GW2Api) GuildUpgradeIds(lang string, ids ...int) (guild []GuildUpgrade, err error)

GuildUpgradeIds Translated information

func (*GW2Api) GuildUpgrades

func (gw2 *GW2Api) GuildUpgrades() (res []int, err error)

GuildUpgrades Get them all

func (*GW2Api) HasPermission

func (gw2 *GW2Api) HasPermission(p Permission) bool

HasPermission checks for permissions of the API Key provided by the user

func (*GW2Api) ItemDetails

func (gw2 *GW2Api) ItemDetails(page int, pageSize int, lang string, ids ...int) ([]Item, error)

ItemDetails returns a list of items depending on the parameters either with pagination or as requested by ids

func (*GW2Api) ItemIds

func (gw2 *GW2Api) ItemIds(lang string, ids ...int) (items []Item, err error)

ItemIds returns a list of detailed item description for the requested ids. Names of the items are localized according to the lang parameter

func (*GW2Api) ItemPages

func (gw2 *GW2Api) ItemPages(page int, pageSize int, lang string) (items []Item, err error)

ItemPages returns a list of detailed item description for the requested page. Names of the items are localized according to the lang parameter

func (*GW2Api) Items

func (gw2 *GW2Api) Items() (res []int, err error)

Items returns a list of all item ids.

func (*GW2Api) MapIds

func (gw2 *GW2Api) MapIds(lang string, ids ...int) (maps []Map, err error)

MapIds returns the map information localized to lang for requested ids

func (*GW2Api) Maps

func (gw2 *GW2Api) Maps() (res []int, err error)

Maps returns a list of all map ids

func (*GW2Api) MatchIds

func (gw2 *GW2Api) MatchIds(ids ...string) (match []Match, err error)

MatchIds returns matches as requested by ids in the form provided by Matches(). Use special id `all` for every match in US/EU

func (*GW2Api) MatchWorld

func (gw2 *GW2Api) MatchWorld(worldID int) (match Match, err error)

MatchWorld finds the match the server id is participating in

func (*GW2Api) Matches

func (gw2 *GW2Api) Matches() (res []string, err error)

Matches returns a list of all current match ids in the form of %d-%d

func (*GW2Api) MiniIds

func (gw2 *GW2Api) MiniIds(lang string, ids ...int) (minis []Mini, err error)

MiniIds returns the detailed information about requested minis localized to lang

func (*GW2Api) Minis

func (gw2 *GW2Api) Minis() (res []int, err error)

Minis returns a list of all mini ids

func (*GW2Api) ObjectiveIds

func (gw2 *GW2Api) ObjectiveIds(lang string, ids ...string) (objs []Objective, err error)

ObjectiveIds returns a list of objectives as request by ids. Use special id `all` to request all objectives

func (*GW2Api) Objectives

func (gw2 *GW2Api) Objectives() (res []string, err error)

Objectives returns a list of all objectives on wvw maps

func (*GW2Api) PvPGameIds

func (gw2 *GW2Api) PvPGameIds(ids ...string) (games []PvPGameStats, err error)

PvPGameIds fetches the details for the requested ids

func (*GW2Api) PvPGames

func (gw2 *GW2Api) PvPGames() (res []string, err error)

PvPGames lists the last 10 match ids

func (*GW2Api) PvPSeasonID

func (gw2 *GW2Api) PvPSeasonID(lang string, id string) (res PvPSeason, err error)

PvPSeasonID fetches information on a season id

func (*GW2Api) PvPSeasons

func (gw2 *GW2Api) PvPSeasons() (res []string, err error)

PvPSeasons returns a list of season ids

func (*GW2Api) PvPStandings

func (gw2 *GW2Api) PvPStandings() (res []PvPSeasonStanding, err error)

PvPStandings fetches the current and previsous standings during the pvp seasons

func (*GW2Api) PvPStats

func (gw2 *GW2Api) PvPStats() (stats PvPStats, err error)

PvPStats all current players stats. Requires authentication

func (*GW2Api) QuagganIds

func (gw2 *GW2Api) QuagganIds(ids ...string) (quag []Quaggan, err error)

QuagganIds ids -> urls for the quaggan images

func (*GW2Api) Quaggans

func (gw2 *GW2Api) Quaggans() (res []string, err error)

Quaggans list of all quaggan ids

func (*GW2Api) RecipeIds

func (gw2 *GW2Api) RecipeIds(ids ...int) (recipes []Recipe, err error)

RecipeIds returns the details on the requested recipes

func (*GW2Api) RecipeSearchInput

func (gw2 *GW2Api) RecipeSearchInput(input int) ([]int, error)

RecipeSearchInput searches for recipes which use the input item id

func (*GW2Api) RecipeSearchOutput

func (gw2 *GW2Api) RecipeSearchOutput(output int) ([]int, error)

RecipeSearchOutput searches for recipes which output the item id

func (*GW2Api) Recipes

func (gw2 *GW2Api) Recipes() (res []int, err error)

Recipes returns list of recipe ids.

func (*GW2Api) Render

func (gw2 *GW2Api) Render(signature string, fileID int) (img image.Image, err error)

Render fetches a pre-rendered PNG image for the requested ressource

func (*GW2Api) SetAuthentication

func (gw2 *GW2Api) SetAuthentication(auth string) (err error)

SetAuthentication adds authentication to a previously un-authenticated instance of GW2Api

func (*GW2Api) SetAuthenticationWithoutCheck

func (gw2 *GW2Api) SetAuthenticationWithoutCheck(authRaw string, permissions []string) (err error)

SetAuthentication adds authentication to a previously un-authenticated If permissions is not empty, the api key is assumed to have been working in the past, so it won't waste the limited GW2api calls by checking the apikey with v2/tokeninfo instance of GW2Api

func (*GW2Api) SetTimeout

func (gw2 *GW2Api) SetTimeout(t time.Duration)

SetTimeout set HTTP timeout for all new HTTP connections started from this instance

func (*GW2Api) SharedInventory

func (gw2 *GW2Api) SharedInventory() (slots []SharedInventorySlot, err error)

SharedInventory returns the list of items currently in the shared inventory

func (*GW2Api) SkinIds

func (gw2 *GW2Api) SkinIds(lang string, ids ...int) (skins []Skin, err error)

SkinIds returns the skin details as requested by the ids parameter.

func (*GW2Api) Skins

func (gw2 *GW2Api) Skins() (res []int, err error)

Skins returns a list of all current skin ids

func (*GW2Api) SpecializationIds

func (gw2 *GW2Api) SpecializationIds(lang string, ids ...int) (specs []DetailSpecialization, err error)

SpecializationIds returns a localized detail object for the requested ids

func (*GW2Api) Specializations

func (gw2 *GW2Api) Specializations() (res []int, err error)

Specializations returns the list of all

func (*GW2Api) Tile

func (gw2 *GW2Api) Tile(continent, floor, zoom, x, y int) (img image.Image, err error)

Tile fetches a rendered JPEG tile for the game map on the requested continent/floor at zoom level and for the coordinates

func (*GW2Api) TokenInfo

func (gw2 *GW2Api) TokenInfo() (token TokenInfo, err error)

TokenInfo requests the token information from the authenticated API Requires authentication

func (*GW2Api) TraitIds

func (gw2 *GW2Api) TraitIds(lang string, ids ...int) (traits []Trait, err error)

TraitIds details on the requested traits. Localized to lang

func (*GW2Api) Traits

func (gw2 *GW2Api) Traits() (res []int, err error)

Traits a list of all traits

func (*GW2Api) WorldIds

func (gw2 *GW2Api) WorldIds(lang string, ids ...int) (worlds []World, err error)

WorldIds localized names of the worlds requested

func (*GW2Api) Worlds

func (gw2 *GW2Api) Worlds() (res []int, err error)

Worlds list of all worlds

type GuildLogEntry

type GuildLogEntry struct {
	ID   int       `json:"id"`
	Time time.Time `json:"time"`
	Type string    `json:"type"`
	//type = treasury
	ItemID int `json:"item_id"`
	Count  int `json:"count"`
	//type = motd
	Motd string `json:"motd"`
	//type = (motd|joined|invited)
	User string `json:"user"`
	//type = influence
	Activity          string   `json:"activity"`
	TotalParticipants int      `json:"total_participants"`
	Participants      []string `json:"participants"`
	//type = rank_change
	ChangedBy string `json:"changed_by"`
	OldRank   string `json:"old_rank"`
	NewRank   string `json:"new_rank"`
	//type = invited
	InvitedBy string `json:"invited_by"`
	//type = stash
	Operation string `json:"operation"`
	Coints    int    `json:"coins"`
	//type = upgrade
	UpgradeID int    `json:"upgrade_id"`
	Action    string `json:"action"`
}

GuildLogEntry returns information about certain events in a guild's log

type GuildMember

type GuildMember struct {
	Name   string    `json:"name"`
	Rank   string    `json:"rank"`
	Joined time.Time `json:"joined"`

	// Only as part of guild team
	Role string `json:"role"`
}

GuildMember Accountname, current rank and date they joined

type GuildPermission

type GuildPermission struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

GuildPermission Name/Desc basically

type GuildRank

type GuildRank struct {
	ID          string   `json:"id"`
	Order       int      `json:"order"`
	Permissions []string `json:"permissions"`
}

GuildRank Granted Permissions and Order to sorty by

type GuildStash

type GuildStash struct {
	UpgradeID int              `json:"upgrade_id"`
	Size      int              `json:"size"`
	Coins     int              `json:"coins"`
	Inventory []GuildStashItem `json:"inventory"`
}

GuildStash represents a bank tab in the guild bank

type GuildStashItem

type GuildStashItem struct {
	ID    int `json:"id"`
	Count int `json:"count"`
}

GuildStashItem represents a single slot in one of the bank tabs

type GuildTeam

type GuildTeam struct {
	ID        int            `json:"id"`
	Members   []GuildMember  `json:"members"`
	Name      string         `json:"name"`
	Aggregate WinLoss        `json:"aggregate"`
	Ladders   LadderStats    `json:"ladders"`
	Games     PvPGameStats   `json:"games"`
	Seasons   GuildTeamStats `json:"seasons"`
}

GuildTeam a designated team for PvP

type GuildTeamStats

type GuildTeamStats struct {
	SeasonID string `json:"id"`
	Wins     int    `json:"wins"`
	Losses   int    `json:"losses"`
	Rating   int    `json:"rating"`
}

GuildTeamStats per season stats of a guild team

type GuildTreasury

type GuildTreasury struct {
	ID       int                    `json:"id"`
	Count    int                    `json:"count"`
	NeededBy []GuildTreasuryUpgrade `json:"needed_by"`
}

GuildTreasury represents the need for an item. NeededBy show the upgrades needing it

type GuildTreasuryUpgrade

type GuildTreasuryUpgrade struct {
	UpgradeID int `json:"upgrade_id"`
	Count     int `json:"count"`
}

GuildTreasuryUpgrade represents an upgrade which requires the parent ressource

type GuildUpgrade

type GuildUpgrade struct {
	ID            int                `json:"id"`
	Name          string             `json:"name"`
	Description   string             `json:"description"`
	BuildTime     int                `json:"build_time"`
	Icon          string             `json:"icon"`
	Type          string             `json:"type"`
	RequiredLevel int                `json:"required_level"`
	Experience    int                `json:"experience"`
	Prerequisites []int              `json:"prerequisites"`
	Costs         []GuildUpgradeCost `json:"costs"`
}

GuildUpgrade All the Upgrade Information

type GuildUpgradeCost

type GuildUpgradeCost struct {
	Type   string `json:"type"`
	Count  int    `json:"count"`
	Name   string `json:"name"`
	ItemID int    `json:"item_id"`
}

GuildUpgradeCost specific costs of an upgrade. Type like Collection or Item

type Gw2Model

type Gw2Model struct {
	DbCreated time.Time `gorm:"default:CURRENT_TIMESTAMP"`
	DbUpdated time.Time `gorm:"default:CURRENT_TIMESTAMP"`
}

func (*Gw2Model) BeforeCreate

func (ent *Gw2Model) BeforeCreate() (err error)

func (*Gw2Model) BeforeSave

func (ent *Gw2Model) BeforeSave() (err error)

type InventoryItem

type InventoryItem struct {
	ID    int `json:"id"`
	Count int `json:"count"`
}

InventoryItem Item in a characters inventory and their count

type Item

type Item struct {
	ID           int                    `json:"id"`
	Name         string                 `json:"name"`
	Icon         string                 `json:"icon"`
	Description  string                 `json:"description,omitempty"`
	Type         string                 `json:"type"`
	Rarity       string                 `json:"rarity"`
	Level        int                    `json:"level"`
	VendorValue  int                    `json:"vendor_value"`
	DefaultSkin  int                    `json:"default_skin"`
	GameTypes    []string               `json:"game_types"`
	Flags        []string               `json:"flags"`
	Restrictions []string               `json:"restrictions"`
	Details      map[string]interface{} `json:"details"`
}

Item includes detailed information about items as requested by the endpoints

type LadderStats

type LadderStats struct {
	Ranked   WinLoss `json:"ranked"`
	UnRanked WinLoss `json:"unranked"`
}

LadderStats WinLoss per queue

type Listing

type Listing struct {
	Listings  int `json:"listings"`
	UnitPrice int `json:"unit_price"`
	Quantity  int `json:"quantity"`
}

Listing includes number of listings at the unit price with respective quantity

type Map

type Map struct {
	ID            int       `json:"id"`
	Name          string    `json:"name"`
	MinLevel      int       `json:"min_level"`
	MaxLevel      int       `json:"max_level"`
	DefaultFloor  int       `json:"default_floor"`
	Floors        []int     `json:"floors"`
	RegionID      int       `json:"region_id"`
	RegionName    string    `json:"region_name"`
	ContinentID   int       `json:"continent_id"`
	ContinentName string    `json:"continent_name"`
	MapRect       [2][2]int `json:"map_rect"`
	ContinentRect [2][2]int `json:"continent_rect"`
}

Map holds specific map details. ContinentID and RegionID can be used with the API to find higher orders of association

type MapWvW

type MapWvW struct {
	ID         int              `json:"id"`
	Type       string           `json:"type"`
	Scores     TeamAssoc        `json:"scores"`
	Bonuses    []Bonus          `json:"bonuses"`
	Deaths     TeamAssoc        `json:"deaths"`
	Kills      TeamAssoc        `json:"kills"`
	Objectives []MatchObjective `json:"objectives"`
}

MapWvW - One of the four maps and their status

type Match

type Match struct {
	ID        string    `json:"id"`
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`
	Scores    TeamAssoc `json:"scores"`
	Worlds    TeamAssoc `json:"worlds"`
	AllWorlds TeamMulti `json:"all_worlds"`
	Deaths    TeamAssoc `json:"deaths"`
	Kills     TeamAssoc `json:"kills"`
	Maps      []MapWvW  `json:"maps"`
}

Match including overall stats and indivdual maps with stats

type MatchObjective

type MatchObjective struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	Owner       string `json:"owner"`
	LastFlipped string `json:"last_flipped"`
	ClaimedBy   string `json:"claimed_by"`
	ClaimedAt   string `json:"claimed_at"`
}

MatchObjective - Map objectives such as towers, keeps, etc

type MaterialItem

type MaterialItem struct {
	ID       int `json:"id"`
	Count    int `json:"count"`
	Category int `json:"category"`
}

MaterialItem represents a material stored in the material storage of the player Requires authentication

type Mini

type Mini struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Icon   string `json:"icon"`
	Order  int    `json:"order"`
	ItemID int    `json:"item_id"`
}

Mini has the basic information and the associated item id for the mini

type Objective

type Objective struct {
	ID       string    `json:"id"`
	Name     string    `json:"name"`
	SectorID int       `json:"sector_id"`
	Type     string    `json:"type"`
	MapType  string    `json:"map_type"`
	MapID    int       `json:"map_id"`
	Coord    []float32 `json:"coord"`
	Marker   string    `json:"marker"`
}

Objective - Map objectives such as towers, keeps, etc

type Permission

type Permission uint

Permission abstracts the bitmask containing permission information

const (
	PermAccount Permission = iota
	PermCharacter
	PermInventory
	PermTradingpost
	PermWallet
	PermUnlocks
	PermPvP
	PermBuilds
	PermProgression
	PermGuilds
	PermSize
)

Perm* represent the specific permission as required by the API

type PetSelection

type PetSelection struct {
	Terrestrial []int `json:"terrestrial"`
	Aquatic     []int `json:"aquatic"`
}

PetSelection for rangers

type Price

type Price struct {
	Quantity  int `json:"quantity"`
	UnitPrice int `json:"unit_price"`
}

Price includes quantity and the high/low price

type ProfessionStats

type ProfessionStats struct {
	Elementalist WinLoss `json:"elementalist"`
	Engineer     WinLoss `json:"engineer"`
	Guardian     WinLoss `json:"guardian"`
	Mesmer       WinLoss `json:"mesmer"`
	Necromancer  WinLoss `json:"necromancer"`
	Ranger       WinLoss `json:"ranger"`
	Revenant     WinLoss `json:"revenant"`
	Thief        WinLoss `json:"thief"`
	Warrior      WinLoss `json:"warrior"`
}

ProfessionStats WinLoss per profession

type PvPDivision

type PvPDivision struct {
	Name      string    `json:"name"`
	Flags     []string  `json:"flags"`
	LargeIcon string    `json:"large_icon"`
	SmallIcon string    `json:"small_icon"`
	PipIcon   string    `json:"pip_icon"`
	Tiers     []PvPTier `json:"tiers"`
}

PvPDivision mostly for graphical interfaces

type PvPGameScore

type PvPGameScore struct {
	Red  int `json:"red"`
	Blue int `json:"blue"`
}

PvPGameScore single games final score

type PvPGameStats

type PvPGameStats struct {
	ID         string       `json:"id"`
	MapID      int          `json:"map_id"`
	Started    time.Time    `json:"started"`
	Ended      time.Time    `json:"ended"`
	Result     string       `json:"result"`
	Team       string       `json:"team"`
	Profession string       `json:"profession"`
	Scores     PvPGameScore `json:"scores"`
	RatingType string       `json:"rating_type"`
}

PvPGameStats all information about a match

type PvPSeason

type PvPSeason struct {
	ID        string        `json:"id"`
	Name      string        `json:"name"`
	Start     time.Time     `json:"start"`
	End       time.Time     `json:"end"`
	Active    bool          `json:"active"`
	Divisions []PvPDivision `json:"divisions"`
}

PvPSeason Meta object for pvp seasons

type PvPSeasonStanding

type PvPSeasonStanding struct {
	Current  PvPStanding `json:"current"`
	Best     PvPStanding `json:"best"`
	SeasonID string      `json:"season_id"`
}

PvPSeasonStanding meta object for the call

type PvPStanding

type PvPStanding struct {
	TotalPoints int `json:"total_points"`
	Division    int `json:"division"`
	Tier        int `json:"tier"`
	Points      int `json:"points"`
	Repeats     int `json:"repeats"`
}

PvPStanding TotalPoints is the definitive amount

type PvPStats

type PvPStats struct {
	PvPRank          int             `json:"pvp_rank"`
	PvPRankPoints    int             `json:"pvp_rank_points"`
	PvPRankRollovers int             `json:"pvp_rank_rollovers"`
	Aggregate        WinLoss         `json:"aggregate"`
	Professions      ProfessionStats `json:"professions"`
	Ladders          LadderStats     `json:"ladders"`
}

PvPStats Meta object for the stats

type PvPTier

type PvPTier struct {
	Points int `json:"points"`
}

PvPTier unnecessary really

type Quaggan

type Quaggan struct {
	ID  string `json:"id"`
	URL string `json:"url"`
}

Quaggan id and url of the image

type Recipe

type Recipe struct {
	ID              int                `json:"id"`
	Type            string             `json:"type"`
	OutputItemID    int                `json:"output_item_id"`
	OutputItemCount int                `json:"output_item_count"`
	TimeToCraftMS   int                `json:"time_to_craft_ms"`
	Disciplines     []string           `json:"disciplines"`
	MinRating       int                `json:"min_rating"`
	Flags           []string           `json:"flags"`
	Ingredients     []RecipeIngredient `json:"ingredients"`
}

Recipe meta object for the recipes

type RecipeIngredient

type RecipeIngredient struct {
	ItemID int `json:"item_id"`
	Count  int `json:"count"`
}

RecipeIngredient for the ingredient list

type SharedInventorySlot

type SharedInventorySlot struct {
	ID      int    `json:"id"`
	Count   int    `json:"count"`
	Binding string `json:"binding"`
}

SharedInventorySlot Self-explanatory

type Skill

type Skill struct {
	ID           int           `json:"id"`
	Name         string        `json:"name"`
	Description  string        `json:"description"`
	Icon         string        `json:"icon"`
	Facts        []Fact        `json:"facts"`
	TraitedFacts []TraitedFact `json:"traited_facts"`
}

Skill with associated facts

type SkillSelection

type SkillSelection struct {
	Legends []string     `json:"legends"`
	Heal    int          `json:"heal"`
	Utility []int        `json:"utility"`
	Elite   int          `json:"elite"`
	Pets    PetSelection `json:"pets"`
}

SkillSelection shows the currently selected heals, utility elite and legends

type Skills

type Skills struct {
	PvE SkillSelection `json:"pve"`
	PvP SkillSelection `json:"pvp"`
	WvW SkillSelection `json:"wvw"`
}

Skills per game type

type Skin

type Skin struct {
	ID           int         `json:"id"`
	Name         string      `json:"name"`
	Type         string      `json:"type"`
	Flags        []string    `json:"flags"`
	Restrictions []string    `json:"restrictions"`
	Icon         string      `json:"icon"`
	Description  string      `json:"description"`
	Details      SkinDetails `json:"details"`
}

Skin all information on the skin

type SkinDetails

type SkinDetails struct {
	Type        string `json:"type"`
	WeightClass string `json:"weight_class"`
	DamageType  string `json:"damage_type"`
}

SkinDetails Either WeightClass(Armor) or DamageType(Weapon) is set depending on Type

type Specalizations

type Specalizations struct {
	PvE []Specialization `json:"pve"`
	PvP []Specialization `json:"pvp"`
	WvW []Specialization `json:"wvw"`
}

Specalizations is a meta object which holds the specalizations associated with the different game types

type Specialization

type Specialization struct {
	ID     int   `json:"id"`
	Traits []int `json:"trait"`
}

Specialization represents the currently selected one and includes all active traits on the character

type TeamAssoc

type TeamAssoc struct {
	Green int `json:"green"`
	Blue  int `json:"blue"`
	Red   int `json:"red"`
}

TeamAssoc Points/Kills/Deaths per team

type TeamMulti

type TeamMulti struct {
	Green []int `json:"green"`
	Blue  []int `json:"blue"`
	Red   []int `json:"red"`
}

TeamMulti Used in multi association for teams

type TokenInfo

type TokenInfo struct {
	Gw2Model
	LastSuccess time.Time      `gorm:"default:CURRENT_TIMESTAMP"`
	ID          string         `json:"id" gorm:"type:varchar(64)"`
	Name        string         `json:"name" gorm:"type:varchar(128);NOT NULL"`
	APIKey      string         `json:"apikey" gorm:"type:varchar(128);NOT NULL"`
	AccountID   string         `json:"accountid" gorm:"type:varchar(64);NOT NULL"`
	Permissions pq.StringArray `json:"permissions" gorm:"type:varchar(255)[]"`
}

TokenInfo contains information about the provided API Key of the user. Including the name of the key as set by the user and the permissions associated with it

func (*TokenInfo) Persist

func (ent *TokenInfo) Persist(apikey string, accountID string) (err error)

func (*TokenInfo) UpdateLastAttemptedUpdate

func (ent *TokenInfo) UpdateLastAttemptedUpdate() (err error)

func (*TokenInfo) UpdateLastSuccessfulUpdate

func (ent *TokenInfo) UpdateLastSuccessfulUpdate() (err error)

type Trait

type Trait struct {
	ID             int           `json:"id"`
	Name           string        `json:"icon"`
	Icon           string        `json:"icon"`
	Description    string        `json:"description"`
	Specialization int           `json:"specialization"`
	Tier           int           `json:"tier"`
	Order          int           `josn:"order"`
	Slot           string        `json:"slot"`
	Facts          []Fact        `json:"facts"`
	TraitedFacts   []TraitedFact `json:"traited_facts"`
	Skills         []Skill       `json:"skills"`
}

Trait overview with facts

type TraitedFact

type TraitedFact Fact

TraitedFact has some extra attributes

type Transaction

type Transaction struct {
	ID        int    `json:"id"`
	ItemID    int    `json:"item_id"`
	Price     int    `json:"price"`
	Quantity  int    `json:"quantity"`
	Created   string `json:"created"`
	Purchased string `json:"purchased"`
}

Transaction represents one of the accounts listed buy or sell orders

type WalletCurrency

type WalletCurrency struct {
	ID    int `json:"id"`
	Value int `json:"value"`
}

WalletCurrency represents a currency and the amount owned by the player

type WinLoss

type WinLoss struct {
	Wins       int `json:"wins"`
	Losses     int `json:"losses"`
	Desertions int `json:"desertions"`
	Byes       int `json:"byes"`
	Forfeits   int `json:"forfeits"`
}

WinLoss includes the detailed information over all exit stati

type World

type World struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

World id <-> name

Jump to

Keyboard shortcuts

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