import type { AcceptDateStrings } from '../../lib/wire.js'; import type { AppCustomerData, AppStripeCreateCheckoutSessionResult, AppStripeCreateCustomerPortalSessionResult, Charge, ChargePagePaginatedResponse, CreateChargeRequestInput, CreateCreditAdjustmentRequest as CreateCreditAdjustmentRequestBody, CreateCreditGrantRequestInput, CreateCustomerRequest as CreateCustomerRequestBody, CreateEntitlementRequestInput, CreditAdjustment, CreditBalances, CreditGrant, CreditGrantPagePaginatedResponse, CreditTransactionPaginatedResponse, CursorPaginationQueryPage, Customer, CustomerData, CustomerPagePaginatedResponse, CustomerStripeCreateCheckoutSessionRequestInput, CustomerStripeCreateCustomerPortalSessionRequest, Entitlement, EntitlementGrant, EntitlementGrantCreateRequest, EntitlementGrantPagePaginatedResponse, EntitlementHistory, EntitlementHistoryWindowSize, EntitlementPagePaginatedResponse, GetCreditBalanceParamsFilter, ListCreditGrantsParamsFilter, ListCreditTransactionsParamsFilter, ListCustomerChargesParamsFilter, ListCustomerEntitlementsParamsFilter, ListCustomersParamsFilter, ResetCustomerEntitlementUsageRequestInput, SortQueryInput, UpdateCreditGrantExternalSettlementRequest as UpdateCreditGrantExternalSettlementRequestBody, UpsertAppCustomerDataRequest, UpsertCustomerBillingDataRequest, UpsertCustomerRequest as UpsertCustomerRequestBody, VoidCreditGrantRequestInput } from '../types.js'; export type CreateCustomerRequest = AcceptDateStrings; export type CreateCustomerResponse = Customer; export type GetCustomerRequest = { customerId: string; }; export type GetCustomerResponse = Customer; export interface ListCustomersQuery { /** Determines which page of the collection to retrieve. */ page?: { size?: number; number?: number; }; /** * Sort customers returned in the response. Supported sort attributes are: * * - `id` * - `name` (default) * - `created_at` * * The `asc` suffix is optional as the default sort order is ascending. The `desc` * suffix is used to specify a descending order. */ sort?: SortQueryInput; /** * Filter customers returned in the response. * * To filter customers by key add the following query param: filter[key]=my-db-id */ filter?: ListCustomersParamsFilter; } export type ListCustomersRequest = AcceptDateStrings; export type ListCustomersResponse = CustomerPagePaginatedResponse; export type UpsertCustomerRequest = AcceptDateStrings<{ customerId: string; body: UpsertCustomerRequestBody; }>; export type UpsertCustomerResponse = Customer; export type DeleteCustomerRequest = { customerId: string; }; export type DeleteCustomerResponse = void; export type GetCustomerBillingRequest = { customerId: string; }; export type GetCustomerBillingResponse = CustomerData; export type UpdateCustomerBillingRequest = AcceptDateStrings<{ customerId: string; body: UpsertCustomerBillingDataRequest; }>; export type UpdateCustomerBillingResponse = CustomerData; export type UpdateCustomerBillingAppDataRequest = AcceptDateStrings<{ customerId: string; body: UpsertAppCustomerDataRequest; }>; export type UpdateCustomerBillingAppDataResponse = AppCustomerData; export type CreateCustomerStripeCheckoutSessionRequest = AcceptDateStrings<{ customerId: string; body: CustomerStripeCreateCheckoutSessionRequestInput; }>; export type CreateCustomerStripeCheckoutSessionResponse = AppStripeCreateCheckoutSessionResult; export type CreateCustomerStripePortalSessionRequest = AcceptDateStrings<{ customerId: string; body: CustomerStripeCreateCustomerPortalSessionRequest; }>; export type CreateCustomerStripePortalSessionResponse = AppStripeCreateCustomerPortalSessionResult; export type CreateCustomerEntitlementRequest = AcceptDateStrings<{ customerId: string; body: CreateEntitlementRequestInput; }>; export type CreateCustomerEntitlementResponse = Entitlement; export type OverrideCustomerEntitlementRequest = AcceptDateStrings<{ customerId: string; entitlementId: string; body: CreateEntitlementRequestInput; }>; export type OverrideCustomerEntitlementResponse = Entitlement; export interface GetCustomerEntitlementHistoryQuery { /** * The start of the queried range. Defaults to the last reset. Truncated to the * minute. The range may span at most 1000 windows. */ from?: Date; /** * The end of the queried range. Defaults to the current time. Truncated to the * minute unless it is the current time. */ to?: Date; /** The size of the windows the usage is grouped into. */ windowSize: EntitlementHistoryWindowSize; /** The IANA time zone the windows are aligned to. */ timeZone?: string; } export type GetCustomerEntitlementHistoryRequest = AcceptDateStrings; export type GetCustomerEntitlementHistoryResponse = EntitlementHistory; export type GetCustomerEntitlementRequest = { customerId: string; entitlementId: string; }; export type GetCustomerEntitlementResponse = Entitlement; export interface ListCustomerEntitlementsQuery { /** Determines which page of the collection to retrieve. */ page?: { size?: number; number?: number; }; /** * Sort entitlements returned in the response. Supported sort attributes are: * * - `created_at` (default) * - `updated_at` * * The `asc` suffix is optional as the default sort order is ascending. The `desc` * suffix is used to specify a descending order. */ sort?: SortQueryInput; /** * Filter entitlements returned in the response. * * To filter entitlements by feature key add the following query param: * `filter[feature_key]=my-feature` */ filter?: ListCustomerEntitlementsParamsFilter; } export type ListCustomerEntitlementsRequest = AcceptDateStrings; export type ListCustomerEntitlementsResponse = EntitlementPagePaginatedResponse; export type ResetCustomerEntitlementUsageRequest = AcceptDateStrings<{ customerId: string; entitlementId: string; body: ResetCustomerEntitlementUsageRequestInput; }>; export type ResetCustomerEntitlementUsageResponse = void; export type DeleteCustomerEntitlementRequest = { customerId: string; entitlementId: string; }; export type DeleteCustomerEntitlementResponse = void; export type CreateCustomerEntitlementGrantRequest = AcceptDateStrings<{ customerId: string; entitlementId: string; body: EntitlementGrantCreateRequest; }>; export type CreateCustomerEntitlementGrantResponse = EntitlementGrant; export interface ListCustomerEntitlementGrantsQuery { /** Determines which page of the collection to retrieve. */ page?: { size?: number; number?: number; }; /** * Sort grants returned in the response. Supported sort attributes are: * * - `created_at` (default) * - `updated_at` * - `effective_at` * - `expires_at` * * The `asc` suffix is optional as the default sort order is ascending. The `desc` * suffix is used to specify a descending order. */ sort?: SortQueryInput; /** Include deleted grants in the response. */ includeDeleted?: boolean; } export type ListCustomerEntitlementGrantsRequest = AcceptDateStrings; export type ListCustomerEntitlementGrantsResponse = EntitlementGrantPagePaginatedResponse; export type CreateCreditGrantRequest = AcceptDateStrings<{ customerId: string; body: CreateCreditGrantRequestInput; }>; export type CreateCreditGrantResponse = CreditGrant; export type GetCreditGrantRequest = { customerId: string; creditGrantId: string; }; export type GetCreditGrantResponse = CreditGrant; export interface ListCreditGrantsQuery { /** Determines which page of the collection to retrieve. */ page?: { size?: number; number?: number; }; /** Filter credit grants returned in the response. */ filter?: ListCreditGrantsParamsFilter; } export type ListCreditGrantsRequest = AcceptDateStrings; export type ListCreditGrantsResponse = CreditGrantPagePaginatedResponse; export interface GetCustomerCreditBalanceQuery { /** * Return the credit balance as of this timestamp. * * Defaults to the current time. Historical responses return `live` as zero because * live charge impacts are only available for current balances. */ timestamp?: Date; filter?: GetCreditBalanceParamsFilter; } export type GetCustomerCreditBalanceRequest = AcceptDateStrings; export type GetCustomerCreditBalanceResponse = CreditBalances; export type CreateCreditAdjustmentRequest = AcceptDateStrings<{ customerId: string; body: CreateCreditAdjustmentRequestBody; }>; export type CreateCreditAdjustmentResponse = CreditAdjustment; export type VoidCreditGrantRequest = AcceptDateStrings<{ customerId: string; creditGrantId: string; body: VoidCreditGrantRequestInput; }>; export type VoidCreditGrantResponse = CreditGrant; export type UpdateCreditGrantExternalSettlementRequest = AcceptDateStrings<{ customerId: string; creditGrantId: string; body: UpdateCreditGrantExternalSettlementRequestBody; }>; export type UpdateCreditGrantExternalSettlementResponse = CreditGrant; export interface ListCreditTransactionsQuery { page?: CursorPaginationQueryPage; /** Filter credit transactions returned in the response. */ filter?: ListCreditTransactionsParamsFilter; } export type ListCreditTransactionsRequest = AcceptDateStrings; export type ListCreditTransactionsResponse = CreditTransactionPaginatedResponse; export interface ListCustomerChargesQuery { /** Determines which page of the collection to retrieve. */ page?: { size?: number; number?: number; }; /** * Sort charges returned in the response. * * Supported sort attributes are: * * - `id` * - `created_at` * - `service_period.from` * - `billing_period.from` */ sort?: SortQueryInput; /** * Filter charges. * * To filter charges by status add the following query param: * `filter[status][oeq]=created,active` * * To filter charges by feature, use `filter[feature_id][oeq]=,` or * `filter[feature_key][oeq]=,`. * * See the `service_period_from` filter field for expressing a service-period * window query. */ filter?: ListCustomerChargesParamsFilter; /** * Expand full objects for referenced entities. * * Supported values are: * * - `real_time_usage`: Expand the charge's real-time usage; it sets the `usage` * and the `totals.realtime` fields. * - `customer`: Expand the charge's customer to the complete entity. * - `feature`: Expand the charge's feature to the complete entity. * - `subscription`: Expand the charge's subscription to the complete entity. * - `realization.invoice`: Expand each realization's invoice to the complete * entity. * - `realization.totals`: Expand each realization run's `totals`. * - `realization.detailed_lines`: Expand each realization run's `detailed_lines`. */ expand?: ('real_time_usage' | 'customer' | 'feature' | 'subscription' | 'realization.invoice' | 'realization.totals' | 'realization.detailed_lines')[]; } export type ListCustomerChargesRequest = AcceptDateStrings; export type ListCustomerChargesResponse = ChargePagePaginatedResponse; export type CreateCustomerChargesRequest = AcceptDateStrings<{ customerId: string; body: CreateChargeRequestInput; }>; export type CreateCustomerChargesResponse = Charge;