CapGdlrCommandBus.CommandResult

Inherits: RefCounted < Object

Result of a command dispatch.

Properties

Methods

void

_init(ok_: bool, status_: CommandStatus, reason_: String, payload_: Variant, metadata_: Dictionary = {}, rate_limit_: CapGdlrCommandBus.RateLimitInfo = null, retry_after_s_: float = -1.0, retry_after_source_: StringName = &””)

CapGdlrCommandBus.CommandResult

rate_limited(retry_after_s: float = -1.0, policy_id: StringName = &””, message: String = “RATE_LIMITED”) static

bool

is_rate_limited()

float

get_retry_after_s(default_value: float = -1.0)

void

set_retry_after_s(value: float, source: StringName)

void

apply_payload_retry_after_extractor(extractor: Callable)

CapGdlrCommandBus.RateLimitInfo

get_rate_limit_info()

Dictionary

to_dict()

CapGdlrCommandBus.CommandResult

from_dict(serialized: Dictionary, CommandClass: GDScript = null) static


Constants

RATE_LIMITED_REASON = "RATE_LIMITED" 🔗

reason of results created by rate_limited().

RETRY_AFTER_SOURCE_NONE = &"" 🔗

retry_after_source when no retry time is known.

RETRY_AFTER_SOURCE_RATE_LIMIT = &"rate_limit" 🔗

retry_after_source when a rate limit set the retry time.


Property Descriptions

bool ok 🔗

True when the command succeeded.


CommandStatus status 🔗

Outcome of the command.


String reason 🔗

Explanation of a failure. Empty on success.


Variant payload 🔗

Data returned by the handler or the remote target. For local execution the bundled bus stores the output of CapGdlrCommandHandlers.LocalOutput.to_dict().


Dictionary metadata 🔗

Free-form data about the result.


float retry_after_s = -1.0 🔗

Seconds to wait before a retry. Negative when unknown.


StringName retry_after_source = &"" 🔗

Who set retry_after_s: RETRY_AFTER_SOURCE_NONE, RETRY_AFTER_SOURCE_RATE_LIMIT, or a transport-specific name such as &"payload".


CapGdlrCommandBus.RateLimitInfo rate_limit 🔗

Rate-limit details. null unless the command was rate limited.


Method Descriptions

void _init(ok_: bool, status_: CommandStatus, reason_: String, payload_: Variant, metadata_: Dictionary = {}, rate_limit_: CapGdlrCommandBus.RateLimitInfo = null, retry_after_s_: float = -1.0, retry_after_source_: StringName = &””) 🔗

Creates a result. metadata_ is copied.


CapGdlrCommandBus.CommandResult rate_limited(retry_after_s: float = -1.0, policy_id: StringName = &””, message: String = “RATE_LIMITED”) static 🔗

Creates the standard result for a rate-limited attempt: a CapGdlrCommandBus.NACK with RATE_LIMITED_REASON, the payload {"message": message}, and rate-limit details.


bool is_rate_limited() 🔗

Returns true when a rate limit produced this result.


float get_retry_after_s(default_value: float = -1.0) 🔗

Returns retry_after_s, or default_value when the retry time is not positive.


void set_retry_after_s(value: float, source: StringName) 🔗

Sets the retry time and records source as its origin.


void apply_payload_retry_after_extractor(extractor: Callable) 🔗

Calls extractor with the payload as a dictionary. When it returns a positive number, the method stores it as the retry time with the source &"payload". An invalid callable is ignored.


CapGdlrCommandBus.RateLimitInfo get_rate_limit_info() 🔗

Returns rate_limit.


Dictionary to_dict() 🔗

Serializes the result. An object payload must have a to_dict() method. See from_dict().


CapGdlrCommandBus.CommandResult from_dict(serialized: Dictionary, CommandClass: GDScript = null) static 🔗

Restores a result from the output of to_dict(). When CommandClass is given and the result is ok, the payload is restored with the Payload.from_dict of that class. See CapGdlrCommandBus.Command.