Tipos
tipo Achievement
type Achievement struct {
ID int `json:"id"`
Name string `json:"name"`
CreationTime string `json:"creationTime"`
State string `json:"state"`
Category string `json:"category"`
}
tipo AchievementProgress
AchievementProgress associa a definição de uma conquista a todos os seus
requisitos por nível.
type AchievementProgress struct {
Achievement Achievement `json:"achievement"`
LevelRequirements []AchievementRequirement `json:"levelRequirements"`
}
tipo AchievementRequirement
type AchievementRequirement struct {
Level int `json:"level"`
RequiredScore int `json:"requiredScore"`
}
tipo AchievementsService
type AchievementsService service
MétodosByUserID
func (s *AchievementsService) ByUserID(ctx context.Context, userID string) ([]UserAchievement, *Response, error)
List
func (s *AchievementsService) List(ctx context.Context) ([]AchievementProgress, *Response, error)
tipo Badge
type Badge struct {
Code string `json:"code"`
Name string `json:"name"`
Description string `json:"description"`
}
tipo BadgeOwners
type BadgeOwners struct {
OwnerCount int `json:"ownerCount"`
Name string `json:"name"`
Description string `json:"description"`
}
tipo BadgesService
type BadgesService service
MétodosOwners
func (s *BadgesService) Owners(ctx context.Context, badgeCode string) (*BadgeOwners, *Response, error)
tipo BotHolder
type BotHolder struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
tipo Client
Client é o cliente para a API Web pública do Habbo. Seus serviços exportados compartilham
o mesmo cliente HTTP e URL base.
type Client struct {
Achievements *AchievementsService
Badges *BadgesService
Matches *MatchesService
Groups *GroupsService
Marketplace *MarketplaceService
Derby *DerbyService
Rooms *RoomsService
Skills *SkillsService
Lists *ListsService
Users *UsersService
Wired *WiredService
// contains filtered or unexported fields
}
Construtores e funçõesNewClient
func NewClient(baseURL string, options ...Option) (*Client, error)
NewWiredClient
NewWiredClient é um construtor de conveniência para clientes que utilizam Variáveis Wired.
É equivalente a NewClient(baseURL, WithWired(roomID, keys), ...options).
func NewWiredClient(baseURL string, roomID int64, keys WiredKeys, options ...Option) (*Client, error)
MétodosBaseURL
BaseURL retorna uma cópia da URL base normalizada do cliente.
func (c *Client) BaseURL() *url.URL
Do
Do envia req com ctx e decodifica uma resposta JSON bem-sucedida em dst.
func (c *Client) Do(ctx context.Context, req *http.Request, dst any) (*Response, error)
NewRequest
NewRequest constrói uma requisição API JSON relativa à URL base do cliente.
func (c *Client) NewRequest(method, relativeURL string, body any) (*http.Request, error)
Ping
func (c *Client) Ping(ctx context.Context) (*Response, error)
tipo DerbyHistoryOptions
DerbyHistoryOptions adiciona a chave de API opcional para consultas ao Derby de pesca.
type DerbyHistoryOptions struct {
HistoryOptions
APIKey string
}
tipo DerbyService
type DerbyService service
MétodosGet
Get retorna a representação do Derby de pesca como JSON bruto (json.RawMessage).
func (s *DerbyService) Get(ctx context.Context, uniqueDerbyID, apiKey string) (json.RawMessage, *Response, error)
IDsByPlayer
func (s *DerbyService) IDsByPlayer(ctx context.Context, uniquePlayerID string, options *DerbyHistoryOptions) ([]string, *Response, error)
Status
Status retorna o status atual do Derby de pesca como JSON bruto (json.RawMessage).
func (s *DerbyService) Status(ctx context.Context, apiKey string) (json.RawMessage, *Response, error)
tipo ErrorResponse
ErrorResponse é retornado para respostas de API fora da faixa 2xx.
type ErrorResponse struct {
Response *http.Response
Body []byte
Code string
Message string
}
MétodosError
func (e *ErrorResponse) Error() string
tipo Friend
type Friend struct {
UniqueID string `json:"uniqueId"`
Name string `json:"name"`
Motto string `json:"motto"`
Online bool `json:"online"`
FigureString string `json:"figureString"`
}
tipo FurniHolder
type FurniHolder struct {
ID int64 `json:"id"`
}
tipo FurniVariableHolder
type FurniVariableHolder struct {
Variable WiredVariable `json:"variable"`
Furni *FurniHolder `json:"furni,omitempty"`
FurniBC *FurniHolder `json:"furni_bc,omitempty"`
WallItem *FurniHolder `json:"wall_item,omitempty"`
WallItemBC *FurniHolder `json:"wall_item_bc,omitempty"`
}
tipo Group
type Group struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Type string `json:"type"`
RoomID *string `json:"roomId"`
BadgeCode string `json:"badgeCode"`
PrimaryColour string `json:"primaryColour"`
SecondaryColour string `json:"secondaryColour"`
}
tipo GroupMember
type GroupMember struct {
Online bool `json:"online"`
Gender string `json:"gender"`
Motto string `json:"motto"`
HabboFigure string `json:"habboFigure"`
MemberSince string `json:"memberSince"`
UniqueID string `json:"uniqueId"`
Name string `json:"name"`
IsAdmin bool `json:"isAdmin"`
}
tipo GroupsService
type GroupsService service
MétodosGet
func (s *GroupsService) Get(ctx context.Context, groupID string) (*Group, *Response, error)
Members
func (s *GroupsService) Members(ctx context.Context, groupID string) ([]GroupMember, *Response, error)
tipo HistoryOptions
HistoryOptions filtra o histórico de IDs de partidas e Derby de pesca. StartTime e
EndTime são repassados no formato esperado pela API do Habbo.
type HistoryOptions struct {
Offset int
Limit int
StartTime string
EndTime string
}
tipo HotLook
type HotLook struct {
Gender string `xml:"gender,attr" json:"gender"`
Figure string `xml:"figure,attr" json:"figure"`
Hash string `xml:"hash,attr" json:"hash"`
}
tipo HotLooksResult
type HotLooksResult struct {
XMLName xml.Name `xml:"habbos" json:"-"`
URL string `xml:"url,attr" json:"url"`
Looks []HotLook `xml:"habbo" json:"looks"`
}
tipo ListsService
type ListsService service
MétodosHotLooks
func (s *ListsService) HotLooks(ctx context.Context) (*HotLooksResult, *Response, error)
tipo MarketplaceBatchRequest
type MarketplaceBatchRequest struct {
RoomItems []MarketplaceItemRequest `json:"roomItems,omitempty"`
WallItems []MarketplaceItemRequest `json:"wallItems,omitempty"`
}
tipo MarketplaceBatchStats
type MarketplaceBatchStats struct {
Status string `json:"status"`
RoomItemData []MarketplaceItemStats `json:"roomItemData"`
WallItemData []MarketplaceItemStats `json:"wallItemData"`
}
tipo MarketplaceHistory
MarketplaceHistory utiliza strings pois esse é o tipo exposto pelo documento
OpenAPI público, inclusive para valores de aparência numérica.
type MarketplaceHistory struct {
DayOffset string `json:"dayOffset"`
AveragePrice string `json:"averagePrice"`
TotalSoldItems string `json:"totalSoldItems"`
TotalCreditSum string `json:"totalCreditSum"`
TotalOpenOffers string `json:"totalOpenOffers"`
}
tipo MarketplaceItemRequest
type MarketplaceItemRequest struct {
Item string `json:"item"`
}
tipo MarketplaceItemStats
type MarketplaceItemStats struct {
Item string `json:"item"`
StatsDate string `json:"statsDate"`
History []MarketplaceHistory `json:"history"`
SoldItemCount int `json:"soldItemCount"`
CreditSum int `json:"creditSum"`
AveragePrice int `json:"averagePrice"`
TotalOpenOffers int `json:"totalOpenOffers"`
CurrentOpenOffers int `json:"currentOpenOffers"`
CurrentPrice int `json:"currentPrice"`
HistoryLimitInDays int `json:"historyLimitInDays"`
}
tipo MarketplaceService
type MarketplaceService service
MétodosBatchStats
func (s *MarketplaceService) BatchStats(ctx context.Context, request MarketplaceBatchRequest) (*MarketplaceBatchStats, *Response, error)
tipo Match
type Match struct {
Metadata MatchMetadata `json:"metadata"`
Info MatchInfo `json:"info"`
}
tipo MatchInfo
type MatchInfo struct {
GameCreation int64 `json:"gameCreation"`
GameDuration int64 `json:"gameDuration"`
GameEnd int64 `json:"gameEnd"`
GameMode string `json:"gameMode"`
MapID int `json:"mapId"`
Ranked bool `json:"ranked"`
Participants []MatchParticipant `json:"participants"`
Teams []MatchTeam `json:"teams"`
}
tipo MatchMetadata
type MatchMetadata struct {
MatchID string `json:"matchId"`
ParticipantPlayerIDs []string `json:"participantPlayerIds"`
}
tipo MatchParticipant
type MatchParticipant struct {
GamePlayerID string `json:"gamePlayerId"`
GameScore int `json:"gameScore"`
PlayerPlacement int `json:"playerPlacement"`
TeamID int `json:"teamId"`
TeamPlacement int `json:"teamPlacement"`
TimesStunned int `json:"timesStunned"`
PowerUpPickups int `json:"powerUpPickups"`
PowerUpActivations int `json:"powerUpActivations"`
TilesCleaned int `json:"tilesCleaned"`
TilesColoured int `json:"tilesColoured"`
TilesStolen int `json:"tilesStolen"`
TilesLocked int `json:"tilesLocked"`
TilesColouredForOpponents int `json:"tilesColouredForOpponents"`
}
tipo MatchTeam
type MatchTeam struct {
TeamID int `json:"teamId"`
Win bool `json:"win"`
TeamScore int `json:"teamScore"`
TeamPlacement int `json:"teamPlacement"`
}
tipo MatchesService
type MatchesService service
MétodosGet
func (s *MatchesService) Get(ctx context.Context, uniqueMatchID string) (*Match, *Response, error)
IDsByPlayer
func (s *MatchesService) IDsByPlayer(ctx context.Context, uniquePlayerID string, options *HistoryOptions) ([]string, *Response, error)
tipo Option
Option configura um Client durante sua construção.
type Option func(*clientConfig) error
Construtores e funçõesWithHTTPClient
WithHTTPClient define o cliente HTTP (http.Client) customizado a ser utilizado.
func WithHTTPClient(hc *http.Client) Option
WithUserAgent
WithUserAgent sobrescreve o cabeçalho User-Agent enviado em cada requisição.
func WithUserAgent(userAgent string) Option
WithWired
WithWired habilita o serviço de Variáveis Wired para o roomID especificado. Pelo menos uma chave de leitura
ou escrita deve ser fornecida.
func WithWired(roomID int64, keys WiredKeys) Option
tipo PetHolder
type PetHolder struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
tipo Response
Response envolve uma resposta HTTP e expõe metadados tais como ETag,
cabeçalhos de limite de taxa e códigos de status sem ocultar a biblioteca padrão.
type Response struct {
*http.Response
}
tipo Room
type Room struct {
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
CreationTime string `json:"creationTime"`
HabboGroupID *string `json:"habboGroupId,omitempty"`
Tags []string `json:"tags"`
MaximumVisitors int `json:"maximumVisitors"`
ShowOwnerName bool `json:"showOwnerName"`
OwnerName string `json:"ownerName"`
OwnerUniqueID string `json:"ownerUniqueId"`
Categories []string `json:"categories"`
ThumbnailURL string `json:"thumbnailUrl"`
ImageURL string `json:"imageUrl"`
Rating int `json:"rating"`
PublicRoom bool `json:"publicRoom"`
DoorMode string `json:"doorMode"`
UniqueID string `json:"uniqueId"`
}
tipo RoomsService
type RoomsService service
MétodosGet
func (s *RoomsService) Get(ctx context.Context, roomID int64) (*Room, *Response, error)
tipo SelectedBadge
type SelectedBadge struct {
BadgeIndex int `json:"badgeIndex"`
Code string `json:"code"`
Name string `json:"name"`
Description string `json:"description"`
}
tipo Skill
type Skill struct {
Level int `json:"level"`
Experience int `json:"experience"`
}
tipo SkillLeaderboard
type SkillLeaderboard struct {
Entries []SkillLeaderboardEntry `json:"entries"`
TotalPages int `json:"totalPages"`
CurrentPage int `json:"currentPage"`
PageSize int `json:"pageSize"`
}
tipo SkillLeaderboardEntry
type SkillLeaderboardEntry struct {
UniqueID string `json:"uniqueId"`
Level int `json:"level"`
Experience int `json:"experience"`
}
tipo SkillsService
type SkillsService service
MétodosGet
func (s *SkillsService) Get(ctx context.Context, uniquePlayerID, skillType string) (*Skill, *Response, error)
Leaderboard
func (s *SkillsService) Leaderboard(ctx context.Context, skillType string, page int) (*SkillLeaderboard, *Response, error)
tipo User
type User struct {
UniqueID string `json:"uniqueId"`
Name string `json:"name"`
FigureString string `json:"figureString"`
Motto string `json:"motto"`
Online bool `json:"online"`
LastAccessTime string `json:"lastAccessTime"`
MemberSince string `json:"memberSince"`
ProfileVisible bool `json:"profileVisible"`
CurrentLevel int `json:"currentLevel"`
CurrentLevelCompletePercent int `json:"currentLevelCompletePercent"`
TotalExperience int `json:"totalExperience"`
StarGemCount int `json:"starGemCount"`
SelectedBadges []SelectedBadge `json:"selectedBadges"`
}
tipo UserAchievement
type UserAchievement struct {
Achievement Achievement `json:"achievement"`
Level int `json:"level"`
Score int `json:"score"`
}
tipo UserGroup
type UserGroup struct {
Online bool `json:"online"`
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Type string `json:"type"`
RoomID string `json:"roomId"`
BadgeCode string `json:"badgeCode"`
PrimaryColour string `json:"primaryColour"`
SecondaryColour string `json:"secondaryColour"`
IsAdmin bool `json:"isAdmin"`
}
tipo UserHolder
type UserHolder struct {
ID int64 `json:"id"`
Name string `json:"name"`
UniqueID string `json:"unique_id"`
}
tipo UserProfile
type UserProfile struct {
User `json:"user"`
Groups []UserGroup `json:"groups"`
Badges []Badge `json:"badges"`
Friends []Friend `json:"friends"`
Rooms []Room `json:"rooms"`
}
tipo UserRequestOptions
UserRequestOptions suporta a revalidação de cache HTTP (If-None-Match) em consultas de usuário.
type UserRequestOptions struct {
IfNoneMatch string
}
tipo UserVariableHolder
type UserVariableHolder struct {
Variable WiredVariable `json:"variable"`
User *UserHolder `json:"user,omitempty"`
Pet *PetHolder `json:"pet,omitempty"`
Bot *BotHolder `json:"bot,omitempty"`
}
tipo WiredBatchMethod
type WiredBatchMethod string
Constantes relacionadasWiredBatchGET, WiredBatchPUT, WiredBatchPATCH, WiredBatchDELETE
const (
WiredBatchGET WiredBatchMethod = http.MethodGet
WiredBatchPUT WiredBatchMethod = http.MethodPut
WiredBatchPATCH WiredBatchMethod = http.MethodPatch
WiredBatchDELETE WiredBatchMethod = http.MethodDelete
)
tipo WiredBatchOperation
type WiredBatchOperation struct {
OperationID string `json:"op_id,omitempty"`
Method WiredBatchMethod `json:"method"`
Path string `json:"path"`
Body *WiredBatchOperationBody `json:"body,omitempty"`
}
tipo WiredBatchOperationBody
type WiredBatchOperationBody struct {
Value int64 `json:"value"`
}
tipo WiredBatchOperationError
type WiredBatchOperationError struct {
Code string `json:"code"`
Message string `json:"message"`
}
tipo WiredBatchOperationResult
type WiredBatchOperationResult struct {
OperationID *string `json:"op_id"`
Status int `json:"status"`
Body *WiredVariable `json:"body,omitempty"`
Error *WiredBatchOperationError `json:"error,omitempty"`
}
tipo WiredBatchResults
type WiredBatchResults struct {
Results []WiredBatchOperationResult `json:"results"`
}
tipo WiredFurniPagedVariables
type WiredFurniPagedVariables struct {
Items []FurniVariableHolder `json:"items"`
Page int `json:"page"`
Size int `json:"size"`
}
tipo WiredIDProfileTarget
type WiredIDProfileTarget struct {
ID int64 `json:"id"`
}
tipo WiredKeys
WiredKeys contém as chaves configuradas nas opções da API Wired do quarto.
Pelo menos uma chave é necessária quando o suporte a Wired está habilitado. As chaves são
enviadas em cabeçalhos HTTP e nunca adicionadas à URL da requisição.
type WiredKeys struct {
ReadKey string
WriteKey string
}
tipo WiredListOptions
type WiredListOptions struct {
OrderBy WiredOrderBy
OrderDirection WiredOrderDirection
Page int
Size int
}
tipo WiredNamedProfileTarget
type WiredNamedProfileTarget struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
tipo WiredOrderBy
type WiredOrderBy string
Constantes relacionadasWiredOrderByValue, WiredOrderByCreationTime, WiredOrderByUpdateTime
const (
WiredOrderByValue WiredOrderBy = "value"
WiredOrderByCreationTime WiredOrderBy = "creation_time"
WiredOrderByUpdateTime WiredOrderBy = "update_time"
)
tipo WiredOrderDirection
type WiredOrderDirection string
Constantes relacionadasWiredOrderAscending, WiredOrderDescending
const (
WiredOrderAscending WiredOrderDirection = "asc"
WiredOrderDescending WiredOrderDirection = "desc"
)
tipo WiredPagedVariables
WiredPagedVariables contém uma lista paginada de itens de variáveis Wired.
type WiredPagedVariables struct {
Items []json.RawMessage `json:"items"`
Page int `json:"page"`
Size int `json:"size"`
}
tipo WiredProfile
WiredProfile representa as variantes de perfil de variáveis Wired.
type WiredProfile struct {
Variables map[string]WiredVariable `json:"variables"`
User *WiredUserProfileTarget `json:"user,omitempty"`
Pet *WiredNamedProfileTarget `json:"pet,omitempty"`
Bot *WiredNamedProfileTarget `json:"bot,omitempty"`
Furni *WiredIDProfileTarget `json:"furni,omitempty"`
FurniBC *WiredIDProfileTarget `json:"furni_bc,omitempty"`
WallItem *WiredIDProfileTarget `json:"wall_item,omitempty"`
WallItemBC *WiredIDProfileTarget `json:"wall_item_bc,omitempty"`
}
tipo WiredRoomVariables
type WiredRoomVariables struct {
Users []string `json:"users"`
Furni []string `json:"furni"`
Global []string `json:"global"`
}
tipo WiredScope
WiredScope identifica a família de uma variável Wired não-global (user ou furni).
type WiredScope string
Constantes relacionadasWiredScopeUser, WiredScopeFurni
const (
WiredScopeUser WiredScope = "user"
WiredScopeFurni WiredScope = "furni"
)
tipo WiredService
type WiredService service
MétodosBatch
Batch executa de 1 a 50 operações de leitura/escrita em lote contra a variável informada.
func (s *WiredService) Batch(ctx context.Context, scope WiredScope, variableName string, operations []WiredBatchOperation) (*WiredBatchResults, *Response, error)
BulkDelete
BulkDelete exclui todos os valores armazenados para as variáveis informadas.
func (s *WiredService) BulkDelete(ctx context.Context, variableNames []string) (*Response, error)
CountValues
func (s *WiredService) CountValues(ctx context.Context, scope WiredScope, variableName string, target WiredTargetKind) (int64, *Response, error)
DeleteUserProfile
func (s *WiredService) DeleteUserProfile(ctx context.Context, target WiredTargetKind, entityID string) (*Response, error)
DeleteValue
func (s *WiredService) DeleteValue(ctx context.Context, scope WiredScope, variableName string, target WiredTargetKind, entityID string) (*Response, error)
FindUserProfile
func (s *WiredService) FindUserProfile(ctx context.Context, options *WiredUserSearchOptions) (*WiredProfile, *Response, error)
GetFurniProfile
func (s *WiredService) GetFurniProfile(ctx context.Context, target WiredTargetKind, entityID string) (*WiredProfile, *Response, error)
GetGlobalProfile
func (s *WiredService) GetGlobalProfile(ctx context.Context) (*WiredProfile, *Response, error)
GetGlobalValue
func (s *WiredService) GetGlobalValue(ctx context.Context, variableName string) (*WiredVariable, *Response, error)
GetUserProfile
func (s *WiredService) GetUserProfile(ctx context.Context, target WiredTargetKind, entityID string) (*WiredProfile, *Response, error)
GetValue
func (s *WiredService) GetValue(ctx context.Context, scope WiredScope, variableName string, target WiredTargetKind, entityID string) (*WiredVariable, *Response, error)
ListFurniValues
func (s *WiredService) ListFurniValues(ctx context.Context, variableName string, target WiredTargetKind, options *WiredListOptions) (*WiredFurniPagedVariables, *Response, error)
ListUserValues
func (s *WiredService) ListUserValues(ctx context.Context, variableName string, target WiredTargetKind, options *WiredListOptions) (*WiredUserPagedVariables, *Response, error)
ListValues
func (s *WiredService) ListValues(ctx context.Context, scope WiredScope, variableName string, target WiredTargetKind, options *WiredListOptions) (*WiredPagedVariables, *Response, error)
ListVariables
func (s *WiredService) ListVariables(ctx context.Context) (*WiredRoomVariables, *Response, error)
PatchFurniProfile
func (s *WiredService) PatchFurniProfile(ctx context.Context, target WiredTargetKind, entityID string, variables map[string]*int64) (*WiredProfile, *Response, error)
PatchGlobalProfile
func (s *WiredService) PatchGlobalProfile(ctx context.Context, variables map[string]int64) (*WiredProfile, *Response, error)
PatchGlobalValue
func (s *WiredService) PatchGlobalValue(ctx context.Context, variableName string, value int64) (*WiredVariable, *Response, error)
PatchUserProfile
func (s *WiredService) PatchUserProfile(ctx context.Context, target WiredTargetKind, entityID string, variables map[string]*int64) (*WiredProfile, *Response, error)
PatchValue
func (s *WiredService) PatchValue(ctx context.Context, scope WiredScope, variableName string, target WiredTargetKind, entityID string, value int64) (*WiredVariable, *Response, error)
PutValue
func (s *WiredService) PutValue(ctx context.Context, scope WiredScope, variableName string, target WiredTargetKind, entityID string, value int64) (*WiredVariable, *Response, error)
tipo WiredTargetKind
WiredTargetKind identifica a coleção de destino em rotas Wired.
type WiredTargetKind string
Constantes relacionadasWiredTargetUsers, WiredTargetPets, WiredTargetBots, WiredTargetFurni, WiredTargetFurniBC, WiredTargetWallItems, WiredTargetWallItemsBC
const (
WiredTargetUsers WiredTargetKind = "users"
WiredTargetPets WiredTargetKind = "pets"
WiredTargetBots WiredTargetKind = "bots"
WiredTargetFurni WiredTargetKind = "furni"
WiredTargetFurniBC WiredTargetKind = "furni-bc"
WiredTargetWallItems WiredTargetKind = "wall-items"
WiredTargetWallItemsBC WiredTargetKind = "wall-items-bc"
)
tipo WiredUserPagedVariables
type WiredUserPagedVariables struct {
Items []UserVariableHolder `json:"items"`
Page int `json:"page"`
Size int `json:"size"`
}
tipo WiredUserProfileTarget
type WiredUserProfileTarget struct {
ID int64 `json:"id"`
Name string `json:"name"`
UniqueID string `json:"unique_id"`
}
tipo WiredUserSearchOptions
type WiredUserSearchOptions struct {
Name string
UniqueID string
}
tipo WiredVariable
type WiredVariable struct {
Value int64 `json:"value"`
CreationTime string `json:"creation_time"`
UpdateTime string `json:"update_time"`
}