create method

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

Creates a new Attribute definition in the parent consent store.

request - The metadata request object.

Request parameters:

parent - Required. The name of the consent store that this Attribute definition belongs to. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/datasets/\[^/\]+/consentStores/\[^/\]+$.

attributeDefinitionId - Required. The ID of the Attribute definition to create. The string must match the following regex: _a-zA-Z{0,255} and must not be a reserved keyword within the Common Expression Language as listed on https://github.com/google/cel-spec/blob/master/doc/langdef.md.

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

Completes with a AttributeDefinition.

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

  final url_ =
      'v1/' + core.Uri.encodeFull('$parent') + '/attributeDefinitions';

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