getPing method

Future<MmSystemStatusResponse?> getPing({
  1. bool? getServerStatus,
  2. String? deviceId,
})

Check system health

Check if the server is up and healthy based on the configuration setting GoRoutineHealthThreshold. If GoRoutineHealthThreshold and the number of goroutines on the server exceeds that threshold the server is considered unhealthy. If GoRoutineHealthThreshold is not set or the number of goroutines is below the threshold the server is considered healthy. Minimum server version: 3.10 If a "device_id" is passed in the query, it will test the Push Notification Proxy in order to discover whether the device is able to receive notifications. The response will have a "CanReceiveNotifications" property with one of the following values: - true: It can receive notifications - false: It cannot receive notifications - unknown: There has been an unknown error, and it is not certain whether it can receive notifications. Minimum server version: 6.5 ##### Permissions None.

Parameters:

  • bool getServerStatus: Check the status of the database and file storage as well

  • String deviceId: Check whether this device id can receive push notifications

Implementation

Future<MmSystemStatusResponse?> getPing({
  bool? getServerStatus,
  String? deviceId,
}) async {
  final response = await getPingWithHttpInfo(
    getServerStatus: getServerStatus,
    deviceId: deviceId,
  );
  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),
      'MmSystemStatusResponse',
    ) as MmSystemStatusResponse;
  }
  return null;
}