@stigg/js-client-sdk 2.2.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,12 @@
1
1
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
- import { GetCustomerPortalByRefIdQuery, GetCustomerByIdQuery, GetActiveSubscriptionsQuery } from '@stigg/api-client-js/src/generated/sdk';
2
+ import { GetCustomerPortalByRefIdQuery, GetCustomerByIdQuery, GetActiveSubscriptionsQuery, UsageHistoryQuery } from '@stigg/api-client-js/src/generated/sdk';
3
+ import { FetchUsageHistory } from '../models';
3
4
  declare class CustomersApi {
4
5
  private readonly client;
5
6
  constructor(client: ApolloClient<NormalizedCacheObject>);
6
7
  getCustomer(customerId: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetCustomerByIdQuery>>;
7
8
  getActiveSubscriptions(customerId: string, resourceId?: string): Promise<import("@apollo/client/core").ApolloQueryResult<GetActiveSubscriptionsQuery>>;
8
9
  getCustomerPortal(customerId: string, resourceId: string | undefined): Promise<import("@apollo/client/core").ApolloQueryResult<GetCustomerPortalByRefIdQuery>>;
10
+ fetchUsageHistory({ customerId, resourceId, endDate, startDate, featureId }: FetchUsageHistory): Promise<import("@apollo/client/core").ApolloQueryResult<UsageHistoryQuery>>;
9
11
  }
10
12
  export default CustomersApi;
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BooleanEntitlement, Coupon, Customer, Entitlement, GetBooleanEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, MeteredEntitlement, NumericEntitlement, Subscription, WaitForCheckoutCompleted, CustomerPortal, Paywall, EstimateSubscription, SubscriptionPreview, EstimateSubscriptionUpdate, GetCustomerPortal, GetActiveSubscriptions } from './models';
1
+ import { BooleanEntitlement, Coupon, Customer, Entitlement, GetBooleanEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, MeteredEntitlement, NumericEntitlement, Subscription, WaitForCheckoutCompleted, CustomerPortal, Paywall, EstimateSubscription, SubscriptionPreview, EstimateSubscriptionUpdate, GetCustomerPortal, GetActiveSubscriptions, FetchUsageHistory, UsageHistoryPoint } from './models';
2
2
  import { ClientConfiguration } from './configuration';
3
3
  import { EventNames, Events } from './services/eventEmitter';
4
4
  export interface StiggClient {
@@ -144,6 +144,12 @@ export declare class Stigg implements StiggClient {
144
144
  * @returns {Promise<CustomerPortal>}
145
145
  */
146
146
  getCustomerPortal({ resourceId }?: GetCustomerPortal): Promise<CustomerPortal>;
147
+ /**
148
+ * Fetch customer usage history of a feature.
149
+ * @return {Promise<UsageHistoryPoint[]>} Array of usage history as data points.
150
+ * @param fetchUsageHistory
151
+ */
152
+ fetchUsageHistory(fetchUsageHistory: FetchUsageHistory): Promise<UsageHistoryPoint[] | undefined>;
147
153
  /**
148
154
  * Get a list of entitlements
149
155
  *