create method

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

Creates a place action link associated with the specified location, and returns it.

The request is considered duplicate if the parent, place_action_link.uri and place_action_link.place_action_type are the same as a previous request.

request - The metadata request object.

Request parameters:

parent - Required. The resource name of the location where to create this place action link. locations/{location_id}. Value must have pattern ^locations/\[^/\]+$.

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

Completes with a PlaceActionLink.

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

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

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