:py:mod:`viam.app.billing_client` ================================= .. py:module:: viam.app.billing_client Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: viam.app.billing_client.BillingClient Attributes ~~~~~~~~~~ .. autoapisummary:: viam.app.billing_client.LOGGER .. py:data:: LOGGER .. py:class:: BillingClient(channel: grpclib.client.Channel, metadata: Mapping[str, str]) gRPC client for retrieving billing data from app. Constructor is used by `ViamClient` to instantiate relevant service stubs. Calls to `BillingClient` methods should be made through `ViamClient`. Establish a Connection:: import asyncio from viam.rpc.dial import DialOptions, Credentials from viam.app.viam_client import ViamClient async def connect() -> ViamClient: # Replace "" (including brackets) with your API key and "" with your API key ID dial_options = DialOptions.with_api_key("", "") return await ViamClient.create_from_dial_options(dial_options) async def main(): # Make a ViamClient viam_client = await connect() # Instantiate a BillingClient to run billing client API methods on billing_client = viam_client.billing_client viam_client.close() if __name__ == '__main__': asyncio.run(main()) .. py:method:: get_current_month_usage(org_id: str, timeout: Optional[float] = None) -> viam.proto.app.billing.GetCurrentMonthUsageResponse :async: Access data usage information for the current month for a given organization. :: usage = await viam_client.billing_client.get_current_month_usage("") :param org_id: the ID of the organization to request usage data for :type org_id: str :returns: Current month usage information :rtype: viam.proto.app.billing.GetCurrentMonthUsageResponse .. py:method:: get_invoice_pdf(invoice_id: str, org_id: str, dest: str, timeout: Optional[float] = None) -> None :async: Access invoice PDF data and optionally save it to a provided file path. :: await viam_client.billing_client.get_invoice_pdf("", "", "") :param invoice_id: the ID of the invoice being requested :type invoice_id: str :param org_id: the ID of the org to request data from :type org_id: str :param dest: filepath to save the invoice to :type dest: str .. py:method:: get_invoices_summary(org_id: str, timeout: Optional[float] = None) -> viam.proto.app.billing.GetInvoicesSummaryResponse :async: Access total outstanding balance plus invoice summaries for a given org. :: summary = await viam_client.billing_client.get_invoices_summary("") :param org_id: the ID of the org to request data for :type org_id: str :returns: Summary of org invoices :rtype: viam.proto.app.billing.GetInvoicesSummaryResponse .. py:method:: get_org_billing_information(org_id: str, timeout: Optional[float] = None) -> viam.proto.app.billing.GetOrgBillingInformationResponse :async: Access billing information (payment method, billing tier, etc.) for a given org. :: information = await viam_client.billing_client.get_org_billing_information("") :param org_id: the ID of the org to request data for :type org_id: str :returns: The org billing information :rtype: viam.proto.app.billing.GetOrgBillingInformationResponse