Interfaces

Interface: UseSubscription

react-autonomy.UseSubscription

UseSubscription contains all the data and methods returned by the useSubscription hook.

Properties

cancelSubscription

cancelSubscription: (options?: CancelSubscription) => Promise<Subscription>

Type declaration

▸ (options?): Promise<Subscription>

The cancelSubscription function calls the Chord API to cancel the subscription.



JS


Parameters

Name

Type

options?

Returns

Promise<Subscription>

Defined in



error

error: Error

Defined in



isFetching

isFetching: boolean

Defined in



isLoaded

isLoaded: boolean

Defined in



loadSubscription

loadSubscription: () => Promise<Subscription>

Type declaration

▸ (): 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.

JS


Returns

Promise<Subscription>

Defined in



pauseSubscription

pauseSubscription: (options: PauseSubscription) => Promise<Subscription>

Type declaration

▸ (options): Promise<Subscription>

The pauseSubscription function calls the Chord API to pause a subscription.



JS


Parameters

Name

Type

options

Returns

Promise<Subscription>

Defined in



resumeSubscription

resumeSubscription: (options: ResumeSubscription) => Promise<Subscription>

Type declaration

▸ (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.



JS


Parameters

Name

Type

options

Returns

Promise<Subscription>

Defined in



skipSubscription

skipSubscription: (options?: SkipSubscription) => Promise<Subscription>

Type declaration

▸ (options?): Promise<Subscription>

The skipSubscription function calls the Chord API to skip the next subscription delivery.



JS


Parameters

Name

Type

options?

Returns

Promise<Subscription>

Defined in



subscription

subscription: Subscription

Defined in



updateSubscription

updateSubscription: (options: SubscriptionUpdateProps) => Promise<Subscription>

Type declaration

▸ (options): Promise<Subscription>

The updateSubscription function calls the Chord API to update a subscription.



JS


Parameters

Name

Type

options

Returns

Promise<Subscription>

Defined in