import { APIResource } from "../resource.js"; import * as Core from "../core.js"; export declare class SubscriptionResource extends APIResource { /** * Create a subscription for the current user. * * @example * ```ts * const subscription = await client.subscription.create({ * id: 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX', * addressID: 'shp_XXXXXXXXXXXXXXXXXXXXXXXXX', * cardID: 'crd_XXXXXXXXXXXXXXXXXXXXXXXXX', * created: '2024-06-29T19:36:19.000Z', * price: 2200, * productVariantID: 'var_XXXXXXXXXXXXXXXXXXXXXXXXX', * quantity: 1, * }); * ``` */ create(body: SubscriptionCreateParams, options?: Core.RequestOptions): Core.APIPromise; /** * Update card, address, or interval for an existing subscription. * * @example * ```ts * const subscription = await client.subscription.update( * 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX', * ); * ``` */ update(id: string, body?: SubscriptionUpdateParams, options?: Core.RequestOptions): Core.APIPromise; update(id: string, options?: Core.RequestOptions): Core.APIPromise; /** * List the subscriptions associated with the current user. * * @example * ```ts * const subscriptions = await client.subscription.list(); * ``` */ list(options?: Core.RequestOptions): Core.APIPromise; /** * Cancel a subscription for the current user. * * @example * ```ts * const subscription = await client.subscription.delete( * 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX', * ); * ``` */ delete(id: string, options?: Core.RequestOptions): Core.APIPromise; /** * Get the subscription with the given ID. * * @example * ```ts * const subscription = await client.subscription.get( * 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX', * ); * ``` */ get(id: string, options?: Core.RequestOptions): Core.APIPromise; } /** * Subscription to a Terminal shop product. */ export interface Subscription { /** * Unique object identifier. The format and length of IDs may change over time. */ id: string; /** * ID of the shipping address used for the subscription. */ addressID: string; /** * ID of the card used for the subscription. */ cardID: string; /** * Date the subscription was created. */ created: string; /** * Price of the subscription in cents (USD). */ price: number; /** * ID of the product variant being subscribed to. */ productVariantID: string; /** * Quantity of the subscription. */ quantity: number; /** * Next shipment and billing date for the subscription. */ next?: string; /** * Schedule of the subscription. */ schedule?: Subscription.Fixed | Subscription.Weekly; } export declare namespace Subscription { interface Fixed { type: 'fixed'; } interface Weekly { interval: number; type: 'weekly'; } } export interface SubscriptionCreateResponse { data: 'ok'; } export interface SubscriptionUpdateResponse { /** * Subscription to a Terminal shop product. */ data: Subscription; } export interface SubscriptionListResponse { /** * List of subscriptions. */ data: Array; } export interface SubscriptionDeleteResponse { data: 'ok'; } export interface SubscriptionGetResponse { /** * Subscription to a Terminal shop product. */ data: Subscription; } export interface SubscriptionCreateParams { /** * Unique object identifier. The format and length of IDs may change over time. */ id: string; /** * ID of the shipping address used for the subscription. */ addressID: string; /** * ID of the card used for the subscription. */ cardID: string; /** * Date the subscription was created. */ created: string; /** * Price of the subscription in cents (USD). */ price: number; /** * ID of the product variant being subscribed to. */ productVariantID: string; /** * Quantity of the subscription. */ quantity: number; /** * Next shipment and billing date for the subscription. */ next?: string; /** * Schedule of the subscription. */ schedule?: SubscriptionCreateParams.Fixed | SubscriptionCreateParams.Weekly; } export declare namespace SubscriptionCreateParams { interface Fixed { type: 'fixed'; } interface Weekly { interval: number; type: 'weekly'; } } export interface SubscriptionUpdateParams { /** * New shipping address ID for the subscription. */ addressID?: string; /** * New payment method ID for the subscription. */ cardID?: string; /** * New schedule for the subscription. */ schedule?: SubscriptionUpdateParams.Fixed | SubscriptionUpdateParams.Weekly; } export declare namespace SubscriptionUpdateParams { interface Fixed { type: 'fixed'; } interface Weekly { interval: number; type: 'weekly'; } } export declare namespace SubscriptionResource { export { type Subscription as Subscription, type SubscriptionCreateResponse as SubscriptionCreateResponse, type SubscriptionUpdateResponse as SubscriptionUpdateResponse, type SubscriptionListResponse as SubscriptionListResponse, type SubscriptionDeleteResponse as SubscriptionDeleteResponse, type SubscriptionGetResponse as SubscriptionGetResponse, type SubscriptionCreateParams as SubscriptionCreateParams, type SubscriptionUpdateParams as SubscriptionUpdateParams, }; } //# sourceMappingURL=subscription.d.ts.map