postBotRunsByRunidStop method
Stop terminates one of the caller org's own bot runs and reports its terminal state.
Stop terminates one of the caller org's own bot runs and reports its terminal state. The own-key guard is the org: it is the caller's validated org, never theirs to choose, and the runtime resolves the run id UNDER it. A run belonging to another tenant is not among this org's runs, so it answers absent — the same 404 a nonexistent id gets, which is what keeps this from being an oracle. Absence is honoured ONLY when the runtime answers it. A runtime that does not serve stop reports nothing about the run, and reporting "stopped" on that basis would be a stop that cannot fail — so it is a 502.
Parameters:
- String runId (required):
RunID is the run to stop, as the bot runtime named it. It is read from the URL — the
{runId}segment the router matched on — and a body carrying a different id cannot redirect the stop.
Implementation
Future<BotStopped?> postBotRunsByRunidStop(String runId,) async {
final response = await postBotRunsByRunidStopWithHttpInfo(runId,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'BotStopped',) as BotStopped;
}
return null;
}