DataSubscriptionService¶
- class google.devicesandservices.health_v4.services.data_subscription_service.DataSubscriptionServiceAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.devicesandservices.health_v4.services.data_subscription_service.transports.base.DataSubscriptionServiceTransport, typing.Callable[[...], google.devicesandservices.health_v4.services.data_subscription_service.transports.base.DataSubscriptionServiceTransport]]] = 'grpc_asyncio', client_options: typing.Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]¶
Data 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.
Instantiates the data subscription service async client.
- Parameters
credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.
transport (Optional[Union[str,DataSubscriptionServiceTransport,Callable[..., DataSubscriptionServiceTransport]]]) – The transport to use, or a Callable that constructs and returns a new transport to use. If a Callable is given, it will be called with the same set of initialization arguments as used in the DataSubscriptionServiceTransport constructor. If set to None, a transport is chosen automatically.
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]) –
Custom options for the client.
1. The
api_endpointproperty can be used to override the default endpoint provided by the client whentransportis not explicitly provided. Only if this property is not set andtransportwas not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the
client_cert_sourceproperty can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.3. The
universe_domainproperty can be used to override the default “googleapis.com” universe. Note thatapi_endpointproperty still takes precedence; anduniverse_domainis currently not supported for mTLS.client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If
None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
- Raises
google.auth.exceptions.MutualTlsChannelError – If mutual TLS transport creation failed for any reason.
- property api_endpoint: str¶
Return the API endpoint used by the client instance.
- Returns
The API endpoint used by the client instance.
- Return type
- static common_billing_account_path(billing_account: str) str¶
Returns a fully-qualified billing_account string.
- static common_location_path(project: str, location: str) str¶
Returns a fully-qualified location string.
- static common_organization_path(organization: str) str¶
Returns a fully-qualified organization string.
- async create_subscriber(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.CreateSubscriberRequest, dict]] = None, *, parent: Optional[str] = None, subscriber: Optional[google.devicesandservices.health_v4.types.data_subscription_service.CreateSubscriberPayload] = None, subscriber_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.api_core.operation_async.AsyncOperation[source]¶
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_urimust be a valid HTTPS endpoint and must pass an automated verification check. The backend will send two HTTP POST requests to theendpoint_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.
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 the
Authorizationheader.# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 async def sample_create_subscriber(): # Create a client client = health_v4.DataSubscriptionServiceAsyncClient() # Initialize request argument(s) subscriber = health_v4.CreateSubscriberPayload() subscriber.endpoint_uri = "endpoint_uri_value" subscriber.endpoint_authorization.secret = "secret_value" request = health_v4.CreateSubscriberRequest( parent="parent_value", subscriber=subscriber, ) # Make the request operation = await client.create_subscriber(request=request) print("Waiting for operation to complete...") response = await operation.result() # Handle the response print(response)
- Parameters
request (Optional[Union[google.devicesandservices.health_v4.types.CreateSubscriberRequest, dict]]) – The request object. – Messages – Request message for CreateSubscriber.
parent (
str) –Required. The parent resource where this subscriber will be created. Format: projects/{project} Example: projects/my-project-123
This corresponds to the
parentfield on therequestinstance; ifrequestis provided, this should not be set.subscriber (
google.devicesandservices.health_v4.types.CreateSubscriberPayload) – Required. The subscriber to create. This corresponds to thesubscriberfield on therequestinstance; ifrequestis provided, this should not be set.subscriber_id (
str) –Optional. The ID to use for the subscriber, which will become the final component of the subscriber’s resource name.
This value should be 4-36 characters, and valid characters are /a-z/.
This corresponds to the
subscriber_idfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
An object representing a long-running operation.
The result type for the operation will be
google.devicesandservices.health_v4.types.Subscriber– Resource Messages – A subscriber receives notifications from Google Health API.- Return type
- async create_subscription(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.CreateSubscriptionRequest, dict]] = None, *, parent: Optional[str] = None, subscription: Optional[google.devicesandservices.health_v4.types.data_subscription_service.CreateSubscriptionPayload] = None, subscription_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.devicesandservices.health_v4.types.data_subscription_service.Subscription[source]¶
Creates a subscription for a specific user to a specific subscriber. This method requires the subscriber to have a
SubscriptionCreatePolicyset toMANUALfor the given data types.# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 async def sample_create_subscription(): # Create a client client = health_v4.DataSubscriptionServiceAsyncClient() # Initialize request argument(s) subscription = health_v4.CreateSubscriptionPayload() subscription.user = "user_value" request = health_v4.CreateSubscriptionRequest( parent="parent_value", subscription=subscription, ) # Make the request response = await client.create_subscription(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.devicesandservices.health_v4.types.CreateSubscriptionRequest, dict]]) – The request object. Request message for CreateSubscription.
parent (
str) –Required. The parent subscriber. Format: projects/{project}/subscribers/{subscriber} The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) if provided during creation, or system-generated otherwise.
This corresponds to the
parentfield on therequestinstance; ifrequestis provided, this should not be set.subscription (
google.devicesandservices.health_v4.types.CreateSubscriptionPayload) – Required. The subscription to create. This corresponds to thesubscriptionfield on therequestinstance; ifrequestis provided, this should not be set.subscription_id (
str) –Optional. The {subscription_id} is user-settable (4-36 chars, matching /a-z/) or system-generated otherwise. If provided, the ID must be unique within the parent subscriber.
This corresponds to the
subscription_idfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
A subscription to a data collection for a specific user, to be delivered to a subscriber.
- Return type
- async delete_subscriber(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.DeleteSubscriberRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.api_core.operation_async.AsyncOperation[source]¶
Deletes a subscriber registration. This will stop all notifications to the subscriber’s endpoint.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 async def sample_delete_subscriber(): # Create a client client = health_v4.DataSubscriptionServiceAsyncClient() # Initialize request argument(s) request = health_v4.DeleteSubscriberRequest( name="name_value", ) # Make the request operation = await client.delete_subscriber(request=request) print("Waiting for operation to complete...") response = await operation.result() # Handle the response print(response)
- Parameters
request (Optional[Union[google.devicesandservices.health_v4.types.DeleteSubscriberRequest, dict]]) – The request object. Request message for DeleteSubscriber.
name (
str) –Required. The name of the subscriber to delete. Format: projects/{project}/subscribers/{subscriber} Example: projects/my-project/subscribers/my-subscriber-123 The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) or system-generated if not provided during creation.
This corresponds to the
namefield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
An object representing a long-running operation.
- The result type for the operation will be
google.protobuf.empty_pb2.EmptyA generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:
- service Foo {
rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
}
- The result type for the operation will be
- Return type
- async delete_subscription(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.DeleteSubscriptionRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) None[source]¶
Deletes a specific user subscription, stopping notifications for this user to this subscriber.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 async def sample_delete_subscription(): # Create a client client = health_v4.DataSubscriptionServiceAsyncClient() # Initialize request argument(s) request = health_v4.DeleteSubscriptionRequest( name="name_value", ) # Make the request await client.delete_subscription(request=request)
- Parameters
request (Optional[Union[google.devicesandservices.health_v4.types.DeleteSubscriptionRequest, dict]]) – The request object. Request message for DeleteSubscription.
name (
str) –Required. The resource name of the subscription to delete. Format:
projects/{project}/subscribers/{subscriber}/subscriptions/{subscription}Example:projects/my-project/subscribers/my-subscriber-123/subscriptions/my-subscription-456The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) if provided during creation, or system-generated otherwise. The {subscription} ID is user-settable (4-36 characters, matching /a-z/) or system-generated if not provided during creation.This corresponds to the
namefield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- classmethod from_service_account_file(filename: str, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_info(info: dict, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
info.
- Parameters
info (dict) – The service account private key info.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_json(filename: str, *args, **kwargs)¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]¶
Return the API endpoint and client cert source for mutual TLS.
The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not “true”, the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.
The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “always”, use the default mTLS endpoint; if the environment variable is “never”, use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.
More details can be found at https://google.aip.dev/auth/4114.
- Parameters
client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.
- Returns
- returns the API endpoint and the
client cert source to use.
- Return type
- Raises
google.auth.exceptions.MutualTLSChannelError – If any errors happen.
- classmethod get_transport_class(label: Optional[str] = None) Type[google.devicesandservices.health_v4.services.data_subscription_service.transports.base.DataSubscriptionServiceTransport]¶
Returns an appropriate transport class.
- Parameters
label – The name of the desired transport. If none is provided, then the first transport in the registry is used.
- Returns
The transport class to use.
- async list_subscribers(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.ListSubscribersRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.devicesandservices.health_v4.services.data_subscription_service.pagers.ListSubscribersAsyncPager[source]¶
Lists all subscribers registered within the owned Google Cloud Project.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 async def sample_list_subscribers(): # Create a client client = health_v4.DataSubscriptionServiceAsyncClient() # Initialize request argument(s) request = health_v4.ListSubscribersRequest( parent="parent_value", ) # Make the request page_result = client.list_subscribers(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.devicesandservices.health_v4.types.ListSubscribersRequest, dict]]) – The request object. Request message for ListSubscribers.
parent (
str) –Required. The parent, which owns this collection of subscribers. Format: projects/{project}
This corresponds to the
parentfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
Response message for ListSubscribers.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
- async list_subscriptions(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.ListSubscriptionsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.devicesandservices.health_v4.services.data_subscription_service.pagers.ListSubscriptionsAsyncPager[source]¶
Lists all active subscriptions for a given subscriber. This can be filtered, for example, by user or data type.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 async def sample_list_subscriptions(): # Create a client client = health_v4.DataSubscriptionServiceAsyncClient() # Initialize request argument(s) request = health_v4.ListSubscriptionsRequest( parent="parent_value", ) # Make the request page_result = client.list_subscriptions(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.devicesandservices.health_v4.types.ListSubscriptionsRequest, dict]]) – The request object. Request message for ListSubscriptions.
parent (
str) –Required. The parent subscriber. Format: projects/{project}/subscribers/{subscriber} The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) if provided during creation, or system-generated otherwise.
This corresponds to the
parentfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
Response message for ListSubscriptions. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
- static parse_common_billing_account_path(path: str) Dict[str, str]¶
Parse a billing_account path into its component segments.
- static parse_common_folder_path(path: str) Dict[str, str]¶
Parse a folder path into its component segments.
- static parse_common_location_path(path: str) Dict[str, str]¶
Parse a location path into its component segments.
- static parse_common_organization_path(path: str) Dict[str, str]¶
Parse a organization path into its component segments.
- static parse_common_project_path(path: str) Dict[str, str]¶
Parse a project path into its component segments.
- static parse_data_type_path(path: str) Dict[str, str]¶
Parses a data_type path into its component segments.
- static parse_subscriber_path(path: str) Dict[str, str]¶
Parses a subscriber path into its component segments.
- static parse_subscription_path(path: str) Dict[str, str]¶
Parses a subscription path into its component segments.
- static subscriber_path(project: str, subscriber: str) str¶
Returns a fully-qualified subscriber string.
- static subscription_path(project: str, subscriber: str, subscription: str) str¶
Returns a fully-qualified subscription string.
- property transport: google.devicesandservices.health_v4.services.data_subscription_service.transports.base.DataSubscriptionServiceTransport¶
Returns the transport used by the client instance.
- Returns
The transport used by the client instance.
- Return type
DataSubscriptionServiceTransport
- property universe_domain: str¶
Return the universe domain used by the client instance.
- Returns
- The universe domain used
by the client instance.
- Return type
- async update_subscriber(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.UpdateSubscriberRequest, dict]] = None, *, subscriber: Optional[google.devicesandservices.health_v4.types.data_subscription_service.Subscriber] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.api_core.operation_async.AsyncOperation[source]¶
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_uriorendpoint_authorizationfield is included in theupdate_mask, the backend will re-verify the endpoint. The verification process is the same as described inCreateSubscriber: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.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 async def sample_update_subscriber(): # Create a client client = health_v4.DataSubscriptionServiceAsyncClient() # Initialize request argument(s) subscriber = health_v4.Subscriber() subscriber.endpoint_uri = "endpoint_uri_value" subscriber.endpoint_authorization.secret = "secret_value" request = health_v4.UpdateSubscriberRequest( subscriber=subscriber, ) # Make the request operation = await client.update_subscriber(request=request) print("Waiting for operation to complete...") response = await operation.result() # Handle the response print(response)
- Parameters
request (Optional[Union[google.devicesandservices.health_v4.types.UpdateSubscriberRequest, dict]]) – The request object. Request message for UpdateSubscriber.
subscriber (
google.devicesandservices.health_v4.types.Subscriber) –Required. The subscriber resource to update. Its ‘name’ field is mapped to the URI, and the value of the ‘name’ field should be of the form: “projects/{project}/subscribers/{subscriber_id}”. The remaining fields of the Subscriber object represent the new values for the corresponding fields in the existing subscriber resource.
This corresponds to the
subscriberfield on therequestinstance; ifrequestis provided, this should not be set.update_mask (
google.protobuf.field_mask_pb2.FieldMask) –Optional. A field mask that specifies which fields of the Subscriber message are to be updated. This allows for partial updates. Supported fields:
endpoint_uri
subscriber_configs
endpoint_authorization
This corresponds to the
update_maskfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
An object representing a long-running operation.
The result type for the operation will be
google.devicesandservices.health_v4.types.Subscriber– Resource Messages – A subscriber receives notifications from Google Health API.- Return type
- async update_subscription(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.UpdateSubscriptionRequest, dict]] = None, *, subscription: Optional[google.devicesandservices.health_v4.types.data_subscription_service.Subscription] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.devicesandservices.health_v4.types.data_subscription_service.Subscription[source]¶
Updates the data types for an existing user subscription.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 async def sample_update_subscription(): # Create a client client = health_v4.DataSubscriptionServiceAsyncClient() # Initialize request argument(s) request = health_v4.UpdateSubscriptionRequest( ) # Make the request response = await client.update_subscription(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.devicesandservices.health_v4.types.UpdateSubscriptionRequest, dict]]) – The request object. Request message for UpdateSubscription.
subscription (
google.devicesandservices.health_v4.types.Subscription) –Required. The subscription to update. The subscription’s
namefield is used to identify the subscription to update. Format: projects/{project}/subscribers/{subscriber}/subscriptions/{subscription}This corresponds to the
subscriptionfield on therequestinstance; ifrequestis provided, this should not be set.update_mask (
google.protobuf.field_mask_pb2.FieldMask) –Optional. The list of fields to update.
This corresponds to the
update_maskfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
A subscription to a data collection for a specific user, to be delivered to a subscriber.
- Return type
- class google.devicesandservices.health_v4.services.data_subscription_service.DataSubscriptionServiceClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.devicesandservices.health_v4.services.data_subscription_service.transports.base.DataSubscriptionServiceTransport, typing.Callable[[...], google.devicesandservices.health_v4.services.data_subscription_service.transports.base.DataSubscriptionServiceTransport]]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]¶
Data 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.
Instantiates the data subscription service client.
- Parameters
credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.
transport (Optional[Union[str,DataSubscriptionServiceTransport,Callable[..., DataSubscriptionServiceTransport]]]) – The transport to use, or a Callable that constructs and returns a new transport. If a Callable is given, it will be called with the same set of initialization arguments as used in the DataSubscriptionServiceTransport constructor. If set to None, a transport is chosen automatically.
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]) –
Custom options for the client.
1. The
api_endpointproperty can be used to override the default endpoint provided by the client whentransportis not explicitly provided. Only if this property is not set andtransportwas not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the
client_cert_sourceproperty can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.3. The
universe_domainproperty can be used to override the default “googleapis.com” universe. Note that theapi_endpointproperty still takes precedence; anduniverse_domainis currently not supported for mTLS.client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If
None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
- Raises
google.auth.exceptions.MutualTLSChannelError – If mutual TLS transport creation failed for any reason.
- __exit__(type, value, traceback)[source]¶
Releases underlying transport’s resources.
Warning
ONLY use as a context manager if the transport is NOT shared with other clients! Exiting the with block will CLOSE the transport and may cause errors in other clients!
- property api_endpoint: str¶
Return the API endpoint used by the client instance.
- Returns
The API endpoint used by the client instance.
- Return type
- static common_billing_account_path(billing_account: str) str[source]¶
Returns a fully-qualified billing_account string.
- static common_location_path(project: str, location: str) str[source]¶
Returns a fully-qualified location string.
- static common_organization_path(organization: str) str[source]¶
Returns a fully-qualified organization string.
- create_subscriber(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.CreateSubscriberRequest, dict]] = None, *, parent: Optional[str] = None, subscriber: Optional[google.devicesandservices.health_v4.types.data_subscription_service.CreateSubscriberPayload] = None, subscriber_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.api_core.operation.Operation[source]¶
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_urimust be a valid HTTPS endpoint and must pass an automated verification check. The backend will send two HTTP POST requests to theendpoint_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.
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 the
Authorizationheader.# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 def sample_create_subscriber(): # Create a client client = health_v4.DataSubscriptionServiceClient() # Initialize request argument(s) subscriber = health_v4.CreateSubscriberPayload() subscriber.endpoint_uri = "endpoint_uri_value" subscriber.endpoint_authorization.secret = "secret_value" request = health_v4.CreateSubscriberRequest( parent="parent_value", subscriber=subscriber, ) # Make the request operation = client.create_subscriber(request=request) print("Waiting for operation to complete...") response = operation.result() # Handle the response print(response)
- Parameters
request (Union[google.devicesandservices.health_v4.types.CreateSubscriberRequest, dict]) – The request object. – Messages – Request message for CreateSubscriber.
parent (str) –
Required. The parent resource where this subscriber will be created. Format: projects/{project} Example: projects/my-project-123
This corresponds to the
parentfield on therequestinstance; ifrequestis provided, this should not be set.subscriber (google.devicesandservices.health_v4.types.CreateSubscriberPayload) – Required. The subscriber to create. This corresponds to the
subscriberfield on therequestinstance; ifrequestis provided, this should not be set.subscriber_id (str) –
Optional. The ID to use for the subscriber, which will become the final component of the subscriber’s resource name.
This value should be 4-36 characters, and valid characters are /a-z/.
This corresponds to the
subscriber_idfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
An object representing a long-running operation.
The result type for the operation will be
google.devicesandservices.health_v4.types.Subscriber– Resource Messages – A subscriber receives notifications from Google Health API.- Return type
- create_subscription(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.CreateSubscriptionRequest, dict]] = None, *, parent: Optional[str] = None, subscription: Optional[google.devicesandservices.health_v4.types.data_subscription_service.CreateSubscriptionPayload] = None, subscription_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.devicesandservices.health_v4.types.data_subscription_service.Subscription[source]¶
Creates a subscription for a specific user to a specific subscriber. This method requires the subscriber to have a
SubscriptionCreatePolicyset toMANUALfor the given data types.# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 def sample_create_subscription(): # Create a client client = health_v4.DataSubscriptionServiceClient() # Initialize request argument(s) subscription = health_v4.CreateSubscriptionPayload() subscription.user = "user_value" request = health_v4.CreateSubscriptionRequest( parent="parent_value", subscription=subscription, ) # Make the request response = client.create_subscription(request=request) # Handle the response print(response)
- Parameters
request (Union[google.devicesandservices.health_v4.types.CreateSubscriptionRequest, dict]) – The request object. Request message for CreateSubscription.
parent (str) –
Required. The parent subscriber. Format: projects/{project}/subscribers/{subscriber} The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) if provided during creation, or system-generated otherwise.
This corresponds to the
parentfield on therequestinstance; ifrequestis provided, this should not be set.subscription (google.devicesandservices.health_v4.types.CreateSubscriptionPayload) – Required. The subscription to create. This corresponds to the
subscriptionfield on therequestinstance; ifrequestis provided, this should not be set.subscription_id (str) –
Optional. The {subscription_id} is user-settable (4-36 chars, matching /a-z/) or system-generated otherwise. If provided, the ID must be unique within the parent subscriber.
This corresponds to the
subscription_idfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
A subscription to a data collection for a specific user, to be delivered to a subscriber.
- Return type
- static data_type_path(user: str, data_type: str) str[source]¶
Returns a fully-qualified data_type string.
- delete_subscriber(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.DeleteSubscriberRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.api_core.operation.Operation[source]¶
Deletes a subscriber registration. This will stop all notifications to the subscriber’s endpoint.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 def sample_delete_subscriber(): # Create a client client = health_v4.DataSubscriptionServiceClient() # Initialize request argument(s) request = health_v4.DeleteSubscriberRequest( name="name_value", ) # Make the request operation = client.delete_subscriber(request=request) print("Waiting for operation to complete...") response = operation.result() # Handle the response print(response)
- Parameters
request (Union[google.devicesandservices.health_v4.types.DeleteSubscriberRequest, dict]) – The request object. Request message for DeleteSubscriber.
name (str) –
Required. The name of the subscriber to delete. Format: projects/{project}/subscribers/{subscriber} Example: projects/my-project/subscribers/my-subscriber-123 The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) or system-generated if not provided during creation.
This corresponds to the
namefield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
An object representing a long-running operation.
- The result type for the operation will be
google.protobuf.empty_pb2.EmptyA generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:
- service Foo {
rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
}
- The result type for the operation will be
- Return type
- delete_subscription(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.DeleteSubscriptionRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) None[source]¶
Deletes a specific user subscription, stopping notifications for this user to this subscriber.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 def sample_delete_subscription(): # Create a client client = health_v4.DataSubscriptionServiceClient() # Initialize request argument(s) request = health_v4.DeleteSubscriptionRequest( name="name_value", ) # Make the request client.delete_subscription(request=request)
- Parameters
request (Union[google.devicesandservices.health_v4.types.DeleteSubscriptionRequest, dict]) – The request object. Request message for DeleteSubscription.
name (str) –
Required. The resource name of the subscription to delete. Format:
projects/{project}/subscribers/{subscriber}/subscriptions/{subscription}Example:projects/my-project/subscribers/my-subscriber-123/subscriptions/my-subscription-456The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) if provided during creation, or system-generated otherwise. The {subscription} ID is user-settable (4-36 characters, matching /a-z/) or system-generated if not provided during creation.This corresponds to the
namefield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- classmethod from_service_account_file(filename: str, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_info(info: dict, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
info.
- Parameters
info (dict) – The service account private key info.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_json(filename: str, *args, **kwargs)¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]¶
Deprecated. Return the API endpoint and client cert source for mutual TLS.
The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not “true”, the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.
The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “always”, use the default mTLS endpoint; if the environment variable is “never”, use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.
More details can be found at https://google.aip.dev/auth/4114.
- Parameters
client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.
- Returns
- returns the API endpoint and the
client cert source to use.
- Return type
- Raises
google.auth.exceptions.MutualTLSChannelError – If any errors happen.
- list_subscribers(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.ListSubscribersRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.devicesandservices.health_v4.services.data_subscription_service.pagers.ListSubscribersPager[source]¶
Lists all subscribers registered within the owned Google Cloud Project.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 def sample_list_subscribers(): # Create a client client = health_v4.DataSubscriptionServiceClient() # Initialize request argument(s) request = health_v4.ListSubscribersRequest( parent="parent_value", ) # Make the request page_result = client.list_subscribers(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.devicesandservices.health_v4.types.ListSubscribersRequest, dict]) – The request object. Request message for ListSubscribers.
parent (str) –
Required. The parent, which owns this collection of subscribers. Format: projects/{project}
This corresponds to the
parentfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
Response message for ListSubscribers.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.devicesandservices.health_v4.services.data_subscription_service.pagers.ListSubscribersPager
- list_subscriptions(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.ListSubscriptionsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.devicesandservices.health_v4.services.data_subscription_service.pagers.ListSubscriptionsPager[source]¶
Lists all active subscriptions for a given subscriber. This can be filtered, for example, by user or data type.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 def sample_list_subscriptions(): # Create a client client = health_v4.DataSubscriptionServiceClient() # Initialize request argument(s) request = health_v4.ListSubscriptionsRequest( parent="parent_value", ) # Make the request page_result = client.list_subscriptions(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.devicesandservices.health_v4.types.ListSubscriptionsRequest, dict]) – The request object. Request message for ListSubscriptions.
parent (str) –
Required. The parent subscriber. Format: projects/{project}/subscribers/{subscriber} The {subscriber} ID is user-settable (4-36 characters, matching /a-z/) if provided during creation, or system-generated otherwise.
This corresponds to the
parentfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
Response message for ListSubscriptions. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.devicesandservices.health_v4.services.data_subscription_service.pagers.ListSubscriptionsPager
- static parse_common_billing_account_path(path: str) Dict[str, str][source]¶
Parse a billing_account path into its component segments.
- static parse_common_folder_path(path: str) Dict[str, str][source]¶
Parse a folder path into its component segments.
- static parse_common_location_path(path: str) Dict[str, str][source]¶
Parse a location path into its component segments.
- static parse_common_organization_path(path: str) Dict[str, str][source]¶
Parse a organization path into its component segments.
- static parse_common_project_path(path: str) Dict[str, str][source]¶
Parse a project path into its component segments.
- static parse_data_type_path(path: str) Dict[str, str][source]¶
Parses a data_type path into its component segments.
- static parse_subscriber_path(path: str) Dict[str, str][source]¶
Parses a subscriber path into its component segments.
- static parse_subscription_path(path: str) Dict[str, str][source]¶
Parses a subscription path into its component segments.
- static parse_user_path(path: str) Dict[str, str][source]¶
Parses a user path into its component segments.
- static subscriber_path(project: str, subscriber: str) str[source]¶
Returns a fully-qualified subscriber string.
- static subscription_path(project: str, subscriber: str, subscription: str) str[source]¶
Returns a fully-qualified subscription string.
- property transport: google.devicesandservices.health_v4.services.data_subscription_service.transports.base.DataSubscriptionServiceTransport¶
Returns the transport used by the client instance.
- Returns
- The transport used by the client
instance.
- Return type
DataSubscriptionServiceTransport
- property universe_domain: str¶
Return the universe domain used by the client instance.
- Returns
The universe domain used by the client instance.
- Return type
- update_subscriber(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.UpdateSubscriberRequest, dict]] = None, *, subscriber: Optional[google.devicesandservices.health_v4.types.data_subscription_service.Subscriber] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.api_core.operation.Operation[source]¶
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_uriorendpoint_authorizationfield is included in theupdate_mask, the backend will re-verify the endpoint. The verification process is the same as described inCreateSubscriber: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.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 def sample_update_subscriber(): # Create a client client = health_v4.DataSubscriptionServiceClient() # Initialize request argument(s) subscriber = health_v4.Subscriber() subscriber.endpoint_uri = "endpoint_uri_value" subscriber.endpoint_authorization.secret = "secret_value" request = health_v4.UpdateSubscriberRequest( subscriber=subscriber, ) # Make the request operation = client.update_subscriber(request=request) print("Waiting for operation to complete...") response = operation.result() # Handle the response print(response)
- Parameters
request (Union[google.devicesandservices.health_v4.types.UpdateSubscriberRequest, dict]) – The request object. Request message for UpdateSubscriber.
subscriber (google.devicesandservices.health_v4.types.Subscriber) –
Required. The subscriber resource to update. Its ‘name’ field is mapped to the URI, and the value of the ‘name’ field should be of the form: “projects/{project}/subscribers/{subscriber_id}”. The remaining fields of the Subscriber object represent the new values for the corresponding fields in the existing subscriber resource.
This corresponds to the
subscriberfield on therequestinstance; ifrequestis provided, this should not be set.update_mask (google.protobuf.field_mask_pb2.FieldMask) –
Optional. A field mask that specifies which fields of the Subscriber message are to be updated. This allows for partial updates. Supported fields:
endpoint_uri
subscriber_configs
endpoint_authorization
This corresponds to the
update_maskfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
An object representing a long-running operation.
The result type for the operation will be
google.devicesandservices.health_v4.types.Subscriber– Resource Messages – A subscriber receives notifications from Google Health API.- Return type
- update_subscription(request: Optional[Union[google.devicesandservices.health_v4.types.data_subscription_service.UpdateSubscriptionRequest, dict]] = None, *, subscription: Optional[google.devicesandservices.health_v4.types.data_subscription_service.Subscription] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()) google.devicesandservices.health_v4.types.data_subscription_service.Subscription[source]¶
Updates the data types for an existing user subscription.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.devicesandservices import health_v4 def sample_update_subscription(): # Create a client client = health_v4.DataSubscriptionServiceClient() # Initialize request argument(s) request = health_v4.UpdateSubscriptionRequest( ) # Make the request response = client.update_subscription(request=request) # Handle the response print(response)
- Parameters
request (Union[google.devicesandservices.health_v4.types.UpdateSubscriptionRequest, dict]) – The request object. Request message for UpdateSubscription.
subscription (google.devicesandservices.health_v4.types.Subscription) –
Required. The subscription to update. The subscription’s
namefield is used to identify the subscription to update. Format: projects/{project}/subscribers/{subscriber}/subscriptions/{subscription}This corresponds to the
subscriptionfield on therequestinstance; ifrequestis provided, this should not be set.update_mask (google.protobuf.field_mask_pb2.FieldMask) –
Optional. The list of fields to update.
This corresponds to the
update_maskfield on therequestinstance; ifrequestis provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- Returns
A subscription to a data collection for a specific user, to be delivered to a subscriber.
- Return type
- class google.devicesandservices.health_v4.services.data_subscription_service.pagers.ListSubscribersAsyncPager(method: Callable[[...], Awaitable[google.devicesandservices.health_v4.types.data_subscription_service.ListSubscribersResponse]], request: google.devicesandservices.health_v4.types.data_subscription_service.ListSubscribersRequest, response: google.devicesandservices.health_v4.types.data_subscription_service.ListSubscribersResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ())[source]¶
A pager for iterating through
list_subscribersrequests.This class thinly wraps an initial
google.devicesandservices.health_v4.types.ListSubscribersResponseobject, and provides an__aiter__method to iterate through itssubscribersfield.If there are more pages, the
__aiter__method will make additionalListSubscribersrequests and continue to iterate through thesubscribersfield on the corresponding responses.All the usual
google.devicesandservices.health_v4.types.ListSubscribersResponseattributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.devicesandservices.health_v4.types.ListSubscribersRequest) – The initial request object.
response (google.devicesandservices.health_v4.types.ListSubscribersResponse) – The initial response object.
retry (google.api_core.retry.AsyncRetry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- class google.devicesandservices.health_v4.services.data_subscription_service.pagers.ListSubscribersPager(method: Callable[[...], google.devicesandservices.health_v4.types.data_subscription_service.ListSubscribersResponse], request: google.devicesandservices.health_v4.types.data_subscription_service.ListSubscribersRequest, response: google.devicesandservices.health_v4.types.data_subscription_service.ListSubscribersResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ())[source]¶
A pager for iterating through
list_subscribersrequests.This class thinly wraps an initial
google.devicesandservices.health_v4.types.ListSubscribersResponseobject, and provides an__iter__method to iterate through itssubscribersfield.If there are more pages, the
__iter__method will make additionalListSubscribersrequests and continue to iterate through thesubscribersfield on the corresponding responses.All the usual
google.devicesandservices.health_v4.types.ListSubscribersResponseattributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.devicesandservices.health_v4.types.ListSubscribersRequest) – The initial request object.
response (google.devicesandservices.health_v4.types.ListSubscribersResponse) – The initial response object.
retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- class google.devicesandservices.health_v4.services.data_subscription_service.pagers.ListSubscriptionsAsyncPager(method: Callable[[...], Awaitable[google.devicesandservices.health_v4.types.data_subscription_service.ListSubscriptionsResponse]], request: google.devicesandservices.health_v4.types.data_subscription_service.ListSubscriptionsRequest, response: google.devicesandservices.health_v4.types.data_subscription_service.ListSubscriptionsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ())[source]¶
A pager for iterating through
list_subscriptionsrequests.This class thinly wraps an initial
google.devicesandservices.health_v4.types.ListSubscriptionsResponseobject, and provides an__aiter__method to iterate through itssubscriptionsfield.If there are more pages, the
__aiter__method will make additionalListSubscriptionsrequests and continue to iterate through thesubscriptionsfield on the corresponding responses.All the usual
google.devicesandservices.health_v4.types.ListSubscriptionsResponseattributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.devicesandservices.health_v4.types.ListSubscriptionsRequest) – The initial request object.
response (google.devicesandservices.health_v4.types.ListSubscriptionsResponse) – The initial response object.
retry (google.api_core.retry.AsyncRetry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.
- class google.devicesandservices.health_v4.services.data_subscription_service.pagers.ListSubscriptionsPager(method: Callable[[...], google.devicesandservices.health_v4.types.data_subscription_service.ListSubscriptionsResponse], request: google.devicesandservices.health_v4.types.data_subscription_service.ListSubscriptionsRequest, response: google.devicesandservices.health_v4.types.data_subscription_service.ListSubscriptionsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, Union[str, bytes]]] = ())[source]¶
A pager for iterating through
list_subscriptionsrequests.This class thinly wraps an initial
google.devicesandservices.health_v4.types.ListSubscriptionsResponseobject, and provides an__iter__method to iterate through itssubscriptionsfield.If there are more pages, the
__iter__method will make additionalListSubscriptionsrequests and continue to iterate through thesubscriptionsfield on the corresponding responses.All the usual
google.devicesandservices.health_v4.types.ListSubscriptionsResponseattributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.devicesandservices.health_v4.types.ListSubscriptionsRequest) – The initial request object.
response (google.devicesandservices.health_v4.types.ListSubscriptionsResponse) – The initial response object.
retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]) – Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.