@vansite/ts-sharetribe-flex-sdk 1.0.34 → 3.0.0
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/README.md +1 -1
- package/dist/endpoints/assets/index.d.ts +47 -0
- package/dist/endpoints/auth/index.d.ts +45 -0
- package/dist/endpoints/integrationApi/AvailabilityExceptions.d.ts +66 -0
- package/dist/endpoints/integrationApi/Events.d.ts +43 -0
- package/dist/endpoints/integrationApi/Images.d.ts +36 -0
- package/dist/endpoints/integrationApi/Listings.d.ts +87 -0
- package/dist/endpoints/integrationApi/Marketplace.d.ts +30 -0
- package/dist/endpoints/integrationApi/Stock.d.ts +42 -0
- package/dist/endpoints/integrationApi/StockAdjustments.d.ts +64 -0
- package/dist/{types/endpoints/integrationApi/StockReservation.d.ts → endpoints/integrationApi/StockReservations.d.ts} +3 -4
- package/dist/endpoints/integrationApi/Transactions.d.ts +76 -0
- package/dist/endpoints/integrationApi/Users.d.ts +72 -0
- package/dist/endpoints/integrationApi/index.d.ts +58 -0
- package/dist/endpoints/marketplace/AvailabilityExceptions.d.ts +69 -0
- package/dist/endpoints/marketplace/Bookings.d.ts +45 -0
- package/dist/endpoints/marketplace/CurrentUser.d.ts +110 -0
- package/dist/endpoints/marketplace/Images.d.ts +38 -0
- package/dist/endpoints/marketplace/Listings.d.ts +52 -0
- package/dist/endpoints/marketplace/Marketplace.d.ts +33 -0
- package/dist/endpoints/marketplace/Messages.d.ts +51 -0
- package/dist/endpoints/marketplace/OwnListings.d.ts +116 -0
- package/dist/endpoints/marketplace/PasswordReset.d.ts +50 -0
- package/dist/endpoints/marketplace/ProcessTransitions.d.ts +42 -0
- package/dist/endpoints/marketplace/Reviews.d.ts +49 -0
- package/dist/endpoints/marketplace/SitemapData.d.ts +60 -0
- package/dist/endpoints/marketplace/Stock.d.ts +50 -0
- package/dist/endpoints/marketplace/StockAdjustments.d.ts +64 -0
- package/dist/endpoints/marketplace/StripeAccount.d.ts +56 -0
- package/dist/endpoints/marketplace/StripeAccountLinks.d.ts +42 -0
- package/dist/endpoints/marketplace/StripeCustomer.d.ts +62 -0
- package/dist/endpoints/marketplace/StripePersons.d.ts +37 -0
- package/dist/endpoints/marketplace/StripeSetupIntents.d.ts +42 -0
- package/dist/endpoints/marketplace/TimeSlots.d.ts +40 -0
- package/dist/endpoints/marketplace/Transactions.d.ts +89 -0
- package/dist/endpoints/marketplace/Users.d.ts +34 -0
- package/dist/endpoints/marketplace/index.d.ts +82 -0
- package/dist/index.d.ts +161 -0
- package/dist/index.js +3 -0
- package/dist/{ts-sharetribe-flex-sdk.cjs.LICENSE.txt → index.js.LICENSE.txt} +35 -5
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/{ts-sharetribe-flex-sdk.js.LICENSE.txt → index.mjs.LICENSE.txt} +35 -5
- package/dist/index.mjs.map +1 -0
- package/dist/index.umd.js +3 -0
- package/dist/{ts-sharetribe-flex-sdk.mjs.LICENSE.txt → index.umd.js.LICENSE.txt} +35 -5
- package/dist/index.umd.js.map +1 -0
- package/dist/integrationSdk.d.ts +119 -0
- package/dist/sdk.d.ts +211 -0
- package/dist/sdkTypes/BigDecimal.d.ts +30 -0
- package/dist/sdkTypes/LatLng.d.ts +34 -0
- package/dist/sdkTypes/LatLngBounds.d.ts +51 -0
- package/dist/sdkTypes/Money.d.ts +35 -0
- package/dist/sdkTypes/UUID.d.ts +45 -0
- package/dist/types/apiConfigs.d.ts +104 -0
- package/dist/types/assets/index.d.ts +101 -0
- package/dist/types/authentication/index.d.ts +152 -0
- package/dist/types/axios.d.ts +10 -0
- package/dist/types/config.d.ts +99 -0
- package/dist/types/endpoints/assets/index.d.ts +22 -36
- package/dist/types/endpoints/assets/index.d.ts.map +1 -1
- package/dist/types/endpoints/auth/index.d.ts +20 -41
- package/dist/types/endpoints/auth/index.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts +30 -49
- package/dist/types/endpoints/integrationApi/AvailabilityExceptions.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Events.d.ts +23 -27
- package/dist/types/endpoints/integrationApi/Events.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Images.d.ts +17 -28
- package/dist/types/endpoints/integrationApi/Images.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Listings.d.ts +42 -104
- package/dist/types/endpoints/integrationApi/Listings.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Marketplace.d.ts +12 -20
- package/dist/types/endpoints/integrationApi/Marketplace.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Stock.d.ts +22 -28
- package/dist/types/endpoints/integrationApi/Stock.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts +35 -35
- package/dist/types/endpoints/integrationApi/StockAdjustments.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/StockReservations.d.ts +43 -0
- package/dist/types/endpoints/integrationApi/StockReservations.d.ts.map +1 -0
- package/dist/types/endpoints/integrationApi/Transactions.d.ts +36 -80
- package/dist/types/endpoints/integrationApi/Transactions.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/Users.d.ts +35 -70
- package/dist/types/endpoints/integrationApi/Users.d.ts.map +1 -1
- package/dist/types/endpoints/integrationApi/index.d.ts +40 -40
- package/dist/types/endpoints/integrationApi/index.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts +34 -48
- package/dist/types/endpoints/marketplace/AvailabilityExceptions.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Bookings.d.ts +24 -23
- package/dist/types/endpoints/marketplace/Bookings.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/CurrentUser.d.ts +54 -125
- package/dist/types/endpoints/marketplace/CurrentUser.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Images.d.ts +19 -27
- package/dist/types/endpoints/marketplace/Images.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Listings.d.ts +26 -25
- package/dist/types/endpoints/marketplace/Listings.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Marketplace.d.ts +15 -19
- package/dist/types/endpoints/marketplace/Marketplace.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Messages.d.ts +24 -29
- package/dist/types/endpoints/marketplace/Messages.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/OwnListings.d.ts +55 -119
- package/dist/types/endpoints/marketplace/OwnListings.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/PasswordReset.d.ts +23 -35
- package/dist/types/endpoints/marketplace/PasswordReset.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts +22 -22
- package/dist/types/endpoints/marketplace/ProcessTransitions.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Reviews.d.ts +23 -25
- package/dist/types/endpoints/marketplace/Reviews.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/SitemapData.d.ts +61 -0
- package/dist/types/endpoints/marketplace/SitemapData.d.ts.map +1 -0
- package/dist/types/endpoints/marketplace/Stock.d.ts +30 -26
- package/dist/types/endpoints/marketplace/Stock.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StockAdjustments.d.ts +36 -34
- package/dist/types/endpoints/marketplace/StockAdjustments.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StripeAccount.d.ts +28 -49
- package/dist/types/endpoints/marketplace/StripeAccount.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts +22 -31
- package/dist/types/endpoints/marketplace/StripeAccountLinks.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StripeCustomer.d.ts +32 -46
- package/dist/types/endpoints/marketplace/StripeCustomer.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StripePersons.d.ts +17 -25
- package/dist/types/endpoints/marketplace/StripePersons.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts +24 -24
- package/dist/types/endpoints/marketplace/StripeSetupIntents.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/TimeSlots.d.ts +20 -23
- package/dist/types/endpoints/marketplace/TimeSlots.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Transactions.d.ts +45 -81
- package/dist/types/endpoints/marketplace/Transactions.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/Users.d.ts +15 -22
- package/dist/types/endpoints/marketplace/Users.d.ts.map +1 -1
- package/dist/types/endpoints/marketplace/index.d.ts +52 -40
- package/dist/types/endpoints/marketplace/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +15 -30
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/integration/events.d.ts +87 -0
- package/dist/types/integrationSdk.d.ts +4 -5
- package/dist/types/integrationSdk.d.ts.map +1 -1
- package/dist/types/marketplace/availabilityExceptions.d.ts +99 -0
- package/dist/types/marketplace/availabilityPlan.d.ts +17 -0
- package/dist/types/marketplace/bookings.d.ts +80 -0
- package/dist/types/marketplace/currentUser.d.ts +202 -0
- package/dist/types/marketplace/images.d.ts +65 -0
- package/dist/types/marketplace/listings.d.ts +169 -0
- package/dist/types/marketplace/marketplace.d.ts +30 -0
- package/dist/types/marketplace/messages.d.ts +87 -0
- package/dist/types/marketplace/ownListings.d.ts +155 -0
- package/dist/types/marketplace/passwordReset.d.ts +54 -0
- package/dist/types/marketplace/processTransitions.d.ts +56 -0
- package/dist/types/marketplace/reviews.d.ts +108 -0
- package/dist/types/marketplace/sitemapData.d.ts +47 -0
- package/dist/types/marketplace/stock.d.ts +45 -0
- package/dist/types/marketplace/stockAdjustment.d.ts +97 -0
- package/dist/types/marketplace/stockReservations.d.ts +89 -0
- package/dist/types/marketplace/stripeAccount.d.ts +67 -0
- package/dist/types/marketplace/stripeAccountLinks.d.ts +55 -0
- package/dist/types/marketplace/stripeCustomer.d.ts +94 -0
- package/dist/types/marketplace/stripePaymentMethod.d.ts +21 -0
- package/dist/types/marketplace/stripePersons.d.ts +48 -0
- package/dist/types/marketplace/stripeSetupIntents.d.ts +48 -0
- package/dist/types/marketplace/timeSlots.d.ts +51 -0
- package/dist/types/marketplace/transactions.d.ts +200 -0
- package/dist/types/marketplace/user.d.ts +200 -0
- package/dist/types/sdk-types.d.ts +10 -0
- package/dist/types/sdk.d.ts +6 -7
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdkTypes/BigDecimal.d.ts +1 -1
- package/dist/types/sdkTypes/BigDecimal.d.ts.map +1 -1
- package/dist/types/sdkTypes/LatLng.d.ts +1 -1
- package/dist/types/sdkTypes/LatLng.d.ts.map +1 -1
- package/dist/types/sdkTypes/LatLngBounds.d.ts +1 -1
- package/dist/types/sdkTypes/LatLngBounds.d.ts.map +1 -1
- package/dist/types/sdkTypes/Money.d.ts +9 -2
- package/dist/types/sdkTypes/Money.d.ts.map +1 -1
- package/dist/types/sdkTypes/UUID.d.ts +8 -1
- package/dist/types/sdkTypes/UUID.d.ts.map +1 -1
- package/dist/types/sharetribe.d.ts +227 -0
- package/dist/types/store.d.ts +22 -0
- package/dist/types/types/apiConfigs.d.ts.map +1 -1
- package/dist/types/types/assets/index.d.ts +74 -36
- package/dist/types/types/assets/index.d.ts.map +1 -1
- package/dist/types/types/authentication/index.d.ts +111 -60
- package/dist/types/types/authentication/index.d.ts.map +1 -1
- package/dist/types/types/axios.d.ts.map +1 -1
- package/dist/types/types/config.d.ts +1 -39
- package/dist/types/types/config.d.ts.map +1 -1
- package/dist/types/types/integration/events.d.ts +52 -20
- package/dist/types/types/integration/events.d.ts.map +1 -1
- package/dist/types/types/marketplace/availabilityExceptions.d.ts +59 -16
- package/dist/types/types/marketplace/availabilityExceptions.d.ts.map +1 -1
- package/dist/types/types/marketplace/availabilityPlan.d.ts +18 -0
- package/dist/types/types/marketplace/availabilityPlan.d.ts.map +1 -0
- package/dist/types/types/marketplace/bookings.d.ts +48 -14
- package/dist/types/types/marketplace/bookings.d.ts.map +1 -1
- package/dist/types/types/marketplace/currentUser.d.ts +99 -55
- package/dist/types/types/marketplace/currentUser.d.ts.map +1 -1
- package/dist/types/types/marketplace/images.d.ts +40 -14
- package/dist/types/types/marketplace/images.d.ts.map +1 -1
- package/dist/types/types/marketplace/listings.d.ts +96 -66
- package/dist/types/types/marketplace/listings.d.ts.map +1 -1
- package/dist/types/types/marketplace/marketplace.d.ts +16 -6
- package/dist/types/types/marketplace/marketplace.d.ts.map +1 -1
- package/dist/types/types/marketplace/messages.d.ts +53 -15
- package/dist/types/types/marketplace/messages.d.ts.map +1 -1
- package/dist/types/types/marketplace/ownListings.d.ts +92 -65
- package/dist/types/types/marketplace/ownListings.d.ts.map +1 -1
- package/dist/types/types/marketplace/passwordReset.d.ts +32 -9
- package/dist/types/types/marketplace/passwordReset.d.ts.map +1 -1
- package/dist/types/types/marketplace/processTransitions.d.ts +33 -14
- package/dist/types/types/marketplace/processTransitions.d.ts.map +1 -1
- package/dist/types/types/marketplace/reviews.d.ts +72 -23
- package/dist/types/types/marketplace/reviews.d.ts.map +1 -1
- package/dist/types/types/marketplace/sitemapData.d.ts +48 -0
- package/dist/types/types/marketplace/sitemapData.d.ts.map +1 -0
- package/dist/types/types/marketplace/stock.d.ts +23 -6
- package/dist/types/types/marketplace/stock.d.ts.map +1 -1
- package/dist/types/types/marketplace/stockAdjustment.d.ts +60 -14
- package/dist/types/types/marketplace/stockAdjustment.d.ts.map +1 -1
- package/dist/types/types/marketplace/stockReservations.d.ts +59 -14
- package/dist/types/types/marketplace/stockReservations.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripeAccount.d.ts +28 -5
- package/dist/types/types/marketplace/stripeAccount.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripeAccountLinks.d.ts +26 -6
- package/dist/types/types/marketplace/stripeAccountLinks.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripeCustomer.d.ts +60 -13
- package/dist/types/types/marketplace/stripeCustomer.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripePaymentMethod.d.ts +1 -2
- package/dist/types/types/marketplace/stripePaymentMethod.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripePersons.d.ts +17 -15
- package/dist/types/types/marketplace/stripePersons.d.ts.map +1 -1
- package/dist/types/types/marketplace/stripeSetupIntents.d.ts +16 -14
- package/dist/types/types/marketplace/stripeSetupIntents.d.ts.map +1 -1
- package/dist/types/types/marketplace/timeSlots.d.ts +13 -15
- package/dist/types/types/marketplace/timeSlots.d.ts.map +1 -1
- package/dist/types/types/marketplace/transactions.d.ts +77 -83
- package/dist/types/types/marketplace/transactions.d.ts.map +1 -1
- package/dist/types/types/marketplace/user.d.ts +85 -64
- package/dist/types/types/marketplace/user.d.ts.map +1 -1
- package/dist/types/types/sharetribe.d.ts +130 -92
- package/dist/types/types/sharetribe.d.ts.map +1 -1
- package/dist/types/types/store.d.ts +3 -14
- package/dist/types/types/store.d.ts.map +1 -1
- package/dist/types/utils/apis.d.ts +1 -1
- package/dist/types/utils/apis.d.ts.map +1 -1
- package/dist/types/utils/config.d.ts.map +1 -1
- package/dist/types/utils/prepare-axios-instance.d.ts +1 -1
- package/dist/types/utils/prepare-axios-instance.d.ts.map +1 -1
- package/dist/types/utils/stores/BrowserStore.d.ts +17 -4
- package/dist/types/utils/stores/BrowserStore.d.ts.map +1 -1
- package/dist/types/utils/stores/ExpressStore.d.ts +26 -8
- package/dist/types/utils/stores/ExpressStore.d.ts.map +1 -1
- package/dist/types/utils/stores/MemoryStore.d.ts +1 -2
- package/dist/types/utils/stores/MemoryStore.d.ts.map +1 -1
- package/dist/types/utils/transit.d.ts +1 -1
- package/dist/types/utils/transit.d.ts.map +1 -1
- package/dist/types/utils/util.d.ts +2 -2
- package/dist/types/utils/util.d.ts.map +1 -1
- package/dist/utils/apis.d.ts +8 -0
- package/dist/utils/config.d.ts +32 -0
- package/dist/utils/convert-types.d.ts +13 -0
- package/dist/utils/parameter-serializer.d.ts +23 -0
- package/dist/utils/prepare-axios-instance.d.ts +14 -0
- package/dist/utils/stores/BrowserStore.d.ts +51 -0
- package/dist/utils/stores/ExpressStore.d.ts +67 -0
- package/dist/utils/stores/MemoryStore.d.ts +23 -0
- package/dist/utils/stores/store.d.ts +8 -0
- package/dist/utils/transit.d.ts +28 -0
- package/dist/utils/util.d.ts +15 -0
- package/package.json +16 -14
- package/dist/ts-sharetribe-flex-sdk.cjs +0 -3
- package/dist/ts-sharetribe-flex-sdk.cjs.map +0 -1
- package/dist/ts-sharetribe-flex-sdk.js +0 -3
- package/dist/ts-sharetribe-flex-sdk.js.map +0 -1
- package/dist/ts-sharetribe-flex-sdk.mjs +0 -3
- package/dist/ts-sharetribe-flex-sdk.mjs.map +0 -1
- package/dist/types/endpoints/integrationApi/StockReservation.d.ts.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Stripe Account operations in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiParameter, ExtraParameterType, UUID } from "../sharetribe";
|
|
5
|
+
import type Stripe from "stripe";
|
|
6
|
+
/**
|
|
7
|
+
* Available endpoints
|
|
8
|
+
*/
|
|
9
|
+
export type StripeAccountEndpoints = "fetch" | "create" | "update";
|
|
10
|
+
/**
|
|
11
|
+
* Stripe Account resource
|
|
12
|
+
*/
|
|
13
|
+
export interface StripeAccount {
|
|
14
|
+
id: UUID;
|
|
15
|
+
type: "stripeAccount";
|
|
16
|
+
attributes: {
|
|
17
|
+
stripeAccountId: string;
|
|
18
|
+
stripeAccountData: Stripe.Account;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Base request parameters
|
|
23
|
+
*/
|
|
24
|
+
export interface StripeAccountParameter extends ApiParameter {
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parameters for creating a Stripe Account
|
|
28
|
+
*/
|
|
29
|
+
export interface StripeAccountCreateParameter extends StripeAccountParameter {
|
|
30
|
+
country: string;
|
|
31
|
+
accountToken?: string;
|
|
32
|
+
bankAccountToken?: string;
|
|
33
|
+
businessProfileMCC?: string;
|
|
34
|
+
businessProfileURL?: string;
|
|
35
|
+
businessProfileProductDescription?: string;
|
|
36
|
+
requestedCapabilities?: string[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parameters for updating a Stripe Account
|
|
40
|
+
*/
|
|
41
|
+
export interface StripeAccountUpdateParameter extends StripeAccountParameter {
|
|
42
|
+
accountToken?: string;
|
|
43
|
+
bankAccountToken?: string;
|
|
44
|
+
businessProfileMCC?: string;
|
|
45
|
+
businessProfileURL?: string;
|
|
46
|
+
businessProfileProductDescription?: string;
|
|
47
|
+
requestedCapabilities?: string[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Expand behavior
|
|
51
|
+
*/
|
|
52
|
+
type ExpandResult<EP extends ExtraParameterType | undefined> = EP extends {
|
|
53
|
+
expand: true;
|
|
54
|
+
} ? StripeAccount : EP extends {
|
|
55
|
+
expand: false;
|
|
56
|
+
} ? Omit<StripeAccount, "attributes"> : Omit<StripeAccount, "attributes">;
|
|
57
|
+
/**
|
|
58
|
+
* Response data per endpoint
|
|
59
|
+
*/
|
|
60
|
+
type ResponseData<E extends StripeAccountEndpoints, EP extends ExtraParameterType | undefined> = E extends "fetch" ? StripeAccount : E extends "create" | "update" ? ExpandResult<EP> : never;
|
|
61
|
+
/**
|
|
62
|
+
* Final response type
|
|
63
|
+
*/
|
|
64
|
+
export type StripeAccountResponse<E extends StripeAccountEndpoints, EP extends ExtraParameterType | undefined = undefined> = {
|
|
65
|
+
data: ResponseData<E, EP>;
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Stripe Account Links in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiParameter, ExtraParameterType, UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Available endpoints
|
|
7
|
+
*/
|
|
8
|
+
export type StripeAccountLinksEndpoints = "create";
|
|
9
|
+
/**
|
|
10
|
+
* Stripe Account Link resource
|
|
11
|
+
*/
|
|
12
|
+
export interface StripeAccountLink {
|
|
13
|
+
id: UUID;
|
|
14
|
+
type: "stripeAccountLink";
|
|
15
|
+
attributes: {
|
|
16
|
+
url: string;
|
|
17
|
+
expiresAt: Date;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Base request parameters
|
|
22
|
+
*/
|
|
23
|
+
export interface StripeAccountLinksParameter extends ApiParameter {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Parameters for creating an account link
|
|
27
|
+
*/
|
|
28
|
+
export interface StripeAccountLinksCreateParameter extends StripeAccountLinksParameter {
|
|
29
|
+
failureURL: string;
|
|
30
|
+
successURL: string;
|
|
31
|
+
type: string;
|
|
32
|
+
collectionOptions: {
|
|
33
|
+
fields: Array<"currently_due" | "eventually_due">;
|
|
34
|
+
future_requirements: Array<"include" | "omit">;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Expand behavior
|
|
39
|
+
*/
|
|
40
|
+
type ExpandResult<EP extends ExtraParameterType | undefined> = EP extends {
|
|
41
|
+
expand: true;
|
|
42
|
+
} ? StripeAccountLink : EP extends {
|
|
43
|
+
expand: false;
|
|
44
|
+
} ? Omit<StripeAccountLink, "attributes"> : Omit<StripeAccountLink, "attributes">;
|
|
45
|
+
/**
|
|
46
|
+
* Response data per endpoint
|
|
47
|
+
*/
|
|
48
|
+
type ResponseData<E extends StripeAccountLinksEndpoints, EP extends ExtraParameterType | undefined> = E extends "create" ? ExpandResult<EP> : never;
|
|
49
|
+
/**
|
|
50
|
+
* Final response type
|
|
51
|
+
*/
|
|
52
|
+
export type StripeAccountLinksResponse<E extends StripeAccountLinksEndpoints = "create", EP extends ExtraParameterType | undefined = undefined> = {
|
|
53
|
+
data: ResponseData<E, EP>;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Stripe Customer operations in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiParameter, ExtraParameterType, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Available endpoints
|
|
7
|
+
*/
|
|
8
|
+
export type StripeCustomerEndpoints = "create" | "addPaymentMethod" | "deletePaymentMethod";
|
|
9
|
+
/**
|
|
10
|
+
* Relationship fields that can be included
|
|
11
|
+
*/
|
|
12
|
+
export type StripeCustomerRelationshipsFields = "defaultPaymentMethod";
|
|
13
|
+
/**
|
|
14
|
+
* Stripe Customer resource
|
|
15
|
+
*/
|
|
16
|
+
export interface StripeCustomer {
|
|
17
|
+
id: UUID;
|
|
18
|
+
type: "stripeCustomer";
|
|
19
|
+
attributes: {
|
|
20
|
+
stripeCustomerId: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Stripe Customer with relationships
|
|
25
|
+
*/
|
|
26
|
+
export interface StripeCustomerWithRelationships extends StripeCustomer {
|
|
27
|
+
relationships: {
|
|
28
|
+
defaultPaymentMethod: Relationship<false, "defaultPaymentMethod">;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Select type based on include
|
|
33
|
+
*/
|
|
34
|
+
export type StripeCustomerType<R extends boolean> = R extends true ? StripeCustomerWithRelationships : StripeCustomer;
|
|
35
|
+
/**
|
|
36
|
+
* Base request parameters
|
|
37
|
+
*/
|
|
38
|
+
export interface StripeCustomerParameter extends ApiParameter {
|
|
39
|
+
include?: StripeCustomerRelationshipsFields[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create endpoint
|
|
43
|
+
*/
|
|
44
|
+
export interface StripeCustomerCreateParameter extends StripeCustomerParameter {
|
|
45
|
+
stripePaymentMethodId?: string;
|
|
46
|
+
stripeCustomerEmail?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Add payment method
|
|
50
|
+
*/
|
|
51
|
+
export interface StripeCustomerAddPaymentMethodParameter extends StripeCustomerParameter {
|
|
52
|
+
stripePaymentMethodId: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Delete payment method (no body required)
|
|
56
|
+
*/
|
|
57
|
+
export interface StripeCustomerDeletePaymentMethodParameter extends StripeCustomerParameter {
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* All parameter types
|
|
61
|
+
*/
|
|
62
|
+
type AllStripeCustomerParameter = StripeCustomerCreateParameter | StripeCustomerAddPaymentMethodParameter | StripeCustomerDeletePaymentMethodParameter;
|
|
63
|
+
/**
|
|
64
|
+
* Detect if relationships are requested
|
|
65
|
+
*/
|
|
66
|
+
type HasInclude<P> = P extends {
|
|
67
|
+
include: infer I extends StripeCustomerRelationshipsFields[];
|
|
68
|
+
} ? I : never;
|
|
69
|
+
type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
|
|
70
|
+
/**
|
|
71
|
+
* Included resources (when include is used)
|
|
72
|
+
*/
|
|
73
|
+
type IncludedResources<P> = HasInclude<P> extends infer Fields extends StripeCustomerRelationshipsFields[] ? RelationshipTypeMap[Fields[number]][] : never;
|
|
74
|
+
/**
|
|
75
|
+
* Expand behavior
|
|
76
|
+
*/
|
|
77
|
+
type ExpandResult<T, EP extends ExtraParameterType | undefined> = EP extends {
|
|
78
|
+
expand: true;
|
|
79
|
+
} ? T : EP extends {
|
|
80
|
+
expand: false;
|
|
81
|
+
} ? Omit<T, "attributes"> : Omit<T, "attributes">;
|
|
82
|
+
/**
|
|
83
|
+
* Response data per endpoint
|
|
84
|
+
*/
|
|
85
|
+
type ResponseData<E extends StripeCustomerEndpoints, P extends AllStripeCustomerParameter, EP extends ExtraParameterType | undefined> = E extends "create" | "addPaymentMethod" | "deletePaymentMethod" ? ExpandResult<StripeCustomerType<IncludesRelationships<P>>, EP> : never;
|
|
86
|
+
/**
|
|
87
|
+
* Final response type
|
|
88
|
+
*/
|
|
89
|
+
export type StripeCustomerResponse<E extends StripeCustomerEndpoints, P extends AllStripeCustomerParameter, EP extends ExtraParameterType | undefined = undefined> = {
|
|
90
|
+
data: ResponseData<E, P, EP>;
|
|
91
|
+
} & (IncludesRelationships<P> extends true ? {
|
|
92
|
+
included: IncludedResources<P>;
|
|
93
|
+
} : {});
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definition for Stripe Payment Method objects in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Stripe Payment Method resource
|
|
7
|
+
*/
|
|
8
|
+
export interface StripePaymentMethod {
|
|
9
|
+
id: UUID;
|
|
10
|
+
type: "stripePaymentMethod";
|
|
11
|
+
attributes: {
|
|
12
|
+
type: string;
|
|
13
|
+
stripePaymentMethodId: string;
|
|
14
|
+
card: {
|
|
15
|
+
brand: string;
|
|
16
|
+
last4Digits: string;
|
|
17
|
+
expirationYear: number;
|
|
18
|
+
expirationMonth: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Stripe Persons in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiParameter, ExtraParameterType, UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Available endpoints
|
|
7
|
+
*/
|
|
8
|
+
export type StripePersonsEndpoints = "create";
|
|
9
|
+
/**
|
|
10
|
+
* Stripe Person resource
|
|
11
|
+
*/
|
|
12
|
+
export interface StripePerson {
|
|
13
|
+
id: UUID;
|
|
14
|
+
type: "stripePerson";
|
|
15
|
+
attributes: {
|
|
16
|
+
stripePersonId: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Base request parameters
|
|
21
|
+
*/
|
|
22
|
+
export interface StripePersonsParameter extends ApiParameter {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parameters for creating a Stripe Person
|
|
26
|
+
*/
|
|
27
|
+
export interface StripePersonsCreateParameter extends StripePersonsParameter {
|
|
28
|
+
personToken: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Expand behavior (controls inclusion of `attributes`)
|
|
32
|
+
*/
|
|
33
|
+
type ExpandResult<EP extends ExtraParameterType | undefined> = EP extends {
|
|
34
|
+
expand: true;
|
|
35
|
+
} ? StripePerson : EP extends {
|
|
36
|
+
expand: false;
|
|
37
|
+
} ? Omit<StripePerson, "attributes"> : Omit<StripePerson, "attributes">;
|
|
38
|
+
/**
|
|
39
|
+
* Response data per endpoint
|
|
40
|
+
*/
|
|
41
|
+
type ResponseData<E extends StripePersonsEndpoints, EP extends ExtraParameterType | undefined> = E extends "create" ? ExpandResult<EP> : never;
|
|
42
|
+
/**
|
|
43
|
+
* Final response type
|
|
44
|
+
*/
|
|
45
|
+
export type StripePersonsResponse<E extends StripePersonsEndpoints = "create", EP extends ExtraParameterType | undefined = undefined> = {
|
|
46
|
+
data: ResponseData<E, EP>;
|
|
47
|
+
};
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Stripe Setup Intents in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiParameter, ExtraParameterType, UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Available endpoints
|
|
7
|
+
*/
|
|
8
|
+
export type StripeSetupIntentsEndpoints = "create";
|
|
9
|
+
/**
|
|
10
|
+
* Stripe Setup Intent resource
|
|
11
|
+
*/
|
|
12
|
+
export interface StripeSetupIntent {
|
|
13
|
+
id: UUID;
|
|
14
|
+
type: "stripeSetupIntent";
|
|
15
|
+
attributes: {
|
|
16
|
+
stripeSetupIntentId: string;
|
|
17
|
+
clientSecret: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Base request parameters
|
|
22
|
+
*/
|
|
23
|
+
export interface StripeSetupIntentsParameter extends ApiParameter {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Parameters for creating a setup intent
|
|
27
|
+
*/
|
|
28
|
+
export interface StripeSetupIntentsCreateParameter extends StripeSetupIntentsParameter {
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Expand behavior (controls whether `attributes` is included)
|
|
32
|
+
*/
|
|
33
|
+
type ExpandResult<EP extends ExtraParameterType | undefined> = EP extends {
|
|
34
|
+
expand: true;
|
|
35
|
+
} ? StripeSetupIntent : EP extends {
|
|
36
|
+
expand: false;
|
|
37
|
+
} ? Omit<StripeSetupIntent, "attributes"> : Omit<StripeSetupIntent, "attributes">;
|
|
38
|
+
/**
|
|
39
|
+
* Response data per endpoint
|
|
40
|
+
*/
|
|
41
|
+
type ResponseData<E extends StripeSetupIntentsEndpoints, EP extends ExtraParameterType | undefined> = E extends "create" ? ExpandResult<EP> : never;
|
|
42
|
+
/**
|
|
43
|
+
* Final response type
|
|
44
|
+
*/
|
|
45
|
+
export type StripeSetupIntentsResponse<E extends StripeSetupIntentsEndpoints = "create", EP extends ExtraParameterType | undefined = undefined> = {
|
|
46
|
+
data: ResponseData<E, EP>;
|
|
47
|
+
};
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Time Slots in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiMeta, ApiParameter, UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Supported time slot types
|
|
7
|
+
*/
|
|
8
|
+
export type TimeSlotType = "time-slot/day" | "time-slot/time";
|
|
9
|
+
/**
|
|
10
|
+
* Available endpoints
|
|
11
|
+
*/
|
|
12
|
+
export type TimeSlotsEndpoints = "query";
|
|
13
|
+
/**
|
|
14
|
+
* Time slot resource
|
|
15
|
+
*/
|
|
16
|
+
export interface TimeSlot {
|
|
17
|
+
id: UUID;
|
|
18
|
+
type: "timeSlot";
|
|
19
|
+
attributes: {
|
|
20
|
+
type: TimeSlotType;
|
|
21
|
+
seats: number;
|
|
22
|
+
start: Date;
|
|
23
|
+
end: Date;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Base request parameters
|
|
28
|
+
*/
|
|
29
|
+
export interface TimeSlotsParameter extends ApiParameter {
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Query parameters for fetching availability
|
|
33
|
+
*/
|
|
34
|
+
export interface TimeSlotsQueryParameter extends TimeSlotsParameter {
|
|
35
|
+
listingId: UUID | string;
|
|
36
|
+
start: Date | string;
|
|
37
|
+
end: Date | string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Response data per endpoint
|
|
41
|
+
*/
|
|
42
|
+
type TimeSlotsResponseData<E extends TimeSlotsEndpoints> = E extends "query" ? TimeSlot[] : never;
|
|
43
|
+
/**
|
|
44
|
+
* Final API response type
|
|
45
|
+
*/
|
|
46
|
+
export type TimeSlotsResponse<E extends TimeSlotsEndpoints = "query"> = {
|
|
47
|
+
data: TimeSlotsResponseData<E>;
|
|
48
|
+
} & (E extends "query" ? {
|
|
49
|
+
meta: ApiMeta;
|
|
50
|
+
} : {});
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Transactions in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiMeta, ApiParameter, ExtraParameter, ExtraParameterType, Money, QueryMeta, QueryProt, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
|
|
5
|
+
import { BookingState } from "./bookings";
|
|
6
|
+
/**
|
|
7
|
+
* Available endpoints
|
|
8
|
+
*/
|
|
9
|
+
export type TransactionsEndpoints = "show" | "query" | "initiate" | "initiateSpeculative" | "transition" | "transitionSpeculative" | "updateMetadata";
|
|
10
|
+
/**
|
|
11
|
+
* Relationship fields that can be included
|
|
12
|
+
*/
|
|
13
|
+
export type TransactionsRelationshipsFields = "marketplace" | "listing" | "listing.marketplace" | "listing.author" | "listing.images" | "listing.currentStock" | "provider" | "provider.profileImage" | "provider.stripeAccount" | "provider.effectivePermissionSet" | "customer" | "customer.profileImage" | "customer.stripeAccount" | "customer.effectivePermissionSet" | "booking" | "stockReservation" | "reviews" | "reviews.author" | "reviews.subject" | "messages" | "messages.sender";
|
|
14
|
+
/**
|
|
15
|
+
* Roles in a transaction
|
|
16
|
+
*/
|
|
17
|
+
export type TransactionParty = "customer" | "provider";
|
|
18
|
+
/**
|
|
19
|
+
* Transaction variety
|
|
20
|
+
*/
|
|
21
|
+
export type TransactionVariety = "sale" | "order";
|
|
22
|
+
/**
|
|
23
|
+
* Line item in a transaction
|
|
24
|
+
*/
|
|
25
|
+
export interface LineItem {
|
|
26
|
+
code: string;
|
|
27
|
+
quantity?: number;
|
|
28
|
+
units?: number;
|
|
29
|
+
seats?: number;
|
|
30
|
+
unitPrice: Money;
|
|
31
|
+
percentage?: number;
|
|
32
|
+
reversal?: boolean;
|
|
33
|
+
lineTotal: Money;
|
|
34
|
+
includeFor: TransactionParty[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Process transition record
|
|
38
|
+
*/
|
|
39
|
+
export interface Transition {
|
|
40
|
+
transition: string;
|
|
41
|
+
createdAt: Date | string;
|
|
42
|
+
by: TransactionParty;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Core transaction attributes (always present)
|
|
46
|
+
*/
|
|
47
|
+
export interface TransactionAttributes {
|
|
48
|
+
createdAt: Date;
|
|
49
|
+
processName: string;
|
|
50
|
+
processVersion: number;
|
|
51
|
+
lastTransition: string;
|
|
52
|
+
lastTransitionedAt: string | Date;
|
|
53
|
+
payinTotal: Money;
|
|
54
|
+
payoutTotal: Money;
|
|
55
|
+
lineItems: LineItem[];
|
|
56
|
+
protectedData: TransactionProtectedData & TransactionCustomProtectedData;
|
|
57
|
+
metadata: TransactionMetadata & TransactionCustomMetadata;
|
|
58
|
+
transitions: Transition[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Base transaction type
|
|
62
|
+
*/
|
|
63
|
+
export interface Transaction {
|
|
64
|
+
id: UUID;
|
|
65
|
+
type: "transaction";
|
|
66
|
+
attributes: TransactionAttributes;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Transaction with relationships
|
|
70
|
+
*/
|
|
71
|
+
export interface TransactionWithRelationships extends Transaction {
|
|
72
|
+
relationships: {
|
|
73
|
+
marketplace: Relationship<false, "marketplace">;
|
|
74
|
+
listing: Relationship<false, "listing">;
|
|
75
|
+
provider: Relationship<false, "provider">;
|
|
76
|
+
customer: Relationship<false, "customer">;
|
|
77
|
+
booking: Relationship<false, "booking">;
|
|
78
|
+
stockReservation: Relationship<false, "stockReservation">;
|
|
79
|
+
reviews: Relationship<true, "reviews">;
|
|
80
|
+
messages: Relationship<true, "messages">;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Select type based on include
|
|
85
|
+
*/
|
|
86
|
+
export type TransactionType<R extends boolean> = R extends true ? TransactionWithRelationships : Transaction;
|
|
87
|
+
/**
|
|
88
|
+
* Base API parameter
|
|
89
|
+
*/
|
|
90
|
+
export interface TransactionsParameter extends ApiParameter {
|
|
91
|
+
include?: TransactionsRelationshipsFields[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Show endpoint
|
|
95
|
+
*/
|
|
96
|
+
export interface TransactionsShowParameter extends TransactionsParameter {
|
|
97
|
+
id: UUID | string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Query endpoint (with optional privileged fields when I = true)
|
|
101
|
+
*/
|
|
102
|
+
export type TransactionsQueryParameter<I extends boolean = false> = TransactionsParameter & {
|
|
103
|
+
bookingEnd?: string;
|
|
104
|
+
bookingStart?: string;
|
|
105
|
+
bookingStates?: BookingState[];
|
|
106
|
+
createdAtEnd?: string;
|
|
107
|
+
createdAtStart?: string;
|
|
108
|
+
hasBooking?: boolean;
|
|
109
|
+
hasMessage?: boolean;
|
|
110
|
+
hasPayin?: boolean;
|
|
111
|
+
hasStockReservation?: boolean;
|
|
112
|
+
lastTransitionedAtStart?: string;
|
|
113
|
+
lastTransitions?: string[];
|
|
114
|
+
listingId?: UUID | string;
|
|
115
|
+
only?: TransactionVariety;
|
|
116
|
+
processName?: string;
|
|
117
|
+
stockReservationStates?: string[];
|
|
118
|
+
userId?: UUID | string;
|
|
119
|
+
sort?: "bookingEnd" | "bookingStart" | "createdAt" | "lastMessageAt" | "lastTransitionedAt" | `meta_${string}` | `prot_${string}`;
|
|
120
|
+
[keyof: QueryMeta]: string | undefined;
|
|
121
|
+
[keyof: QueryProt]: string | undefined;
|
|
122
|
+
} & (I extends true ? {
|
|
123
|
+
customerId?: UUID | string;
|
|
124
|
+
providerId?: UUID | string;
|
|
125
|
+
} : {});
|
|
126
|
+
/**
|
|
127
|
+
* Initiate / Speculative initiate
|
|
128
|
+
*/
|
|
129
|
+
export interface TransactionsInitiateParameter extends TransactionsParameter {
|
|
130
|
+
processAlias: string;
|
|
131
|
+
transition: string;
|
|
132
|
+
params?: unknown;
|
|
133
|
+
}
|
|
134
|
+
export interface TransactionsInitiateSpeculativeParameter extends TransactionsInitiateParameter {
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Transition / Speculative transition
|
|
138
|
+
*/
|
|
139
|
+
export interface TransactionsTransitionParameter extends TransactionsParameter {
|
|
140
|
+
id: UUID | string;
|
|
141
|
+
transition: string;
|
|
142
|
+
params?: unknown;
|
|
143
|
+
}
|
|
144
|
+
export interface TransactionsTransitionSpeculativeParameter extends TransactionsTransitionParameter {
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Update metadata
|
|
148
|
+
*/
|
|
149
|
+
export interface TransactionsUpdateMetadataParameter extends TransactionsParameter {
|
|
150
|
+
id: UUID | string;
|
|
151
|
+
metadata?: TransactionMetadata & TransactionCustomMetadata;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Custom data structures
|
|
155
|
+
*/
|
|
156
|
+
export interface TransactionProtectedData {
|
|
157
|
+
[key: string]: any;
|
|
158
|
+
}
|
|
159
|
+
export interface TransactionCustomProtectedData extends Record<string, unknown> {
|
|
160
|
+
}
|
|
161
|
+
export interface TransactionMetadata {
|
|
162
|
+
[key: string]: any;
|
|
163
|
+
}
|
|
164
|
+
export interface TransactionCustomMetadata extends Record<string, unknown> {
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Helpers
|
|
168
|
+
*/
|
|
169
|
+
type HasInclude<P> = P extends {
|
|
170
|
+
include: infer I extends TransactionsRelationshipsFields[];
|
|
171
|
+
} ? I : never;
|
|
172
|
+
type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
|
|
173
|
+
type IncludedResources<P> = HasInclude<P> extends infer Fields extends TransactionsRelationshipsFields[] ? RelationshipTypeMap[Fields[number]][] : never;
|
|
174
|
+
/**
|
|
175
|
+
* Expand behavior (for transition responses)
|
|
176
|
+
*/
|
|
177
|
+
type ExpandResult<T, EP extends ExtraParameter | undefined> = EP extends {
|
|
178
|
+
expand: true;
|
|
179
|
+
} ? T : EP extends {
|
|
180
|
+
expand: false;
|
|
181
|
+
} ? Omit<T, "attributes"> : Omit<T, "attributes">;
|
|
182
|
+
/**
|
|
183
|
+
* Union of all parameter types
|
|
184
|
+
*/
|
|
185
|
+
type AllTransactionsParameter = TransactionsShowParameter | TransactionsQueryParameter<any> | TransactionsInitiateParameter | TransactionsInitiateSpeculativeParameter | TransactionsTransitionParameter | TransactionsTransitionSpeculativeParameter | TransactionsUpdateMetadataParameter;
|
|
186
|
+
/**
|
|
187
|
+
* Final response data type
|
|
188
|
+
*/
|
|
189
|
+
type TransactionsResponseData<E extends TransactionsEndpoints, P extends AllTransactionsParameter, EP extends ExtraParameter | undefined> = E extends "show" ? TransactionType<IncludesRelationships<P>> : E extends "query" ? TransactionType<IncludesRelationships<P>>[] : E extends "initiate" | "initiateSpeculative" | "transition" | "transitionSpeculative" | "updateMetadata" ? ExpandResult<TransactionType<IncludesRelationships<P>>, EP> : never;
|
|
190
|
+
/**
|
|
191
|
+
* Final response type
|
|
192
|
+
*/
|
|
193
|
+
export type TransactionsResponse<E extends TransactionsEndpoints, P extends AllTransactionsParameter, EP extends ExtraParameterType = undefined> = {
|
|
194
|
+
data: TransactionsResponseData<E, P, EP>;
|
|
195
|
+
} & (IncludesRelationships<P> extends true ? {
|
|
196
|
+
included: IncludedResources<P>;
|
|
197
|
+
} : {}) & (E extends "query" ? {
|
|
198
|
+
meta: ApiMeta;
|
|
199
|
+
} : {});
|
|
200
|
+
export {};
|