list method

Future<ListCompaniesResponse> list(
  1. String parent, {
  2. int? pageSize,
  3. String? pageToken,
  4. bool? requireOpenJobs,
  5. String? $fields,
})

Lists all companies associated with the project.

Request parameters:

parent - Required. Resource name of the tenant under which the company is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar". Value must have pattern ^projects/\[^/\]+/tenants/\[^/\]+$.

pageSize - The maximum number of companies to be returned, at most 100. Default is 100 if a non-positive number is provided.

pageToken - The starting indicator from which to return results.

requireOpenJobs - Set to true if the companies requested must have open jobs. Defaults to false. If true, at most page_size of companies are fetched, among which only those with open jobs are returned.

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

Completes with a ListCompaniesResponse.

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<ListCompaniesResponse> list(
  core.String parent, {
  core.int? pageSize,
  core.String? pageToken,
  core.bool? requireOpenJobs,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (pageSize != null) 'pageSize': ['${pageSize}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (requireOpenJobs != null) 'requireOpenJobs': ['${requireOpenJobs}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v4/' + core.Uri.encodeFull('$parent') + '/companies';

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