1616class ViamClient :
1717 """gRPC client for all communication and interaction with app.
1818
19+ `ViamClient` class for creating and managing specialized client instances.
1920 There is currently 1 way to instantiate a `ViamClient` object::
2021
2122 ViamClient.create_from_dial_options(...)
@@ -25,10 +26,14 @@ class ViamClient:
2526 async def create_from_dial_options (cls , dial_options : DialOptions , app_url : Optional [str ] = None ) -> Self :
2627 """Create `ViamClient` that establishes a connection to the Viam app.
2728
28- Args:
29+ ::
30+
31+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
32+ ViamClient.create_from_dial_options(dial_options)
2933
30- dial_options (viam.rpc.dial.DialOptions): Required information for authorization and connection to app. `creds` and
31- `auth_entity` fields are required.
34+ Args:
35+ dial_options (viam.rpc.dial.DialOptions): Required information for authorization and connection to app.
36+ `creds` and `auth_entity` fields are required.
3237 app_url: (Optional[str]): URL of app. Uses app.viam.com if not specified.
3338
3439 Raises:
@@ -62,22 +67,70 @@ async def create_from_dial_options(cls, dial_options: DialOptions, app_url: Opti
6267
6368 @property
6469 def data_client (self ) -> DataClient :
65- """Insantiate and return a `DataClient` used to make `data` and `data_sync` method calls."""
70+ """Instantiate and return a `DataClient` object used to make `data` and `data_sync` method calls.
71+ To use the `DataClient`, you must first instantiate a `ViamClient`.
72+
73+ ::
74+
75+ async def connect() -> ViamClient:
76+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
77+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
78+ return await ViamClient.create_from_dial_options(dial_options)
79+
80+ async def main():
81+ viam_client = await connect()
82+
83+ # Instantiate a DataClient to run data client API methods on
84+ data_client = viam_client.data_client
85+ """
6686 return DataClient (self ._channel , self ._metadata )
6787
6888 @property
6989 def app_client (self ) -> AppClient :
70- """Insantiate and return an `AppClient` used to make `app` method calls."""
90+ """Instantiate and return an `AppClient` used to make `app` method calls.
91+ To use the `AppClient`, you must first instantiate a `ViamClient`.
92+
93+ ::
94+
95+ async def connect() -> ViamClient:
96+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
97+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
98+ return await ViamClient.create_from_dial_options(dial_options)
99+
100+
101+ async def main():
102+ viam_client = await connect()
103+
104+ # Instantiate an AppClient called "fleet" to run fleet management API methods on
105+ fleet = viam_client.app_client
106+ """
71107 return AppClient (self ._channel , self ._metadata , self ._location_id )
72108
73109 @property
74110 def ml_training_client (self ) -> MLTrainingClient :
75- """Instantiate and return a `MLTrainingClient` used to make `ml_training` method calls."""
111+ """Instantiate and return a `MLTrainingClient` used to make `ml_training` method calls.
112+ To use the `MLTrainingClient`, you must first instantiate a `ViamClient`.
113+
114+ ::
115+
116+ async def connect() -> ViamClient:
117+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
118+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
119+ return await ViamClient.create_from_dial_options(dial_options)
120+
121+
122+ async def main():
123+ viam_client = await connect()
124+
125+ # Instantiate an MLTrainingClient to run ML training client API methods on
126+ ml_training_client = viam_client.ml_training_client
127+ """
76128 return MLTrainingClient (self ._channel , self ._metadata )
77129
78130 @property
79131 def billing_client (self ) -> BillingClient :
80- """Instantiate and return a `BillingClient` used to make `billing` method calls."""
132+ """Instantiate and return a `BillingClient` used to make `billing` method calls.
133+ To use the `BillingClient`, you must first instantiate a `ViamClient`."""
81134 return BillingClient (self ._channel , self ._metadata )
82135
83136 def close (self ):
0 commit comments