@outseta/react 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/generated/activity/activity.ts +395 -0
- package/src/generated/billing/billing.ts +1333 -0
- package/src/generated/crm/crm.ts +1528 -63
- package/src/generated/email/email.ts +992 -0
- package/src/generated/outsetaAPI.schemas.ts +334 -27
- package/src/generated/support/support.ts +478 -1
- package/src/mutator.ts +32 -11
|
@@ -0,0 +1,1333 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Generated by orval v7.21.0 🍺
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
* Outseta API
|
|
6
|
+
* # Outseta REST API
|
|
7
|
+
|
|
8
|
+
The Outseta REST API enables you to perform a variety of powerful tasks such as creating and updating people, accounts, subscriptions, and invoices. Outseta uses standard HTTP protocols within a compliant architecture that is simple to integrate. You can use the API both on the client or the server side; see the authentication section below for each scenario.
|
|
9
|
+
|
|
10
|
+
**Base URL:** `https://{your-domain}.outseta.com/api/v1/`
|
|
11
|
+
|
|
12
|
+
## API Guidelines
|
|
13
|
+
|
|
14
|
+
1. The API will only respond to secured communication done over **HTTPS**. HTTP requests will be sent a `301` redirect to the corresponding HTTPS resource.
|
|
15
|
+
2. Responses are sent in **JSON** format. In case the API request results in an error, it is represented by an `"error": {}` key in the JSON response.
|
|
16
|
+
3. The request method (verb) determines the nature of the action: **GET** fetches data, **POST** creates new records, **PUT** updates existing records.
|
|
17
|
+
4. The API responds with appropriate **HTTP status codes** for all requests.
|
|
18
|
+
5. Use `donotlog=1` as a query parameter on any API call where you don't want the action to be logged in the activity log.
|
|
19
|
+
|
|
20
|
+
## Authentication
|
|
21
|
+
|
|
22
|
+
All API requests require authentication via one of two methods:
|
|
23
|
+
|
|
24
|
+
### Server-Side (API Keys)
|
|
25
|
+
|
|
26
|
+
Use API keys for server-to-server integrations. Create keys at **Settings > Integrations > API Keys**. Make sure to record the secret key when you create it.
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Authorization: Outseta {api_key}:{api_secret}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Example:**
|
|
33
|
+
```
|
|
34
|
+
Authorization: Outseta ce08fd5a-e1ee-4472-9c5f-b7575d8369b2:74fc1d2242a4eb7336d34b0e40cfbc5f
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
> **Warning:** Never expose API keys in client-side code. The API key and secret combined give full access to all data in your account.
|
|
38
|
+
|
|
39
|
+
### Client-Side (Bearer Token)
|
|
40
|
+
|
|
41
|
+
Do **not** use API keys on the client side — they can be easily copied. Instead, obtain a JWT access token by calling the `POST /tokens` endpoint from the server side with your credentials, then use it on the client:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Authorization: bearer {access_token}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Tokens are JWTs containing claims such as `PersonUid`, `AccountUid`, and subscription details. Tokens expire after approximately one year.
|
|
48
|
+
|
|
49
|
+
Verify tokens server-side using Outseta's [JWKS endpoint](https://{your-domain}.outseta.com/.well-known/jwks.json).
|
|
50
|
+
|
|
51
|
+
## Field Selection
|
|
52
|
+
|
|
53
|
+
When you make an API request, you'll automatically get all the basic information from the main object and its immediate child objects. Referenced objects beyond the first level are returned as `null`.
|
|
54
|
+
|
|
55
|
+
Change this behavior using the `fields` query parameter:
|
|
56
|
+
|
|
57
|
+
- **Go deeper** — Request fields lower down in the object tree: `?fields=CurrentSubscription.Plan.*`
|
|
58
|
+
- **Go lighter** — Request only the essentials for faster performance: `?fields=Uid,Name`
|
|
59
|
+
- **Combination** — `?fields=Uid,Name,CurrentSubscription.Plan.Uid`
|
|
60
|
+
- **Wildcard** — Use `*` to get all fields in an object: `?fields=*` or `?fields=CurrentSubscription.Plan.*`
|
|
61
|
+
|
|
62
|
+
> **Tip:** When expanding nested paths, include `*` and intermediate path segments (e.g., `PersonAccount.*`) to preserve root-level and intermediate fields.
|
|
63
|
+
|
|
64
|
+
**Examples:**
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
# Get the current subscription plan UID for an account
|
|
68
|
+
GET /crm/accounts/{uid}?fields=CurrentSubscription.Plan.Uid
|
|
69
|
+
|
|
70
|
+
# Get the account UID and plan UID for a list of accounts
|
|
71
|
+
GET /crm/accounts?fields=Uid,CurrentSubscription.Plan.Uid
|
|
72
|
+
|
|
73
|
+
# Get the full plan object for an account's current subscription
|
|
74
|
+
GET /crm/accounts/{uid}?fields=CurrentSubscription.Plan.*
|
|
75
|
+
|
|
76
|
+
# Get a person with their account and subscription info
|
|
77
|
+
GET /crm/people/{uid}?fields=Uid,PersonAccount.Account.CurrentSubscription.Plan.Uid
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If your request includes fields from a child object you will be limited to retrieving **25 items** per page. The maximum for requests not expanding child object fields is **100 items**.
|
|
81
|
+
|
|
82
|
+
## Pagination
|
|
83
|
+
|
|
84
|
+
List endpoints return paginated results with a `metadata` object and an `items` array:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"metadata": {
|
|
89
|
+
"limit": 25,
|
|
90
|
+
"offset": 0,
|
|
91
|
+
"total": 142
|
|
92
|
+
},
|
|
93
|
+
"items": [ ... ]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
| Parameter | Type | Default | Description |
|
|
98
|
+
|-----------|------|---------|-------------|
|
|
99
|
+
| `offset` | integer | `0` | Page number (zero-based) |
|
|
100
|
+
| `limit` | integer | `25` | Maximum number of records per page |
|
|
101
|
+
|
|
102
|
+
**Examples:**
|
|
103
|
+
```
|
|
104
|
+
?offset=0&limit=20 # returns results 1-20
|
|
105
|
+
?offset=1&limit=20 # returns results 21-40
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Sorting
|
|
109
|
+
|
|
110
|
+
Sort results using the `orderBy` parameter with a property name and direction:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
?orderBy=PropertyName+DESC
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Filtering
|
|
117
|
+
|
|
118
|
+
Filter results by passing entity properties as query parameters.
|
|
119
|
+
|
|
120
|
+
### Basic Filtering
|
|
121
|
+
|
|
122
|
+
Filter on any field using the field name as a query parameter:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
GET /crm/people?Email=john@example.com
|
|
126
|
+
GET /crm/accounts?AccountStage=2
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Wildcard Matching
|
|
130
|
+
|
|
131
|
+
| Pattern | Match Type | Example |
|
|
132
|
+
|---------|-----------|---------|
|
|
133
|
+
| `*value` | Ends with | `?Email=*@example.com` |
|
|
134
|
+
| `value*` | Starts with | `?Name=Acme*` |
|
|
135
|
+
| `*value*` | Contains | `?Name=*corp*` |
|
|
136
|
+
|
|
137
|
+
### Comparison Operators
|
|
138
|
+
|
|
139
|
+
For advanced filtering, append comparison operators to field names:
|
|
140
|
+
|
|
141
|
+
| Operator | Description | Example |
|
|
142
|
+
|----------|-------------|---------|
|
|
143
|
+
| `__gt` | Greater than | `Created__gt=2024-01-01` |
|
|
144
|
+
| `__gte` | Greater than or equal | `Amount__gte=100` |
|
|
145
|
+
| `__lt` | Less than | `Created__lt=2024-12-31` |
|
|
146
|
+
| `__lte` | Less than or equal | `Amount__lte=500` |
|
|
147
|
+
| `__ne` | Not equal | `Status__ne=Active` |
|
|
148
|
+
| `__isnull` | Is null (true/false) | `ProfileImageS3Url__isnull=true` |
|
|
149
|
+
|
|
150
|
+
**Examples:**
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
# Date filtering
|
|
154
|
+
GET /crm/accounts?Created__gt=2024-01-01
|
|
155
|
+
GET /billing/subscriptions?EndDate__lt=2024-08-01
|
|
156
|
+
|
|
157
|
+
# Numeric filtering
|
|
158
|
+
GET /billing/invoices?Amount__gte=1000
|
|
159
|
+
|
|
160
|
+
# Null value filtering
|
|
161
|
+
GET /crm/people?ProfileImageS3Url__isnull=true
|
|
162
|
+
|
|
163
|
+
# Multiple filters combined with field selection
|
|
164
|
+
GET /billing/subscriptions?StartDate__gte=2024-01-01&Rate__lt=100&DiscountCode__isnull=false&fields=Uid,Amount,StartDate,DiscountCode,Plan.Name
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Account Billing Stages
|
|
168
|
+
|
|
169
|
+
Account stages reflect the financial standing of each account and are not directly editable — they change automatically based on subscription activity.
|
|
170
|
+
|
|
171
|
+
| Value | Stage | Description |
|
|
172
|
+
|-------|-------|-------------|
|
|
173
|
+
| `2` | Trialing | Currently on a free trial or free plan |
|
|
174
|
+
| `3` | Subscribing | Active paid subscription (contributes to MRR) |
|
|
175
|
+
| `4` | Canceling | Customer has indicated intent to cancel |
|
|
176
|
+
| `5` | Expired | Subscription has ended after cancellation |
|
|
177
|
+
| `6` | Trial Expired | Free trial ended without conversion to paid |
|
|
178
|
+
|
|
179
|
+
Filter by stage: `GET /crm/accounts?AccountStage=3` returns all actively subscribing accounts.
|
|
180
|
+
|
|
181
|
+
## Webhooks
|
|
182
|
+
|
|
183
|
+
Use **Activity Notifications** to receive real-time callbacks when events occur in Outseta. Configure webhooks at **Settings > Notifications**.
|
|
184
|
+
|
|
185
|
+
Common events include:
|
|
186
|
+
- `Person Created` / `Person Updated`
|
|
187
|
+
- `Account Created` / `Account Updated`
|
|
188
|
+
- `Subscription Created` / `Subscription Updated`
|
|
189
|
+
|
|
190
|
+
Always verify webhook signatures using the SHA256 secret provided in the Outseta dashboard.
|
|
191
|
+
|
|
192
|
+
## Error Responses
|
|
193
|
+
|
|
194
|
+
| Status Code | Description |
|
|
195
|
+
|-------------|-------------|
|
|
196
|
+
| `200` | Success |
|
|
197
|
+
| `301` | Redirect — HTTP requests are redirected to HTTPS |
|
|
198
|
+
| `400` | Bad request — invalid parameters or Uid format |
|
|
199
|
+
| `401` | Unauthorized — missing or invalid authentication |
|
|
200
|
+
| `404` | Entity not found |
|
|
201
|
+
| `4XX` / `5XX` | Client or server error |
|
|
202
|
+
|
|
203
|
+
Validation errors return a JSON body with `ErrorMessage` and `PropertyName` fields:
|
|
204
|
+
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"ErrorMessage": "Invalid company email",
|
|
208
|
+
"PropertyName": "Email"
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Rate Limits
|
|
213
|
+
|
|
214
|
+
Requests authorized by an API Key should not exceed **4 requests/second**.
|
|
215
|
+
|
|
216
|
+
## Support
|
|
217
|
+
|
|
218
|
+
For help regarding the Outseta API please email [support@outseta.com](mailto:support@outseta.com).
|
|
219
|
+
|
|
220
|
+
* OpenAPI spec version: v1
|
|
221
|
+
*/
|
|
222
|
+
import {
|
|
223
|
+
useMutation,
|
|
224
|
+
useQuery
|
|
225
|
+
} from '@tanstack/react-query';
|
|
226
|
+
import type {
|
|
227
|
+
MutationFunction,
|
|
228
|
+
QueryFunction,
|
|
229
|
+
QueryKey,
|
|
230
|
+
UseMutationOptions,
|
|
231
|
+
UseMutationResult,
|
|
232
|
+
UseQueryOptions,
|
|
233
|
+
UseQueryResult
|
|
234
|
+
} from '@tanstack/react-query';
|
|
235
|
+
|
|
236
|
+
import type {
|
|
237
|
+
DiscountCoupon,
|
|
238
|
+
DiscountCouponAddDiscountCouponBody,
|
|
239
|
+
Invoice,
|
|
240
|
+
InvoiceAddInvoiceBody,
|
|
241
|
+
PaymentInformation,
|
|
242
|
+
PaymentInformationSavePaymentInformationBody,
|
|
243
|
+
Plan,
|
|
244
|
+
PlanFamily,
|
|
245
|
+
Subscription,
|
|
246
|
+
SubscriptionAddOnAddSubscriptionAddOnBody,
|
|
247
|
+
SubscriptionChangeSubscriptionBody,
|
|
248
|
+
SubscriptionChangeSubscriptionParams,
|
|
249
|
+
SubscriptionChangeSubscriptionPreviewBody,
|
|
250
|
+
SubscriptionChangeSubscriptionPreviewParams,
|
|
251
|
+
SubscriptionFirstTimeSubscriptionBody,
|
|
252
|
+
SubscriptionFirstTimeSubscriptionPreviewBody,
|
|
253
|
+
SubscriptionFirstTimeSubscriptionPreviewParams,
|
|
254
|
+
SubscriptionSetSubscriptionUpgradeRequiredBody,
|
|
255
|
+
Transaction,
|
|
256
|
+
TransactionsAddPaymentTransactionBody,
|
|
257
|
+
Usage,
|
|
258
|
+
UsageAddUsageBody
|
|
259
|
+
} from '../outsetaAPI.schemas';
|
|
260
|
+
|
|
261
|
+
import { customFetch } from '../../mutator';
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @summary Add a new discount coupon. Only one of AmountOff or PercentOff should be set.
|
|
270
|
+
Duration values: 1 = Forever, 2 = Once, 3 = Repeating (DurationInMonths must be set).
|
|
271
|
+
*/
|
|
272
|
+
export const discountCouponAddDiscountCoupon = (
|
|
273
|
+
discountCouponAddDiscountCouponBody: DiscountCouponAddDiscountCouponBody,
|
|
274
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
275
|
+
) => {
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
return customFetch<DiscountCoupon>(
|
|
279
|
+
{url: `/api/v1/billing/discountcoupons`, method: 'POST',
|
|
280
|
+
headers: {'Content-Type': 'application/json', },
|
|
281
|
+
data: discountCouponAddDiscountCouponBody, signal
|
|
282
|
+
},
|
|
283
|
+
options);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
export const getDiscountCouponAddDiscountCouponMutationOptions = <TError = void,
|
|
289
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof discountCouponAddDiscountCoupon>>, TError,{data: DiscountCouponAddDiscountCouponBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
290
|
+
): UseMutationOptions<Awaited<ReturnType<typeof discountCouponAddDiscountCoupon>>, TError,{data: DiscountCouponAddDiscountCouponBody}, TContext> => {
|
|
291
|
+
|
|
292
|
+
const mutationKey = ['discountCouponAddDiscountCoupon'];
|
|
293
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
294
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
295
|
+
options
|
|
296
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
297
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof discountCouponAddDiscountCoupon>>, {data: DiscountCouponAddDiscountCouponBody}> = (props) => {
|
|
303
|
+
const {data} = props ?? {};
|
|
304
|
+
|
|
305
|
+
return discountCouponAddDiscountCoupon(data,requestOptions)
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
return { mutationFn, ...mutationOptions }}
|
|
312
|
+
|
|
313
|
+
export type DiscountCouponAddDiscountCouponMutationResult = NonNullable<Awaited<ReturnType<typeof discountCouponAddDiscountCoupon>>>
|
|
314
|
+
export type DiscountCouponAddDiscountCouponMutationBody = DiscountCouponAddDiscountCouponBody
|
|
315
|
+
export type DiscountCouponAddDiscountCouponMutationError = void
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* @summary Add a new discount coupon. Only one of AmountOff or PercentOff should be set.
|
|
319
|
+
Duration values: 1 = Forever, 2 = Once, 3 = Repeating (DurationInMonths must be set).
|
|
320
|
+
*/
|
|
321
|
+
export const useDiscountCouponAddDiscountCoupon = <TError = void,
|
|
322
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof discountCouponAddDiscountCoupon>>, TError,{data: DiscountCouponAddDiscountCouponBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
323
|
+
): UseMutationResult<
|
|
324
|
+
Awaited<ReturnType<typeof discountCouponAddDiscountCoupon>>,
|
|
325
|
+
TError,
|
|
326
|
+
{data: DiscountCouponAddDiscountCouponBody},
|
|
327
|
+
TContext
|
|
328
|
+
> => {
|
|
329
|
+
|
|
330
|
+
const mutationOptions = getDiscountCouponAddDiscountCouponMutationOptions(options);
|
|
331
|
+
|
|
332
|
+
return useMutation(mutationOptions);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* @summary Add a usage entry for an add-on that bills for usage at the end of the month.
|
|
336
|
+
*/
|
|
337
|
+
export const usageAddUsage = (
|
|
338
|
+
usageAddUsageBody: UsageAddUsageBody,
|
|
339
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
340
|
+
) => {
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
return customFetch<Usage>(
|
|
344
|
+
{url: `/api/v1/billing/usage`, method: 'POST',
|
|
345
|
+
headers: {'Content-Type': 'application/json', },
|
|
346
|
+
data: usageAddUsageBody, signal
|
|
347
|
+
},
|
|
348
|
+
options);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
export const getUsageAddUsageMutationOptions = <TError = void,
|
|
354
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof usageAddUsage>>, TError,{data: UsageAddUsageBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
355
|
+
): UseMutationOptions<Awaited<ReturnType<typeof usageAddUsage>>, TError,{data: UsageAddUsageBody}, TContext> => {
|
|
356
|
+
|
|
357
|
+
const mutationKey = ['usageAddUsage'];
|
|
358
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
359
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
360
|
+
options
|
|
361
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
362
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof usageAddUsage>>, {data: UsageAddUsageBody}> = (props) => {
|
|
368
|
+
const {data} = props ?? {};
|
|
369
|
+
|
|
370
|
+
return usageAddUsage(data,requestOptions)
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
return { mutationFn, ...mutationOptions }}
|
|
377
|
+
|
|
378
|
+
export type UsageAddUsageMutationResult = NonNullable<Awaited<ReturnType<typeof usageAddUsage>>>
|
|
379
|
+
export type UsageAddUsageMutationBody = UsageAddUsageBody
|
|
380
|
+
export type UsageAddUsageMutationError = void
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* @summary Add a usage entry for an add-on that bills for usage at the end of the month.
|
|
384
|
+
*/
|
|
385
|
+
export const useUsageAddUsage = <TError = void,
|
|
386
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof usageAddUsage>>, TError,{data: UsageAddUsageBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
387
|
+
): UseMutationResult<
|
|
388
|
+
Awaited<ReturnType<typeof usageAddUsage>>,
|
|
389
|
+
TError,
|
|
390
|
+
{data: UsageAddUsageBody},
|
|
391
|
+
TContext
|
|
392
|
+
> => {
|
|
393
|
+
|
|
394
|
+
const mutationOptions = getUsageAddUsageMutationOptions(options);
|
|
395
|
+
|
|
396
|
+
return useMutation(mutationOptions);
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* @summary Retrieves all transactions for a given account. Transactions are tied to accounts and invoices.
|
|
400
|
+
BillingTransactionType: Invoice = 1, Payment = 2, Credit = 3, Refund = 4, Chargeback = 5.
|
|
401
|
+
*/
|
|
402
|
+
export const transactionsGetAllTransactionsByAccountId = (
|
|
403
|
+
accountUid: string | null,
|
|
404
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
405
|
+
) => {
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
return customFetch<Transaction[]>(
|
|
409
|
+
{url: `/api/v1/billing/transactions/${accountUid}`, method: 'GET', signal
|
|
410
|
+
},
|
|
411
|
+
options);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
export const getTransactionsGetAllTransactionsByAccountIdQueryKey = (accountUid?: string | null,) => {
|
|
418
|
+
return [
|
|
419
|
+
`/api/v1/billing/transactions/${accountUid}`
|
|
420
|
+
] as const;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
export const getTransactionsGetAllTransactionsByAccountIdQueryOptions = <TData = Awaited<ReturnType<typeof transactionsGetAllTransactionsByAccountId>>, TError = void>(accountUid: string | null, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof transactionsGetAllTransactionsByAccountId>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
425
|
+
) => {
|
|
426
|
+
|
|
427
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
428
|
+
|
|
429
|
+
const queryKey = queryOptions?.queryKey ?? getTransactionsGetAllTransactionsByAccountIdQueryKey(accountUid);
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof transactionsGetAllTransactionsByAccountId>>> = ({ signal }) => transactionsGetAllTransactionsByAccountId(accountUid, requestOptions, signal);
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
return { queryKey, queryFn, enabled: !!(accountUid), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof transactionsGetAllTransactionsByAccountId>>, TError, TData> & { queryKey: QueryKey }
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export type TransactionsGetAllTransactionsByAccountIdQueryResult = NonNullable<Awaited<ReturnType<typeof transactionsGetAllTransactionsByAccountId>>>
|
|
443
|
+
export type TransactionsGetAllTransactionsByAccountIdQueryError = void
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* @summary Retrieves all transactions for a given account. Transactions are tied to accounts and invoices.
|
|
448
|
+
BillingTransactionType: Invoice = 1, Payment = 2, Credit = 3, Refund = 4, Chargeback = 5.
|
|
449
|
+
*/
|
|
450
|
+
|
|
451
|
+
export function useTransactionsGetAllTransactionsByAccountId<TData = Awaited<ReturnType<typeof transactionsGetAllTransactionsByAccountId>>, TError = void>(
|
|
452
|
+
accountUid: string | null, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof transactionsGetAllTransactionsByAccountId>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
453
|
+
|
|
454
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
455
|
+
|
|
456
|
+
const queryOptions = getTransactionsGetAllTransactionsByAccountIdQueryOptions(accountUid,options)
|
|
457
|
+
|
|
458
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
459
|
+
|
|
460
|
+
query.queryKey = queryOptions.queryKey ;
|
|
461
|
+
|
|
462
|
+
return query;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* @summary Adds a payment to an invoice. If the amount matches the outstanding amount of the invoice,
|
|
470
|
+
the invoice will be marked as Paid.
|
|
471
|
+
*/
|
|
472
|
+
export const transactionsAddPaymentTransaction = (
|
|
473
|
+
transactionsAddPaymentTransactionBody: TransactionsAddPaymentTransactionBody,
|
|
474
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
475
|
+
) => {
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
return customFetch<Transaction>(
|
|
479
|
+
{url: `/api/v1/billing/transactions/payment`, method: 'POST',
|
|
480
|
+
headers: {'Content-Type': 'application/json', },
|
|
481
|
+
data: transactionsAddPaymentTransactionBody, signal
|
|
482
|
+
},
|
|
483
|
+
options);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
export const getTransactionsAddPaymentTransactionMutationOptions = <TError = void,
|
|
489
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof transactionsAddPaymentTransaction>>, TError,{data: TransactionsAddPaymentTransactionBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
490
|
+
): UseMutationOptions<Awaited<ReturnType<typeof transactionsAddPaymentTransaction>>, TError,{data: TransactionsAddPaymentTransactionBody}, TContext> => {
|
|
491
|
+
|
|
492
|
+
const mutationKey = ['transactionsAddPaymentTransaction'];
|
|
493
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
494
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
495
|
+
options
|
|
496
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
497
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof transactionsAddPaymentTransaction>>, {data: TransactionsAddPaymentTransactionBody}> = (props) => {
|
|
503
|
+
const {data} = props ?? {};
|
|
504
|
+
|
|
505
|
+
return transactionsAddPaymentTransaction(data,requestOptions)
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
return { mutationFn, ...mutationOptions }}
|
|
512
|
+
|
|
513
|
+
export type TransactionsAddPaymentTransactionMutationResult = NonNullable<Awaited<ReturnType<typeof transactionsAddPaymentTransaction>>>
|
|
514
|
+
export type TransactionsAddPaymentTransactionMutationBody = TransactionsAddPaymentTransactionBody
|
|
515
|
+
export type TransactionsAddPaymentTransactionMutationError = void
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* @summary Adds a payment to an invoice. If the amount matches the outstanding amount of the invoice,
|
|
519
|
+
the invoice will be marked as Paid.
|
|
520
|
+
*/
|
|
521
|
+
export const useTransactionsAddPaymentTransaction = <TError = void,
|
|
522
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof transactionsAddPaymentTransaction>>, TError,{data: TransactionsAddPaymentTransactionBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
523
|
+
): UseMutationResult<
|
|
524
|
+
Awaited<ReturnType<typeof transactionsAddPaymentTransaction>>,
|
|
525
|
+
TError,
|
|
526
|
+
{data: TransactionsAddPaymentTransactionBody},
|
|
527
|
+
TContext
|
|
528
|
+
> => {
|
|
529
|
+
|
|
530
|
+
const mutationOptions = getTransactionsAddPaymentTransactionMutationOptions(options);
|
|
531
|
+
|
|
532
|
+
return useMutation(mutationOptions);
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* @summary Update payment information for an account.
|
|
536
|
+
*/
|
|
537
|
+
export const paymentInformationSavePaymentInformation = (
|
|
538
|
+
paymentInformationSavePaymentInformationBody: PaymentInformationSavePaymentInformationBody,
|
|
539
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
540
|
+
) => {
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
return customFetch<PaymentInformation>(
|
|
544
|
+
{url: `/api/v1/billing/paymentinformation`, method: 'POST',
|
|
545
|
+
headers: {'Content-Type': 'application/json', },
|
|
546
|
+
data: paymentInformationSavePaymentInformationBody, signal
|
|
547
|
+
},
|
|
548
|
+
options);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
export const getPaymentInformationSavePaymentInformationMutationOptions = <TError = void,
|
|
554
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof paymentInformationSavePaymentInformation>>, TError,{data: PaymentInformationSavePaymentInformationBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
555
|
+
): UseMutationOptions<Awaited<ReturnType<typeof paymentInformationSavePaymentInformation>>, TError,{data: PaymentInformationSavePaymentInformationBody}, TContext> => {
|
|
556
|
+
|
|
557
|
+
const mutationKey = ['paymentInformationSavePaymentInformation'];
|
|
558
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
559
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
560
|
+
options
|
|
561
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
562
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof paymentInformationSavePaymentInformation>>, {data: PaymentInformationSavePaymentInformationBody}> = (props) => {
|
|
568
|
+
const {data} = props ?? {};
|
|
569
|
+
|
|
570
|
+
return paymentInformationSavePaymentInformation(data,requestOptions)
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
return { mutationFn, ...mutationOptions }}
|
|
577
|
+
|
|
578
|
+
export type PaymentInformationSavePaymentInformationMutationResult = NonNullable<Awaited<ReturnType<typeof paymentInformationSavePaymentInformation>>>
|
|
579
|
+
export type PaymentInformationSavePaymentInformationMutationBody = PaymentInformationSavePaymentInformationBody
|
|
580
|
+
export type PaymentInformationSavePaymentInformationMutationError = void
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* @summary Update payment information for an account.
|
|
584
|
+
*/
|
|
585
|
+
export const usePaymentInformationSavePaymentInformation = <TError = void,
|
|
586
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof paymentInformationSavePaymentInformation>>, TError,{data: PaymentInformationSavePaymentInformationBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
587
|
+
): UseMutationResult<
|
|
588
|
+
Awaited<ReturnType<typeof paymentInformationSavePaymentInformation>>,
|
|
589
|
+
TError,
|
|
590
|
+
{data: PaymentInformationSavePaymentInformationBody},
|
|
591
|
+
TContext
|
|
592
|
+
> => {
|
|
593
|
+
|
|
594
|
+
const mutationOptions = getPaymentInformationSavePaymentInformationMutationOptions(options);
|
|
595
|
+
|
|
596
|
+
return useMutation(mutationOptions);
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* @summary Add an add-on to a subscription.
|
|
600
|
+
*/
|
|
601
|
+
export const subscriptionAddOnAddSubscriptionAddOn = (
|
|
602
|
+
subscriptionAddOnAddSubscriptionAddOnBody: SubscriptionAddOnAddSubscriptionAddOnBody,
|
|
603
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
604
|
+
) => {
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
return customFetch<Blob>(
|
|
608
|
+
{url: `/api/v1/billing/subscriptionaddons`, method: 'POST',
|
|
609
|
+
headers: {'Content-Type': 'application/json', },
|
|
610
|
+
data: subscriptionAddOnAddSubscriptionAddOnBody,
|
|
611
|
+
responseType: 'blob', signal
|
|
612
|
+
},
|
|
613
|
+
options);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
export const getSubscriptionAddOnAddSubscriptionAddOnMutationOptions = <TError = void,
|
|
619
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionAddOnAddSubscriptionAddOn>>, TError,{data: SubscriptionAddOnAddSubscriptionAddOnBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
620
|
+
): UseMutationOptions<Awaited<ReturnType<typeof subscriptionAddOnAddSubscriptionAddOn>>, TError,{data: SubscriptionAddOnAddSubscriptionAddOnBody}, TContext> => {
|
|
621
|
+
|
|
622
|
+
const mutationKey = ['subscriptionAddOnAddSubscriptionAddOn'];
|
|
623
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
624
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
625
|
+
options
|
|
626
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
627
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof subscriptionAddOnAddSubscriptionAddOn>>, {data: SubscriptionAddOnAddSubscriptionAddOnBody}> = (props) => {
|
|
633
|
+
const {data} = props ?? {};
|
|
634
|
+
|
|
635
|
+
return subscriptionAddOnAddSubscriptionAddOn(data,requestOptions)
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
return { mutationFn, ...mutationOptions }}
|
|
642
|
+
|
|
643
|
+
export type SubscriptionAddOnAddSubscriptionAddOnMutationResult = NonNullable<Awaited<ReturnType<typeof subscriptionAddOnAddSubscriptionAddOn>>>
|
|
644
|
+
export type SubscriptionAddOnAddSubscriptionAddOnMutationBody = SubscriptionAddOnAddSubscriptionAddOnBody
|
|
645
|
+
export type SubscriptionAddOnAddSubscriptionAddOnMutationError = void
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* @summary Add an add-on to a subscription.
|
|
649
|
+
*/
|
|
650
|
+
export const useSubscriptionAddOnAddSubscriptionAddOn = <TError = void,
|
|
651
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionAddOnAddSubscriptionAddOn>>, TError,{data: SubscriptionAddOnAddSubscriptionAddOnBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
652
|
+
): UseMutationResult<
|
|
653
|
+
Awaited<ReturnType<typeof subscriptionAddOnAddSubscriptionAddOn>>,
|
|
654
|
+
TError,
|
|
655
|
+
{data: SubscriptionAddOnAddSubscriptionAddOnBody},
|
|
656
|
+
TContext
|
|
657
|
+
> => {
|
|
658
|
+
|
|
659
|
+
const mutationOptions = getSubscriptionAddOnAddSubscriptionAddOnMutationOptions(options);
|
|
660
|
+
|
|
661
|
+
return useMutation(mutationOptions);
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* @summary Create an ad-hoc invoice for a given account.
|
|
665
|
+
*/
|
|
666
|
+
export const invoiceAddInvoice = (
|
|
667
|
+
invoiceAddInvoiceBody: InvoiceAddInvoiceBody,
|
|
668
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
669
|
+
) => {
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
return customFetch<Invoice>(
|
|
673
|
+
{url: `/api/v1/billing/invoices`, method: 'POST',
|
|
674
|
+
headers: {'Content-Type': 'application/json', },
|
|
675
|
+
data: invoiceAddInvoiceBody, signal
|
|
676
|
+
},
|
|
677
|
+
options);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
export const getInvoiceAddInvoiceMutationOptions = <TError = void,
|
|
683
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof invoiceAddInvoice>>, TError,{data: InvoiceAddInvoiceBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
684
|
+
): UseMutationOptions<Awaited<ReturnType<typeof invoiceAddInvoice>>, TError,{data: InvoiceAddInvoiceBody}, TContext> => {
|
|
685
|
+
|
|
686
|
+
const mutationKey = ['invoiceAddInvoice'];
|
|
687
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
688
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
689
|
+
options
|
|
690
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
691
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof invoiceAddInvoice>>, {data: InvoiceAddInvoiceBody}> = (props) => {
|
|
697
|
+
const {data} = props ?? {};
|
|
698
|
+
|
|
699
|
+
return invoiceAddInvoice(data,requestOptions)
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
return { mutationFn, ...mutationOptions }}
|
|
706
|
+
|
|
707
|
+
export type InvoiceAddInvoiceMutationResult = NonNullable<Awaited<ReturnType<typeof invoiceAddInvoice>>>
|
|
708
|
+
export type InvoiceAddInvoiceMutationBody = InvoiceAddInvoiceBody
|
|
709
|
+
export type InvoiceAddInvoiceMutationError = void
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* @summary Create an ad-hoc invoice for a given account.
|
|
713
|
+
*/
|
|
714
|
+
export const useInvoiceAddInvoice = <TError = void,
|
|
715
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof invoiceAddInvoice>>, TError,{data: InvoiceAddInvoiceBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
716
|
+
): UseMutationResult<
|
|
717
|
+
Awaited<ReturnType<typeof invoiceAddInvoice>>,
|
|
718
|
+
TError,
|
|
719
|
+
{data: InvoiceAddInvoiceBody},
|
|
720
|
+
TContext
|
|
721
|
+
> => {
|
|
722
|
+
|
|
723
|
+
const mutationOptions = getInvoiceAddInvoiceMutationOptions(options);
|
|
724
|
+
|
|
725
|
+
return useMutation(mutationOptions);
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* @summary Retrieves a subscription.
|
|
729
|
+
*/
|
|
730
|
+
export const subscriptionGetSubscription = (
|
|
731
|
+
subscriptionUid: string | null,
|
|
732
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
733
|
+
) => {
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
return customFetch<Subscription>(
|
|
737
|
+
{url: `/api/v1/billing/subscriptions/${subscriptionUid}`, method: 'GET', signal
|
|
738
|
+
},
|
|
739
|
+
options);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
export const getSubscriptionGetSubscriptionQueryKey = (subscriptionUid?: string | null,) => {
|
|
746
|
+
return [
|
|
747
|
+
`/api/v1/billing/subscriptions/${subscriptionUid}`
|
|
748
|
+
] as const;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
export const getSubscriptionGetSubscriptionQueryOptions = <TData = Awaited<ReturnType<typeof subscriptionGetSubscription>>, TError = void>(subscriptionUid: string | null, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof subscriptionGetSubscription>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
753
|
+
) => {
|
|
754
|
+
|
|
755
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
756
|
+
|
|
757
|
+
const queryKey = queryOptions?.queryKey ?? getSubscriptionGetSubscriptionQueryKey(subscriptionUid);
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof subscriptionGetSubscription>>> = ({ signal }) => subscriptionGetSubscription(subscriptionUid, requestOptions, signal);
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
return { queryKey, queryFn, enabled: !!(subscriptionUid), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof subscriptionGetSubscription>>, TError, TData> & { queryKey: QueryKey }
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export type SubscriptionGetSubscriptionQueryResult = NonNullable<Awaited<ReturnType<typeof subscriptionGetSubscription>>>
|
|
771
|
+
export type SubscriptionGetSubscriptionQueryError = void
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* @summary Retrieves a subscription.
|
|
776
|
+
*/
|
|
777
|
+
|
|
778
|
+
export function useSubscriptionGetSubscription<TData = Awaited<ReturnType<typeof subscriptionGetSubscription>>, TError = void>(
|
|
779
|
+
subscriptionUid: string | null, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof subscriptionGetSubscription>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
780
|
+
|
|
781
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
782
|
+
|
|
783
|
+
const queryOptions = getSubscriptionGetSubscriptionQueryOptions(subscriptionUid,options)
|
|
784
|
+
|
|
785
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
786
|
+
|
|
787
|
+
query.queryKey = queryOptions.queryKey ;
|
|
788
|
+
|
|
789
|
+
return query;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* @summary Add a discount to a subscription.
|
|
797
|
+
*/
|
|
798
|
+
export const subscriptionAddDiscountToSubscription = (
|
|
799
|
+
subscriptionUid: string | null,
|
|
800
|
+
discountUid: string | null,
|
|
801
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
802
|
+
) => {
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
return customFetch<Blob>(
|
|
806
|
+
{url: `/api/v1/billing/subscriptions/${subscriptionUid}/discounts/${discountUid}`, method: 'POST',
|
|
807
|
+
responseType: 'blob', signal
|
|
808
|
+
},
|
|
809
|
+
options);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
export const getSubscriptionAddDiscountToSubscriptionMutationOptions = <TError = void,
|
|
815
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionAddDiscountToSubscription>>, TError,{subscriptionUid: string | null;discountUid: string | null}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
816
|
+
): UseMutationOptions<Awaited<ReturnType<typeof subscriptionAddDiscountToSubscription>>, TError,{subscriptionUid: string | null;discountUid: string | null}, TContext> => {
|
|
817
|
+
|
|
818
|
+
const mutationKey = ['subscriptionAddDiscountToSubscription'];
|
|
819
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
820
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
821
|
+
options
|
|
822
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
823
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof subscriptionAddDiscountToSubscription>>, {subscriptionUid: string | null;discountUid: string | null}> = (props) => {
|
|
829
|
+
const {subscriptionUid,discountUid} = props ?? {};
|
|
830
|
+
|
|
831
|
+
return subscriptionAddDiscountToSubscription(subscriptionUid,discountUid,requestOptions)
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
return { mutationFn, ...mutationOptions }}
|
|
838
|
+
|
|
839
|
+
export type SubscriptionAddDiscountToSubscriptionMutationResult = NonNullable<Awaited<ReturnType<typeof subscriptionAddDiscountToSubscription>>>
|
|
840
|
+
|
|
841
|
+
export type SubscriptionAddDiscountToSubscriptionMutationError = void
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* @summary Add a discount to a subscription.
|
|
845
|
+
*/
|
|
846
|
+
export const useSubscriptionAddDiscountToSubscription = <TError = void,
|
|
847
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionAddDiscountToSubscription>>, TError,{subscriptionUid: string | null;discountUid: string | null}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
848
|
+
): UseMutationResult<
|
|
849
|
+
Awaited<ReturnType<typeof subscriptionAddDiscountToSubscription>>,
|
|
850
|
+
TError,
|
|
851
|
+
{subscriptionUid: string | null;discountUid: string | null},
|
|
852
|
+
TContext
|
|
853
|
+
> => {
|
|
854
|
+
|
|
855
|
+
const mutationOptions = getSubscriptionAddDiscountToSubscriptionMutationOptions(options);
|
|
856
|
+
|
|
857
|
+
return useMutation(mutationOptions);
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* @summary Indicate that an upgrade of plan is required. When a subscription is flagged, next time
|
|
861
|
+
the user authenticates the authentication widget will prompt the user to change plan.
|
|
862
|
+
*/
|
|
863
|
+
export const subscriptionSetSubscriptionUpgradeRequired = (
|
|
864
|
+
subscriptionUid: string | null,
|
|
865
|
+
subscriptionSetSubscriptionUpgradeRequiredBody: SubscriptionSetSubscriptionUpgradeRequiredBody,
|
|
866
|
+
options?: SecondParameter<typeof customFetch>,) => {
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
return customFetch<Subscription>(
|
|
870
|
+
{url: `/api/v1/billing/subscriptions/${subscriptionUid}/setsubscriptionupgraderequired`, method: 'PUT',
|
|
871
|
+
headers: {'Content-Type': 'application/json', },
|
|
872
|
+
data: subscriptionSetSubscriptionUpgradeRequiredBody
|
|
873
|
+
},
|
|
874
|
+
options);
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
export const getSubscriptionSetSubscriptionUpgradeRequiredMutationOptions = <TError = void,
|
|
880
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionSetSubscriptionUpgradeRequired>>, TError,{subscriptionUid: string | null;data: SubscriptionSetSubscriptionUpgradeRequiredBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
881
|
+
): UseMutationOptions<Awaited<ReturnType<typeof subscriptionSetSubscriptionUpgradeRequired>>, TError,{subscriptionUid: string | null;data: SubscriptionSetSubscriptionUpgradeRequiredBody}, TContext> => {
|
|
882
|
+
|
|
883
|
+
const mutationKey = ['subscriptionSetSubscriptionUpgradeRequired'];
|
|
884
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
885
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
886
|
+
options
|
|
887
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
888
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof subscriptionSetSubscriptionUpgradeRequired>>, {subscriptionUid: string | null;data: SubscriptionSetSubscriptionUpgradeRequiredBody}> = (props) => {
|
|
894
|
+
const {subscriptionUid,data} = props ?? {};
|
|
895
|
+
|
|
896
|
+
return subscriptionSetSubscriptionUpgradeRequired(subscriptionUid,data,requestOptions)
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
return { mutationFn, ...mutationOptions }}
|
|
903
|
+
|
|
904
|
+
export type SubscriptionSetSubscriptionUpgradeRequiredMutationResult = NonNullable<Awaited<ReturnType<typeof subscriptionSetSubscriptionUpgradeRequired>>>
|
|
905
|
+
export type SubscriptionSetSubscriptionUpgradeRequiredMutationBody = SubscriptionSetSubscriptionUpgradeRequiredBody
|
|
906
|
+
export type SubscriptionSetSubscriptionUpgradeRequiredMutationError = void
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* @summary Indicate that an upgrade of plan is required. When a subscription is flagged, next time
|
|
910
|
+
the user authenticates the authentication widget will prompt the user to change plan.
|
|
911
|
+
*/
|
|
912
|
+
export const useSubscriptionSetSubscriptionUpgradeRequired = <TError = void,
|
|
913
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionSetSubscriptionUpgradeRequired>>, TError,{subscriptionUid: string | null;data: SubscriptionSetSubscriptionUpgradeRequiredBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
914
|
+
): UseMutationResult<
|
|
915
|
+
Awaited<ReturnType<typeof subscriptionSetSubscriptionUpgradeRequired>>,
|
|
916
|
+
TError,
|
|
917
|
+
{subscriptionUid: string | null;data: SubscriptionSetSubscriptionUpgradeRequiredBody},
|
|
918
|
+
TContext
|
|
919
|
+
> => {
|
|
920
|
+
|
|
921
|
+
const mutationOptions = getSubscriptionSetSubscriptionUpgradeRequiredMutationOptions(options);
|
|
922
|
+
|
|
923
|
+
return useMutation(mutationOptions);
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* @summary Preview what the initial or renewal invoice would look like if an account were to register
|
|
927
|
+
with this subscription. Returns an invoice object with information about the amount outstanding.
|
|
928
|
+
BillingRenewalTerm values: 1 = Monthly, 2 = Yearly, 3 = Quarterly, 4 = OneTime.
|
|
929
|
+
Pass asOf=renewal to see the renewal invoice instead of the initial invoice.
|
|
930
|
+
*/
|
|
931
|
+
export const subscriptionFirstTimeSubscriptionPreview = (
|
|
932
|
+
subscriptionFirstTimeSubscriptionPreviewBody: SubscriptionFirstTimeSubscriptionPreviewBody,
|
|
933
|
+
params?: SubscriptionFirstTimeSubscriptionPreviewParams,
|
|
934
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
935
|
+
) => {
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
return customFetch<Invoice>(
|
|
939
|
+
{url: `/api/v1/billing/subscriptions/compute-charge-summary`, method: 'POST',
|
|
940
|
+
headers: {'Content-Type': 'application/json', },
|
|
941
|
+
data: subscriptionFirstTimeSubscriptionPreviewBody,
|
|
942
|
+
params, signal
|
|
943
|
+
},
|
|
944
|
+
options);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
export const getSubscriptionFirstTimeSubscriptionPreviewMutationOptions = <TError = unknown,
|
|
950
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionFirstTimeSubscriptionPreview>>, TError,{data: SubscriptionFirstTimeSubscriptionPreviewBody;params?: SubscriptionFirstTimeSubscriptionPreviewParams}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
951
|
+
): UseMutationOptions<Awaited<ReturnType<typeof subscriptionFirstTimeSubscriptionPreview>>, TError,{data: SubscriptionFirstTimeSubscriptionPreviewBody;params?: SubscriptionFirstTimeSubscriptionPreviewParams}, TContext> => {
|
|
952
|
+
|
|
953
|
+
const mutationKey = ['subscriptionFirstTimeSubscriptionPreview'];
|
|
954
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
955
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
956
|
+
options
|
|
957
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
958
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof subscriptionFirstTimeSubscriptionPreview>>, {data: SubscriptionFirstTimeSubscriptionPreviewBody;params?: SubscriptionFirstTimeSubscriptionPreviewParams}> = (props) => {
|
|
964
|
+
const {data,params} = props ?? {};
|
|
965
|
+
|
|
966
|
+
return subscriptionFirstTimeSubscriptionPreview(data,params,requestOptions)
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
return { mutationFn, ...mutationOptions }}
|
|
973
|
+
|
|
974
|
+
export type SubscriptionFirstTimeSubscriptionPreviewMutationResult = NonNullable<Awaited<ReturnType<typeof subscriptionFirstTimeSubscriptionPreview>>>
|
|
975
|
+
export type SubscriptionFirstTimeSubscriptionPreviewMutationBody = SubscriptionFirstTimeSubscriptionPreviewBody
|
|
976
|
+
export type SubscriptionFirstTimeSubscriptionPreviewMutationError = unknown
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* @summary Preview what the initial or renewal invoice would look like if an account were to register
|
|
980
|
+
with this subscription. Returns an invoice object with information about the amount outstanding.
|
|
981
|
+
BillingRenewalTerm values: 1 = Monthly, 2 = Yearly, 3 = Quarterly, 4 = OneTime.
|
|
982
|
+
Pass asOf=renewal to see the renewal invoice instead of the initial invoice.
|
|
983
|
+
*/
|
|
984
|
+
export const useSubscriptionFirstTimeSubscriptionPreview = <TError = unknown,
|
|
985
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionFirstTimeSubscriptionPreview>>, TError,{data: SubscriptionFirstTimeSubscriptionPreviewBody;params?: SubscriptionFirstTimeSubscriptionPreviewParams}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
986
|
+
): UseMutationResult<
|
|
987
|
+
Awaited<ReturnType<typeof subscriptionFirstTimeSubscriptionPreview>>,
|
|
988
|
+
TError,
|
|
989
|
+
{data: SubscriptionFirstTimeSubscriptionPreviewBody;params?: SubscriptionFirstTimeSubscriptionPreviewParams},
|
|
990
|
+
TContext
|
|
991
|
+
> => {
|
|
992
|
+
|
|
993
|
+
const mutationOptions = getSubscriptionFirstTimeSubscriptionPreviewMutationOptions(options);
|
|
994
|
+
|
|
995
|
+
return useMutation(mutationOptions);
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* @summary Add a subscription to an account for the first time. Returns an invoice object
|
|
999
|
+
with information about the amount outstanding.
|
|
1000
|
+
*/
|
|
1001
|
+
export const subscriptionFirstTimeSubscription = (
|
|
1002
|
+
subscriptionFirstTimeSubscriptionBody: SubscriptionFirstTimeSubscriptionBody,
|
|
1003
|
+
options?: SecondParameter<typeof customFetch>,) => {
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
return customFetch<Invoice>(
|
|
1007
|
+
{url: `/api/v1/billing/subscriptions/firsttimesubscription`, method: 'PUT',
|
|
1008
|
+
headers: {'Content-Type': 'application/json', },
|
|
1009
|
+
data: subscriptionFirstTimeSubscriptionBody
|
|
1010
|
+
},
|
|
1011
|
+
options);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
|
|
1015
|
+
|
|
1016
|
+
export const getSubscriptionFirstTimeSubscriptionMutationOptions = <TError = void,
|
|
1017
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionFirstTimeSubscription>>, TError,{data: SubscriptionFirstTimeSubscriptionBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
1018
|
+
): UseMutationOptions<Awaited<ReturnType<typeof subscriptionFirstTimeSubscription>>, TError,{data: SubscriptionFirstTimeSubscriptionBody}, TContext> => {
|
|
1019
|
+
|
|
1020
|
+
const mutationKey = ['subscriptionFirstTimeSubscription'];
|
|
1021
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
1022
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
1023
|
+
options
|
|
1024
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
1025
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof subscriptionFirstTimeSubscription>>, {data: SubscriptionFirstTimeSubscriptionBody}> = (props) => {
|
|
1031
|
+
const {data} = props ?? {};
|
|
1032
|
+
|
|
1033
|
+
return subscriptionFirstTimeSubscription(data,requestOptions)
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
return { mutationFn, ...mutationOptions }}
|
|
1040
|
+
|
|
1041
|
+
export type SubscriptionFirstTimeSubscriptionMutationResult = NonNullable<Awaited<ReturnType<typeof subscriptionFirstTimeSubscription>>>
|
|
1042
|
+
export type SubscriptionFirstTimeSubscriptionMutationBody = SubscriptionFirstTimeSubscriptionBody
|
|
1043
|
+
export type SubscriptionFirstTimeSubscriptionMutationError = void
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* @summary Add a subscription to an account for the first time. Returns an invoice object
|
|
1047
|
+
with information about the amount outstanding.
|
|
1048
|
+
*/
|
|
1049
|
+
export const useSubscriptionFirstTimeSubscription = <TError = void,
|
|
1050
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionFirstTimeSubscription>>, TError,{data: SubscriptionFirstTimeSubscriptionBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
1051
|
+
): UseMutationResult<
|
|
1052
|
+
Awaited<ReturnType<typeof subscriptionFirstTimeSubscription>>,
|
|
1053
|
+
TError,
|
|
1054
|
+
{data: SubscriptionFirstTimeSubscriptionBody},
|
|
1055
|
+
TContext
|
|
1056
|
+
> => {
|
|
1057
|
+
|
|
1058
|
+
const mutationOptions = getSubscriptionFirstTimeSubscriptionMutationOptions(options);
|
|
1059
|
+
|
|
1060
|
+
return useMutation(mutationOptions);
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* @summary Preview what the invoice would look like when changing a subscription. Returns an invoice object
|
|
1064
|
+
with information about the amount outstanding. This method does not commit the subscription change.
|
|
1065
|
+
*/
|
|
1066
|
+
export const subscriptionChangeSubscriptionPreview = (
|
|
1067
|
+
subscriptionUid: string | null,
|
|
1068
|
+
subscriptionChangeSubscriptionPreviewBody: SubscriptionChangeSubscriptionPreviewBody,
|
|
1069
|
+
params?: SubscriptionChangeSubscriptionPreviewParams,
|
|
1070
|
+
options?: SecondParameter<typeof customFetch>,) => {
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
return customFetch<Invoice>(
|
|
1074
|
+
{url: `/api/v1/billing/subscriptions/${subscriptionUid}/changesubscriptionpreview`, method: 'PUT',
|
|
1075
|
+
headers: {'Content-Type': 'application/json', },
|
|
1076
|
+
data: subscriptionChangeSubscriptionPreviewBody,
|
|
1077
|
+
params
|
|
1078
|
+
},
|
|
1079
|
+
options);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
export const getSubscriptionChangeSubscriptionPreviewMutationOptions = <TError = void,
|
|
1085
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionChangeSubscriptionPreview>>, TError,{subscriptionUid: string | null;data: SubscriptionChangeSubscriptionPreviewBody;params?: SubscriptionChangeSubscriptionPreviewParams}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
1086
|
+
): UseMutationOptions<Awaited<ReturnType<typeof subscriptionChangeSubscriptionPreview>>, TError,{subscriptionUid: string | null;data: SubscriptionChangeSubscriptionPreviewBody;params?: SubscriptionChangeSubscriptionPreviewParams}, TContext> => {
|
|
1087
|
+
|
|
1088
|
+
const mutationKey = ['subscriptionChangeSubscriptionPreview'];
|
|
1089
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
1090
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
1091
|
+
options
|
|
1092
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
1093
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof subscriptionChangeSubscriptionPreview>>, {subscriptionUid: string | null;data: SubscriptionChangeSubscriptionPreviewBody;params?: SubscriptionChangeSubscriptionPreviewParams}> = (props) => {
|
|
1099
|
+
const {subscriptionUid,data,params} = props ?? {};
|
|
1100
|
+
|
|
1101
|
+
return subscriptionChangeSubscriptionPreview(subscriptionUid,data,params,requestOptions)
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
return { mutationFn, ...mutationOptions }}
|
|
1108
|
+
|
|
1109
|
+
export type SubscriptionChangeSubscriptionPreviewMutationResult = NonNullable<Awaited<ReturnType<typeof subscriptionChangeSubscriptionPreview>>>
|
|
1110
|
+
export type SubscriptionChangeSubscriptionPreviewMutationBody = SubscriptionChangeSubscriptionPreviewBody
|
|
1111
|
+
export type SubscriptionChangeSubscriptionPreviewMutationError = void
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* @summary Preview what the invoice would look like when changing a subscription. Returns an invoice object
|
|
1115
|
+
with information about the amount outstanding. This method does not commit the subscription change.
|
|
1116
|
+
*/
|
|
1117
|
+
export const useSubscriptionChangeSubscriptionPreview = <TError = void,
|
|
1118
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionChangeSubscriptionPreview>>, TError,{subscriptionUid: string | null;data: SubscriptionChangeSubscriptionPreviewBody;params?: SubscriptionChangeSubscriptionPreviewParams}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
1119
|
+
): UseMutationResult<
|
|
1120
|
+
Awaited<ReturnType<typeof subscriptionChangeSubscriptionPreview>>,
|
|
1121
|
+
TError,
|
|
1122
|
+
{subscriptionUid: string | null;data: SubscriptionChangeSubscriptionPreviewBody;params?: SubscriptionChangeSubscriptionPreviewParams},
|
|
1123
|
+
TContext
|
|
1124
|
+
> => {
|
|
1125
|
+
|
|
1126
|
+
const mutationOptions = getSubscriptionChangeSubscriptionPreviewMutationOptions(options);
|
|
1127
|
+
|
|
1128
|
+
return useMutation(mutationOptions);
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* @summary Change a subscription on an account. Returns an invoice object with information about
|
|
1132
|
+
the amount outstanding.
|
|
1133
|
+
*/
|
|
1134
|
+
export const subscriptionChangeSubscription = (
|
|
1135
|
+
subscriptionUid: string | null,
|
|
1136
|
+
subscriptionChangeSubscriptionBody: SubscriptionChangeSubscriptionBody,
|
|
1137
|
+
params?: SubscriptionChangeSubscriptionParams,
|
|
1138
|
+
options?: SecondParameter<typeof customFetch>,) => {
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
return customFetch<Subscription>(
|
|
1142
|
+
{url: `/api/v1/billing/subscriptions/${subscriptionUid}/changesubscription`, method: 'PUT',
|
|
1143
|
+
headers: {'Content-Type': 'application/json', },
|
|
1144
|
+
data: subscriptionChangeSubscriptionBody,
|
|
1145
|
+
params
|
|
1146
|
+
},
|
|
1147
|
+
options);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
export const getSubscriptionChangeSubscriptionMutationOptions = <TError = void,
|
|
1153
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionChangeSubscription>>, TError,{subscriptionUid: string | null;data: SubscriptionChangeSubscriptionBody;params?: SubscriptionChangeSubscriptionParams}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
1154
|
+
): UseMutationOptions<Awaited<ReturnType<typeof subscriptionChangeSubscription>>, TError,{subscriptionUid: string | null;data: SubscriptionChangeSubscriptionBody;params?: SubscriptionChangeSubscriptionParams}, TContext> => {
|
|
1155
|
+
|
|
1156
|
+
const mutationKey = ['subscriptionChangeSubscription'];
|
|
1157
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
1158
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
1159
|
+
options
|
|
1160
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
1161
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof subscriptionChangeSubscription>>, {subscriptionUid: string | null;data: SubscriptionChangeSubscriptionBody;params?: SubscriptionChangeSubscriptionParams}> = (props) => {
|
|
1167
|
+
const {subscriptionUid,data,params} = props ?? {};
|
|
1168
|
+
|
|
1169
|
+
return subscriptionChangeSubscription(subscriptionUid,data,params,requestOptions)
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
return { mutationFn, ...mutationOptions }}
|
|
1176
|
+
|
|
1177
|
+
export type SubscriptionChangeSubscriptionMutationResult = NonNullable<Awaited<ReturnType<typeof subscriptionChangeSubscription>>>
|
|
1178
|
+
export type SubscriptionChangeSubscriptionMutationBody = SubscriptionChangeSubscriptionBody
|
|
1179
|
+
export type SubscriptionChangeSubscriptionMutationError = void
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* @summary Change a subscription on an account. Returns an invoice object with information about
|
|
1183
|
+
the amount outstanding.
|
|
1184
|
+
*/
|
|
1185
|
+
export const useSubscriptionChangeSubscription = <TError = void,
|
|
1186
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof subscriptionChangeSubscription>>, TError,{subscriptionUid: string | null;data: SubscriptionChangeSubscriptionBody;params?: SubscriptionChangeSubscriptionParams}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
1187
|
+
): UseMutationResult<
|
|
1188
|
+
Awaited<ReturnType<typeof subscriptionChangeSubscription>>,
|
|
1189
|
+
TError,
|
|
1190
|
+
{subscriptionUid: string | null;data: SubscriptionChangeSubscriptionBody;params?: SubscriptionChangeSubscriptionParams},
|
|
1191
|
+
TContext
|
|
1192
|
+
> => {
|
|
1193
|
+
|
|
1194
|
+
const mutationOptions = getSubscriptionChangeSubscriptionMutationOptions(options);
|
|
1195
|
+
|
|
1196
|
+
return useMutation(mutationOptions);
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* @summary Retrieves all plans.
|
|
1200
|
+
*/
|
|
1201
|
+
export const planGetAllPlans = (
|
|
1202
|
+
|
|
1203
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
1204
|
+
) => {
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
return customFetch<Plan[]>(
|
|
1208
|
+
{url: `/api/v1/billing/plans`, method: 'GET', signal
|
|
1209
|
+
},
|
|
1210
|
+
options);
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
export const getPlanGetAllPlansQueryKey = () => {
|
|
1217
|
+
return [
|
|
1218
|
+
`/api/v1/billing/plans`
|
|
1219
|
+
] as const;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
export const getPlanGetAllPlansQueryOptions = <TData = Awaited<ReturnType<typeof planGetAllPlans>>, TError = unknown>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof planGetAllPlans>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
1224
|
+
) => {
|
|
1225
|
+
|
|
1226
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
1227
|
+
|
|
1228
|
+
const queryKey = queryOptions?.queryKey ?? getPlanGetAllPlansQueryKey();
|
|
1229
|
+
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof planGetAllPlans>>> = ({ signal }) => planGetAllPlans(requestOptions, signal);
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof planGetAllPlans>>, TError, TData> & { queryKey: QueryKey }
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
export type PlanGetAllPlansQueryResult = NonNullable<Awaited<ReturnType<typeof planGetAllPlans>>>
|
|
1242
|
+
export type PlanGetAllPlansQueryError = unknown
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* @summary Retrieves all plans.
|
|
1247
|
+
*/
|
|
1248
|
+
|
|
1249
|
+
export function usePlanGetAllPlans<TData = Awaited<ReturnType<typeof planGetAllPlans>>, TError = unknown>(
|
|
1250
|
+
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof planGetAllPlans>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
1251
|
+
|
|
1252
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
1253
|
+
|
|
1254
|
+
const queryOptions = getPlanGetAllPlansQueryOptions(options)
|
|
1255
|
+
|
|
1256
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
1257
|
+
|
|
1258
|
+
query.queryKey = queryOptions.queryKey ;
|
|
1259
|
+
|
|
1260
|
+
return query;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* @summary Retrieves all plan families.
|
|
1268
|
+
*/
|
|
1269
|
+
export const planFamilyGetAllPlanFamilies = (
|
|
1270
|
+
|
|
1271
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
1272
|
+
) => {
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
return customFetch<PlanFamily[]>(
|
|
1276
|
+
{url: `/api/v1/billing/planfamilies`, method: 'GET', signal
|
|
1277
|
+
},
|
|
1278
|
+
options);
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
|
|
1284
|
+
export const getPlanFamilyGetAllPlanFamiliesQueryKey = () => {
|
|
1285
|
+
return [
|
|
1286
|
+
`/api/v1/billing/planfamilies`
|
|
1287
|
+
] as const;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
export const getPlanFamilyGetAllPlanFamiliesQueryOptions = <TData = Awaited<ReturnType<typeof planFamilyGetAllPlanFamilies>>, TError = unknown>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof planFamilyGetAllPlanFamilies>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
1292
|
+
) => {
|
|
1293
|
+
|
|
1294
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
1295
|
+
|
|
1296
|
+
const queryKey = queryOptions?.queryKey ?? getPlanFamilyGetAllPlanFamiliesQueryKey();
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof planFamilyGetAllPlanFamilies>>> = ({ signal }) => planFamilyGetAllPlanFamilies(requestOptions, signal);
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
|
|
1305
|
+
|
|
1306
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof planFamilyGetAllPlanFamilies>>, TError, TData> & { queryKey: QueryKey }
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
export type PlanFamilyGetAllPlanFamiliesQueryResult = NonNullable<Awaited<ReturnType<typeof planFamilyGetAllPlanFamilies>>>
|
|
1310
|
+
export type PlanFamilyGetAllPlanFamiliesQueryError = unknown
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
/**
|
|
1314
|
+
* @summary Retrieves all plan families.
|
|
1315
|
+
*/
|
|
1316
|
+
|
|
1317
|
+
export function usePlanFamilyGetAllPlanFamilies<TData = Awaited<ReturnType<typeof planFamilyGetAllPlanFamilies>>, TError = unknown>(
|
|
1318
|
+
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof planFamilyGetAllPlanFamilies>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
1319
|
+
|
|
1320
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
1321
|
+
|
|
1322
|
+
const queryOptions = getPlanFamilyGetAllPlanFamiliesQueryOptions(options)
|
|
1323
|
+
|
|
1324
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
1325
|
+
|
|
1326
|
+
query.queryKey = queryOptions.queryKey ;
|
|
1327
|
+
|
|
1328
|
+
return query;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
|