Documentation
¶
Overview ¶
Package api provides access to different APIs that are used by the bot as well as JSON unmarshal functions for specific API types
Index ¶
- type Achievement
- type ApiLedger
- type ApiOverview
- type ApiStringInt
- type ApiTimeRFC3339
- type BandTitle
- type BountyList
- type BountyListApi
- type CurrentLedger
- type DailyDeedImg
- type EventApiResponse
- type EventData
- type EventDataComponent
- type EventDataComponentData
- type FactionLedger
- type FactionNextLevel
- type FactionReputation
- type Factions
- type FriendsLedger
- type RandomFact
- type Route
- type SeasonProgress
- type SeasonTier
- type Seasons
- type SortedAchievement
- type Traderoutes
- type UrbanDict
- type UrbanDictEntry
- type UserAchievements
- type UserBalance
- type UserStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Achievement ¶
type Achievement struct {
Sort int `json:"Sort"`
Name string `json:"Name"`
Description string `json:"Description"`
MediaUrl string `json:"MediaUrl"`
}
Achievement is a subpart of the SortedAchievement API response
func GetLatestAchievement ¶
func GetLatestAchievement(hc *http.Client, rc string) (Achievement, error)
GetLatestAchievement calls the SoT achievements API endpoint and returns a Achievement struct
type ApiLedger ¶ added in v1.4.2
type ApiLedger struct {
Current CurrentLedger `json:"current"`
}
ApiLedger is the complete SoT faction ledger API endpoint response structure
type ApiOverview ¶
type ApiOverview struct {
Stats UserStats `json:"stats"`
}
type ApiStringInt ¶
type ApiStringInt int64
ApiStringInt is a type alias for a int64. It is meant to be used for example in API responses where an obvious Int is returned as string in the JSON
func (*ApiStringInt) UnmarshalJSON ¶
func (s *ApiStringInt) UnmarshalJSON(is []byte) error
UnmarshalJSON converts the ApiStringInt string into an int64
type ApiTimeRFC3339 ¶ added in v1.4.4
ApiTimeRFC3339 is an alias type for time.Time
func (ApiTimeRFC3339) Time ¶ added in v1.4.4
func (t ApiTimeRFC3339) Time() time.Time
Time returns the time.Time object of a ApiTimeRFC3339 type
func (*ApiTimeRFC3339) UnmarshalJSON ¶ added in v1.4.4
func (t *ApiTimeRFC3339) UnmarshalJSON(s []byte) error
UnmarshalJSON converts a API RFC3339 formated date strings into a time.Time object
type BountyList ¶ added in v1.4.4
type BountyList struct {
Type string
Title string
BodyText string
StartDate time.Time
EndDate time.Time
CompletedAt time.Time
Image DailyDeedImg
EntitlementRewardValue int
EntitlementRewardCurrency string
}
func GetDailyDeed ¶ added in v1.4.3
func GetDailyDeed(hc *http.Client, rc string) (BountyList, error)
type BountyListApi ¶ added in v1.4.6
type BountyListApi struct {
Type string `json:"#Type"`
Title string `json:"Title"`
BodyText string `json:"BodyText"`
StartDateApi *ApiTimeRFC3339 `json:"StartDate,omitempty"`
EndDateApi *ApiTimeRFC3339 `json:"EndDate,omitempty"`
CompletedAtApi *ApiTimeRFC3339 `json:"CompletedAt,omitempty"`
Image DailyDeedImg `json:"Image"`
EntitlementRewardValue int `json:"EntitlementRewardValue"`
EntitlementRewardCurrency string `json:"EntitlementRewardCurrency"`
}
type CurrentLedger ¶ added in v1.4.2
type CurrentLedger struct {
Friends FriendsLedger `json:"friends"`
}
CurrentLedger is a subset of the ApiLedger API response
type DailyDeedImg ¶ added in v1.4.3
type DailyDeedImg struct {
Desktop string `json:"desktop"`
}
type EventApiResponse ¶ added in v1.4.3
type EventApiResponse struct {
Data EventData `json:"data"`
}
type EventData ¶ added in v1.4.4
type EventData struct {
Components []EventDataComponent `json:"components"`
}
type EventDataComponent ¶ added in v1.4.4
type EventDataComponent struct {
Data EventDataComponentData `json:"data"`
}
type EventDataComponentData ¶ added in v1.4.4
type EventDataComponentData struct {
BountyList []BountyListApi `json:"BountyList"`
}
type FactionLedger ¶ added in v1.4.2
type FactionLedger struct {
Name string
Band int `json:"band"`
BandTitle string
Rank int `json:"rank"`
Score int `json:"score"`
ToNextRank int `json:"toNextRank"`
}
FactionLedger is a subset of the FriendsLedger API response
func GetFactionLedger ¶ added in v1.4.2
GetFactionLedger calls the SoT ledger API endpoint and returns a FactionLedger struct
type FactionNextLevel ¶
type FactionReputation ¶
type FactionReputation struct {
Name string
Motto string `json:"Motto"`
Level int `json:"Level"`
Rank string `json:"Rank"`
Xp int `json:"Xp"`
NextLevel FactionNextLevel `json:"NextCompanyLevel"`
}
func GetFactionReputation ¶
type Factions ¶
type Factions struct {
AthenasFortune FactionReputation `json:"AthenasFortune"`
BilgeRats FactionReputation `json:"BilgeRats"`
GoldHoarders FactionReputation `json:"GoldHoarders"`
HuntersCall FactionReputation `json:"HuntersCall"`
MerchantAlliance FactionReputation `json:"MerchantAlliance"`
OrderOfSouls FactionReputation `json:"OrderOfSouls"`
ReapersBones FactionReputation `json:"ReapersBones"`
SeaDogs FactionReputation `json:"SeaDogs"`
}
type FriendsLedger ¶ added in v1.4.2
type FriendsLedger struct {
User FactionLedger `json:"user"`
}
FriendsLedger is a subset of the CurrentLedger API response
type RandomFact ¶
type RandomFact struct {
Id string `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
SourceUrl string `json:"source_url"`
Language string `json:"language"`
Permalink string `json:"permalink"`
}
func GetRandFact ¶
func GetRandFact(hc *http.Client) (RandomFact, error)
type Route ¶ added in v1.4.4
type Route struct {
Outpost string `json:"outpost"`
Sought string `json:"sought_after"`
Surplus string `json:"surplus"`
}
Route defines the structure of the sub part of the API response that is a actual route
type SeasonProgress ¶
type SeasonProgress struct {
LevelProgress float64 `json:"LevelProgress"`
Tier int `json:"Tier"`
SeasonTitle string `json:"Title"`
TotalChallenges int `json:"TotalChallenges"`
CompletedChallenges int `json:"CompleteChallenges"`
Tiers []SeasonTier `json:"Tiers"`
}
func GetSeasonProgress ¶
func GetSeasonProgress(hc *http.Client, rc string) (SeasonProgress, error)
type SeasonTier ¶ added in v1.4.7
type Seasons ¶ added in v1.4.8
type Seasons []SeasonProgress
type SortedAchievement ¶
type SortedAchievement struct {
Achievement Achievement `json:"achievement"`
}
SortedAchievement is a subpart of the UserAchievements API response
type Traderoutes ¶ added in v1.4.4
type Traderoutes struct {
Dates string `json:"trade_route_dates"`
Routes map[string]Route `json:"routes"`
ValidFrom time.Time
ValidThru time.Time
}
Traderoutes defines the structure for the rarethief.com trading route API response
func GetTraderoutes ¶ added in v1.4.4
func GetTraderoutes(hc *http.Client) (Traderoutes, error)
GetTraderoutes fetches the currently active trading routes from the rarethief.com API and returns Traderoutes struct
type UrbanDict ¶
type UrbanDict struct {
List []UrbanDictEntry `json:"list"`
}
type UrbanDictEntry ¶
type UrbanDictEntry struct {
Definition string `json:"definition"`
PermaLink string `json:"permalink"`
Example string `json:"example"`
Author string `json:"author"`
Word string `json:"word"`
}
func GetUrbanDict ¶
func GetUrbanDict(hc *http.Client, w string) (UrbanDictEntry, error)
type UserAchievements ¶
type UserAchievements struct {
Sorted []SortedAchievement `json:"sorted"`
}
UserAchievements defines the structure of the SoT API response for the users latest achievements
type UserBalance ¶
type UserBalance struct {
GamerTag string `json:"gamertag"`
Title string `json:"title"`
Doubloons int `json:"doubloons"`
Gold int `json:"gold"`
AncientCoins int `json:"ancientCoins"`
}
UserBalance defines the structure of the SoT user balance API endpoint response
func GetBalance ¶
func GetBalance(hc *http.Client, rc string) (UserBalance, error)
GetBalance calls the SoT balance API endpoint and returns a UserBalance struct
type UserStats ¶
type UserStats struct {
KrakenDefeated ApiStringInt `json:"Combat_Kraken_Defeated"`
MegalodonEncounters ApiStringInt `json:"Player_TinyShark_Spawned"`
ChestsHandedIn ApiStringInt `json:"Chests_HandedIn_Total"`
ShipsSunk ApiStringInt `json:"Combat_Ships_Sunk"`
VomitedTotal ApiStringInt `json:"Vomited_Total"`
}