create method Null safety

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

Creates a repo in the given project with the given name.

If the named repository already exists, CreateRepo returns ALREADY_EXISTS.

request - The metadata request object.

Request parameters:

parent - The project in which to create the repo. Values are of the form projects/. Value must have pattern ^projects/\[^/\]+$.

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

Completes with a Repo.

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<Repo> create(
  Repo 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') + '/repos';

  final _response = await _requester.request(
    _url,
    'POST',
    body: _body,
    queryParams: _queryParams,
  );
  return Repo.fromJson(_response as core.Map<core.String, core.dynamic>);
}