create method

Examples: curl -X POST -H "Content-Type: application/json" -H "X-Goog-Api-Key: AIzaSyAMumboJumbojFTVX2lTBQ” -H "X-Goog-Firebase-Installations-Auth: eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWQiOiJjZEV6WVFhaWZoOXR5dVF5ZktvR3M4IiwicHJvamVjdE51bWJlciI6MzUwMDY3NzEyNjMsImV4cCI6MTU2NjMyMzg5NCwiYXBwSWQiOiIxOjM1MDA2NzcxMjYzOmFuZHJvaWQ6Mjc4NTNlNTJkMzMxZTQyMiJ9.ABdN8xAwRQIgSNvJtB--vTNoxDIZiryYi1z05mCfqCj7nbJlsirJ5UYCIQC7BoXW9xvYEi9qASd1nWU0Crs1u3SRhq0BmJLgm9msIA" -d "{ 'javascript': { 'endpoint': 'https://fcm.googleapis.com/fcm/send/eTgyI1vNRYs:APA91bG4g3QzXI8opChSFfwz3vS6GQN8WfcOA-SEL6bFDje79UEu2wft3EHgoefwPayQ_nWWXfKbRT5eya1jjLzWugOvWUeSlPUwcT6-A1XOlOqRxVaAqtFaZM5gte7Ay-fT8sAoiEuE', 'p256dh': 'BDV5QV8YK9QH7WdfjVdo0l-njtu5nySdMPbFgIY1xdgu5Ks3ZbxkJqdXzaZxKhgOgcspCYjgcTrhhkmOSrN8bho', 'auth': '4sOuBLO7qbdDguQu0DnWaQ', 'application_pub_key': 'BE1y40dQNCrNODvWszwjdYeJEbYZmcHYcKuMgqDBWKlMi06Tm9m1Dxmo5mmJC7j3wVWw76ekeZ999cyz5TwdzBw'}}" https://fcmregistrations.googleapis.com/v1/projects/android-gcm-test-519bd/registrations

request - The metadata request object.

Request parameters:

parent - The GCP project id, e.g. projects/my-project-123 Value must have pattern ^projects/\[^/\]+$.

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

Completes with a GoogleFirebaseFcmRegistrationV1Registration.

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<GoogleFirebaseFcmRegistrationV1Registration> create(
  GoogleFirebaseFcmRegistrationV1Registration 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') + '/registrations';

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