list method

Future<ListInvoicesResponse> list(
  1. String advertiserId, {
  2. String? issueMonth,
  3. String? loiSapinInvoiceType,
  4. int? pageSize,
  5. String? pageToken,
  6. String? $fields,
})

Lists invoices posted for an advertiser in a given month.

Invoices generated by billing profiles with a "Partner" invoice level are not retrievable through this method.

Request parameters:

advertiserId - Required. The ID of the advertiser to list invoices for. Value must have pattern ^\[^/\]+$.

issueMonth - The month to list the invoices for. If not set, the request will retrieve invoices for the previous month. Must be in the format YYYYMM.

loiSapinInvoiceType - Select type of invoice to retrieve for Loi Sapin advertisers. Only applicable to Loi Sapin advertisers. Will be ignored otherwise. Possible string values are:

  • "LOI_SAPIN_INVOICE_TYPE_UNSPECIFIED" : Value is not specified.
  • "LOI_SAPIN_INVOICE_TYPE_MEDIA" : Invoices with Media cost.
  • "LOI_SAPIN_INVOICE_TYPE_PLATFORM" : Invoices with Platform fee.

pageSize - Requested page size. Must be between 1 and 200. If unspecified will default to 100. Returns error code INVALID_ARGUMENT if an invalid value is specified.

pageToken - A token identifying a page of results the server should return. Typically, this is the value of next_page_token returned from the previous call to ListInvoices method. If not specified, the first page of results will be returned.

$fields - Selector specifying which fields to include in a partial response.

Completes with a ListInvoicesResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<ListInvoicesResponse> list(
  core.String advertiserId, {
  core.String? issueMonth,
  core.String? loiSapinInvoiceType,
  core.int? pageSize,
  core.String? pageToken,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (issueMonth != null) 'issueMonth': [issueMonth],
    if (loiSapinInvoiceType != null)
      'loiSapinInvoiceType': [loiSapinInvoiceType],
    if (pageSize != null) 'pageSize': ['${pageSize}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ =
      'v2/advertisers/' + core.Uri.encodeFull('$advertiserId') + '/invoices';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return ListInvoicesResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}