AppGatewayResponsePromise#
- class wattson.hosts.ccx.app_gateway.messages.app_gateway_response_promise.AppGatewayResponsePromise(query: AppGatewayQuery, resolve_event: Event)#
Bases:
AppGatewayResponse
Methods
If the associated query has been resolved, the respective WattsonResponse is returned.
is_promise
Checks whether the associated query has already been resolved
Adds a callback to be called as soon as the promise resolves.
As soon as the response resolves, it is checked for its success.
Wait for the query to resolve.
trigger_resolve
- __init__(query: AppGatewayQuery, resolve_event: Event)#
- get_response() AppGatewayResponse | None #
If the associated query has been resolved, the respective WattsonResponse is returned. Otherwise, None is returned.
- is_resolved() bool #
Checks whether the associated query has already been resolved
- on_resolve(callback: Callable[[AppGatewayResponse], None])#
Adds a callback to be called as soon as the promise resolves.
- Parameters:
callback (Callable[[AppGatewayResponse], None]) – The callback to call
- raise_exception_on_fail()#
As soon as the response resolves, it is checked for its success. In case it is not successful, an exception is raised.
- resolve(timeout: float | None = None) bool #
Wait for the query to resolve. If a timeout is given, the waiting is stopped after this timeout (in seconds). Returns True iff the query has been resolved.
- Parameters:
timeout (Optional[float], optional) – (Default value = None)