executeCommand method
Execute a command
Execute a command on a team. ##### Permissions Must have use_slash_commands
permission for the team the command is in.
Parameters:
- MmExecuteCommandRequest mmExecuteCommandRequest (required): command to be executed
Implementation
Future<MmCommandResponse?> executeCommand(
MmExecuteCommandRequest mmExecuteCommandRequest,
) async {
final response = await executeCommandWithHttpInfo(
mmExecuteCommandRequest,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw MmApiException(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),
'MmCommandResponse',
) as MmCommandResponse;
}
return null;
}