diff --git a/README.rst b/README.rst index 8adb4569..372f5a91 100644 --- a/README.rst +++ b/README.rst @@ -3,14 +3,34 @@ Python Client for ClearBlade IoT Core API Quick start ----------- +**Notes** -To use this library, you first need to go through the following steps: +1. This SDK is for use with ClearBlade IoT Core Standard and ClearBlade IoT Core Enterprise. + +2. ClearBlade IoT **Core** Enterprise is DIFFERENT from ClearBlade IoT Enterprise!!! + +3. If you are using ClearBlade but not using ClearBlade IoT Core (Standard or Enterprise), then you need this different SDK: ``_. + +4. To understand how IoT Core Enterprise differs from Standard, look here: ``_. + + + +To use this SDK, you first need to go through the following steps: 1. Install pip package - ```pip install clearblade-cloud-iot``` -2. Set an environment variable **CLEARBLADE_CONFIGURATION**, pointing to your ClearBlade service account JSON file. +2. Set an environment variable **CLEARBLADE_CONFIGURATION**, pointing to your ClearBlade service account JSON file (see below). + +3. Optionally set an environment variable **BINARYDATA_AND_TIME_GOOGLE_FORMAT** to True. Look at **Note about types of times and binaryData** below for details. + + +To create a service account and download a credentials JSON file look at the appropriate link below: + +`ClearBlade IoT Core Standard `_ + +`ClearBlade IoT Core Enterprise `_ + -3. Optionally set an environment variable **BINARYDATA_AND_TIME_GOOGLE_FORMAT** to True. Look at **Note about types of times and binaryData** below for details. Installation ~~~~~~~~~~~~ diff --git a/clearblade/cloud/iot_v1/device_types.py b/clearblade/cloud/iot_v1/device_types.py index f686ffcd..0b7d6cdd 100644 --- a/clearblade/cloud/iot_v1/device_types.py +++ b/clearblade/cloud/iot_v1/device_types.py @@ -43,7 +43,7 @@ """ from typing import List -from .resources import GatewayType, LogLevel, PublicKeyFormat, PublicKeyCredential, DeviceCredential +from .resources import GatewayType, LogLevel, PublicKeyFormat, PublicKeyCredential, DeviceCredential, FieldMask from .utils import get_value import os from proto.datetime_helpers import DatetimeWithNanoseconds @@ -591,7 +591,7 @@ def _prepare_params_for_list(self): if self.device_ids: params['deviceIds'] = self.device_ids if self.field_mask: - params['fieldMask'] = self.field_mask + params['fieldMask'] = FieldMask.convert_fieldmask_for_list(self.field_mask) if self.gateway_list_options : if 'associationsDeviceId' in self.gateway_list_options: params['gatewayListOptions.associationsDeviceId'] = self.gateway_list_options['associationsDeviceId'] diff --git a/clearblade/cloud/iot_v1/resources.py b/clearblade/cloud/iot_v1/resources.py index b933a701..0d37e590 100644 --- a/clearblade/cloud/iot_v1/resources.py +++ b/clearblade/cloud/iot_v1/resources.py @@ -168,4 +168,22 @@ def convert_credentials_for_create_update(cls, credentials): if updateDeviceCredential: credentials[index] = credential - return credentials \ No newline at end of file + return credentials + +class FieldMask(): + def __init__(self, paths: [str]): + self.paths = paths + + def __getitem__(self, arg): + return getattr(self, arg) + + def get(self, arg): + return getattr(self, arg) + + @classmethod + def convert_fieldmask_for_list(cls, field_mask): + if (isinstance(field_mask, FieldMask)): + field_mask = field_mask.__dict__ + if 'paths' in field_mask: + field_mask = field_mask['paths'] + return field_mask diff --git a/google/cloud/iot_v1/types/device_manager.py b/google/cloud/iot_v1/types/device_manager.py index 93d6622d..8b8b19f5 100644 --- a/google/cloud/iot_v1/types/device_manager.py +++ b/google/cloud/iot_v1/types/device_manager.py @@ -318,11 +318,11 @@ class ListDevicesRequest(proto.Message): ``projects/my-project/locations/us-central1/registries/my-registry``. device_num_ids (Sequence[int]): A list of device numeric IDs. If empty, this - field is ignored. Maximum IDs: 10,000. + field is ignored. device_ids (Sequence[str]): A list of device string IDs. For example, ``['device0', 'device12']``. If empty, this field is - ignored. Maximum IDs: 10,000 + ignored. field_mask (google.protobuf.field_mask_pb2.FieldMask): The fields of the ``Device`` resource to be returned in the response. The fields ``id`` and ``num_id`` are always diff --git a/setup.py b/setup.py index c788fdca..56ba1951 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ name = "clearblade-cloud-iot" description = "Cloud IoT API client library" -version = "2.0.5" +version = "2.0.7" release_status = "Development Status :: 5 - Production/Stable" dependencies = ["httpx", "proto-plus"] @@ -58,7 +58,7 @@ description=description, long_description=readme, author="Clearblade", - author_email="googleapis-packages@oogle.com", + author_email="info@clearblade.com", license="Apache 2.0", url="https://github.com/clearblade/python-iot", classifiers=[