create method

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

Creates a new listing.

request - The metadata request object.

Request parameters:

parent - Required. The parent resource path of the listing. e.g. projects/myproject/locations/US/dataExchanges/123. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/dataExchanges/\[^/\]+$.

listingId - Required. The ID of the listing to create. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces. Max length: 100 bytes.

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

Completes with a Listing.

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

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

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