MethodResponse Class

Represents a response to a direct method.

Initializer for MethodResponse.

Inheritance
builtins.object
MethodResponse

Constructor

MethodResponse(request_id, status, payload=None)

Parameters

Name Description
request_id
Required
str

The request id of the MethodRequest being responded to.

status
Required
int

The status of the execution of the MethodRequest.

payload
dict, str, int, float, bool or None (<xref:JSON compatible values>)

The JSON payload to be sent with the response. (OPTIONAL)

default value: None

Variables

Name Description
request_id
str

The request id of the MethodRequest being responded to.

status
int

The status of the execution of the MethodRequest.

payload

The JSON payload to be sent with the response.

Methods

create_from_method_request

Factory method for creating a MethodResponse from a MethodRequest.

create_from_method_request

Factory method for creating a MethodResponse from a MethodRequest.

create_from_method_request(method_request, status, payload=None)

Parameters

Name Description
method_request
Required
<xref:MethodRequest.>

The MethodRequest object to respond to.

status
Required
int

The status of the execution of the MethodRequest.

payload
default value: None