• Sends an intent and waits for a response. Returns a promise that resolves with the response or a timeout error after 1 second.

    • If there are subscribers, a unique request ID is generated and used for the response channel.
    • If no subscribers, resolves with body: undefined.

    Type Parameters

    • R = any

      The expected response body type.

    Parameters

    • intent: Intent<Record<string, any>>

      The intent to send.

    Returns Promise<ServiceResponse<{
        body: undefined | R;
        payload: undefined | ApiCallback<R>;
    }>>

    Example

    sendAsyncIntent({
    type: "studio.start.vm",
    options: { imageId: id },
    }).then(([error, data]) => {
    if (error) {
    log.error(`Error starting VM: ${error}`);
    } else if (data) {
    log.warn(`result: ${JSON.stringify(data, null, 2)}`);
    }
    });