list method

Future<InventoryItemsListResponse> list(
  1. String profileId,
  2. String projectId, {
  3. List<String>? ids,
  4. bool? inPlan,
  5. int? maxResults,
  6. List<String>? orderId,
  7. String? pageToken,
  8. List<String>? siteId,
  9. String? sortField,
  10. String? sortOrder,
  11. String? type,
  12. String? $fields,
})

Retrieves a list of inventory items, possibly filtered.

This method supports paging.

Request parameters:

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

projectId - Project ID for order documents.

ids - Select only inventory items with these IDs.

inPlan - Select only inventory items that are in plan.

maxResults - Maximum number of results to return.

orderId - Select only inventory items that belong to specified orders.

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

siteId - Select only inventory items that are associated with these sites.

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.

type - Select only inventory items with this type. Possible string values are:

  • "PLANNING_PLACEMENT_TYPE_REGULAR"
  • "PLANNING_PLACEMENT_TYPE_CREDIT"

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

Completes with a InventoryItemsListResponse.

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<InventoryItemsListResponse> list(
  core.String profileId,
  core.String projectId, {
  core.List<core.String>? ids,
  core.bool? inPlan,
  core.int? maxResults,
  core.List<core.String>? orderId,
  core.String? pageToken,
  core.List<core.String>? siteId,
  core.String? sortField,
  core.String? sortOrder,
  core.String? type,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'ids': ?ids,
    'inPlan': ?inPlan == null ? null : ['${inPlan}'],
    'maxResults': ?maxResults == null ? null : ['${maxResults}'],
    'orderId': ?orderId,
    'pageToken': ?pageToken == null ? null : [pageToken],
    'siteId': ?siteId,
    'sortField': ?sortField == null ? null : [sortField],
    'sortOrder': ?sortOrder == null ? null : [sortOrder],
    'type': ?type == null ? null : [type],
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ =
      'userprofiles/' +
      core.Uri.encodeFull('$profileId') +
      '/projects/' +
      commons.escapeVariable('$projectId') +
      '/inventoryItems';

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