Interface: UseSubscription
react-autonomy.UseSubscription
UseSubscription contains all the data and methods returned by the useSubscription hook.
• cancelSubscription: (options?: CancelSubscription) => Promise<Subscription>
▸ (options?): Promise<Subscription>
The cancelSubscription function calls the Chord API to cancel the subscription.
Name | Type |
---|---|
options? |
Promise<Subscription>
• error: Error
• isFetching: boolean
• isLoaded: boolean
• loadSubscription: () => Promise<Subscription>
▸ (): Promise<Subscription>
The loadSubscription function loads information about the subscription from the Chord API.
You shouldn't need to call this function, except in exceptional circumstances, as the useSubscription hook will automatically start loading the subscription when the hook is initialized.
Here's an example of when you might want to use loadSubscription in a custom callback. It should be noted that skipSubscription returns the updated subscription, but in this example, assume that it doesn't for educational purposes.
Promise<Subscription>
• pauseSubscription: (options: PauseSubscription) => Promise<Subscription>
▸ (options): Promise<Subscription>
The pauseSubscription function calls the Chord API to pause a subscription.
Name | Type |
---|---|
options |
Promise<Subscription>
• resumeSubscription: (options: ResumeSubscription) => Promise<Subscription>
▸ (options): Promise<Subscription>
The resumeSubscription function calls the Chord API to resume a subscription.
Paused subscriptions will not be processed until manually resumed or the actionableDate is reached.
Name | Type |
---|---|
options |
Promise<Subscription>
• skipSubscription: (options?: SkipSubscription) => Promise<Subscription>
▸ (options?): Promise<Subscription>
The skipSubscription function calls the Chord API to skip the next subscription delivery.
Name | Type |
---|---|
options? |
Promise<Subscription>
• subscription: Subscription
• updateSubscription: (options: SubscriptionUpdateProps) => Promise<Subscription>
▸ (options): Promise<Subscription>
The updateSubscription function calls the Chord API to update a subscription.
Name | Type |
---|---|
options |
Promise<Subscription>