Documentation
¶
Overview ¶
Package pdrest provides a typed HTTP client for the PalDefender REST API.
Supports version, guilds, players, pals, items, techs, progression, bans, kicks, broadcasts, alerts and item/pal grants via bearer-token authentication. All request methods accept a context.Context.
Index ¶
- type APIError
- type AlertRequest
- type AlertResponse
- type BanIPRequest
- type BanIPResponse
- type BanRequest
- type BanResponse
- type BanlistData
- type BanlistIPEntry
- type BanlistIssuer
- type BanlistResponse
- type BanlistTimestamp
- type BanlistUserEntry
- type BroadcastRequest
- type BroadcastResponse
- type Client
- func (c *Client) Alert(ctx context.Context, message string) (*AlertResponse, error)
- func (c *Client) Ban(ctx context.Context, playerIdentifier, reason string, ip bool) (*BanResponse, error)
- func (c *Client) BanIP(ctx context.Context, ip string, request *BanIPRequest) (*BanIPResponse, error)
- func (c *Client) Broadcast(ctx context.Context, message, sender string) (*BroadcastResponse, error)
- func (c *Client) Close() error
- func (c *Client) DeleteBase(ctx context.Context, baseCampIdentifier string) (*DeleteBaseResponse, error)
- func (c *Client) ForgetTech(ctx context.Context, playerIdentifier string, technology ...TechnologyInput) (*ForgetTechResponse, error)
- func (c *Client) GetBanlist(ctx context.Context, filters map[string]string) (*BanlistResponse, error)
- func (c *Client) GetGuild(ctx context.Context, guildID string) (*GuildDetail, error)
- func (c *Client) GetGuilds(ctx context.Context) (*GuildsResponse, error)
- func (c *Client) GetItems(ctx context.Context, playerIdentifier string) (*PlayerItemsResponse, error)
- func (c *Client) GetPals(ctx context.Context, playerIdentifier string) (*PlayerPalsResponse, error)
- func (c *Client) GetPlayer(ctx context.Context, playerIdentifier string) (*PlayerInfo, error)
- func (c *Client) GetPlayers(ctx context.Context) (*PlayersResponse, error)
- func (c *Client) GetProgression(ctx context.Context, playerIdentifier string) (*PlayerProgressionResponse, error)
- func (c *Client) GetTechs(ctx context.Context, playerIdentifier string) (*PlayerTechsResponse, error)
- func (c *Client) GetVersion(ctx context.Context) (*VersionInfo, error)
- func (c *Client) GiveItems(ctx context.Context, playerIdentifier string, items ...ItemInput) (*GrantResult, error)
- func (c *Client) GivePalEggs(ctx context.Context, playerIdentifier string, palEggs ...PalEggInput) (*GrantResult, error)
- func (c *Client) GivePalTemplates(ctx context.Context, playerIdentifier string, templates ...string) (*GrantResult, error)
- func (c *Client) GivePals(ctx context.Context, playerIdentifier string, pals ...PalInput) (*GrantResult, error)
- func (c *Client) GiveProgression(ctx context.Context, playerIdentifier string, request *GiveProgressionRequest, ...) (*GrantResult, error)
- func (c *Client) GiveRecipeMaterials(ctx context.Context, playerIdentifier string, product any, quantity int) (*GrantResult, error)
- func (c *Client) Kick(ctx context.Context, playerIdentifier, reason string) (*KickResponse, error)
- func (c *Client) LearnTech(ctx context.Context, playerIdentifier string, technology ...TechnologyInput) (*LearnTechResponse, error)
- func (c *Client) ReloadConfig(ctx context.Context) (*ReloadConfigResponse, error)
- func (c *Client) SendPlayerMessage(ctx context.Context, request *SendPlayerMessageRequest) (*SendPlayerMessageResponse, error)
- func (c *Client) SummonNPC(ctx context.Context, request *SummonNPCRequest) (*SummonNPCResponse, error)
- func (c *Client) SummonPal(ctx context.Context, request *SummonPalRequest) (*SummonPalResponse, error)
- func (c *Client) Unban(ctx context.Context, userID, reason string) (*UnbanResponse, error)
- func (c *Client) UnbanIP(ctx context.Context, ip string, request *UnbanIPRequest) (*UnbanIPResponse, error)
- type Coordinates
- type DeleteBaseCamp
- type DeleteBaseDeleted
- type DeleteBaseResponse
- type ErrorDetail
- type ErrorEnvelope
- type ForgetTechResponse
- type ForgottenTechs
- type GiveItem
- type GivePal
- type GivePalEgg
- type GiveProgressionRequest
- type GrantResult
- type GrantTotals
- type GrantValues
- type GuildAdmin
- type GuildCampDetail
- type GuildCampPal
- type GuildCampSummary
- type GuildDetail
- type GuildExpeditions
- type GuildLaboratory
- type GuildMember
- type GuildResponse
- type GuildSlot
- type GuildStorage
- type GuildSummary
- type GuildsMeta
- type GuildsResponse
- type InventorySection
- type InventorySlot
- type ItemInput
- type KickRequest
- type KickResponse
- type LearnTechResponse
- type Option
- type PalEggInput
- type PalIVs
- type PalInput
- type PalInstance
- type PalSouls
- type PalsData
- type PlayerBaseCamp
- type PlayerInfo
- type PlayerInventory
- type PlayerItemsMeta
- type PlayerItemsResponse
- type PlayerPalsMeta
- type PlayerPalsResponse
- type PlayerProgressionData
- type PlayerProgressionMeta
- type PlayerProgressionResponse
- type PlayerResponse
- type PlayerTechsData
- type PlayerTechsMeta
- type PlayerTechsResponse
- type PlayersMeta
- type PlayersResponse
- type ProgressionActivities
- type ProgressionBosses
- type ProgressionCaptures
- type ProgressionCurrencies
- type ProgressionPlayer
- type RESTClient
- type RecipeResolver
- type ReloadConfigResponse
- type ResearchProgress
- type SendPlayerMessageRequest
- type SendPlayerMessageResponse
- type SummonNPCRequest
- type SummonNPCResponse
- type SummonPalRequest
- type SummonPalResponse
- type SummonedNPC
- type SummonedPal
- type TechnologyInput
- type UnbanIPRequest
- type UnbanIPResponse
- type UnbanRequest
- type UnbanResponse
- type VersionInfo
- type VersionResponse
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
// StatusCode is the HTTP status code of the response.
StatusCode int `json:"status_code"`
// Method is the HTTP method of the request.
Method string `json:"method"`
// Path is the path of the request.
Path string `json:"path"`
// Envelope is the decoded documented error envelope, or nil when the
// response body does not follow the envelope shape.
Envelope *ErrorEnvelope `json:"envelope,omitempty"`
// ResponseBody is the decoded body of the error response.
ResponseBody any `json:"response_body"`
}
APIError represents HTTP errors returned by the PalDefender REST API.
type AlertRequest ¶
type AlertRequest struct {
// Message is the alert message.
Message string `json:"Message"`
}
AlertRequest is the body of an alert request.
type AlertResponse ¶
type AlertResponse struct {
// Success indicates whether the alert was sent.
Success bool `json:"Success"`
}
AlertResponse describes the result of an alert.
type BanIPRequest ¶
type BanIPRequest struct {
// Reason is the ban reason.
Reason string `json:"Reason,omitempty"`
// UserId is the ID of the user associated with the IP.
UserId string `json:"UserId,omitempty"`
}
BanIPRequest is the body of an IP ban request.
type BanIPResponse ¶
type BanIPResponse struct {
// Success indicates whether the ban was successful.
Success bool `json:"Success"`
// IP is the banned IP.
IP string `json:"IP"`
// UserId is the ID of the user associated with the IP.
UserId string `json:"UserId"`
// Kicked is the number of kicked players.
Kicked int `json:"Kicked"`
}
BanIPResponse describes the result of banning an IP.
type BanRequest ¶
type BanRequest struct {
// Reason is the ban reason.
Reason string `json:"Reason,omitempty"`
// IP indicates whether the ban should include the IP.
IP bool `json:"IP,omitempty"`
}
BanRequest is the body of a player ban request.
type BanResponse ¶
type BanResponse struct {
// Success indicates whether the ban was successful.
Success bool `json:"Success"`
// UserId is the ID of the banned user.
UserId string `json:"UserId"`
// IP indicates whether the IP was banned.
IP bool `json:"IP"`
// BannedIP is the banned IP.
BannedIP string `json:"BannedIP"`
// Kicked is the number of kicked players.
Kicked int `json:"Kicked"`
}
BanResponse describes the result of banning a player.
type BanlistData ¶
type BanlistData struct {
// Version is the ban list file format version.
Version int `json:"Version"`
// BannedMessage is the message shown to banned players.
BannedMessage string `json:"BannedMessage"`
// UserEntries are the user ban entries matching the applied filters.
UserEntries []BanlistUserEntry `json:"UserEntries"`
// IPEntries are the IP ban entries matching the applied filters.
IPEntries []BanlistIPEntry `json:"IPEntries"`
}
BanlistData is the ban list content returned by the API.
type BanlistIPEntry ¶
type BanlistIPEntry struct {
// IP is the banned IP address.
IP string `json:"IP"`
// Active indicates whether the ban is currently active.
Active bool `json:"Active"`
// BannedBy is the issuer data for the ban action.
BannedBy BanlistIssuer `json:"BannedBy"`
// UnbannedBy is the issuer data for the unban action, when present.
UnbannedBy *BanlistIssuer `json:"UnbannedBy,omitempty"`
}
BanlistIPEntry is an IP ban entry of the ban list.
type BanlistIssuer ¶
type BanlistIssuer struct {
// Type is the issuer type, such as rest, player, or system.
Type string `json:"Type"`
// NameValue is the issuer name, user ID, token, or type fallback.
NameValue string `json:"NameValue"`
// IP is the issuer IP address metadata.
IP string `json:"IP"`
// Reason is the reason recorded for the action.
Reason string `json:"Reason"`
// Timestamp is the UTC timestamp of the action.
Timestamp BanlistTimestamp `json:"Timestamp"`
}
BanlistIssuer describes the issuer of a ban or unban action.
type BanlistResponse ¶
type BanlistResponse struct {
// Banlist is the ban list data after applying query filters.
Banlist BanlistData `json:"Banlist"`
}
BanlistResponse wraps the ban list content returned by the API.
type BanlistTimestamp ¶
type BanlistTimestamp struct {
// UTC is the Unix timestamp in seconds.
UTC int64 `json:"UTC"`
// Year is the UTC year.
Year int `json:"Year"`
// Month is the UTC month.
Month int `json:"Month"`
// Day is the UTC day of month.
Day int `json:"Day"`
// Hour is the UTC hour.
Hour int `json:"Hour"`
// Min is the UTC minute.
Min int `json:"Min"`
// Sec is the UTC second.
Sec int `json:"Sec"`
// Msec is the millisecond component.
Msec int `json:"Msec"`
}
BanlistTimestamp describes UTC timestamp components of an action.
type BanlistUserEntry ¶
type BanlistUserEntry struct {
// UserId is the banned user ID.
UserId string `json:"UserId"`
// Active indicates whether the ban is currently active.
Active bool `json:"Active"`
// BannedBy is the issuer data for the ban action.
BannedBy BanlistIssuer `json:"BannedBy"`
// UnbannedBy is the issuer data for the unban action, when present.
UnbannedBy *BanlistIssuer `json:"UnbannedBy,omitempty"`
}
BanlistUserEntry is a user ban entry of the ban list.
type BroadcastRequest ¶
type BroadcastRequest struct {
// Message is the broadcast message.
Message string `json:"Message"`
// Sender is the name of the broadcast sender.
Sender string `json:"Sender,omitempty"`
}
BroadcastRequest is the body of a broadcast request.
type BroadcastResponse ¶
type BroadcastResponse struct {
// Success indicates whether the broadcast was successful.
Success bool `json:"Success"`
}
BroadcastResponse describes the result of a broadcast.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the typed HTTP client for the PalDefender REST API.
func NewClient ¶
NewClient creates a PalDefender client with a normalized base URL and bearer token.
The base URL host must be an IP address or a valid DNS hostname with RFC 1123 style labels (ASCII letters, digits, '-'); internal hostnames with other characters, such as underscores, are rejected. The internal HTTP client never follows redirects and ignores environment proxies; inject a client via WithHTTPClient to customize that behavior.
func (*Client) Alert ¶
Alert sends a PalDefender alert with the given message.
Example ¶
package main
import (
"context"
"errors"
"fmt"
"net/http"
"net/http/httptest"
pdrest "github.com/TagamerStudio/pdrest-go"
)
func main() {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusUnauthorized)
_, _ = fmt.Fprint(w, `{"Error":{"Code":"INVALID_TOKEN","Message":"invalid token","Details":{}}}`)
}))
defer srv.Close()
client, err := pdrest.NewClient(srv.URL, "wrong-token")
if err != nil {
fmt.Println("client error:", err)
return
}
defer func() { _ = client.Close() }()
_, err = client.Alert(context.Background(), "Restart now.")
var apiErr *pdrest.APIError
if errors.As(err, &apiErr) {
fmt.Printf("API error: status %d on %s %s", apiErr.StatusCode, apiErr.Method, apiErr.Path)
}
}
Output: API error: status 401 on POST /Alert
func (*Client) Ban ¶
func (c *Client) Ban(ctx context.Context, playerIdentifier, reason string, ip bool) (*BanResponse, error)
Ban bans the player or IP identified by playerIdentifier; ip selects between the two.
func (*Client) BanIP ¶
func (c *Client) BanIP(ctx context.Context, ip string, request *BanIPRequest) (*BanIPResponse, error)
BanIP bans the given IP address.
func (*Client) Close ¶
Close releases the idle connections of the underlying HTTP client. It is a no-op when a custom client was injected via WithHTTPClient.
func (*Client) DeleteBase ¶
func (c *Client) DeleteBase(ctx context.Context, baseCampIdentifier string) (*DeleteBaseResponse, error)
DeleteBase deletes the base camp identified by baseCampIdentifier.
func (*Client) ForgetTech ¶
func (c *Client) ForgetTech(ctx context.Context, playerIdentifier string, technology ...TechnologyInput) (*ForgetTechResponse, error)
ForgetTech removes technologies from the player identified by playerIdentifier.
func (*Client) GetBanlist ¶
func (c *Client) GetBanlist(ctx context.Context, filters map[string]string) (*BanlistResponse, error)
GetBanlist returns the ban list, optionally filtered.
func (*Client) GetGuilds ¶
func (c *Client) GetGuilds(ctx context.Context) (*GuildsResponse, error)
GetGuilds lists all guilds.
func (*Client) GetItems ¶
func (c *Client) GetItems(ctx context.Context, playerIdentifier string) (*PlayerItemsResponse, error)
GetItems returns the items of the player identified by playerIdentifier.
func (*Client) GetPlayers ¶
func (c *Client) GetPlayers(ctx context.Context) (*PlayersResponse, error)
GetPlayers returns the connected players.
Example ¶
package main
import (
"context"
"fmt"
"net/http"
"net/http/httptest"
pdrest "github.com/TagamerStudio/pdrest-go"
)
func main() {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
_, _ = fmt.Fprint(w, `{"Meta":{"PlayerCount":1,"OnlineCount":1},"Players":[{"Name":"Alice","UserId":"steam_76561198012345678"}]}`)
}))
defer srv.Close()
client, err := pdrest.NewClient(srv.URL, "bearer-token")
if err != nil {
fmt.Println("client error:", err)
return
}
defer func() { _ = client.Close() }()
players, err := client.GetPlayers(context.Background())
if err != nil {
fmt.Println("request error:", err)
return
}
fmt.Printf("%d known players, first is %s", players.Meta.PlayerCount, players.Players[0].Name)
}
Output: 1 known players, first is Alice
func (*Client) GetProgression ¶
func (c *Client) GetProgression(ctx context.Context, playerIdentifier string) (*PlayerProgressionResponse, error)
GetProgression returns the progression of the player identified by playerIdentifier.
func (*Client) GetTechs ¶
func (c *Client) GetTechs(ctx context.Context, playerIdentifier string) (*PlayerTechsResponse, error)
GetTechs returns the techs of the player identified by playerIdentifier.
func (*Client) GetVersion ¶
func (c *Client) GetVersion(ctx context.Context) (*VersionInfo, error)
GetVersion returns the PalDefender version info.
Example ¶
package main
import (
"context"
"fmt"
"net/http"
"net/http/httptest"
"time"
pdrest "github.com/TagamerStudio/pdrest-go"
)
func main() {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
_, _ = fmt.Fprint(w, `{"Version":{"Major":0,"Minor":8,"Patch":1,"Version":"0.8.1"}}`)
}))
defer srv.Close()
client, err := pdrest.NewClient(srv.URL, "bearer-token", pdrest.WithTimeout(30*time.Second))
if err != nil {
fmt.Println("client error:", err)
return
}
defer func() { _ = client.Close() }()
version, err := client.GetVersion(context.Background())
if err != nil {
fmt.Println("request error:", err)
return
}
fmt.Printf("PalDefender %s", version.Version)
}
Output: PalDefender 0.8.1
func (*Client) GiveItems ¶
func (c *Client) GiveItems(ctx context.Context, playerIdentifier string, items ...ItemInput) (*GrantResult, error)
GiveItems grants items to the player identified by playerIdentifier. Duplicate item IDs across the inputs are combined into a single grant of the summed count, keeping the first-seen order.
Example ¶
package main
import (
"context"
"fmt"
"net/http"
"net/http/httptest"
pdrest "github.com/TagamerStudio/pdrest-go"
)
func main() {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
_, _ = fmt.Fprint(w, `{"Granted":{"Items":3}}`)
}))
defer srv.Close()
client, err := pdrest.NewClient(srv.URL, "bearer-token")
if err != nil {
fmt.Println("client error:", err)
return
}
defer func() { _ = client.Close() }()
grant, err := client.GiveItems(context.Background(), "steam_76561198012345678", "Money", []any{"Money", 2})
if err != nil {
fmt.Println("request error:", err)
return
}
fmt.Printf("granted %d item units", grant.Granted.Items)
}
Output: granted 3 item units
func (*Client) GivePalEggs ¶
func (c *Client) GivePalEggs(ctx context.Context, playerIdentifier string, palEggs ...PalEggInput) (*GrantResult, error)
GivePalEggs grants pal eggs to the player identified by playerIdentifier.
In tuple inputs a trailing ".json" value selects the pal template; use a GivePalEgg or map input for template names without the ".json" suffix. A single slice of scalar values is treated as one (egg_id, pal_id, level) tuple; pass GivePalEgg objects or maps to grant multiple eggs.
func (*Client) GivePalTemplates ¶
func (c *Client) GivePalTemplates(ctx context.Context, playerIdentifier string, templates ...string) (*GrantResult, error)
GivePalTemplates grants pal templates to the player identified by playerIdentifier.
func (*Client) GivePals ¶
func (c *Client) GivePals(ctx context.Context, playerIdentifier string, pals ...PalInput) (*GrantResult, error)
GivePals grants pals to the player identified by playerIdentifier.
func (*Client) GiveProgression ¶
func (c *Client) GiveProgression(ctx context.Context, playerIdentifier string, request *GiveProgressionRequest, exp, technologyPoints, ancientTechnologyPoints *int, relics map[string]int) (*GrantResult, error)
GiveProgression grants progression (exp, relics, and tech points) to a player.
func (*Client) GiveRecipeMaterials ¶
func (c *Client) GiveRecipeMaterials(ctx context.Context, playerIdentifier string, product any, quantity int) (*GrantResult, error)
GiveRecipeMaterials grants the materials required to craft product, scaled by quantity.
func (*Client) LearnTech ¶
func (c *Client) LearnTech(ctx context.Context, playerIdentifier string, technology ...TechnologyInput) (*LearnTechResponse, error)
LearnTech unlocks technologies for the player identified by playerIdentifier.
func (*Client) ReloadConfig ¶
func (c *Client) ReloadConfig(ctx context.Context) (*ReloadConfigResponse, error)
ReloadConfig reloads the PalDefender configuration.
func (*Client) SendPlayerMessage ¶
func (c *Client) SendPlayerMessage(ctx context.Context, request *SendPlayerMessageRequest) (*SendPlayerMessageResponse, error)
SendPlayerMessage sends a direct message to a player.
func (*Client) SummonNPC ¶
func (c *Client) SummonNPC(ctx context.Context, request *SummonNPCRequest) (*SummonNPCResponse, error)
SummonNPC spawns an NPC at the given map coordinates. Coordinates are always sent, and zero is a valid coordinate value.
func (*Client) SummonPal ¶
func (c *Client) SummonPal(ctx context.Context, request *SummonPalRequest) (*SummonPalResponse, error)
SummonPal spawns a Pal at the given map coordinates. Exactly one of PalID or PalTemplate must be provided. Coordinates are always sent, and zero is a valid coordinate value.
Example ¶
package main
import (
"context"
"fmt"
"net/http"
"net/http/httptest"
pdrest "github.com/TagamerStudio/pdrest-go"
)
func main() {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
_, _ = fmt.Fprint(w, `{"Summoned":{"Type":"Pal","PalID":"Foxparks","Level":12,"DamageMeter":true,"X":230,"Y":-486,"Z":4097}}`)
}))
defer srv.Close()
client, err := pdrest.NewClient(srv.URL, "bearer-token")
if err != nil {
fmt.Println("client error:", err)
return
}
defer func() { _ = client.Close() }()
summoned, err := client.SummonPal(context.Background(), &pdrest.SummonPalRequest{
PalID: "Foxparks",
X: 230,
Y: -486,
Z: 4097,
Level: 12,
})
if err != nil {
fmt.Println("request error:", err)
return
}
fmt.Printf("summoned %s at %.0f,%.0f,%.0f", summoned.Summoned.PalID, summoned.Summoned.X, summoned.Summoned.Y, summoned.Summoned.Z)
}
Output: summoned Foxparks at 230,-486,4097
func (*Client) UnbanIP ¶
func (c *Client) UnbanIP(ctx context.Context, ip string, request *UnbanIPRequest) (*UnbanIPResponse, error)
UnbanIP unbans the given IP address.
type Coordinates ¶
type Coordinates struct {
// X is the X coordinate.
X float64 `json:"x"`
// Y is the Y coordinate.
Y float64 `json:"y"`
// Z is the Z coordinate.
Z float64 `json:"z"`
}
Coordinates are a position in the world or on the map.
type DeleteBaseCamp ¶
type DeleteBaseCamp struct {
// ID is the base camp GUID.
ID string `json:"Id"`
// Summary is the human-readable base camp summary.
Summary string `json:"Summary"`
}
DeleteBaseCamp is the summary of a deleted base camp.
type DeleteBaseDeleted ¶
type DeleteBaseDeleted struct {
// BaseCampPals is the number of base camp pals deleted.
BaseCampPals int `json:"BaseCampPals"`
// StorageContainers is the number of storage containers cleared.
StorageContainers int `json:"StorageContainers"`
// ItemStacks is the number of item stacks deleted.
ItemStacks int `json:"ItemStacks"`
// ItemCount is the total item count deleted.
ItemCount int `json:"ItemCount"`
// Buildings is the number of buildings deleted.
Buildings int `json:"Buildings"`
// DropItems is the number of dropped item actors deleted.
DropItems int `json:"DropItems"`
// DefenseModels is the number of defense models deleted.
DefenseModels int `json:"DefenseModels"`
// OtherMapObjects is the number of other map objects deleted.
OtherMapObjects int `json:"OtherMapObjects"`
// PalBox indicates whether the base Palbox was deleted.
PalBox bool `json:"PalBox"`
}
DeleteBaseDeleted are the cleanup counts of a deleted base camp.
type DeleteBaseResponse ¶
type DeleteBaseResponse struct {
// BaseCamp is the deleted base camp summary.
BaseCamp DeleteBaseCamp `json:"BaseCamp"`
// Deleted are the cleanup counts of the deleted base camp.
Deleted DeleteBaseDeleted `json:"Deleted"`
// Archive is the path to the generated audit archive.
Archive string `json:"Archive"`
}
DeleteBaseResponse describes the result of deleting a base camp.
type ErrorDetail ¶
type ErrorDetail struct {
// Code is the machine-readable error code.
Code string `json:"Code"`
// Message is the human-readable error message.
Message string `json:"Message"`
// Details is the server-provided details payload, when present.
Details any `json:"Details"`
}
ErrorDetail are the details of an API error.
type ErrorEnvelope ¶
type ErrorEnvelope struct {
// Error holds the error details.
Error ErrorDetail `json:"Error"`
}
ErrorEnvelope is the error body documented by the PalDefender REST API.
type ForgetTechResponse ¶
type ForgetTechResponse struct {
// ForgottenCount is the number of technologies removed from the player.
ForgottenCount int `json:"ForgottenCount"`
// Forgotten are the removed technology IDs, or All when every unlocked
// technology was removed.
Forgotten ForgottenTechs `json:"Forgotten"`
// Skipped are the technology IDs skipped because they were not unlocked.
Skipped []string `json:"Skipped"`
}
ForgetTechResponse describes the result of forgetting technologies.
type ForgottenTechs ¶
type ForgottenTechs struct {
// IDs are the removed technology IDs.
IDs []string
// All indicates whether every unlocked technology was removed.
All bool
}
ForgottenTechs are the technology IDs removed by a forget request. All reports whether every unlocked technology was removed ("All").
func (*ForgottenTechs) UnmarshalJSON ¶
func (f *ForgottenTechs) UnmarshalJSON(data []byte) error
UnmarshalJSON accepts a single technology ID, the string "All", or an array of technology IDs.
type GiveItem ¶
type GiveItem struct {
// ItemID is the item identifier.
ItemID string `json:"ItemID"`
// Count is the quantity of the item.
Count int `json:"Count"`
}
GiveItem is the input for giving an item to a player.
type GivePal ¶
type GivePal struct {
// PalID is the pal identifier.
PalID string `json:"PalID"`
// Level is the pal level.
Level int `json:"Level"`
}
GivePal is the input for giving a pal to a player.
type GivePalEgg ¶
type GivePalEgg struct {
// EggID is the egg identifier.
EggID string `json:"EggID"`
// PalID is the identifier of the pal contained in the egg.
PalID string `json:"PalID,omitempty"`
// PalTemplate is the template of the pal contained in the egg.
PalTemplate string `json:"PalTemplate,omitempty"`
// Level is the level of the pal at birth.
Level int `json:"Level,omitempty"`
}
GivePalEgg is the input for giving a pal egg to a player.
type GiveProgressionRequest ¶
type GiveProgressionRequest struct {
// EXP is the experience to grant.
EXP int `json:"EXP,omitempty"`
// TechnologyPoints is the number of technology points to grant.
TechnologyPoints int `json:"TechnologyPoints,omitempty"`
// AncientTechnologyPoints is the number of ancient technology points to grant.
AncientTechnologyPoints int `json:"AncientTechnologyPoints,omitempty"`
// Relics are the relic point amounts to grant keyed by relic type.
Relics map[string]int `json:"Relics,omitempty"`
}
GiveProgressionRequest defines the progression fields to be granted.
type GrantResult ¶
type GrantResult struct {
// Granted are the values granted by the request.
Granted GrantValues `json:"Granted"`
// Totals are the updated totals for granted currencies, when applicable.
Totals GrantTotals `json:"Totals,omitempty"`
}
GrantResult describes the result of a grant operation.
type GrantTotals ¶
type GrantTotals struct {
// TechnologyPoints is the updated technology point total.
TechnologyPoints int `json:"TechnologyPoints,omitempty"`
// AncientTechnologyPoints is the updated ancient technology point total.
AncientTechnologyPoints int `json:"AncientTechnologyPoints,omitempty"`
// Relics are the updated relic point totals keyed by relic type.
Relics map[string]int `json:"Relics,omitempty"`
}
GrantTotals are the updated currency totals returned by a grant endpoint.
type GrantValues ¶
type GrantValues struct {
// EXP is the experience granted, on progression grants.
EXP int `json:"EXP,omitempty"`
// TechnologyPoints are the technology points granted, on progression grants.
TechnologyPoints int `json:"TechnologyPoints,omitempty"`
// AncientTechnologyPoints are the ancient technology points granted, on progression grants.
AncientTechnologyPoints int `json:"AncientTechnologyPoints,omitempty"`
// Relics are the relic point amounts granted by relic type, on progression grants.
Relics map[string]int `json:"Relics,omitempty"`
// Items is the number of item units granted, on item grants.
Items int `json:"Items,omitempty"`
// Pals is the number of Pals granted, on pal grants.
Pals int `json:"Pals,omitempty"`
// PalTemplates is the number of Pal templates granted, on pal template grants.
PalTemplates int `json:"PalTemplates,omitempty"`
// PalEggs is the number of Pal eggs granted, on pal egg grants.
PalEggs int `json:"PalEggs,omitempty"`
}
GrantValues are the values granted by a grant endpoint. Only the fields documented for the called endpoint are populated.
type GuildAdmin ¶
type GuildAdmin struct {
// ID is the admin PlayerUID.
ID string `json:"id"`
// Name is the admin player name.
Name string `json:"name"`
}
GuildAdmin identifies the administrator of a guild.
type GuildCampDetail ¶
type GuildCampDetail struct {
// ID is the base camp identifier.
ID string `json:"id"`
// WorldPos is the position in the world.
WorldPos Coordinates `json:"world_pos"`
// MapPos is the position on the map.
MapPos Coordinates `json:"map_pos"`
// Level is the base camp level.
Level int `json:"level"`
// State is the base camp state.
State string `json:"state"`
// Pals are the worker Pals of the base camp keyed by Pal instance ID.
Pals map[string]GuildCampPal `json:"pals"`
// Buildings is the building payload placeholder.
Buildings string `json:"buildings"`
}
GuildCampDetail details a guild base camp.
type GuildCampPal ¶
type GuildCampPal struct {
// Nickname is the pal nickname.
Nickname string `json:"nickname"`
// PalID is the pal species identifier.
PalID string `json:"pal_id"`
// NpcID is the unique NPC ID.
NpcID string `json:"npc_id"`
// SkinID is the skin ID.
SkinID string `json:"skin_id"`
// Gender is the pal gender.
Gender string `json:"gender"`
// Level is the pal level.
Level int `json:"level"`
// Shiny indicates whether this is a rare pal.
Shiny bool `json:"shiny"`
// PhysicalHealth is the physical health state. The JSON key matches the
// official documentation spelling "phisical_health".
PhysicalHealth string `json:"phisical_health"`
// WorkerSick is the worker sickness state.
WorkerSick string `json:"worker_sick"`
// San is the sanity value.
San float64 `json:"san"`
// Imported indicates whether this is marked as imported.
Imported bool `json:"imported"`
// Friendship is the friendship point value.
Friendship int `json:"friendship"`
// ActiveSkills are the equipped active skills.
ActiveSkills []string `json:"active_skills"`
// LearntSkills are the learned skills.
LearntSkills []string `json:"learnt_skills"`
// Passives are the passive skill IDs.
Passives []string `json:"passives"`
}
GuildCampPal is a worker pal of a base camp.
type GuildCampSummary ¶
type GuildCampSummary struct {
// ID is the base camp identifier.
ID string `json:"id"`
// WorldPos is the position in the world.
WorldPos Coordinates `json:"world_pos"`
// MapPos is the position on the map.
MapPos Coordinates `json:"map_pos"`
}
GuildCampSummary summarizes a guild base camp.
type GuildDetail ¶
type GuildDetail struct {
// Name is the guild name.
Name string `json:"name"`
// Level is the guild level.
Level int `json:"Level"`
// Admin is the guild administrator.
Admin GuildAdmin `json:"admin"`
// MemberCount is the number of guild members.
MemberCount int `json:"member_count"`
// Members are the guild members.
Members []GuildMember `json:"members"`
// CampCount is the number of guild base camps.
CampCount int `json:"camp_count"`
// Camps are the guild base camps.
Camps []GuildCampDetail `json:"camps"`
// Items are the guild item storage data.
Items GuildStorage `json:"items"`
// Expeditions are the guild expeditions.
Expeditions GuildExpeditions `json:"expeditions"`
// Laboratory is the guild laboratory.
Laboratory GuildLaboratory `json:"laboratory"`
}
GuildDetail details a guild with members, base camps, and items.
type GuildExpeditions ¶
type GuildExpeditions struct {
// Finished is the number of finished expeditions.
Finished int `json:"finished"`
// Missions are the released mission flags keyed by mission ID.
Missions map[string]bool `json:"missions"`
}
GuildExpeditions describes the guild expedition state.
type GuildLaboratory ¶
type GuildLaboratory struct {
// CurrentResearch is the current research ID.
CurrentResearch string `json:"current_research"`
// Researches are the active researches keyed by research ID.
Researches map[string]ResearchProgress `json:"researches"`
}
GuildLaboratory describes the guild laboratory research state.
type GuildMember ¶
type GuildMember struct {
// PlayerUID is the player identifier.
PlayerUID string `json:"player_uid"`
// PlayerName is the player name.
PlayerName string `json:"player_name"`
// Status is the player status.
Status string `json:"status"`
}
GuildMember describes a guild member.
type GuildResponse ¶
type GuildResponse struct {
// Guild is the guild details.
Guild GuildDetail `json:"Guild"`
}
GuildResponse wraps the guild details returned by the API.
type GuildSlot ¶
type GuildSlot struct {
// ItemID is the item identifier.
ItemID string `json:"item_id"`
// Count is the stack count in the slot.
Count int `json:"count"`
}
GuildSlot is an item stored in a guild storage container slot.
type GuildStorage ¶
type GuildStorage struct {
// ContainerID is the container identifier.
ContainerID string `json:"container_id"`
// Current is the number of occupied slots.
Current int `json:"current"`
// Max is the total slot count.
Max int `json:"max"`
// Slots are the items keyed by slot index.
Slots map[string]GuildSlot
}
GuildStorage represents the item container of a guild.
func (*GuildStorage) UnmarshalJSON ¶
func (g *GuildStorage) UnmarshalJSON(data []byte) error
UnmarshalJSON captures the dynamic slot keys of the container.
type GuildSummary ¶
type GuildSummary struct {
// Name is the guild name.
Name string `json:"name"`
// Level is the guild level.
Level int `json:"Level"`
// Admin is the guild administrator.
Admin GuildAdmin `json:"admin"`
// CampCount is the number of guild base camps.
CampCount int `json:"camp_count"`
// Camps are the summaries of the guild base camps.
Camps []GuildCampSummary `json:"camps"`
// MemberCount is the number of guild members.
MemberCount int `json:"member_count"`
// Members are the PlayerUIDs of the guild members.
Members []string `json:"members"`
}
GuildSummary summarizes a guild with counts and members.
type GuildsMeta ¶
type GuildsMeta struct {
// GuildCount is the number of guilds returned.
GuildCount int `json:"GuildCount"`
}
GuildsMeta describes the guild list returned by the API.
type GuildsResponse ¶
type GuildsResponse struct {
// Meta is the guild list metadata.
Meta GuildsMeta `json:"Meta"`
// Guilds are the known guild summaries keyed by guild UUID.
Guilds map[string]GuildSummary `json:"Guilds"`
}
GuildsResponse maps the guild UUID to GuildSummary.
type InventorySection ¶
type InventorySection struct {
// Available indicates whether the container was available.
Available bool `json:"Available"`
// ContainerID is the container identifier.
ContainerID string `json:"ContainerID"`
// UsedSlots is the number of used slots.
UsedSlots int `json:"UsedSlots"`
// MaxSlots is the maximum number of slots.
MaxSlots int `json:"MaxSlots"`
// FreeSlots is the number of free slots.
FreeSlots int `json:"FreeSlots"`
// Slots are the item slots of the section.
Slots map[string]InventorySlot `json:"Slots"`
}
InventorySection represents a section of a player's inventory.
type InventorySlot ¶
type InventorySlot struct {
// ItemID is the item identifier.
ItemID string `json:"ItemID"`
// Count is the quantity of the item.
Count int `json:"Count"`
}
InventorySlot represents an item in an inventory slot.
type ItemInput ¶
type ItemInput any
ItemInput accepts strings, GiveItem objects, dictionaries, or (item_id, count) tuples. Duplicate item IDs across inputs are combined into a single grant of the summed count, keeping the first-seen order.
type KickRequest ¶
type KickRequest struct {
// Reason is the kick reason.
Reason string `json:"Reason,omitempty"`
}
KickRequest is the body of a player kick request.
type KickResponse ¶
type KickResponse struct {
// Success indicates whether the kick was successful.
Success bool `json:"Success"`
// UserId is the ID of the kicked user.
UserId string `json:"UserId"`
}
KickResponse describes the result of kicking a player.
type LearnTechResponse ¶
type LearnTechResponse struct {
// UnlockedCount is the number of technologies unlocked by the request.
UnlockedCount int `json:"UnlockedCount"`
// Unlocked are the technology IDs that were unlocked.
Unlocked []string `json:"Unlocked"`
// Skipped are the technology IDs skipped because they were already unlocked.
Skipped []string `json:"Skipped"`
}
LearnTechResponse describes the result of learning technologies.
type Option ¶
type Option func(*Client)
Option is a configuration function applied to the Client.
func WithDisplayAddress ¶
WithDisplayAddress sets the address displayed in requests.
func WithHTTPClient ¶
WithHTTPClient injects a custom http.Client (used in tests). The injected client's Timeout is preserved; a zero Timeout disables the default request timeout unless WithTimeout is also set. Close becomes a no-op because the injected client is owned by the caller. Keep a Timeout set, or cancel the request contexts, unless the caller manages timeouts itself.
func WithOrigin ¶
WithOrigin sets the HTTP Origin header sent with requests.
func WithRecipeResolver ¶
func WithRecipeResolver(resolver RecipeResolver) Option
WithRecipeResolver injects a recipe resolver for GiveRecipeMaterials.
func WithTimeout ¶
WithTimeout sets the HTTP timeout of the client.
type PalEggInput ¶
type PalEggInput any
PalEggInput accepts GivePalEgg objects, dictionaries, or tuples. In tuple form a trailing ".json" value is treated as a PalTemplate and any other value as a PalID.
type PalIVs ¶
type PalIVs struct {
// Health is the health IV.
Health float64 `json:"Health"`
// AttackMelee is the melee attack IV.
AttackMelee float64 `json:"AttackMelee"`
// AttackShot is the ranged attack IV.
AttackShot float64 `json:"AttackShot"`
// Defense is the defense IV.
Defense float64 `json:"Defense"`
}
PalIVs are the IV values of a pal.
type PalInput ¶
type PalInput any
PalInput accepts strings, GivePal objects, dictionaries, or (pal_id, level) tuples.
type PalInstance ¶
type PalInstance struct {
// PalID is the pal species identifier.
PalID string `json:"PalID"`
// UniqueNPCID is the unique NPC ID, when present.
UniqueNPCID string `json:"UniqueNPCID"`
// Nickname is the custom pal nickname, or an empty string.
Nickname string `json:"Nickname"`
// SkinId is the skin ID, or an empty string.
SkinId string `json:"SkinId"`
// Gender is the pal gender.
Gender string `json:"Gender"`
// Level is the pal level.
Level int `json:"Level"`
// Exp is the pal experience.
Exp int `json:"Exp"`
// Shiny indicates whether this is a rare pal.
Shiny bool `json:"Shiny"`
// PartnerSkillLevel is the partner skill rank.
PartnerSkillLevel int `json:"PartnerSkillLevel"`
// CondensedPals is the condense rank progress.
CondensedPals int `json:"CondensedPals"`
// UnusedStatusPoints are the unused pal status points.
UnusedStatusPoints int `json:"UnusedStatusPoints"`
// FriendshipPoints is the friendship point value.
FriendshipPoints int `json:"FriendshipPoints"`
// PhysicalHealth is the physical health state.
PhysicalHealth string `json:"PhysicalHealth"`
// WorkerSick is the worker sickness state.
WorkerSick string `json:"WorkerSick"`
// ImportedCharacter indicates whether this is marked as imported.
ImportedCharacter bool `json:"ImportedCharacter"`
// HP is the current health.
HP float64 `json:"HP"`
// MP is the current MP, when present.
MP float64 `json:"MP"`
// SP is the current stamina, when present.
SP float64 `json:"SP"`
// Shield is the current shield value, when present.
Shield float64 `json:"Shield"`
// Hunger is the current hunger value.
Hunger float64 `json:"Hunger"`
// MaxHunger is the maximum hunger value.
MaxHunger float64 `json:"MaxHunger"`
// SAN is the sanity value.
SAN float64 `json:"SAN"`
// Support is the support value.
Support int `json:"Support"`
// CraftSpeed is the craft speed value.
CraftSpeed int `json:"CraftSpeed"`
// PalSouls are the pal soul ranks.
PalSouls PalSouls `json:"PalSouls"`
// IVs are the pal IV values.
IVs PalIVs `json:"IVs"`
// ActiveSkills are the equipped active skills.
ActiveSkills []string `json:"ActiveSkills"`
// LearntSkills are the learned skills.
LearntSkills []string `json:"LearntSkills"`
// Passives are the passive skill IDs.
Passives []string `json:"Passives"`
// ExtraWorkSuitabilities are the additional work suitability ranks keyed by suitability ID.
ExtraWorkSuitabilities map[string]int `json:"ExtraWorkSuitabilities"`
// DisableWorkPreferences are the disabled work preference IDs.
DisableWorkPreferences []string `json:"DisableWorkPreferences"`
// TeamSlotIndex is the team slot index, only on team pals.
TeamSlotIndex int `json:"team_slot_index"`
// Page is the palbox page index, only on palbox pals.
Page int `json:"page"`
// Slot is the palbox slot index, only on palbox pals.
Slot int `json:"slot"`
// BaseCampSlotIndex is the base camp worker slot index, only on base camp pals.
BaseCampSlotIndex int `json:"base_camp_slot_index"`
}
PalInstance represents a pal owned by a player.
type PalSouls ¶
type PalSouls struct {
// Health is the health soul rank.
Health int `json:"Health"`
// Attack is the attack soul rank.
Attack int `json:"Attack"`
// Defense is the defense soul rank.
Defense int `json:"Defense"`
// CraftSpeed is the craft speed soul rank.
CraftSpeed int `json:"CraftSpeed"`
}
PalSouls are the pal soul ranks of a pal.
type PalsData ¶
type PalsData struct {
// Team are the team pals keyed by Pal instance ID.
Team map[string]PalInstance `json:"Team"`
// Palbox are the palbox pals keyed by Pal instance ID.
Palbox map[string]PalInstance `json:"Palbox"`
// BaseCamps are the base camps of the player.
BaseCamps []PlayerBaseCamp `json:"BaseCamps"`
}
PalsData groups the team, palbox, and base camps of a player.
type PlayerBaseCamp ¶
type PlayerBaseCamp struct {
// ID is the base camp identifier.
ID string `json:"id"`
// Level is the base camp level.
Level int `json:"level"`
// WorldPos is the position in the world.
WorldPos Coordinates `json:"world_pos"`
// MapPos is the position on the map.
MapPos Coordinates `json:"map_pos"`
// State is the base camp state.
State string `json:"state"`
// Pals are the worker Pals of the base camp keyed by Pal instance ID.
Pals map[string]PalInstance `json:"pals"`
}
PlayerBaseCamp details a player's base camp.
type PlayerInfo ¶
type PlayerInfo struct {
// Name is the player name.
Name string `json:"Name"`
// IP is the player IP address.
IP string `json:"IP"`
// PlayerUID is the player identifier.
PlayerUID string `json:"PlayerUID"`
// UserId is the user ID on the platform.
UserId string `json:"UserId"`
// GuildName is the name of the player's guild.
GuildName string `json:"GuildName"`
// GuildUUID is the UUID of the player's guild.
GuildUUID string `json:"GuildUUID"`
// Status is the saved player account state.
Status string `json:"Status"`
// WorldLocation is the location in the world.
WorldLocation Coordinates `json:"WorldLocation"`
// MapLocation is the location on the map.
MapLocation Coordinates `json:"MapLocation"`
}
PlayerInfo describes a server player.
type PlayerInventory ¶
type PlayerInventory struct {
// Items is the items section.
Items InventorySection `json:"Items"`
// KeyItems is the key items section.
KeyItems InventorySection `json:"KeyItems"`
// Weapons is the weapons section.
Weapons InventorySection `json:"Weapons"`
// Armor is the armor section.
Armor InventorySection `json:"Armor"`
// Food is the food section.
Food InventorySection `json:"Food"`
// DropSlot is the dropped items section.
DropSlot InventorySection `json:"DropSlot"`
}
PlayerInventory groups the inventory sections of a player.
type PlayerItemsMeta ¶
type PlayerItemsMeta struct {
// PlayerUID is the player identifier.
PlayerUID string `json:"PlayerUID"`
// Player is the player identifier supplied in the request path.
Player string `json:"Player"`
}
PlayerItemsMeta describes the inventory returned by the API.
type PlayerItemsResponse ¶
type PlayerItemsResponse struct {
// Meta is the inventory metadata.
Meta PlayerItemsMeta `json:"Meta"`
// Inventory are the inventory containers of the player.
Inventory PlayerInventory `json:"Inventory"`
}
PlayerItemsResponse groups the inventory containers of a player.
type PlayerPalsMeta ¶
type PlayerPalsMeta struct {
// PlayerUID is the player identifier.
PlayerUID string `json:"PlayerUID"`
// Player is the player identifier supplied in the request path.
Player string `json:"Player"`
// TeamCount is the number of pals in the player team.
TeamCount int `json:"TeamCount"`
// PalboxCount is the number of pals in the player palbox.
PalboxCount int `json:"PalboxCount"`
// BaseCampCount is the number of base camps included.
BaseCampCount int `json:"BaseCampCount"`
}
PlayerPalsMeta describes the pal data returned by the API.
type PlayerPalsResponse ¶
type PlayerPalsResponse struct {
// Meta is the pal data metadata.
Meta PlayerPalsMeta `json:"Meta"`
// Pals are the team, palbox, and base camp pals.
Pals PalsData `json:"Pals"`
}
PlayerPalsResponse groups the team, palbox, and base camps of a player.
type PlayerProgressionData ¶
type PlayerProgressionData struct {
// Player is the level and experience progress.
Player ProgressionPlayer `json:"Player"`
// Currencies are the player's currencies.
Currencies ProgressionCurrencies `json:"Currencies"`
// Bosses is the progress against bosses.
Bosses ProgressionBosses `json:"Bosses"`
// Captures is the capture progress.
Captures ProgressionCaptures `json:"Captures"`
// Activities is the activities progress.
Activities ProgressionActivities `json:"Activities"`
}
PlayerProgressionData aggregates the complete progression of a player.
type PlayerProgressionMeta ¶
type PlayerProgressionMeta struct {
// PlayerUID is the player identifier.
PlayerUID string `json:"PlayerUID"`
// Player is the player identifier supplied in the request path.
Player string `json:"Player"`
}
PlayerProgressionMeta describes the progression returned by the API.
type PlayerProgressionResponse ¶
type PlayerProgressionResponse struct {
// Meta is the progression metadata.
Meta PlayerProgressionMeta `json:"Meta"`
// Progression is the progression data of the player.
Progression PlayerProgressionData `json:"Progression"`
}
PlayerProgressionResponse aggregates the complete progression of a player.
type PlayerResponse ¶
type PlayerResponse struct {
// Player is the player details.
Player PlayerInfo `json:"Player"`
}
PlayerResponse wraps the player details returned by the API.
type PlayerTechsData ¶
type PlayerTechsData struct {
// Unlocked are the IDs of the unlocked technologies.
Unlocked []string `json:"Unlocked"`
}
PlayerTechsData describes the technologies unlocked by a player.
type PlayerTechsMeta ¶
type PlayerTechsMeta struct {
// PlayerUID is the player identifier.
PlayerUID string `json:"PlayerUID"`
// Player is the player identifier supplied in the request path.
Player string `json:"Player"`
// UnlockedCount is the number of unlocked technologies.
UnlockedCount int `json:"UnlockedCount"`
// LockedCount is the number of locked technologies.
LockedCount int `json:"LockedCount"`
// TotalCount is the total number of technologies.
TotalCount int `json:"TotalCount"`
}
PlayerTechsMeta describes the technology data returned by the API.
type PlayerTechsResponse ¶
type PlayerTechsResponse struct {
// Meta is the technology count metadata.
Meta PlayerTechsMeta `json:"Meta"`
// Techs are the technology data of the player.
Techs PlayerTechsData `json:"Techs"`
}
PlayerTechsResponse describes the technologies of a player.
type PlayersMeta ¶
type PlayersMeta struct {
// PlayerCount is the number of player accounts returned.
PlayerCount int `json:"PlayerCount"`
// OnlineCount is the number of returned players currently online.
OnlineCount int `json:"OnlineCount"`
}
PlayersMeta describes the player list returned by the API.
type PlayersResponse ¶
type PlayersResponse struct {
// Meta is the player list metadata.
Meta PlayersMeta `json:"Meta"`
// Players are the known players.
Players []PlayerInfo `json:"Players"`
}
PlayersResponse lists the known players.
type ProgressionActivities ¶
type ProgressionActivities struct {
// CraftItemCounts are the crafted item counts keyed by item ID.
CraftItemCounts map[string]int `json:"craftItemCounts"`
// NormalDungeonClearCount is the number of completed normal dungeons.
NormalDungeonClearCount int `json:"normalDungeonClearCount"`
// FixedDungeonClearCount is the number of completed fixed dungeons.
FixedDungeonClearCount int `json:"fixedDungeonClearCount"`
// OilrigClearCount is the number of completed oil rigs.
OilrigClearCount int `json:"oilrigClearCount"`
// PalRankUpCounts are the pal rank-up counts keyed by Pal ID.
PalRankUpCounts map[string]int `json:"palRankUpCounts"`
// ArenaSoloClearCounts are the arena solo clear counts keyed by arena ID.
ArenaSoloClearCounts map[string]int `json:"arenaSoloClearCounts"`
// NPCTalkCounts are the NPC talk counts keyed by NPC ID.
NPCTalkCounts map[string]int `json:"npcTalkCounts"`
// FishingCounts are the fishing counts keyed by fish ID.
FishingCounts map[string]int `json:"fishingCounts"`
// FoundTreasureCount is the number of found treasures.
FoundTreasureCount int `json:"foundTreasureCount"`
// CampConqueredCount is the number of conquered base camps.
CampConqueredCount int `json:"campConqueredCount"`
// FirstFishingComplete indicates whether the first fishing session was completed.
FirstFishingComplete bool `json:"firstFishingComplete"`
}
ProgressionActivities describes the activities performed by the player.
type ProgressionBosses ¶
type ProgressionBosses struct {
// TowerBossDefeatCounts are the tower boss defeat counts keyed by boss ID.
TowerBossDefeatCounts map[string]int `json:"towerBossDefeatCounts"`
// NormalBossDefeatFlags are the normal boss defeat flags keyed by boss ID.
NormalBossDefeatFlags map[string]bool `json:"normalBossDefeatFlags"`
// RaidBossDefeatCounts are the raid boss defeat counts keyed by boss ID.
RaidBossDefeatCounts map[string]int `json:"raidBossDefeatCounts"`
// TotalBossDefeatCount is the total number of defeated bosses.
TotalBossDefeatCount int `json:"totalBossDefeatCount"`
// PredatorDefeatCount is the number of defeated predators.
PredatorDefeatCount int `json:"predatorDefeatCount"`
}
ProgressionBosses describes the player's progress against bosses.
type ProgressionCaptures ¶
type ProgressionCaptures struct {
// TribeCaptureCount is the number of captures per tribe.
TribeCaptureCount int `json:"tribeCaptureCount"`
// PalCaptureCounts are the capture counts keyed by Pal ID.
PalCaptureCounts map[string]int `json:"palCaptureCounts"`
// PalCaptureBonusCounts are the capture bonus counts keyed by Pal ID.
PalCaptureBonusCounts map[string]int `json:"palCaptureBonusCounts"`
// PalButcherCounts are the butcher counts keyed by Pal ID.
PalButcherCounts map[string]int `json:"palButcherCounts"`
}
ProgressionCaptures describes the player's pal captures.
type ProgressionCurrencies ¶
type ProgressionCurrencies struct {
// Relics are the relic point totals keyed by relic type.
Relics map[string]int `json:"relics"`
// TechnologyPoints is the number of technology points.
TechnologyPoints int `json:"technologyPoints"`
// AncientTechnologyPoints is the number of ancient technology points.
AncientTechnologyPoints int `json:"ancientTechnologyPoints"`
}
ProgressionCurrencies describes a player's currencies.
type ProgressionPlayer ¶
type ProgressionPlayer struct {
// Level is the player level.
Level int `json:"level"`
// Exp is the player's experience.
Exp int `json:"exp"`
// UnusedStatusPoints are the unused status points.
UnusedStatusPoints int `json:"unusedStatusPoints"`
}
ProgressionPlayer describes a player's level and experience.
type RESTClient ¶
type RESTClient interface {
Close() error
GetVersion(ctx context.Context) (*VersionInfo, error)
GetGuilds(ctx context.Context) (*GuildsResponse, error)
GetGuild(ctx context.Context, guildID string) (*GuildDetail, error)
GetPlayers(ctx context.Context) (*PlayersResponse, error)
GetPlayer(ctx context.Context, playerIdentifier string) (*PlayerInfo, error)
GetPals(ctx context.Context, playerIdentifier string) (*PlayerPalsResponse, error)
GetItems(ctx context.Context, playerIdentifier string) (*PlayerItemsResponse, error)
GetTechs(ctx context.Context, playerIdentifier string) (*PlayerTechsResponse, error)
GetProgression(ctx context.Context, playerIdentifier string) (*PlayerProgressionResponse, error)
GiveItems(ctx context.Context, playerIdentifier string, items ...ItemInput) (*GrantResult, error)
GiveRecipeMaterials(ctx context.Context, playerIdentifier string, product any, quantity int) (*GrantResult, error)
GivePals(ctx context.Context, playerIdentifier string, pals ...PalInput) (*GrantResult, error)
GivePalTemplates(ctx context.Context, playerIdentifier string, templates ...string) (*GrantResult, error)
GivePalEggs(ctx context.Context, playerIdentifier string, palEggs ...PalEggInput) (*GrantResult, error)
GiveProgression(ctx context.Context, playerIdentifier string, request *GiveProgressionRequest, exp, technologyPoints, ancientTechnologyPoints *int, relics map[string]int) (*GrantResult, error)
LearnTech(ctx context.Context, playerIdentifier string, technology ...TechnologyInput) (*LearnTechResponse, error)
ForgetTech(ctx context.Context, playerIdentifier string, technology ...TechnologyInput) (*ForgetTechResponse, error)
DeleteBase(ctx context.Context, baseCampIdentifier string) (*DeleteBaseResponse, error)
SummonPal(ctx context.Context, request *SummonPalRequest) (*SummonPalResponse, error)
SummonNPC(ctx context.Context, request *SummonNPCRequest) (*SummonNPCResponse, error)
Ban(ctx context.Context, playerIdentifier, reason string, ip bool) (*BanResponse, error)
Unban(ctx context.Context, userID, reason string) (*UnbanResponse, error)
BanIP(ctx context.Context, ip string, request *BanIPRequest) (*BanIPResponse, error)
UnbanIP(ctx context.Context, ip string, request *UnbanIPRequest) (*UnbanIPResponse, error)
Kick(ctx context.Context, playerIdentifier, reason string) (*KickResponse, error)
Broadcast(ctx context.Context, message, sender string) (*BroadcastResponse, error)
Alert(ctx context.Context, message string) (*AlertResponse, error)
ReloadConfig(ctx context.Context) (*ReloadConfigResponse, error)
SendPlayerMessage(ctx context.Context, request *SendPlayerMessageRequest) (*SendPlayerMessageResponse, error)
GetBanlist(ctx context.Context, filters map[string]string) (*BanlistResponse, error)
}
RESTClient defines the contract with the PalDefender REST API.
type RecipeResolver ¶
RecipeResolver resolves the materials of a recipe by product ID.
type ReloadConfigResponse ¶
type ReloadConfigResponse struct {
// Success indicates whether the configuration was reloaded.
Success bool `json:"Success"`
}
ReloadConfigResponse describes the result of reloading the configuration.
type ResearchProgress ¶
type ResearchProgress struct {
// WorkAmount is the current work amount.
WorkAmount float64 `json:"work_amount"`
// RequiredWorkAmount is the required work amount.
RequiredWorkAmount float64 `json:"required_work_amount"`
// Percentage is the current work divided by the required work.
Percentage float64 `json:"percentage"`
}
ResearchProgress is the progress of a guild laboratory research.
type SendPlayerMessageRequest ¶
type SendPlayerMessageRequest struct {
// SendType is the message send type.
SendType string `json:"SendType"`
// Message is the message to send.
Message string `json:"Message"`
// UserID is the ID of the destination user.
UserID string `json:"UserID,omitempty"`
// UserIDs are the IDs of the destination users.
UserIDs []string `json:"UserIDs,omitempty"`
// Sender is the name of the message sender.
Sender string `json:"Sender,omitempty"`
}
SendPlayerMessageRequest is the body of a request to send a message to players.
type SendPlayerMessageResponse ¶
type SendPlayerMessageResponse struct {
// Success indicates whether the message was sent.
Success bool `json:"Success"`
// SentCount is the number of sent messages.
SentCount int `json:"SentCount"`
}
SendPlayerMessageResponse describes the result of sending a message.
type SummonNPCRequest ¶
type SummonNPCRequest struct {
// NPCID is the NPC ID or NPC character ID.
NPCID string `json:"NPCID"`
// X is the map X coordinate.
X float64 `json:"X"`
// Y is the map Y coordinate.
Y float64 `json:"Y"`
// Z is the map Z coordinate.
Z float64 `json:"Z"`
// Level is the NPC level (server default: 1).
Level int `json:"Level,omitempty"`
// Uncapturable prevents capture when true.
Uncapturable bool `json:"Uncapturable,omitempty"`
// DisableAI disables normal AI when true.
DisableAI bool `json:"DisableAI,omitempty"`
}
SummonNPCRequest is the body of an NPC summon request. Coordinates are always sent; zero is a valid coordinate value.
type SummonNPCResponse ¶
type SummonNPCResponse struct {
// Summoned is the spawned NPC details.
Summoned SummonedNPC `json:"Summoned"`
}
SummonNPCResponse describes the result of an NPC summon request.
type SummonPalRequest ¶
type SummonPalRequest struct {
// PalID is the Pal species identifier; mutually exclusive with PalTemplate.
PalID string `json:"PalID,omitempty"`
// PalTemplate is a template filename from Pals/Templates/; mutually
// exclusive with PalID.
PalTemplate string `json:"PalTemplate,omitempty"`
// X is the map X coordinate.
X float64 `json:"X"`
// Y is the map Y coordinate.
Y float64 `json:"Y"`
// Z is the map Z coordinate.
Z float64 `json:"Z"`
// Level is the level for PalID summons (server default: 1). Ignored for a
// template.
Level int `json:"Level,omitempty"`
// Uncapturable prevents capture when true.
Uncapturable bool `json:"Uncapturable,omitempty"`
// DisableAI disables normal AI when true.
DisableAI bool `json:"DisableAI,omitempty"`
// DisableDamageMeter disables damage tracking when true.
DisableDamageMeter bool `json:"DisableDamageMeter,omitempty"`
// DisableStatuses are the status names to suppress.
DisableStatuses []string `json:"DisableStatuses,omitempty"`
}
SummonPalRequest is the body of a Pal summon request. Exactly one of PalID or PalTemplate must be provided. Coordinates are always sent; zero is a valid coordinate value.
type SummonPalResponse ¶
type SummonPalResponse struct {
// Summoned is the spawned Pal details.
Summoned SummonedPal `json:"Summoned"`
}
SummonPalResponse describes the result of a Pal summon request.
type SummonedNPC ¶
type SummonedNPC struct {
// Type is the summoned entity type ("NPC").
Type string `json:"Type"`
// NPCID is the NPC ID.
NPCID string `json:"NPCID"`
// Level is the spawned NPC level.
Level int `json:"Level"`
// Uncapturable indicates whether capture is prevented.
Uncapturable bool `json:"Uncapturable"`
// DisableAI indicates whether normal AI is disabled.
DisableAI bool `json:"DisableAI"`
// X is the map X coordinate.
X float64 `json:"X"`
// Y is the map Y coordinate.
Y float64 `json:"Y"`
// Z is the map Z coordinate.
Z float64 `json:"Z"`
}
SummonedNPC describes an NPC spawned by a summon request.
type SummonedPal ¶
type SummonedPal struct {
// Type is the summoned entity type ("Pal").
Type string `json:"Type"`
// PalID is the Pal species identifier.
PalID string `json:"PalID"`
// PalTemplate is the template filename, when a template was used.
PalTemplate string `json:"PalTemplate"`
// Level is the spawned Pal level.
Level int `json:"Level"`
// Uncapturable indicates whether capture is prevented.
Uncapturable bool `json:"Uncapturable"`
// DisableAI indicates whether normal AI is disabled.
DisableAI bool `json:"DisableAI"`
// DamageMeter is the damage meter state returned by the API.
DamageMeter bool `json:"DamageMeter"`
// X is the map X coordinate.
X float64 `json:"X"`
// Y is the map Y coordinate.
Y float64 `json:"Y"`
// Z is the map Z coordinate.
Z float64 `json:"Z"`
}
SummonedPal describes a Pal spawned by a summon request.
type UnbanIPRequest ¶
type UnbanIPRequest struct {
// Reason is the unban reason.
Reason string `json:"Reason,omitempty"`
}
UnbanIPRequest is the body of an IP unban request.
type UnbanIPResponse ¶
type UnbanIPResponse struct {
// Success indicates whether the unban was successful.
Success bool `json:"Success"`
// IP is the unbanned IP.
IP string `json:"IP"`
}
UnbanIPResponse describes the result of unbanning an IP.
type UnbanRequest ¶
type UnbanRequest struct {
// Reason is the unban reason.
Reason string `json:"Reason,omitempty"`
}
UnbanRequest is the body of a player unban request.
type UnbanResponse ¶
type UnbanResponse struct {
// Success indicates whether the unban was successful.
Success bool `json:"Success"`
// UserId is the ID of the unbanned user.
UserId string `json:"UserId"`
}
UnbanResponse describes the result of unbanning a player.
type VersionInfo ¶
type VersionInfo struct {
// Major is the major version.
Major int `json:"Major"`
// Minor is the minor version.
Minor int `json:"Minor"`
// Patch is the patch version.
Patch int `json:"Patch"`
// Build is the build number.
Build int `json:"Build"`
// Version is the short version string.
Version string `json:"Version"`
// VersionLong is the long version string.
VersionLong string `json:"VersionLong"`
// Beta indicates whether it is a beta version.
Beta bool `json:"Beta"`
}
VersionInfo describes the version of the PalDefender REST API.
type VersionResponse ¶
type VersionResponse struct {
// Version is the PalDefender version details.
Version VersionInfo `json:"Version"`
}
VersionResponse wraps the version details returned by the API.