gw2api

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 7 Imported by: 5

README

GW2API

A Guild Wars 2 API Client in Go.

Supported Endpoints

  • /v2/achievements

  • /v2/achievements/daily

  • /v2/achievements/daily/tomorrow

  • /v2/achievements/groups

  • /v2/achievements/categories

  • /v2/account

  • /v2/account/achievements

  • /v2/account/bank

  • /v2/account/dailycrafting

  • /v2/account/dungeons

  • /v2/account/dyes

  • /v2/account/finishers

  • /v2/account/gliders

  • /v2/account/home/cats

  • /v2/account/home/nodes

  • /v2/account/inventory

  • /v2/account/luck

  • /v2/account/mailcarriers

  • /v2/account/mapchests

  • /v2/account/masteries

  • /v2/account/mastery/points

  • /v2/account/materials

  • /v2/account/minis

  • /v2/account/mounts/skins

  • /v2/account/mounts/types

  • /v2/account/novelties

  • /v2/account/outfits

  • /v2/account/pvp/heroes

  • /v2/account/raids

  • /v2/account/recipes

  • /v2/account/skins

  • /v2/account/titles

  • /v2/account/wallet

  • /v2/account/worldbosses

  • /v2/characters

  • /v2/commerce/transactions

  • /v2/pvp/stats

  • /v2/pvp/games

  • /v2/pvp/standings

  • /v2/tokeninfo

  • /v2/dailycrafting

  • /v2/mapchests

  • /v2/worldbosses

  • /v2/masteries

  • /v2/mounts

  • /v2/mounts/skins

  • /v2/mounts/types

  • /v2/outfits

  • /v2/pets

  • /v2/professions

  • /v2/races

  • /v2/specializations

  • /v2/skills

  • /v2/traits

  • /v2/legends

  • /v2/guild/:id

  • /v2/emblem

  • /v2/guild/permissions

  • /v2/guild/search

  • /v2/guild/upgrades

  • /v2/guild/:id/log

  • /v2/guild/:id/members

  • /v2/guild/:id/ranks

  • /v2/guild/:id/stash

  • /v2/guild/:id/treasury

  • /v2/guild/:id/teams

  • /v2/guild/:id/upgrades

  • /v2/home/cats

  • /v2/home/nodes

  • /v2/finishers

  • /v2/items

  • /v2/itemstats

  • /v2/materials

  • /v2/pvp/amulets

  • /v2/recipes

  • /v2/recipes/search

  • /v2/skins

  • /v2/continents

  • /v2/maps

  • /v2/build

  • /v2/colors

  • /v2/currencies

  • /v2/dungeons

  • /v2/files

  • /v2/quaggans

  • /v2/minis

  • /v2/novelties

  • /v2/raids

  • /v2/titles

  • /v2/worlds

  • /v2/backstory/answers

  • /v2/backstory/questions

  • /v2/stories

  • /v2/stories/seasons

  • /v2/quests

  • /v2/pvp

  • /v2/pvp/ranks

  • /v2/pvp/seasons

  • /v2/pvp/seasons/:id/leaderboards

  • /v2/commerce/delivery

  • /v2/commerce/exchange

  • /v2/commerce/exchange/coins

  • /v2/commerce/exchange/gems

  • /v2/commerce/listings

  • /v2/commerce/prices

  • /v2/commerce/transactions

  • /v2/wvw/abilities

  • /v2/wvw/matches

  • /v2/wvw/objectives

  • /v2/wvw/ranks

  • /v2/wvw/upgrades

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound           = errors.New("not found")
	ErrInvalidAccessToken = errors.New("Invalid access token")
)

Error constants

Functions

This section is empty.

Types

type Account

type Account struct {
	ID           string        `json:"id"`
	Name         string        `json:"name"`
	Age          time.Duration `json:"age"`
	World        int           `json:"world"`
	Guilds       []string      `json:"guilds"`
	GuildLeader  []string      `json:"guild_leader"`
	Created      time.Time     `json:"created"`
	Access       []string      `json:"access"`
	Commander    bool          `json:"commander"`
	FractalLevel int           `json:"fractal_level"`
	DailyAP      int           `json:"daily_ap"`
	MonthlyAP    int           `json:"monthly_ap"`
	WvWRank      int           `json:"wvw_rank"`
}

Account includes general information

type AccountAchievement

type AccountAchievement struct {
	ID      int  `json:"id"`
	Current int  `json:"current"`
	Max     int  `json:"max"`
	Done    bool `json:"done"`
}

AccountAchievement contains the unlock status for an achievement

type AccountBankItem

type AccountBankItem struct {
	ID                 int    `json:"id"`
	Count              int    `json:"count"`
	Skin               int    `json:"skin"`
	Upgrades           []int  `json:"upgrades"`
	UpgradeSlotIndices []int  `json:"upgrade_slot_indices"`
	Dyes               []int  `json:"dyes"`
	Binding            string `json:"binding"`
	Stats              struct {
		ID         int `json:"id"`
		Attributes struct {
		} `json:"attributes"`
	} `json:"stats"`
}

AccountBankItem is an item from the account bank

type AccountDailyCraftingItem

type AccountDailyCraftingItem struct {
	ID string `json:"id"`
}

AccountDailyCraftingItem is an object crafted daily

type AccountFinisher

type AccountFinisher struct {
	ID        int  `json:"id"`
	Permanent bool `json:"permanent"`
	Quantity  int  `json:"qantity"`
}

AccountFinisher is an finisher unluck for an account

type AccountHomeCat

type AccountHomeCat struct {
	ID   int    `json:"id"`
	Hint string `json:"hint"`
}

AccountHomeCat is a home cat node

type AccountLuck

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

AccountLuck is the accounts consumed luck

type AccountMastery

type AccountMastery struct {
	ID    string `json:"id"`
	Level int    `json:"level"`
}

AccountMastery contains the unlocked mastery level

type AccountMasteryPoints

type AccountMasteryPoints struct {
	Totals []struct {
		Region string `json:"region"` // The mastery region
		Spent  int    `json:"spent"`  // Amount of masteries of this region spent in mastery tracks
		Earned int    `json:"earned"` // Amount of masteries of this region earned for the account
	} `json:"totals"`
	Unlocked []int `json:"unlocked"` // Array of mastery ids
}

AccountMasteryPoints contains the accounts mastery points for each region

type BuildTemplate

type BuildTemplate struct {
	Name            string `json:"name"`
	Profession      string `json:"profession"`
	Specializations []struct {
		ID     int   `json:"id"`
		Traits []int `json:"traits"`
	} `json:"specializations"`
	Skills struct {
		Heal      int   `json:"heal"`
		Utilities []int `json:"utilities"`
		Elite     int   `json:"elite"`
	} `json:"skills"`
	AquaticSkills struct {
		Heal      int   `json:"heal"`
		Utilities []int `json:"utilities"`
		Elite     int   `json:"elite"`
	} `json:"aquatic_skills"`
}

BuildTemplate is a template in the accounts storage

type ItemStack added in v0.1.1

type ItemStack struct {
	ID        string `json:"id"`
	Count     int    `json:"count"`
	Charges   int    `json:"charges"`
	Skin      int    `json:"skin"`
	Upgrades  []int  `json:"upgrades"`
	Infusions []int  `json:"infusions"`
	Binding   string `json:"binding"`
	BoundTo   string `json:"bound_to"`
}

ItemStack is the data contained in requests that return stored items, e.g. bank or shared inventory

type Material

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

A Material is an item stored in the players vault/material storage

type Session

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

Session is used to make requests to the gw2api. It also handles authentication.

func New

func New() *Session

New creates a new gw2api session

func (*Session) GetAccount

func (s *Session) GetAccount() (account Account, err error)

GetAccount returns the owner account of the apikey provided

func (*Session) GetAccountAchievements

func (s *Session) GetAccountAchievements(ids ...int) (accountAchievements []*AccountAchievement, err error)

GetAccountAchievements returns the accounts achievement status for the given ids

func (*Session) GetAccountBuildStorage

func (s *Session) GetAccountBuildStorage(ids ...int) (buildstorage []*BuildTemplate, err error)

GetAccountBuildStorage returns all builds stored in the accounts build storage

func (*Session) GetAccountDailyCrafting

func (s *Session) GetAccountDailyCrafting(ids ...int) (items []*AccountDailyCraftingItem, err error)

GetAccountDailyCrafting returns the accounts daily crafted items

func (*Session) GetAccountDungeons

func (s *Session) GetAccountDungeons()

NOT YET IMPLEMENTED

func (*Session) GetAccountDyes

func (s *Session) GetAccountDyes() (dyes []int, err error)

GetAccountDyes returns all dye unlocks

func (*Session) GetAccountFinishers

func (s *Session) GetAccountFinishers() (finishers []*AccountFinisher, err error)

GetAccountFinishers returns all finisher unlocks

func (*Session) GetAccountGliders

func (s *Session) GetAccountGliders() (gliders []int, err error)

GetAccountGliders returns all glider unlocks

func (*Session) GetAccountHomeCats

func (s *Session) GetAccountHomeCats() (cats []*AccountHomeCat, err error)

GetAccountHomeCats returns all home cat unlocks

func (*Session) GetAccountHomeNodes

func (s *Session) GetAccountHomeNodes() (nodes []string, err error)

GetAccountHomeNodes returns all home node unlocks

func (*Session) GetAccountLuck

func (s *Session) GetAccountLuck() (luck AccountLuck, err error)

GetAccountLuck returns the accounts luck

func (*Session) GetAccountMapChests

func (s *Session) GetAccountMapChests() (chests []string, err error)

GetAccountMapChests returns all Hero's choice chests unlocked since daily reset

func (*Session) GetAccountMasteries

func (s *Session) GetAccountMasteries() (masteries []*AccountMastery, err error)

GetAccountMasteries returns all masteries and their levels unlocked

func (*Session) GetAccountMasteryPoints

func (s *Session) GetAccountMasteryPoints() (masteryPoints AccountMasteryPoints, err error)

GetAccountMasteryPoints returns the mastery points for each region

func (*Session) GetAccountMaterials

func (s *Session) GetAccountMaterials() (materials []*Material, err error)

GetAccountMaterials returns the accounts materials stored

func (*Session) GetAccountSharedInventory

func (s *Session) GetAccountSharedInventory() (items []*ItemSlot, err error)

GetAccountSharedInventory returns the items stored in the shared inventory slots

func (*Session) GetMailCarriers

func (s *Session) GetMailCarriers() (carries []int, err error)

GetMailCarries returns all mail carrier unlocks

func (*Session) GetTokenInfo

func (s *Session) GetTokenInfo() (tokeninfo TokenInfo, err error)

GetTokenInfo returns general information about the provided token

func (*Session) WithAccessToken

func (s *Session) WithAccessToken(token string) *Session

WithAccessToken sets an accesstoken for a session

func (*Session) WithEndpointAPI

func (s *Session) WithEndpointAPI(endpointApi string) *Session

WithEndpointAPI sets the API endpoint

func (*Session) WithLanguage

func (s *Session) WithLanguage(lang string) *Session

WithLanguage sets the sessions language

type TokenInfo

type TokenInfo struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Permissions []string `json:"permissions"`
}

TokenInfo contains general token information, such as the permissions

Jump to

Keyboard shortcuts

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