viam.app.billing_client

Module Contents

Classes

BillingClient

gRPC client for retrieving billing data from app.

Attributes

LOGGER

viam.app.billing_client.LOGGER
class viam.app.billing_client.BillingClient(channel: grpclib.client.Channel, metadata: Mapping[str, str])[source]

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 "<API-KEY>" (including brackets) with your API key and "<API-KEY-ID>" with your API key ID
    dial_options = DialOptions.with_api_key("<API-KEY>", "<API-KEY-ID>")
    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())
async get_current_month_usage(org_id: str, timeout: float | None = None) viam.proto.app.billing.GetCurrentMonthUsageResponse[source]

Access data usage information for the current month for a given organization.

usage = await viam_client.billing_client.get_current_month_usage("<ORG-ID>")
Parameters:

org_id (str) – the ID of the organization to request usage data for

Returns:

Current month usage information

Return type:

viam.proto.app.billing.GetCurrentMonthUsageResponse

async get_invoice_pdf(invoice_id: str, org_id: str, dest: str, timeout: float | None = None) None[source]

Access invoice PDF data and optionally save it to a provided file path.

await viam_client.billing_client.get_invoice_pdf("<INVOICE-ID>", "<ORG-ID>", "<FILENAME>")
Parameters:
  • invoice_id (str) – the ID of the invoice being requested

  • org_id (str) – the ID of the org to request data from

  • dest (str) – filepath to save the invoice to

async get_invoices_summary(org_id: str, timeout: float | None = None) viam.proto.app.billing.GetInvoicesSummaryResponse[source]

Access total outstanding balance plus invoice summaries for a given org.

summary = await viam_client.billing_client.get_invoices_summary("<ORG-ID>")
Parameters:

org_id (str) – the ID of the org to request data for

Returns:

Summary of org invoices

Return type:

viam.proto.app.billing.GetInvoicesSummaryResponse

async get_org_billing_information(org_id: str, timeout: float | None = None) viam.proto.app.billing.GetOrgBillingInformationResponse[source]

Access billing information (payment method, billing tier, etc.) for a given org.

information = await viam_client.billing_client.get_org_billing_information("<ORG-ID>")
Parameters:

org_id (str) – the ID of the org to request data for

Returns:

The org billing information

Return type:

viam.proto.app.billing.GetOrgBillingInformationResponse