Documentation
¶
Index ¶
- Constants
- type AutocompleteUser
- type ChangeEmailRequest
- type ChangePasswordRequest
- type ChangeUsernameRequest
- type Client
- func (c *Client) AddFriend(userID string) (*MessageResponse, error)
- func (c *Client) ChangeEmail(newEmail string) (*MessageResponse, error)
- func (c *Client) ChangePassword(oldPassword, newPassword string) (*MessageResponse, error)
- func (c *Client) ChangeUsername(newUsername string) (*MessageResponse, error)
- func (c *Client) CollectDailyItem() (string, error)
- func (c *Client) GetAccountDetails() (*UserAccountInfo, error)
- func (c *Client) GetCurrentDrop() (*CurrentDrop, error)
- func (c *Client) GetDailyShopOffers() ([]DailyOfferSet, error)
- func (c *Client) GetFriendLeaderboard() ([]LeaderboardEntry, error)
- func (c *Client) GetFriendList() ([]string, error)
- func (c *Client) GetMoonOffers() ([]MoonOffer, error)
- func (c *Client) GetPlayerInfo(username string) (*PlayerInfoResponse, error)
- func (c *Client) GetSelfInfo() (*PlayerInfoResponse, error)
- func (c *Client) GetSkinCatalog() ([]SkinElement, error)
- func (c *Client) GetSubscriptionOffers() ([]SubscriptionOffer, error)
- func (c *Client) GetUserID(username string) (string, error)
- func (c *Client) GetUserSkin(userID, format, profile, size string) ([]byte, error)
- func (c *Client) Logout() (*MessageResponse, error)
- func (c *Client) RemoveFriend(userID string) (*MessageResponse, error)
- func (c *Client) SearchUsers(searchTerm string) ([]AutocompleteUser, error)
- func (c *Client) SetSessionCookie(token string)
- func (c *Client) UpdateSkinSlot(slotID string, updates map[string]SkinPart) (*UpdateSkinSlotResponse, error)
- type CurrentDrop
- type DailyOfferSet
- type DeathReason
- type Disposition
- type DropPack
- type DropSkinElement
- type Game
- type GameHistoryEntry
- type GameSettings
- type GameTypeAdvancedStats
- type GameTypeStats
- type LeaderboardEntry
- type MessageResponse
- type MoonOffer
- type OfferElement
- type OfferElements
- type OfferPack
- type OverallGameStats
- type PackSkinElementLink
- type PlayerIndividualStats
- type PlayerInfoResponse
- type PlayerRanking
- type PlayerStatistics
- type PlayerUser
- type PreviewSkinElement
- type RoleStats
- type Skin
- type SkinElement
- type SkinLayer
- type SkinPart
- type Slot
- type SubscriptionOffer
- type TokenInfo
- type UpdateSkinSlotResponse
- type UserAccountInfo
Constants ¶
const ( SkinFormatPNG = "png" SkinFormatSVG = "svg" )
Skin format constants to use with GetUserSkin
const ( SkinProfileFull = "full" // Renders the entire user skin. SkinProfileCenter = "center" // Renders a centered profile (face). SkinProfileRight = "right" // Renders a right-facing profile (face). )
Skin profile constants to use with GetUserSkin
const ( SkinSizeDefault = "" // The default size. SkinSizeLarge = "large" // A larger rendering. SkinSizeSmall = "small" // A smaller rendering. )
Skin size constants to use with GetUserSkin (PNG only)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutocompleteUser ¶
AutocompleteUser represents a single user in the autocomplete search results.
type ChangeEmailRequest ¶
type ChangeEmailRequest struct {
Email string `url:"email"`
}
ChangeEmailRequest is the request payload for changing a user's email.
type ChangePasswordRequest ¶
type ChangePasswordRequest struct {
OldPassword string `url:"oldPass"`
NewPassword string `url:"newPass"`
}
ChangePasswordRequest is the request payload for changing a user's password.
type ChangeUsernameRequest ¶
type ChangeUsernameRequest struct {
Username string `url:"username"`
}
ChangeUsernameRequest is the request payload for changing a user's username.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main API client for the Wolfy.net API.
func NewClient ¶
NewClient creates and new, authenticated API client. It immediately checks if the provided authToken is valid by making a test API call.
func (*Client) AddFriend ¶
func (c *Client) AddFriend(userID string) (*MessageResponse, error)
AddFriend sends a friend request to the specified user ID. This function adds specific headers required for this endpoint.
func (*Client) ChangeEmail ¶
func (c *Client) ChangeEmail(newEmail string) (*MessageResponse, error)
UpdateEmail changes the authenticated user's email address.
func (*Client) ChangePassword ¶
func (c *Client) ChangePassword(oldPassword, newPassword string) (*MessageResponse, error)
UpdatePassword changes the authenticated user's password. It requires both the old and the new password.
func (*Client) ChangeUsername ¶
func (c *Client) ChangeUsername(newUsername string) (*MessageResponse, error)
UpdateUsername changes the authenticated user's username.
func (*Client) CollectDailyItem ¶
CollectDailyItem attempts to claim the free daily item from the shop.
func (*Client) GetAccountDetails ¶
func (c *Client) GetAccountDetails() (*UserAccountInfo, error)
GetAccountDetails retrieves the detailed private profile for the currently authenticated user. This includes sensitive information such as email, currency, and account settings.
func (*Client) GetCurrentDrop ¶
func (c *Client) GetCurrentDrop() (*CurrentDrop, error)
GetCurrentDrop retrieves details about the current featured item drop, including available packs and the cosmetic items within them.
func (*Client) GetDailyShopOffers ¶
func (c *Client) GetDailyShopOffers() ([]DailyOfferSet, error)
GetDailyShopOffers retrieves the list of daily offers from the shop. This includes free items, and rotating skins and packs for coins and moons.
func (*Client) GetFriendLeaderboard ¶
func (c *Client) GetFriendLeaderboard() ([]LeaderboardEntry, error)
GetFriendLeaderboard retrieves the leaderboard of the authenticated user's friends, returning a slice of users with their rank and summary information.
func (*Client) GetFriendList ¶
GetFriends retrieves the friend list of the authenticated user.
func (*Client) GetMoonOffers ¶
GetMoonOffers retrieves the available Moon currency purchase options.
func (*Client) GetPlayerInfo ¶
func (c *Client) GetPlayerInfo(username string) (*PlayerInfoResponse, error)
GetPlayerInfo retrieves the detailed profile for a given player by their username.
func (*Client) GetSelfInfo ¶
func (c *Client) GetSelfInfo() (*PlayerInfoResponse, error)
GetSelfInfo retrieves the detailed profile for the currently authenticated user.
func (*Client) GetSkinCatalog ¶
func (c *Client) GetSkinCatalog() ([]SkinElement, error)
GetSkinCatalog retrieves the master catalog of all available cosmetic items in the game. This is an authenticated call and returns a slice of all skin elements.
func (*Client) GetSubscriptionOffers ¶
func (c *Client) GetSubscriptionOffers() ([]SubscriptionOffer, error)
GetSubscriptionOffers retrieves the available Alpha subscription plans.
func (*Client) GetUserID ¶
FindUserID finds a user by their exact username and returns their unique ID. This uses the player leaderboard endpoint for a more direct lookup.
func (*Client) GetUserSkin ¶
GetUserSkin fetches the rendered skin image for a given user ID. It returns the raw image data as a byte slice. The 'size' parameter is only applied if the format is PNG.
func (*Client) Logout ¶
func (c *Client) Logout() (*MessageResponse, error)
Logout invalidates the current user's session on the server.
func (*Client) RemoveFriend ¶
func (c *Client) RemoveFriend(userID string) (*MessageResponse, error)
RemoveFriend sends a request to remove the specified user from the friend list.
func (*Client) SearchUsers ¶ added in v1.0.3
func (c *Client) SearchUsers(searchTerm string) ([]AutocompleteUser, error)
SearchUsers performs a username search with autocomplete functionality. It searches for users whose usernames match the given search term and returns a list of matching user results with their IDs and usernames.
func (*Client) SetSessionCookie ¶
func (*Client) UpdateSkinSlot ¶
func (c *Client) UpdateSkinSlot(slotID string, updates map[string]SkinPart) (*UpdateSkinSlotResponse, error)
UpdateSkinSlot changes the equipped cosmetic items for a specific skin slot. The 'updates' map should contain the skin parts to change, e.g., "top": SkinPart{ID:"002", Color:5}.
type CurrentDrop ¶
type CurrentDrop struct {
ID string `json:"id"`
Name string `json:"name"`
Start string `json:"start"`
End string `json:"end"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Packs []DropPack `json:"packs"`
}
CurrentDrop is the top-level response from the /drop endpoint.
type DailyOfferSet ¶
type DailyOfferSet struct {
ID int `json:"id"`
End string `json:"end"`
Elements OfferElements `json:"elements"`
}
DailyOfferSet represents the complete set of offers available for a single day.
type DeathReason ¶
type DeathReason struct {
Type string `json:"type"`
DayNumber int `json:"dayNumber"`
VotersIDs []string `json:"votersIds,omitempty"`
HunterID string `json:"hunterId,omitempty"`
MayorID string `json:"mayorId,omitempty"`
LoverID string `json:"loverId,omitempty"`
}
DeathReason provides details on how a player died in a game. Fields are optional as they depend on the type of death.
type Disposition ¶
type Disposition struct {
Y float64 `json:"y"`
Scale float64 `json:"scale"`
X float64 `json:"x,omitempty"` // omitempty because it's not always present
}
Disposition defines the positioning and scale of a skin element. It is a pointer in the parent struct because it can be null.
type DropPack ¶
type DropPack struct {
ID int `json:"id"`
Name string `json:"name"`
Colors []map[string]interface{} `json:"colors"` // Flexible for varied keys
Price int `json:"price"`
Rarity string `json:"rarity"`
Currency string `json:"currency"`
SkinElements []DropSkinElement `json:"SkinElements"`
PreviewElements []PreviewSkinElement `json:"previewElements"`
Collected bool `json:"collected"`
}
DropPack represents a single bundle or pack within the current drop.
type DropSkinElement ¶
type DropSkinElement struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Access string `json:"access"`
Rarity string `json:"rarity"`
Level int `json:"level"`
Currency string `json:"currency"`
Price int `json:"price"`
Colors [][]string `json:"colors"`
New bool `json:"new"`
Disposition *Disposition `json:"disposition"` // Re-using from SkinElement
SmallPet bool `json:"smallPet"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
PackSkinElement PackSkinElementLink `json:"PackSkinElement"`
}
DropSkinElement represents a skin element as part of a drop pack. It's similar to SkinElement but with some different fields.
type Game ¶
type Game struct {
ID string `json:"id"`
InstanceID string `json:"instanceId"`
Status int `json:"status"`
PlayerCount int `json:"playerCount"`
Settings GameSettings `json:"settings"`
Private bool `json:"private"`
Voice bool `json:"voice"`
Serious bool `json:"serious"`
Platform string `json:"platform"`
Lang string `json:"lang"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
NextID interface{} `json:"nextId"` // Can be null
AdminID string `json:"adminId"`
}
Game holds detailed information about a specific match instance.
type GameHistoryEntry ¶
type GameHistoryEntry struct {
Role string `json:"role"`
Winner bool `json:"winner"`
DeathReason *DeathReason `json:"deathReason"` // Pointer to handle null
WordCount int `json:"wordCount"`
KillCount int `json:"killCount"`
XP int `json:"xp"`
Elo int `json:"elo"`
Lovers bool `json:"lovers"`
Infected bool `json:"infected"`
UserID string `json:"userId"`
GameID string `json:"gameId"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Game Game `json:"game"`
}
GameHistoryEntry represents a single game played by the user in their history.
type GameSettings ¶
type GameSettings struct {
Slots int `json:"slots"`
Mayor bool `json:"mayor"`
Roles map[string]int `json:"roles"`
Balancing int `json:"balancing"`
}
GameSettings holds the specific rules and role composition for a game.
type GameTypeAdvancedStats ¶
type GameTypeAdvancedStats struct {
Inactivity float64 `json:"inactivity"`
DaysAlive float64 `json:"daysAlive"`
Mayor float64 `json:"mayor"`
GoodVote float64 `json:"goodVote,omitempty"`
InnocentKilled float64 `json:"innocentKilled,omitempty"`
}
GameTypeAdvancedStats contains overall advanced stats for a game alignment (innocent/threat).
type GameTypeStats ¶
type GameTypeStats struct {
ID string `json:"id"`
WinRate float64 `json:"winRate"`
AdvancedStats GameTypeAdvancedStats `json:"advancedStats"`
}
GameTypeStats contains the overall win rate and stats for an alignment.
type LeaderboardEntry ¶
type LeaderboardEntry struct {
ID string `json:"id"`
Username string `json:"username"`
XP int `json:"xp"`
SlotID string `json:"slotId"`
SkinVersion string `json:"skinVersion"`
Rank int `json:"rank"`
Elo int `json:"elo"`
GamePlayed int `json:"gamePlayed"`
IsFriend bool `json:"isFriend"`
}
LeaderboardEntry represents a single user's summary on the main leaderboard.
type MessageResponse ¶
type MessageResponse struct {
Message string `json:"message"`
}
MessageResponse is a generic response containing a single message string. It is used for many POST actions like logout, settings changes, etc.
type MoonOffer ¶
type MoonOffer struct {
ID string `json:"id"`
Moons int `json:"moons"`
Bonus int `json:"bonus"`
Tier int `json:"tier"`
Discount float64 `json:"discount"`
Img string `json:"img"`
Stripe string `json:"stripe"`
Price float64 `json:"price"`
Currency string `json:"currency"`
IDNewPlayerDiscount string `json:"idNewPlayerDiscount,omitempty"`
NewPlayerDiscount float64 `json:"newPlayerDiscount,omitempty"`
Tag string `json:"tag,omitempty"`
}
MoonOffer represents a single purchasable pack of Moon currency.
type OfferElement ¶
type OfferElement struct {
Category string `json:"category"`
Moons int `json:"moons"`
Coins int `json:"coins"`
Pack *OfferPack `json:"pack"` // Pointer to handle null
Skin *SkinElement `json:"skin"` // Pointer to handle null
Collected bool `json:"collected,omitempty"`
}
OfferElement represents a single slot in the daily offers, which can contain a skin or a pack.
type OfferElements ¶
type OfferElements struct {
MoonsUltraHigh OfferElement `json:"moonsUltraHigh"`
CollectionHigh OfferElement `json:"collectionHigh"`
MoonsLow OfferElement `json:"moonsLow"`
CoinsLow OfferElement `json:"coinsLow"`
CoinsHigh OfferElement `json:"coinsHigh"`
MoonsHigh OfferElement `json:"moonsHigh"`
MoonsMedium OfferElement `json:"moonsMedium"`
Premium OfferElement `json:"premium"`
CollectionLow OfferElement `json:"collectionLow"`
Free OfferElement `json:"free"`
}
OfferElements is a structured representation of all the different offer categories for a day.
type OfferPack ¶
type OfferPack struct {
Price int `json:"price"`
Currency string `json:"currency"`
ID int `json:"id"`
Rarity string `json:"rarity"`
SkinElements []SkinElement `json:"SkinElements"` // Reusing the existing SkinElement
}
OfferPack represents a bundle of items within a daily offer.
type OverallGameStats ¶
type OverallGameStats struct {
Innocent GameTypeStats `json:"innocent"`
Threat GameTypeStats `json:"threat"`
}
OverallGameStats holds the statistics broken down by alignment (innocent vs. threat).
type PackSkinElementLink ¶
type PackSkinElementLink struct {
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
SkinPackID int `json:"skinPackId"`
SkinElementID string `json:"skinElementId"`
}
PackSkinElementLink contains metadata linking a skin element to a drop pack.
type PlayerIndividualStats ¶
type PlayerIndividualStats struct {
Moonpass int `json:"moonpass"`
WinCount int `json:"winCount"`
KillCount int `json:"killCount"`
WordAvg float64 `json:"wordAvg"`
}
PlayerIndividualStats contains specific win, kill, and word counts.
type PlayerInfoResponse ¶
type PlayerInfoResponse struct {
User PlayerUser `json:"user"`
IsFriend bool `json:"isFriend"`
Statistics PlayerStatistics `json:"statistics"`
History []GameHistoryEntry `json:"history"`
}
PlayerInfoResponse is the top-level response from the /leaderboard/player endpoint.
type PlayerRanking ¶
PlayerRanking holds the Elo ranking details for a user.
type PlayerStatistics ¶
type PlayerStatistics struct {
Laurels map[string]int `json:"laurels"`
Individual PlayerIndividualStats `json:"individual"`
Roles []RoleStats `json:"roles"`
Game OverallGameStats `json:"game"`
}
PlayerStatistics holds the gameplay statistics for a user.
type PlayerUser ¶
type PlayerUser struct {
ProfilePicture string `json:"profilePicture"`
ID string `json:"id"`
Username string `json:"username"`
Rank int `json:"rank"`
XP int `json:"xp"`
SlotID string `json:"slotId"`
SkinVersion string `json:"skinVersion"`
Elo int `json:"elo"`
CreatedAt string `json:"createdAt"`
MonthsSubscribed int `json:"monthsSubscribed"`
GamePlayed int `json:"gamePlayed"`
Ranking PlayerRanking `json:"ranking"`
}
PlayerUser contains detailed information about a specific player.
type PreviewSkinElement ¶
type PreviewSkinElement struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Access string `json:"access"`
Rarity string `json:"rarity"`
Level int `json:"level"`
Currency string `json:"currency"`
Price int `json:"price"`
New bool `json:"new"`
Disposition *Disposition `json:"disposition"`
SmallPet interface{} `json:"smallPet"` // Can be null
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
PreviewSkinElement represents a skin item used for previewing a pack.
type RoleStats ¶
type RoleStats struct {
ID string `json:"id"`
WinRate float64 `json:"winRate"`
AdvancedStats map[string]float64 `json:"advancedStats"`
}
RoleStats contains win rate and advanced statistics for a specific role.
type Skin ¶
type Skin struct {
Eyes SkinPart `json:"eyes"`
Face SkinPart `json:"face"`
Hair SkinPart `json:"hair"`
Nose SkinPart `json:"nose"`
Top SkinPart `json:"top"`
Bottom SkinPart `json:"bottom"`
Shoes SkinPart `json:"shoes"`
Tombstone SkinPart `json:"tombstone"`
Glasses SkinPart `json:"glasses"`
}
Skin provides a detailed breakdown of all components of a user's skin.
type SkinElement ¶
type SkinElement struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Access string `json:"access"`
Rarity string `json:"rarity"`
Level int `json:"level"`
Price int `json:"price"`
Colors [][]string `json:"colors"`
New bool `json:"new"`
Disposition *Disposition `json:"disposition"` // Pointer to handle null value
Currency string `json:"currency"`
SmallPet interface{} `json:"smallPet"` // Type is unknown, can be null
SkinLayers []SkinLayer `json:"skinLayers"`
Bought bool `json:"bought"`
}
SkinElement is the top-level response for a single item from the /skin/elements endpoint. It represents one available cosmetic item in the game's master catalog.
type SkinLayer ¶
type SkinLayer struct {
ID int `json:"id"`
}
SkinLayer represents a single graphical layer for a skin element.
type Slot ¶
type Slot struct {
Unlocked bool `json:"unlocked"`
ID string `json:"id"`
OfferID string `json:"offerId,omitempty"` // Only in unlocked slots
SkinVersion string `json:"skinVersion,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
UserID string `json:"userId,omitempty"`
Skin *Skin `json:"skin,omitempty"` // Pointer to handle null
Equiped bool `json:"equiped,omitempty"`
Price int `json:"price,omitempty"` // Only in locked slots
Currency string `json:"currency,omitempty"`
Alpha bool `json:"alpha,omitempty"`
}
Slot represents a single skin slot, which can be locked or unlocked.
type SubscriptionOffer ¶
type SubscriptionOffer struct {
ID string `json:"id"`
Stripe string `json:"stripe"`
Price float64 `json:"price"`
Currency string `json:"currency"`
Interval string `json:"interval"`
IntervalCount int `json:"intervalCount"`
SavedLabel int `json:"savedLabel,omitempty"`
Badge string `json:"badge"`
MostPopular bool `json:"mostPopular,omitempty"`
}
SubscriptionOffer represents a single purchasable Alpha subscription plan.
type TokenInfo ¶
type TokenInfo struct {
ID string `json:"id"`
TwoFactor interface{} `json:"twoFactor"`
}
TokenInfo contains details about the user's current session token.
type UpdateSkinSlotResponse ¶
type UpdateSkinSlotResponse struct {
Slots []Slot `json:"slots"`
Skin Skin `json:"skin"`
SlotID string `json:"slotId"`
Version string `json:"version"`
Coins int `json:"coins"`
Moons int `json:"moons"`
}
UpdateSkinSlotResponse is the response received after successfully updating a skin slot.
type UserAccountInfo ¶
type UserAccountInfo struct {
ID string `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
TwitterID interface{} `json:"twitterId"`
FacebookID interface{} `json:"facebookId"`
GoogleID interface{} `json:"googleId"`
DiscordID interface{} `json:"discordId"`
AppleID interface{} `json:"appleId"`
ProfilePicture string `json:"profilePicture"`
XP int `json:"xp"`
Elo int `json:"elo"`
Coins int `json:"coins"`
Moons int `json:"moons"`
Rank int `json:"rank"`
SkinVersion string `json:"skinVersion"`
SkinIndex int `json:"skinIndex"`
AnonymousSkinIndex int `json:"anonymousSkinIndex"`
SlotID string `json:"slotId"`
AnonymousSlotID interface{} `json:"anonymousSlotId"`
AllowFriendRequests bool `json:"allowFriendRequests"`
AllowGroupRequests bool `json:"allowGroupRequests"`
AllowNewsletter bool `json:"allowNewsletter"`
Nickname interface{} `json:"nickname"`
Confirmed bool `json:"confirmed"`
DiscountEndAt interface{} `json:"discountEndAt"`
TwoFactorSecret bool `json:"twoFactorSecret"`
Lang string `json:"lang"`
BanEnd interface{} `json:"ban_end"`
ReasonBan interface{} `json:"reason_ban"`
NeedRename bool `json:"needRename"`
Banned bool `json:"banned"`
FriendsVisibility string `json:"friendsVisibility"`
AlphaLegacy bool `json:"alphaLegacy"`
Password bool `json:"password"`
Token TokenInfo `json:"token"`
Slots []Slot `json:"slots"`
Skin Skin `json:"skin"`
Features []string `json:"features"`
Subscription interface{} `json:"subscription"`
}
UserAccountInfo is the top-level response from the /user endpoint, containing detailed private information for the authenticated user.