create method

Future<SavedQuery> create(
  1. SavedQuery request,
  2. String parent, {
  3. String? savedQueryId,
  4. String? $fields,
})

Creates a new SavedQuery for the user making the request.

request - The metadata request object.

Request parameters:

parent - Required. The parent resource in which to create the saved query: "projects/[PROJECT_ID]/locations/[LOCATION_ID]" "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]" For example: "projects/my-project/locations/global" "organizations/123456789/locations/us-central1" Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$.

savedQueryId - Optional. The ID to use for the saved query, which will become the final component of the saved query's resource name.If the saved_query_id is not provided, the system will generate an alphanumeric ID.The saved_query_id is limited to 100 characters and can include only the following characters: upper and lower-case alphanumeric characters, underscores, hyphens, periods.First character has to be alphanumeric.

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

Completes with a SavedQuery.

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<SavedQuery> create(
  SavedQuery request,
  core.String parent, {
  core.String? savedQueryId,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (savedQueryId != null) 'savedQueryId': [savedQueryId],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v2/' + core.Uri.encodeFull('$parent') + '/savedQueries';

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