getContents method

Gets all the contents in a dialogue. Takes parameter request of type GetContentsRequest.

Implementation

Future<DialoguewiseResponse> getContents(GetContentsRequest request) async {
  if (request.slug.isEmpty) {
    throw ArgumentError("Please provide a Slug.");
  } else if ((request.pageSize == null && request.pageIndex != null) ||
      (request.pageSize != null && request.pageIndex == null)) {
    throw ArgumentError("Please set both pageSize and pageIndex");
  }

  http.Request clientRequest = _getHeader(accessToken, Endpoints.getContents);
  clientRequest.body = jsonEncode(request);

  return _getResponse(clientRequest);
}