list method

Future<BillingProfilesListResponse> list(
  1. String profileId, {
  2. String? currencyCode,
  3. List<String>? ids,
  4. int? maxResults,
  5. String? name,
  6. bool? onlySuggestion,
  7. String? pageToken,
  8. String? sortField,
  9. String? sortOrder,
  10. List<String>? status,
  11. List<String>? subaccountIds,
  12. String? $fields,
})

Retrieves a list of billing profiles, possibly filtered.

This method supports paging.

Request parameters:

profileId - User profile ID associated with this request. Value must have pattern ^\[^/\]+$.

currencyCode - Select only billing profile with currency.

ids - Select only billing profile with these IDs.

maxResults - Maximum number of results to return.

name - Allows searching for billing profiles by name. Wildcards () are allowed. For example, "profile2020" will return objects with names like "profile June 2020", "profile April 2020", or simply "profile 2020". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "profile" will match objects with name "my profile", "profile 2021", or simply "profile".

onlySuggestion - Select only billing profile which is suggested for the currency_code & subaccount_id using the Billing Suggestion API.

pageToken - Value of the nextPageToken from the previous result page.

sortField - Field by which to sort the list. Possible string values are:

  • "ID"
  • "NAME"

sortOrder - Order of sorted results. Possible string values are:

  • "ASCENDING" : Ascending order.
  • "DESCENDING" : Descending order.

status - Select only billing profile with the specified status.

subaccountIds - Select only billing profile with the specified subaccount.When only_suggestion is true, only a single subaccount_id is supported.

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

Completes with a BillingProfilesListResponse.

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<BillingProfilesListResponse> list(
  core.String profileId, {
  core.String? currencyCode,
  core.List<core.String>? ids,
  core.int? maxResults,
  core.String? name,
  core.bool? onlySuggestion,
  core.String? pageToken,
  core.String? sortField,
  core.String? sortOrder,
  core.List<core.String>? status,
  core.List<core.String>? subaccountIds,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (currencyCode != null) 'currency_code': [currencyCode],
    if (ids != null) 'ids': ids,
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (name != null) 'name': [name],
    if (onlySuggestion != null) 'onlySuggestion': ['${onlySuggestion}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (sortField != null) 'sortField': [sortField],
    if (sortOrder != null) 'sortOrder': [sortOrder],
    if (status != null) 'status': status,
    if (subaccountIds != null) 'subaccountIds': subaccountIds,
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'userprofiles/' +
      core.Uri.encodeFull('$profileId') +
      '/billingProfiles';

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