Options
All
  • Public
  • Public/Protected
  • All
Menu

Stigg Node.js SDK client

Hierarchy

  • Stigg

Implements

Index

Methods

  • addListener<K>(eventName: K, listener: Events[K]): void
  • Add an event listener

    Type parameters

    Parameters

    • eventName: K

      The event to listen for ('entitlementsUpdated', 'usageUpdated', 'packagePublished', 'cacheHit', 'cacheMiss')

    • listener: Events[K]

      The callback function to be called when the event occurs

    Returns void

  • archiveCustomer(customerId: string): Promise<string>
  • close(): void
  • Discards all network connections, background tasks, and other resources held by the client.

    Do not attempt to use the client after calling this method.

    Returns void

  • detachCustomerPaymentMethod(customerId: string): Promise<SlimCustomer>
  • getCoupons(): Promise<Coupon[]>
  • getEntitlements(customerId: string, resourceId?: string): Promise<undefined | ({ accessDeniedReason: AccessDeniedReason; feature: { id: string }; hasAccess: boolean; isFallback: boolean } | { accessDeniedReason: AccessDeniedReason; feature: { id: string }; hasAccess: boolean; isFallback: boolean; isUnlimited?: boolean; value?: number } | { accessDeniedReason: AccessDeniedReason; feature: { id: string }; hasAccess: boolean; isFallback: boolean; isUnlimited?: boolean; usageLimit?: number })[] | Entitlement[]>
  • Get entitlements per user

    Parameters

    • customerId: string
    • Optional resourceId: string

    Returns Promise<undefined | ({ accessDeniedReason: AccessDeniedReason; feature: { id: string }; hasAccess: boolean; isFallback: boolean } | { accessDeniedReason: AccessDeniedReason; feature: { id: string }; hasAccess: boolean; isFallback: boolean; isUnlimited?: boolean; value?: number } | { accessDeniedReason: AccessDeniedReason; feature: { id: string }; hasAccess: boolean; isFallback: boolean; isUnlimited?: boolean; usageLimit?: number })[] | Entitlement[]>

  • Import a Customer from billing integration. Private information such as email and name are not imported and needs to be send in order to be persisted in Stigg. Active billing integration is required for this functionality.

    Parameters

    Returns Promise<SlimCustomer>

    Newly created customer. Throw exception on errors.

  • Migrate subscription to latest plan and addons version and pricing. using SubscriptionMigrationTime.EndOfBillingPeriod is possible only if Stripe integration is enabled and will migrate the subscription in the end of the current billing period. Using Immediate will perform the migration imidietly. Default, migration will happen imidietly.

    Parameters

    Returns Promise<{ subscriptionId: string }>

    The subscription id

  • reloadEntitlements(customerId: string, resourceId?: string): Promise<{ entitledEntityExists: boolean }>
  • Reload entitlements of a customer or customer resource. Note: this method skips the Edge API, so use it only when you need "read-after-write" consistency after entitlements presumably have changed.

    Parameters

    • customerId: string
    • Optional resourceId: string

    Returns Promise<{ entitledEntityExists: boolean }>

  • removeListener<K>(eventName: K, listener: Events[K]): void
  • Remove an event listener

    Type parameters

    Parameters

    • eventName: K

      The event to stop listening for

    • listener: Events[K]

      The callback function to remove

    Returns void

  • unarchiveCustomer(customerId: string): Promise<SlimCustomer>
  • waitForInitialization(): Promise<Stigg>
  • Initialize an instance of the Stigg SDK client.

    Parameters

    Returns Stigg

    stigg SDK instance.

Generated using TypeDoc