registerSubscriber method

Registers a service account with subscriber privileges on the Pub/Sub topic for this Channel Services account or integrator.

After you create a subscriber, you get the events through SubscriberEvent Possible error codes: * PERMISSION_DENIED: The reseller account making the request and the provided reseller account are different, or the impersonated user is not a super admin. * INVALID_ARGUMENT: Required request parameters are missing or invalid. * INTERNAL: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a technical issue in the backend. Contact Cloud Channel support. Return value: The topic name with the registered service email address.

request - The metadata request object.

Request parameters:

integrator - Optional. Resource name of the integrator. Required if account is not provided. Otherwise, leave this field empty/unset. Value must have pattern ^integrators/\[^/\]+$.

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

Completes with a GoogleCloudChannelV1RegisterSubscriberResponse.

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<GoogleCloudChannelV1RegisterSubscriberResponse>
registerSubscriber(
  GoogleCloudChannelV1RegisterSubscriberRequest request,
  core.String integrator, {
  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('$integrator') + ':registerSubscriber';

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