public static interface DataSubscriptionServiceGrpc.AsyncServiceData Subscription Service that allows clients (e.g., Fitbit 3P applications, internal Fitbit Services) to manage their subscriber endpoints. This service provides CRUD APIs for subscribers, and also offers functionalities for subscriber verification and statistics.
Methods
createSubscriber(CreateSubscriberRequest request, StreamObserver<Operation> responseObserver)
public default void createSubscriber(CreateSubscriberRequest request, StreamObserver<Operation> responseObserver) Registers a new subscriber endpoint to receive notifications.
A subscriber represents an application or service that wishes to receive
data change notifications for users who have granted consent.
Endpoint Verification:
For a subscriber to be successfully created, the provided endpoint_uri
must be a valid HTTPS endpoint and must pass an automated verification
check. The backend will send two HTTP POST requests to the endpoint_uri:
- Verification with Authorization:
- Headers: Includes
Content-Type: application/jsonandAuthorization(with the exact value fromCreateSubscriberPayload.endpoint_authorization.secret). - Body:
{"type": "verification"} - Expected Response: HTTP
201 Created.
- Headers: Includes
- Verification without Authorization:
- Headers: Includes
Content-Type: application/json. TheAuthorizationheader is OMITTED. - Body:
{"type": "verification"} - Expected Response: HTTP
401 Unauthorizedor403 Forbidden. Both tests must pass for the subscriber creation to succeed. If verification fails, the operation will not be completed and an error will be returned. This process ensures the endpoint is reachable and correctly validates theAuthorizationheader.
- Headers: Includes
| Parameters | |
|---|---|
| Name | Description |
request |
CreateSubscriberRequest |
responseObserver |
io.grpc.stub.StreamObserver<Operation> |
createSubscription(CreateSubscriptionRequest request, StreamObserver<Subscription> responseObserver)
public default void createSubscription(CreateSubscriptionRequest request, StreamObserver<Subscription> responseObserver) Creates a subscription for a specific user to a specific subscriber.
This method requires the subscriber to have a SubscriptionCreatePolicy
set to MANUAL for the given data types.
| Parameters | |
|---|---|
| Name | Description |
request |
CreateSubscriptionRequest |
responseObserver |
io.grpc.stub.StreamObserver<Subscription> |
deleteSubscriber(DeleteSubscriberRequest request, StreamObserver<Operation> responseObserver)
public default void deleteSubscriber(DeleteSubscriberRequest request, StreamObserver<Operation> responseObserver)Deletes a subscriber registration. This will stop all notifications to the subscriber's endpoint.
| Parameters | |
|---|---|
| Name | Description |
request |
DeleteSubscriberRequest |
responseObserver |
io.grpc.stub.StreamObserver<Operation> |
deleteSubscription(DeleteSubscriptionRequest request, StreamObserver<Empty> responseObserver)
public default void deleteSubscription(DeleteSubscriptionRequest request, StreamObserver<Empty> responseObserver)Deletes a specific user subscription, stopping notifications for this user to this subscriber.
| Parameters | |
|---|---|
| Name | Description |
request |
DeleteSubscriptionRequest |
responseObserver |
io.grpc.stub.StreamObserver<Empty> |
listSubscribers(ListSubscribersRequest request, StreamObserver<ListSubscribersResponse> responseObserver)
public default void listSubscribers(ListSubscribersRequest request, StreamObserver<ListSubscribersResponse> responseObserver)Lists all subscribers registered within the owned Google Cloud Project.
| Parameters | |
|---|---|
| Name | Description |
request |
ListSubscribersRequest |
responseObserver |
io.grpc.stub.StreamObserver<ListSubscribersResponse> |
listSubscriptions(ListSubscriptionsRequest request, StreamObserver<ListSubscriptionsResponse> responseObserver)
public default void listSubscriptions(ListSubscriptionsRequest request, StreamObserver<ListSubscriptionsResponse> responseObserver)Lists all active subscriptions for a given subscriber. This can be filtered, for example, by user or data type.
| Parameters | |
|---|---|
| Name | Description |
request |
ListSubscriptionsRequest |
responseObserver |
io.grpc.stub.StreamObserver<ListSubscriptionsResponse> |
updateSubscriber(UpdateSubscriberRequest request, StreamObserver<Operation> responseObserver)
public default void updateSubscriber(UpdateSubscriberRequest request, StreamObserver<Operation> responseObserver) Updates the configuration of an existing subscriber, such as the
endpoint URI or the data types it's interested in.
Endpoint Verification:
If the endpoint_uri or endpoint_authorization field is included in the
update_mask, the backend will re-verify the endpoint. The verification
process is the same as described in CreateSubscriber:
- Verification with Authorization: POST to the new or existing
endpoint_uriwith the new or existingAuthorizationsecret. Expects HTTP201 Created. - Verification without Authorization: POST to the
endpoint_uriwithout theAuthorizationheader. Expects HTTP401 Unauthorizedor403 Forbidden. Both tests must pass using the potentially updated values for the subscriber update to succeed. If verification fails, the update will not be applied, and an error will be returned.
| Parameters | |
|---|---|
| Name | Description |
request |
UpdateSubscriberRequest |
responseObserver |
io.grpc.stub.StreamObserver<Operation> |
updateSubscription(UpdateSubscriptionRequest request, StreamObserver<Subscription> responseObserver)
public default void updateSubscription(UpdateSubscriptionRequest request, StreamObserver<Subscription> responseObserver)Updates the data types for an existing user subscription.
| Parameters | |
|---|---|
| Name | Description |
request |
UpdateSubscriptionRequest |
responseObserver |
io.grpc.stub.StreamObserver<Subscription> |