Responses and Builders
This SDK returns typed responses and provides builder helpers to compose requests.
BaseResponse (common fields)
ok: bool— HTTP status is 2xxstatus: int— HTTP status codeheaders: array<string,string>— flattened response headersdata: mixed— normalized body payload (JSONdata/attributesor full decoded body)meta: mixed— JSONmetawhen presenterror: ?string— short error for non-2xx responsesraw: ?string— raw response bodyerrors: array<int,array>— Pterodactylerrors[]when presentpayload: ?array— full decoded JSON payload- Rate limits (when provided by panel):
rateLimit: ?intrateRemaining: ?intrateReset: ?intretryAfter: ?intretryAfterSeconds(): ?int— recommended wait time
explain(): ?string— human-friendly error summary usingerrors[]and status fallback
ListResponse
Extends BaseResponse; represents collection endpoints.
data: array<int,mixed>— list of itemspagination: array— meta.pagination when provided (e.g.,current_page,total_pages,per_page,total)
Constructed internally via ListResponse::fromBase(...).
ItemResponse
Extends BaseResponse; represents single item endpoints.
data: array<string,mixed>— item attributesid: ?int— convenience field whendata['id']is present
Constructed via ItemResponse::fromBase(...).
ActionResponse
Extends BaseResponse; represents mutation results.
ok: boolmessage: ?string— computed fromerrorordata['message']/data['meta']['message']
Constructed via ActionResponse::fromBase(...).
Builders
GetBuilder
param(string $key, mixed $value): self— add query paramincludes(string|array|BackedEnum $includes): self— set includes list (deduplicated)send(): BaseResponse— performs the GET and returns typed response (using::fromBasewhen available)
ListBuilder extends GetBuilder
Adds pagination helpers:
perPage(int $size): selfpage(int $number): selfallPages(): self— fetches all pages and returns a response withdataset to the concatenated items
ItemBuilder extends GetBuilder
Represents /{id} endpoints and holds id as readonly.
getId(): int|stringsend(): ItemResponse
Notes
- All Client and Application modules follow the same patterns:
all()returns aListBuilderget(...)returns anItemBuilder- write operations return
ItemResponseorActionResponse
- Use
->okto check success and->explain()to get human-friendly error context.