@@ -23,6 +23,32 @@ class BillingClient:
2323
2424 Constructor is used by `ViamClient` to instantiate relevant service stubs. Calls to
2525 `BillingClient` methods should be made through `ViamClient`.
26+
27+ Establish a Connection::
28+
29+ import asyncio
30+
31+ from viam.rpc.dial import DialOptions, Credentials
32+ from viam.app.viam_client import ViamClient
33+
34+
35+ async def connect() -> ViamClient:
36+ # Replace "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
37+ dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
38+ return await ViamClient.create_from_dial_options(dial_options)
39+
40+
41+ async def main():
42+ # Make a ViamClient
43+ viam_client = await connect()
44+ # Instantiate a BillingClient to run billing client API methods on
45+ billing_client = viam_client.billing_client
46+
47+ viam_client.close()
48+
49+ if __name__ == '__main__':
50+ asyncio.run(main())
51+
2652 """
2753
2854 def __init__ (self , channel : Channel , metadata : Mapping [str , str ]):
@@ -43,6 +69,10 @@ def __init__(self, channel: Channel, metadata: Mapping[str, str]):
4369 async def get_current_month_usage (self , org_id : str , timeout : Optional [float ] = None ) -> GetCurrentMonthUsageResponse :
4470 """Access data usage information for the current month for a given organization.
4571
72+ ::
73+
74+ usage = await viam_client.billing_client.get_current_month_usage("<ORG-ID>")
75+
4676 Args:
4777 org_id (str): the ID of the organization to request usage data for
4878
@@ -55,6 +85,10 @@ async def get_current_month_usage(self, org_id: str, timeout: Optional[float] =
5585 async def get_invoice_pdf (self , invoice_id : str , org_id : str , dest : str , timeout : Optional [float ] = None ) -> None :
5686 """Access invoice PDF data and optionally save it to a provided file path.
5787
88+ ::
89+
90+ await viam_client.billing_client.get_invoice_pdf("<INVOICE-ID>", "<ORG-ID>", "<FILENAME>")
91+
5892 Args:
5993 invoice_id (str): the ID of the invoice being requested
6094 org_id (str): the ID of the org to request data from
@@ -70,6 +104,10 @@ async def get_invoice_pdf(self, invoice_id: str, org_id: str, dest: str, timeout
70104 async def get_invoices_summary (self , org_id : str , timeout : Optional [float ] = None ) -> GetInvoicesSummaryResponse :
71105 """Access total outstanding balance plus invoice summaries for a given org.
72106
107+ ::
108+
109+ summary = await viam_client.billing_client.get_invoices_summary("<ORG-ID>")
110+
73111 Args:
74112 org_id (str): the ID of the org to request data for
75113
@@ -82,6 +120,10 @@ async def get_invoices_summary(self, org_id: str, timeout: Optional[float] = Non
82120 async def get_org_billing_information (self , org_id : str , timeout : Optional [float ] = None ) -> GetOrgBillingInformationResponse :
83121 """Access billing information (payment method, billing tier, etc.) for a given org.
84122
123+ ::
124+
125+ information = await viam_client.billing_client.get_org_billing_information("<ORG-ID>")
126+
85127 Args:
86128 org_id (str): the ID of the org to request data for
87129
0 commit comments