getFirstPage method

Future<OrderedPagedCollection> getFirstPage(
  1. String outboxUrl
)

Implementation

Future<OrderedPagedCollection> getFirstPage(String outboxUrl) async {
  Config.logger.v("Getting first page with outboxUrl=$outboxUrl");

  Uri outboxUri = Uri.parse(outboxUrl);

  if (outboxUri.authority != Config.domainName) {
    outboxUri = outboxUri.asProxyUri();
  }

  http.Response pageResponse = await http.get(
    outboxUri,
    headers: {
      "Content-Type": "application/json",
      "Accept": "application/json",
    },
  );

  Config.logger.d("Response-Headers: ${pageResponse.headers}");

  OrderedPagedCollection collection = OrderedPagedCollection.fromJson(
      jsonDecode(utf8.decode(pageResponse.bodyBytes)));

  Config.logger.v("Returning collection");

  return collection;
}