Class DataSubscriptionService.DataSubscriptionServiceBase
Base class for server-side implementations of DataSubscriptionService
Namespace: Google.DevicesAndServices.Health.V4
Assembly: Google.DevicesAndServices.Health.V4.dll
Syntax
[BindServiceMethod(typeof(DataSubscriptionService), "BindService")]
public abstract class DataSubscriptionService.DataSubscriptionServiceBase
Methods
CreateSubscriber(CreateSubscriberRequest, ServerCallContext)
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.
- Headers: Includes
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 the Authorization header.
Declaration
public virtual Task<Operation> CreateSubscriber(CreateSubscriberRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateSubscriberRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Operation> | The response to send back to the client (wrapped by a task). |
CreateSubscription(CreateSubscriptionRequest, ServerCallContext)
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.
Declaration
public virtual Task<Subscription> CreateSubscription(CreateSubscriptionRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateSubscriptionRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Subscription> | The response to send back to the client (wrapped by a task). |
DeleteSubscriber(DeleteSubscriberRequest, ServerCallContext)
Deletes a subscriber registration. This will stop all notifications to the subscriber's endpoint.
Declaration
public virtual Task<Operation> DeleteSubscriber(DeleteSubscriberRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| DeleteSubscriberRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Operation> | The response to send back to the client (wrapped by a task). |
DeleteSubscription(DeleteSubscriptionRequest, ServerCallContext)
Deletes a specific user subscription, stopping notifications for this user to this subscriber.
Declaration
public virtual Task<Empty> DeleteSubscription(DeleteSubscriptionRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| DeleteSubscriptionRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Empty> | The response to send back to the client (wrapped by a task). |
ListSubscribers(ListSubscribersRequest, ServerCallContext)
Lists all subscribers registered within the owned Google Cloud Project.
Declaration
public virtual Task<ListSubscribersResponse> ListSubscribers(ListSubscribersRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| ListSubscribersRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<ListSubscribersResponse> | The response to send back to the client (wrapped by a task). |
ListSubscriptions(ListSubscriptionsRequest, ServerCallContext)
Lists all active subscriptions for a given subscriber. This can be filtered, for example, by user or data type.
Declaration
public virtual Task<ListSubscriptionsResponse> ListSubscriptions(ListSubscriptionsRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| ListSubscriptionsRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<ListSubscriptionsResponse> | The response to send back to the client (wrapped by a task). |
UpdateSubscriber(UpdateSubscriberRequest, ServerCallContext)
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.
Declaration
public virtual Task<Operation> UpdateSubscriber(UpdateSubscriberRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| UpdateSubscriberRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Operation> | The response to send back to the client (wrapped by a task). |
UpdateSubscription(UpdateSubscriptionRequest, ServerCallContext)
Updates the data types for an existing user subscription.
Declaration
public virtual Task<Subscription> UpdateSubscription(UpdateSubscriptionRequest request, ServerCallContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| UpdateSubscriptionRequest | request | The request received from the client. |
| ServerCallContext | context | The context of the server-side call handler being invoked. |
Returns
| Type | Description |
|---|---|
| Task<Subscription> | The response to send back to the client (wrapped by a task). |