create method

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

Creates a user link on an account or property.

If the user with the specified email already has permissions on the account or property, then the user's existing permissions will be unioned with the permissions specified in the new UserLink.

request - The metadata request object.

Request parameters:

parent - Required. Example format: accounts/1234 Value must have pattern ^properties/\[^/\]+$.

notifyNewUser - Optional. If set, then email the new user notifying them that they've been granted permissions to the resource.

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

Completes with a GoogleAnalyticsAdminV1alphaUserLink.

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

  final _url = 'v1alpha/' + core.Uri.encodeFull('$parent') + '/userLinks';

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