@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,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Own Listings in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiMeta, ApiParameter, ExtraParameterType, LatLng, Money, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
|
|
5
|
+
import { AvailabilityPlan } from "./availabilityPlan";
|
|
6
|
+
/**
|
|
7
|
+
* Listing states
|
|
8
|
+
*/
|
|
9
|
+
export type OwnListingState = "draft" | "pendingApproval" | "published" | "closed";
|
|
10
|
+
/**
|
|
11
|
+
* Available endpoints
|
|
12
|
+
*/
|
|
13
|
+
export type OwnListingsEndpoints = "show" | "query" | "create" | "createDraft" | "update" | "publishDraft" | "discardDraft" | "close" | "open" | "addImage";
|
|
14
|
+
/**
|
|
15
|
+
* Relationship fields
|
|
16
|
+
*/
|
|
17
|
+
export type OwnListingsRelationshipsFields = "marketplace" | "author.profileImage" | "author.marketplace" | "author.stripeAccount" | "author.effectivePermissionSet" | "images" | "currentStock";
|
|
18
|
+
/**
|
|
19
|
+
* Own Listing resource
|
|
20
|
+
*/
|
|
21
|
+
export interface OwnListing {
|
|
22
|
+
id: UUID;
|
|
23
|
+
type: "ownListing";
|
|
24
|
+
attributes: {
|
|
25
|
+
title: string;
|
|
26
|
+
description: string;
|
|
27
|
+
price: Money;
|
|
28
|
+
geolocation: LatLng;
|
|
29
|
+
state: OwnListingState;
|
|
30
|
+
deleted: boolean;
|
|
31
|
+
createdAt: Date;
|
|
32
|
+
availabilityPlan: AvailabilityPlan | null;
|
|
33
|
+
publicData: OwnListingPublicData & OwnListingCustomPublicData;
|
|
34
|
+
privateData: OwnListingPrivateData & OwnListingCustomPrivateData;
|
|
35
|
+
metadata: OwnListingMetadata & OwnListingCustomMetadata;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* With relationships
|
|
40
|
+
*/
|
|
41
|
+
export interface OwnListingWithRelationships extends OwnListing {
|
|
42
|
+
relationships: {
|
|
43
|
+
marketplace: Relationship<false, "marketplace">;
|
|
44
|
+
author: Relationship<false, "author">;
|
|
45
|
+
images: Relationship<true, "images">;
|
|
46
|
+
currentStock?: Relationship<false, "currentStock">;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export type OwnListingResource<R extends boolean> = R extends true ? OwnListingWithRelationships : OwnListing;
|
|
50
|
+
/**
|
|
51
|
+
* Base request parameters
|
|
52
|
+
*/
|
|
53
|
+
export interface OwnListingsParameter extends ApiParameter {
|
|
54
|
+
include?: OwnListingsRelationshipsFields[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Endpoint-specific parameters
|
|
58
|
+
*/
|
|
59
|
+
export type OwnListingsShowParameter = OwnListingsParameter & {
|
|
60
|
+
id: UUID | string;
|
|
61
|
+
};
|
|
62
|
+
export type OwnListingsQueryParameter = OwnListingsParameter;
|
|
63
|
+
export interface OwnListingsCreateParameter extends OwnListingsParameter {
|
|
64
|
+
title: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
price?: Money;
|
|
67
|
+
geolocation?: LatLng;
|
|
68
|
+
availabilityPlan?: AvailabilityPlan | null;
|
|
69
|
+
publicData?: OwnListingPublicData & OwnListingCustomPublicData;
|
|
70
|
+
privateData?: OwnListingPrivateData & OwnListingCustomPrivateData;
|
|
71
|
+
metadata?: OwnListingMetadata & OwnListingCustomMetadata;
|
|
72
|
+
images?: string[];
|
|
73
|
+
}
|
|
74
|
+
export type OwnListingsCreateDraftParameter = OwnListingsCreateParameter;
|
|
75
|
+
export interface OwnListingsUpdateParameter extends OwnListingsParameter {
|
|
76
|
+
id: UUID | string;
|
|
77
|
+
title?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
price?: Money;
|
|
80
|
+
geolocation?: LatLng;
|
|
81
|
+
availabilityPlan?: AvailabilityPlan | null;
|
|
82
|
+
publicData?: OwnListingPublicData & OwnListingCustomPublicData;
|
|
83
|
+
privateData?: OwnListingPrivateData & OwnListingCustomPrivateData;
|
|
84
|
+
metadata?: OwnListingMetadata & OwnListingCustomMetadata;
|
|
85
|
+
images?: string[];
|
|
86
|
+
}
|
|
87
|
+
export type OwnListingsPublishDraftParameter = OwnListingsParameter & {
|
|
88
|
+
id: UUID | string;
|
|
89
|
+
};
|
|
90
|
+
export type OwnListingsDiscardDraftParameter = OwnListingsParameter & {
|
|
91
|
+
id: UUID | string;
|
|
92
|
+
};
|
|
93
|
+
export type OwnListingsCloseParameter = OwnListingsParameter & {
|
|
94
|
+
id: UUID | string;
|
|
95
|
+
};
|
|
96
|
+
export type OwnListingsOpenParameter = OwnListingsParameter & {
|
|
97
|
+
id: UUID | string;
|
|
98
|
+
};
|
|
99
|
+
export type OwnListingsAddImageParameter = OwnListingsParameter & {
|
|
100
|
+
id: UUID | string;
|
|
101
|
+
imageId: UUID | string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Custom data
|
|
105
|
+
*/
|
|
106
|
+
export interface OwnListingPublicData {
|
|
107
|
+
[key: string]: any;
|
|
108
|
+
}
|
|
109
|
+
export interface OwnListingCustomPublicData extends Record<string, unknown> {
|
|
110
|
+
}
|
|
111
|
+
export interface OwnListingPrivateData {
|
|
112
|
+
[key: string]: any;
|
|
113
|
+
}
|
|
114
|
+
export interface OwnListingCustomPrivateData extends Record<string, unknown> {
|
|
115
|
+
}
|
|
116
|
+
export interface OwnListingMetadata {
|
|
117
|
+
[key: string]: any;
|
|
118
|
+
}
|
|
119
|
+
export interface OwnListingCustomMetadata extends Record<string, unknown> {
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* All parameter types
|
|
123
|
+
*/
|
|
124
|
+
type AllOwnListingsParameter = OwnListingsShowParameter | OwnListingsQueryParameter | OwnListingsCreateParameter | OwnListingsCreateDraftParameter | OwnListingsUpdateParameter | OwnListingsPublishDraftParameter | OwnListingsDiscardDraftParameter | OwnListingsCloseParameter | OwnListingsOpenParameter | OwnListingsAddImageParameter;
|
|
125
|
+
/**
|
|
126
|
+
* Include detection — fixes TS2536
|
|
127
|
+
*/
|
|
128
|
+
type HasInclude<P> = P extends {
|
|
129
|
+
include: infer I extends readonly OwnListingsRelationshipsFields[];
|
|
130
|
+
} ? I : never;
|
|
131
|
+
type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
|
|
132
|
+
type IncludedResources<P> = HasInclude<P> extends infer Fields extends OwnListingsRelationshipsFields[] ? RelationshipTypeMap[Fields[number]][] : never;
|
|
133
|
+
/**
|
|
134
|
+
* Expand behavior
|
|
135
|
+
*/
|
|
136
|
+
type ExpandResult<T, EP extends ExtraParameterType | undefined> = EP extends {
|
|
137
|
+
expand: true;
|
|
138
|
+
} ? T : EP extends {
|
|
139
|
+
expand: false;
|
|
140
|
+
} ? Omit<T, "attributes"> : Omit<T, "attributes">;
|
|
141
|
+
/**
|
|
142
|
+
* Response data per endpoint
|
|
143
|
+
*/
|
|
144
|
+
type ResponseData<E extends OwnListingsEndpoints, P extends AllOwnListingsParameter, EP extends ExtraParameterType | undefined> = E extends "show" | "create" | "createDraft" | "update" | "publishDraft" | "close" | "open" | "addImage" ? ExpandResult<OwnListingResource<IncludesRelationships<P>>, EP> : E extends "query" ? OwnListingResource<IncludesRelationships<P>>[] : E extends "discardDraft" ? Pick<OwnListing, "id" | "type"> : never;
|
|
145
|
+
/**
|
|
146
|
+
* Final response
|
|
147
|
+
*/
|
|
148
|
+
export type OwnListingsResponse<E extends OwnListingsEndpoints, P extends AllOwnListingsParameter, EP extends ExtraParameterType | undefined = undefined> = {
|
|
149
|
+
data: ResponseData<E, P, EP>;
|
|
150
|
+
} & (IncludesRelationships<P> extends true ? {
|
|
151
|
+
included: IncludedResources<P>;
|
|
152
|
+
} : {}) & (E extends "query" ? {
|
|
153
|
+
meta: ApiMeta;
|
|
154
|
+
} : {});
|
|
155
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Password Reset operations in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiParameter, ExtraParameterType, UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Available endpoints
|
|
7
|
+
*/
|
|
8
|
+
export type PasswordResetEndpoints = "request" | "reset";
|
|
9
|
+
/**
|
|
10
|
+
* Password reset resource (usually empty or minimal)
|
|
11
|
+
*/
|
|
12
|
+
export interface PasswordReset {
|
|
13
|
+
id: UUID;
|
|
14
|
+
type: "passwordReset";
|
|
15
|
+
attributes?: Record<string, never>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Base request parameters
|
|
19
|
+
*/
|
|
20
|
+
export interface PasswordResetParameter extends ApiParameter {
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Request password reset (send email)
|
|
24
|
+
*/
|
|
25
|
+
export interface PasswordResetRequestParameter extends PasswordResetParameter {
|
|
26
|
+
email: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Complete password reset using token
|
|
30
|
+
*/
|
|
31
|
+
export interface PasswordResetResetParameter extends PasswordResetParameter {
|
|
32
|
+
email: string;
|
|
33
|
+
passwordResetToken: string;
|
|
34
|
+
newPassword: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Expand behavior
|
|
38
|
+
*/
|
|
39
|
+
type ExpandResult<EP extends ExtraParameterType | undefined> = EP extends {
|
|
40
|
+
expand: true;
|
|
41
|
+
} ? PasswordReset : EP extends {
|
|
42
|
+
expand: false;
|
|
43
|
+
} ? Omit<PasswordReset, "attributes"> : Omit<PasswordReset, "attributes">;
|
|
44
|
+
/**
|
|
45
|
+
* Response data per endpoint
|
|
46
|
+
*/
|
|
47
|
+
type ResponseData<E extends PasswordResetEndpoints, EP extends ExtraParameterType | undefined> = E extends "request" | "reset" ? ExpandResult<EP> : never;
|
|
48
|
+
/**
|
|
49
|
+
* Final response type
|
|
50
|
+
*/
|
|
51
|
+
export type PasswordResetResponse<E extends PasswordResetEndpoints, EP extends ExtraParameterType | undefined = undefined> = {
|
|
52
|
+
data: ResponseData<E, EP>;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Process Transitions in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiParameter, UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Available endpoints
|
|
7
|
+
*/
|
|
8
|
+
export type ProcessTransitionsEndpoints = "query";
|
|
9
|
+
/**
|
|
10
|
+
* Actors that can trigger a transition
|
|
11
|
+
*/
|
|
12
|
+
type Actor = "customer" | "provider" | "operator" | "system";
|
|
13
|
+
/**
|
|
14
|
+
* Supported parameter types in transition requests
|
|
15
|
+
*/
|
|
16
|
+
type ParamType = "uuid" | "string" | "integer" | "timestamp" | "boolean" | "object" | "money" | ["lineItem"];
|
|
17
|
+
/**
|
|
18
|
+
* Process Transition resource
|
|
19
|
+
*/
|
|
20
|
+
export interface ProcessTransition {
|
|
21
|
+
id: UUID;
|
|
22
|
+
type: "processTransition";
|
|
23
|
+
attributes: {
|
|
24
|
+
name: string;
|
|
25
|
+
actor: Actor[];
|
|
26
|
+
actions: string[];
|
|
27
|
+
params: {
|
|
28
|
+
req: Record<string, ParamType>;
|
|
29
|
+
opt: Record<string, ParamType> | null;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Base request parameters
|
|
35
|
+
*/
|
|
36
|
+
export interface ProcessTransitionsParameter extends ApiParameter {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Query parameters
|
|
40
|
+
*/
|
|
41
|
+
export interface ProcessTransitionsQueryParameter extends ProcessTransitionsParameter {
|
|
42
|
+
processAlias?: string;
|
|
43
|
+
lastTransition?: string;
|
|
44
|
+
transactionId?: UUID | string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Response data per endpoint
|
|
48
|
+
*/
|
|
49
|
+
type ResponseData<E extends ProcessTransitionsEndpoints> = E extends "query" ? ProcessTransition[] : never;
|
|
50
|
+
/**
|
|
51
|
+
* Final response type
|
|
52
|
+
*/
|
|
53
|
+
export type ProcessTransitionsResponse<E extends ProcessTransitionsEndpoints = "query"> = {
|
|
54
|
+
data: ResponseData<E>;
|
|
55
|
+
};
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Reviews in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiMeta, ApiParameter, ExtraParameterType, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Available endpoints
|
|
7
|
+
*/
|
|
8
|
+
export type ReviewsEndpoints = "show" | "query";
|
|
9
|
+
/**
|
|
10
|
+
* Relationship fields that can be included
|
|
11
|
+
*/
|
|
12
|
+
export type ReviewsRelationshipsFields = "author" | "author.profileImage" | "author.marketplace" | "author.stripeAccount" | "author.effectivePermissionSet" | "listing" | "listing.marketplace" | "listing.author" | "listing.images" | "listing.currentStock" | "subject" | "subject.profileImage" | "subject.marketplace" | "subject.stripeAccount" | "subject.effectivePermissionSet";
|
|
13
|
+
/**
|
|
14
|
+
* Review types and states
|
|
15
|
+
*/
|
|
16
|
+
export type ReviewType = "ofProvider" | "ofCustomer";
|
|
17
|
+
export type ReviewState = "public" | "pending";
|
|
18
|
+
/**
|
|
19
|
+
* Review resource
|
|
20
|
+
*/
|
|
21
|
+
export interface Review {
|
|
22
|
+
id: UUID;
|
|
23
|
+
type: "review";
|
|
24
|
+
attributes: {
|
|
25
|
+
type: ReviewType;
|
|
26
|
+
state: ReviewState;
|
|
27
|
+
rating: number;
|
|
28
|
+
content: string;
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
deleted: boolean;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* With relationships
|
|
35
|
+
*/
|
|
36
|
+
export interface ReviewWithRelationships extends Review {
|
|
37
|
+
relationships: {
|
|
38
|
+
author: Relationship<false, "author">;
|
|
39
|
+
listing?: Relationship<false, "listing">;
|
|
40
|
+
subject: Relationship<false, "subject">;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Select type based on include
|
|
45
|
+
*/
|
|
46
|
+
export type ReviewResource<R extends boolean> = R extends true ? ReviewWithRelationships : Review;
|
|
47
|
+
/**
|
|
48
|
+
* Base request parameters
|
|
49
|
+
*/
|
|
50
|
+
export interface ReviewsParameter extends ApiParameter {
|
|
51
|
+
include?: ReviewsRelationshipsFields[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Show endpoint
|
|
55
|
+
*/
|
|
56
|
+
export interface ReviewsShowParameter extends ReviewsParameter {
|
|
57
|
+
id: UUID | string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Query endpoint
|
|
61
|
+
*/
|
|
62
|
+
export interface ReviewsQueryParameter extends ReviewsParameter {
|
|
63
|
+
transactionId?: UUID | string;
|
|
64
|
+
listingId?: UUID | string;
|
|
65
|
+
subjectId?: UUID | string;
|
|
66
|
+
type?: ReviewType;
|
|
67
|
+
state?: ReviewState;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* All parameter types
|
|
71
|
+
*/
|
|
72
|
+
type AllReviewsParameter = ReviewsShowParameter | ReviewsQueryParameter;
|
|
73
|
+
/**
|
|
74
|
+
* Detect include — fixed for TS2536
|
|
75
|
+
*/
|
|
76
|
+
type HasInclude<P> = P extends {
|
|
77
|
+
include: infer I extends readonly ReviewsRelationshipsFields[];
|
|
78
|
+
} ? I : never;
|
|
79
|
+
type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
|
|
80
|
+
/**
|
|
81
|
+
* Included resources — bulletproof
|
|
82
|
+
*/
|
|
83
|
+
type IncludedResources<P> = P extends {
|
|
84
|
+
include: infer I extends readonly ReviewsRelationshipsFields[];
|
|
85
|
+
} ? RelationshipTypeMap[I[number]][] : never;
|
|
86
|
+
/**
|
|
87
|
+
* Expand behavior
|
|
88
|
+
*/
|
|
89
|
+
type ExpandResult<T, EP extends ExtraParameterType | undefined> = EP extends {
|
|
90
|
+
expand: true;
|
|
91
|
+
} ? T : EP extends {
|
|
92
|
+
expand: false;
|
|
93
|
+
} ? Omit<T, "attributes"> : Omit<T, "attributes">;
|
|
94
|
+
/**
|
|
95
|
+
* Response data per endpoint
|
|
96
|
+
*/
|
|
97
|
+
type ResponseData<E extends ReviewsEndpoints, P extends AllReviewsParameter, EP extends ExtraParameterType | undefined> = E extends "query" ? ReviewResource<IncludesRelationships<P>>[] : E extends "show" ? ExpandResult<ReviewResource<IncludesRelationships<P>>, EP> : never;
|
|
98
|
+
/**
|
|
99
|
+
* Final response type
|
|
100
|
+
*/
|
|
101
|
+
export type ReviewsResponse<E extends ReviewsEndpoints, P extends AllReviewsParameter, EP extends ExtraParameterType | undefined = undefined> = {
|
|
102
|
+
data: ResponseData<E, P, EP>;
|
|
103
|
+
} & (IncludesRelationships<P> extends true ? {
|
|
104
|
+
included: IncludedResources<P>;
|
|
105
|
+
} : {}) & (E extends "query" ? {
|
|
106
|
+
meta: ApiMeta;
|
|
107
|
+
} : {});
|
|
108
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for SitemapData in the Sharetribe Marketplace API.
|
|
3
|
+
*
|
|
4
|
+
* The sitemap_data endpoints provide data for generating XML sitemaps:
|
|
5
|
+
* - queryListings: Returns up to 10,000 most recent public listings
|
|
6
|
+
* - queryAssets: Returns CMS pages/assets created in Console
|
|
7
|
+
*
|
|
8
|
+
* @see https://www.sharetribe.com/docs/concepts/sitemap-in-sharetribe/
|
|
9
|
+
*/
|
|
10
|
+
import { ApiMeta, UUID } from "../sharetribe";
|
|
11
|
+
/**
|
|
12
|
+
* Minimal listing data for sitemap generation
|
|
13
|
+
*/
|
|
14
|
+
export interface SitemapListing {
|
|
15
|
+
id: UUID;
|
|
16
|
+
type: "listing";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* CMS asset data for sitemap generation
|
|
20
|
+
*/
|
|
21
|
+
export interface SitemapAsset {
|
|
22
|
+
id: UUID;
|
|
23
|
+
type: "asset";
|
|
24
|
+
attributes: {
|
|
25
|
+
assetPath: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Response from sitemap_data/query_listings
|
|
30
|
+
*
|
|
31
|
+
* Returns up to 10,000 most recent public listings.
|
|
32
|
+
* Results are cached for 1 day.
|
|
33
|
+
*/
|
|
34
|
+
export interface SitemapListingsResponse {
|
|
35
|
+
data: SitemapListing[];
|
|
36
|
+
meta: ApiMeta;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Response from sitemap_data/query_assets
|
|
40
|
+
*
|
|
41
|
+
* Returns CMS pages created in Console.
|
|
42
|
+
* Excludes pages with built-in/custom paths.
|
|
43
|
+
*/
|
|
44
|
+
export interface SitemapAssetsResponse {
|
|
45
|
+
data: SitemapAsset[];
|
|
46
|
+
meta: ApiMeta;
|
|
47
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Stock operations in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ExtraParameterType, UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Available endpoints
|
|
7
|
+
*/
|
|
8
|
+
export type StockEndpoints = "compareAndSet";
|
|
9
|
+
/**
|
|
10
|
+
* Stock resource
|
|
11
|
+
*/
|
|
12
|
+
export interface Stock {
|
|
13
|
+
id: UUID;
|
|
14
|
+
type: "stock";
|
|
15
|
+
attributes: {
|
|
16
|
+
quantity: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parameters for compare-and-set operation
|
|
21
|
+
*/
|
|
22
|
+
export interface StockCompareAndSetParameter {
|
|
23
|
+
listingId: UUID | string;
|
|
24
|
+
oldTotal: number;
|
|
25
|
+
newTotal: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Expand behavior
|
|
29
|
+
*/
|
|
30
|
+
type ExpandResult<EP extends ExtraParameterType | undefined> = EP extends {
|
|
31
|
+
expand: true;
|
|
32
|
+
} ? Stock : EP extends {
|
|
33
|
+
expand: false;
|
|
34
|
+
} ? Omit<Stock, "attributes"> : Omit<Stock, "attributes">;
|
|
35
|
+
/**
|
|
36
|
+
* Response data per endpoint
|
|
37
|
+
*/
|
|
38
|
+
type ResponseData<E extends StockEndpoints, EP extends ExtraParameterType | undefined> = E extends "compareAndSet" ? ExpandResult<EP> : never;
|
|
39
|
+
/**
|
|
40
|
+
* Final response type
|
|
41
|
+
*/
|
|
42
|
+
export type StockResponse<E extends StockEndpoints = "compareAndSet", EP extends ExtraParameterType | undefined = undefined> = {
|
|
43
|
+
data: ResponseData<E, EP>;
|
|
44
|
+
};
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Stock Adjustments in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiMeta, ApiParameter, ExtraParameterType, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Available endpoints
|
|
7
|
+
*/
|
|
8
|
+
export type StockAdjustmentsEndpoints = "query" | "create" | "delete";
|
|
9
|
+
/**
|
|
10
|
+
* Relationship fields that can be included
|
|
11
|
+
*/
|
|
12
|
+
export type StockAdjustmentsRelationshipsFields = "ownListing" | "ownListing.marketplace" | "ownListing.author" | "ownListing.images" | "ownListing.currentStock" | "stockReservation";
|
|
13
|
+
/**
|
|
14
|
+
* Stock Adjustment resource
|
|
15
|
+
*/
|
|
16
|
+
export interface StockAdjustment {
|
|
17
|
+
id: UUID;
|
|
18
|
+
type: "stockAdjustment";
|
|
19
|
+
attributes: {
|
|
20
|
+
at: Date;
|
|
21
|
+
quantity: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* With relationships
|
|
26
|
+
*/
|
|
27
|
+
export interface StockAdjustmentWithRelationships extends StockAdjustment {
|
|
28
|
+
relationships: {
|
|
29
|
+
ownListing: Relationship<false, "ownListing">;
|
|
30
|
+
stockReservation: Relationship<false, "stockReservation">;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Select type based on include
|
|
35
|
+
*/
|
|
36
|
+
export type StockAdjustmentType<R extends boolean> = R extends true ? StockAdjustmentWithRelationships : StockAdjustment;
|
|
37
|
+
/**
|
|
38
|
+
* Base request parameters
|
|
39
|
+
*/
|
|
40
|
+
export interface StockAdjustmentsParameter extends ApiParameter {
|
|
41
|
+
include?: StockAdjustmentsRelationshipsFields[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Query endpoint
|
|
45
|
+
*/
|
|
46
|
+
export interface StockAdjustmentsQueryParameter extends StockAdjustmentsParameter {
|
|
47
|
+
listingId: UUID | string;
|
|
48
|
+
start: Date | string;
|
|
49
|
+
end: Date | string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create endpoint
|
|
53
|
+
*/
|
|
54
|
+
export interface StockAdjustmentsCreateParameter extends StockAdjustmentsParameter {
|
|
55
|
+
listingId: UUID | string;
|
|
56
|
+
quantity: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* All parameter types
|
|
60
|
+
*/
|
|
61
|
+
type AllStockAdjustmentsParameter = StockAdjustmentsQueryParameter | StockAdjustmentsCreateParameter;
|
|
62
|
+
/**
|
|
63
|
+
* Detect include + fix TS2536
|
|
64
|
+
*/
|
|
65
|
+
type HasInclude<P> = P extends {
|
|
66
|
+
include: infer I extends readonly StockAdjustmentsRelationshipsFields[];
|
|
67
|
+
} ? I : never;
|
|
68
|
+
type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
|
|
69
|
+
/**
|
|
70
|
+
* Included resources — bulletproof version (no TS2536)
|
|
71
|
+
*/
|
|
72
|
+
type IncludedResources<P> = P extends {
|
|
73
|
+
include: infer I extends readonly StockAdjustmentsRelationshipsFields[];
|
|
74
|
+
} ? RelationshipTypeMap[I[number]][] : never;
|
|
75
|
+
/**
|
|
76
|
+
* Expand behavior
|
|
77
|
+
*/
|
|
78
|
+
type ExpandResult<T, EP extends ExtraParameterType | undefined> = EP extends {
|
|
79
|
+
expand: true;
|
|
80
|
+
} ? T : EP extends {
|
|
81
|
+
expand: false;
|
|
82
|
+
} ? Omit<T, "attributes"> : Omit<T, "attributes">;
|
|
83
|
+
/**
|
|
84
|
+
* Response data per endpoint
|
|
85
|
+
*/
|
|
86
|
+
type ResponseData<E extends StockAdjustmentsEndpoints, P extends AllStockAdjustmentsParameter, EP extends ExtraParameterType | undefined> = E extends "query" ? StockAdjustmentType<IncludesRelationships<P>>[] : E extends "create" ? ExpandResult<StockAdjustmentType<IncludesRelationships<P>>, EP> : E extends "delete" ? Pick<StockAdjustment, "id" | "type"> : never;
|
|
87
|
+
/**
|
|
88
|
+
* Final response type
|
|
89
|
+
*/
|
|
90
|
+
export type StockAdjustmentsResponse<E extends StockAdjustmentsEndpoints, P extends AllStockAdjustmentsParameter, EP extends ExtraParameterType | undefined = undefined> = {
|
|
91
|
+
data: ResponseData<E, P, EP>;
|
|
92
|
+
} & (IncludesRelationships<P> extends true ? {
|
|
93
|
+
included: IncludedResources<P>;
|
|
94
|
+
} : {}) & (E extends "query" ? {
|
|
95
|
+
meta: ApiMeta;
|
|
96
|
+
} : {});
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Stock Reservations in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import { ApiParameter, ExtraParameterType, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
|
|
5
|
+
/**
|
|
6
|
+
* Available endpoints
|
|
7
|
+
*/
|
|
8
|
+
export type StockReservationsEndpoints = "show";
|
|
9
|
+
/**
|
|
10
|
+
* Relationship fields that can be included
|
|
11
|
+
*/
|
|
12
|
+
export type StockReservationsRelationshipsFields = "transaction" | "transaction.marketplace" | "transaction.listing" | "transaction.provider" | "transaction.customer" | "transaction.booking" | "transaction.stockReservation" | "transaction.reviews" | "transaction.messages";
|
|
13
|
+
/**
|
|
14
|
+
* Possible reservation states
|
|
15
|
+
*/
|
|
16
|
+
export type StockReservationState = "pending" | "proposed" | "accepted" | "declined" | "cancelled";
|
|
17
|
+
/**
|
|
18
|
+
* Stock Reservation resource
|
|
19
|
+
*/
|
|
20
|
+
export interface StockReservation {
|
|
21
|
+
id: UUID;
|
|
22
|
+
type: "stockReservation";
|
|
23
|
+
attributes: {
|
|
24
|
+
quantity: number;
|
|
25
|
+
state: StockReservationState;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* With relationships
|
|
30
|
+
*/
|
|
31
|
+
export interface StockReservationWithRelationships extends StockReservation {
|
|
32
|
+
relationships: {
|
|
33
|
+
listing: Relationship<false, "listing">;
|
|
34
|
+
transaction: Relationship<false, "transaction">;
|
|
35
|
+
stockAdjustments: Relationship<true, "stockAdjustment">;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Select type based on include
|
|
40
|
+
*/
|
|
41
|
+
export type StockReservationType<R extends boolean> = R extends true ? StockReservationWithRelationships : StockReservation;
|
|
42
|
+
/**
|
|
43
|
+
* Base request parameters
|
|
44
|
+
*/
|
|
45
|
+
export interface StockReservationParameter extends ApiParameter {
|
|
46
|
+
include?: StockReservationsRelationshipsFields[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Show endpoint parameters
|
|
50
|
+
*/
|
|
51
|
+
export interface StockReservationShowParameter extends StockReservationParameter {
|
|
52
|
+
id: UUID | string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* All parameter types
|
|
56
|
+
*/
|
|
57
|
+
type AllStockReservationsParameter = StockReservationShowParameter;
|
|
58
|
+
/**
|
|
59
|
+
* Detect include usage
|
|
60
|
+
*/
|
|
61
|
+
type HasInclude<P> = P extends {
|
|
62
|
+
include: infer I extends StockReservationsRelationshipsFields[];
|
|
63
|
+
} ? I : never;
|
|
64
|
+
type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
|
|
65
|
+
/**
|
|
66
|
+
* Included resources — fixed version (no TS2536)
|
|
67
|
+
*/
|
|
68
|
+
type IncludedResources<P> = HasInclude<P> extends infer Fields extends StockReservationsRelationshipsFields[] ? RelationshipTypeMap[Fields[number]][] : never;
|
|
69
|
+
/**
|
|
70
|
+
* Expand behavior
|
|
71
|
+
*/
|
|
72
|
+
type ExpandResult<T, EP extends ExtraParameterType | undefined> = EP extends {
|
|
73
|
+
expand: true;
|
|
74
|
+
} ? T : EP extends {
|
|
75
|
+
expand: false;
|
|
76
|
+
} ? Omit<T, "attributes"> : Omit<T, "attributes">;
|
|
77
|
+
/**
|
|
78
|
+
* Response data
|
|
79
|
+
*/
|
|
80
|
+
type ResponseData<E extends StockReservationsEndpoints, P extends AllStockReservationsParameter, EP extends ExtraParameterType | undefined> = E extends "show" ? ExpandResult<StockReservationType<IncludesRelationships<P>>, EP> : never;
|
|
81
|
+
/**
|
|
82
|
+
* Final response type
|
|
83
|
+
*/
|
|
84
|
+
export type StockReservationsResponse<E extends StockReservationsEndpoints = "show", P extends AllStockReservationsParameter = StockReservationShowParameter, EP extends ExtraParameterType | undefined = undefined> = {
|
|
85
|
+
data: ResponseData<E, P, EP>;
|
|
86
|
+
} & (IncludesRelationships<P> extends true ? {
|
|
87
|
+
included: IncludedResources<P>;
|
|
88
|
+
} : {});
|
|
89
|
+
export {};
|