Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Usage

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Private Readonly store

store: Store

Static Readonly DEFAULT_FIELDS

DEFAULT_FIELDS: string = ...

Methods

add

  • Record usage to an account's subscription.

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const response = await client.billing.usage.add({
      UsageDate: new Date("2021-01-01T08:00:00.000Z"),
      Amount: 10,
      SubscriptionAddOn: {
        Uid: "z9MKvMm4"
      }
    });
    console.log(response);
    
    throws

    Response If the server returns a non-"OK" status, the whole response object will be thrown.

    Parameters

    • usage: UsageAdd

      The usage to log to Outseta. SubscriptionAddOn can be located in the Subscription model for an Account.

    • options: { fields?: string } = {}
      • Optional fields?: string

        Not all fields on the model are returned by default - you can request specific fields with a that looks something like ',SubscriptionAddOn.Subscription.Uid'. Note: the shape of the returned object may not match the model in this library if this string does not start with '' as shown.

    Returns Promise<UsageItem | ValidationError<UsageItem>>

    The response body if response status OK, or response body with validation errors if response status 400.

getAll

  • getAll(options?: { Account?: Required<Pick<Account, "Uid">>; fields?: string; limit?: number; offset?: number }): Promise<List<UsageItem>>
  • Get all usage:

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const response = await client.billing.usage.getAll();
    console.log(response);
    

    Get all usage for a particular account:

    const client = new OutsetaApiClient({
      subdomain: 'test-company',
      apiKey: example_key,
      secretKey: example_secret
    });
    const Account = {
      Uid: 'jW7GJVWq'
    };
    const response = await client.billing.usage.getAll({ Account });
    console.log(response);
    
    throws

    Response If the server returns a non-"OK" status, the whole response object will be thrown.

    Parameters

    • options: { Account?: Required<Pick<Account, "Uid">>; fields?: string; limit?: number; offset?: number } = {}
      • Optional Account?: Required<Pick<Account, "Uid">>

        Get all usage for a particular account.

      • Optional fields?: string

        Not all fields on the model are returned by default - you can request specific fields with a that looks something like ',SubscriptionAddOn.Subscription.Uid'. Note: the shape of the returned object may not match the model in this library if this string does not start with '' as shown.

      • Optional limit?: number

        The number of results returned by the API.

      • Optional offset?: number

        For pagination; returns (limit) results after this value.

    Returns Promise<List<UsageItem>>

    The response body if response status OK.

Generated using TypeDoc