getSmsMessagesPaginated method
Get all SMS messages in all phone numbers in paginated form. .
By default returns all SMS messages across all phone numbers sorted by ascending created at date. Responses are paginated. You can restrict results to a list of phone number IDs. You can also filter out read messages
Parameters:
-
String phoneNumber: Optional receiving phone number to filter SMS messages for
-
int page: Optional page index in SMS list pagination
-
int size: Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results
-
String sort: Optional createdAt sort direction ASC or DESC
-
bool unreadOnly: Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly
-
DateTime since: Optional filter SMSs received after given date time
-
DateTime before: Optional filter SMSs received before given date time
Implementation
Future<PageSmsProjection?> getSmsMessagesPaginated({ String? phoneNumber, int? page, int? size, String? sort, bool? unreadOnly, DateTime? since, DateTime? before, }) async {
final response = await getSmsMessagesPaginatedWithHttpInfo( phoneNumber: phoneNumber, page: page, size: size, sort: sort, unreadOnly: unreadOnly, since: since, before: before, );
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), 'PageSmsProjection',) as PageSmsProjection;
}
return null;
}