create method
- Reservation request,
- String parent, {
- String? reservationId,
- String? $fields,
Creates a new reservation.
request
- The metadata request object.
Request parameters:
parent
- Required. The parent location in which to create the
reservation. Structured like
projects/{project_number}/locations/{location}
.
Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$
.
reservationId
- Required. The ID to use for the reservation, which will
become the final component of the reservation's name. This value is
structured like: my-reservation-name
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Reservation.
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<Reservation> create(
Reservation request,
core.String parent, {
core.String? reservationId,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (reservationId != null) 'reservationId': [reservationId],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/admin/' + core.Uri.encodeFull('$parent') + '/reservations';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Reservation.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}