Result

Result Class

class gs_interactive.client.result.Result(status: Status, value: T)[source]

This is a generic class that wraps the result of an operation, It contains the status of the operation and the value returned by the operation.

__init__(status: Status, value: T)[source]

Construct a new Result object with the specified status and value.

Parameters:
  • status – the status of the operation.

  • value – the value returned by the operation.

static error(status: Status, msg: str)[source]

A static method to create a failed result.

static from_exception(exception: ApiException)[source]

A static method create a Result object from an ApiException.

static from_response(response: ApiResponse)[source]

A static method create a Result object from an successful ApiResponse.

get_status()[source]

Get the status of the operation.

get_status_message()[source]

Get the detail message of the status.

get_value()[source]

Get the value returned by the operation.

is_error()[source]

Whether the operation is failed.

is_ok()[source]

Whether the operation is successful.

static ok(value)[source]

A static method to create a successful result.