patch method

Future<TopicSubscription> patch(
  1. TopicSubscription request,
  2. String name, {
  3. bool? allowMissing,
  4. String? $fields,
})

Updates a TopicSubscription.

Subscribes an app installation instance by registration_id, either FID or FCM Token, to a topicSubscription. Returns an existing TopicSubscription or creates a new one if it does not exist.

request - The metadata request object.

Request parameters:

name - Identifier. The resource name of the subscription. Format: projects/{project}/registrations/{registration}/topicSubscriptions/{topicSubscription} The {registration} part contains the registration ID (e.g., FID). Value must have pattern ^projects/\[^/\]+/registrations/\[^/\]+/topicSubscriptions/\[^/\]+$.

allowMissing - Optional. If set to true, and the topic subscription is not found, a new topic subscription will be created.

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

Completes with a TopicSubscription.

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<TopicSubscription> patch(
  TopicSubscription request,
  core.String name, {
  core.bool? allowMissing,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    'allowMissing': ?allowMissing == null ? null : ['${allowMissing}'],
    'fields': ?$fields == null ? null : [$fields],
  };

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

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