@vansite/ts-sharetribe-flex-sdk 1.0.33 → 2.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/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 +80 -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} +53 -41
- 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} +13 -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} +13 -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 +28 -0
- package/dist/sdkTypes/UUID.d.ts +38 -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/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 +50 -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/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 +1 -1
- package/dist/types/sdkTypes/Money.d.ts.map +1 -1
- package/dist/types/sdkTypes/UUID.d.ts +1 -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/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/convert-types.d.ts.map +1 -1
- package/dist/types/utils/parameter-serializer.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 +1 -2
- package/dist/types/utils/stores/BrowserStore.d.ts.map +1 -1
- package/dist/types/utils/stores/ExpressStore.d.ts +6 -7
- 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/stores/store.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 +37 -0
- package/dist/utils/stores/ExpressStore.d.ts +48 -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 +18 -17
- 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,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Assets in the Sharetribe Marketplace API.
|
|
3
|
+
*/
|
|
4
|
+
import type { ApiParameter, Relationship, RelationshipTypeMap, UUID } from "../sharetribe";
|
|
5
|
+
import type { ImageVariant, ImageVariantName } from "../marketplace/images";
|
|
6
|
+
/**
|
|
7
|
+
* Available endpoints
|
|
8
|
+
*/
|
|
9
|
+
export type AssetEndpoints = "assetByAlias" | "assetsByAlias" | "assetByVersion" | "assetsByVersion";
|
|
10
|
+
/**
|
|
11
|
+
* Relationship fields
|
|
12
|
+
*/
|
|
13
|
+
export type AssetRelationshipsFields = "imageAsset";
|
|
14
|
+
/**
|
|
15
|
+
* Image asset resource
|
|
16
|
+
*/
|
|
17
|
+
export interface ImageAsset {
|
|
18
|
+
id: UUID;
|
|
19
|
+
type: "imageAsset";
|
|
20
|
+
attributes: {
|
|
21
|
+
assetPath: string;
|
|
22
|
+
variants: Partial<Record<ImageVariantName, ImageVariant>>;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generic JSON asset (e.g. config, translations)
|
|
27
|
+
*/
|
|
28
|
+
export type JsonAsset = Record<string, unknown>;
|
|
29
|
+
/**
|
|
30
|
+
* JSON asset with embedded image relationships
|
|
31
|
+
*/
|
|
32
|
+
export interface JsonAssetWithRelationships {
|
|
33
|
+
images: Relationship<true, "imageAsset">;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Base request parameters
|
|
37
|
+
*/
|
|
38
|
+
export interface AssetParameter extends ApiParameter {
|
|
39
|
+
include?: AssetRelationshipsFields[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Single asset by alias/version
|
|
43
|
+
*/
|
|
44
|
+
export interface AssetByAliasParameter extends AssetParameter {
|
|
45
|
+
path: string;
|
|
46
|
+
alias: string;
|
|
47
|
+
}
|
|
48
|
+
export interface AssetByVersionParameter extends AssetParameter {
|
|
49
|
+
path: string;
|
|
50
|
+
version: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Multiple assets by alias/version
|
|
54
|
+
*/
|
|
55
|
+
export interface AssetsByAliasParameter extends AssetParameter {
|
|
56
|
+
paths: string[];
|
|
57
|
+
alias: string;
|
|
58
|
+
}
|
|
59
|
+
export interface AssetsByVersionParameter extends AssetParameter {
|
|
60
|
+
paths: string[];
|
|
61
|
+
version: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* All parameter types
|
|
65
|
+
*/
|
|
66
|
+
type AllAssetParameter = AssetByAliasParameter | AssetsByAliasParameter | AssetByVersionParameter | AssetsByVersionParameter;
|
|
67
|
+
/**
|
|
68
|
+
* Detect if path ends with .json
|
|
69
|
+
*/
|
|
70
|
+
type IsJsonPath<Path extends string> = Path extends `${string}.json` ? true : false;
|
|
71
|
+
/**
|
|
72
|
+
* Resolve asset data type from path(s)
|
|
73
|
+
*/
|
|
74
|
+
type ResolveAssetType<P extends AllAssetParameter> = P extends {
|
|
75
|
+
path: infer Path extends string;
|
|
76
|
+
} ? IsJsonPath<Path> extends true ? JsonAsset : ImageAsset : P extends {
|
|
77
|
+
paths: infer Paths extends string[];
|
|
78
|
+
} ? Paths extends [string] ? IsJsonPath<Paths[0]> extends true ? JsonAsset : ImageAsset : JsonAsset | ImageAsset : never;
|
|
79
|
+
/**
|
|
80
|
+
* Include detection — fixes TS2536
|
|
81
|
+
*/
|
|
82
|
+
type HasInclude<P> = P extends {
|
|
83
|
+
include: infer I extends readonly AssetRelationshipsFields[];
|
|
84
|
+
} ? I : never;
|
|
85
|
+
type IncludesRelationships<P> = HasInclude<P> extends never ? false : true;
|
|
86
|
+
type IncludedResources<P> = P extends {
|
|
87
|
+
include: infer I extends readonly AssetRelationshipsFields[];
|
|
88
|
+
} ? RelationshipTypeMap["imageAsset"][] : never;
|
|
89
|
+
/**
|
|
90
|
+
* Response data per endpoint
|
|
91
|
+
*/
|
|
92
|
+
type ResponseData<E extends AssetEndpoints, P extends AllAssetParameter> = ResolveAssetType<P>;
|
|
93
|
+
/**
|
|
94
|
+
* Final response type
|
|
95
|
+
*/
|
|
96
|
+
export type AssetResponse<E extends AssetEndpoints, P extends AllAssetParameter> = {
|
|
97
|
+
data: ResponseData<E, P>;
|
|
98
|
+
} & (IncludesRelationships<P> extends true ? {
|
|
99
|
+
included: IncludedResources<P>;
|
|
100
|
+
} : {});
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for Sharetribe Authentication API (OAuth2)
|
|
3
|
+
*
|
|
4
|
+
* @see https://www.sharetribe.com/api-reference/authentication.html
|
|
5
|
+
*/
|
|
6
|
+
import type { UUID } from "../sharetribe";
|
|
7
|
+
/**
|
|
8
|
+
* OAuth2 grant types
|
|
9
|
+
*/
|
|
10
|
+
export type GrantType = "client_credentials" | "password" | "authorization_code" | "refresh_token" | "token_exchange";
|
|
11
|
+
/**
|
|
12
|
+
* Available scopes
|
|
13
|
+
*/
|
|
14
|
+
export type Scope = "public-read" | "user" | "trusted:user" | "integ" | "details" | "refresh-token";
|
|
15
|
+
/**
|
|
16
|
+
* Identity provider ID (built-in + custom)
|
|
17
|
+
*/
|
|
18
|
+
export type IdentityProviderId = "facebook" | "google" | string;
|
|
19
|
+
export type LoginParameterType = "user" | "auth_code";
|
|
20
|
+
/**
|
|
21
|
+
* Base token request
|
|
22
|
+
*/
|
|
23
|
+
interface BaseTokenRequest {
|
|
24
|
+
client_id: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Public read access (anonymous)
|
|
28
|
+
*/
|
|
29
|
+
export type AnonymousTokenRequest = BaseTokenRequest & {
|
|
30
|
+
grant_type: "client_credentials";
|
|
31
|
+
scope: "public-read";
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* User authentication (password or authorization code)
|
|
35
|
+
*/
|
|
36
|
+
export type UserTokenRequest = BaseTokenRequest & {
|
|
37
|
+
scope: "user";
|
|
38
|
+
grant_type: "password";
|
|
39
|
+
username: string;
|
|
40
|
+
password: string;
|
|
41
|
+
};
|
|
42
|
+
export type UserTokenRequestWithAuthCode = BaseTokenRequest & {
|
|
43
|
+
scope: "user";
|
|
44
|
+
grant_type: "authorization_code";
|
|
45
|
+
code: string;
|
|
46
|
+
redirect_uri: string;
|
|
47
|
+
code_verifier: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Admin "login as" flow
|
|
51
|
+
*/
|
|
52
|
+
export type LoginAsTokenRequest = BaseTokenRequest & {
|
|
53
|
+
grant_type: "authorization_code";
|
|
54
|
+
scope: "user";
|
|
55
|
+
code: string;
|
|
56
|
+
redirect_uri: string;
|
|
57
|
+
code_verifier: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Trusted impersonation
|
|
61
|
+
*/
|
|
62
|
+
export type TrustedUserTokenRequest = BaseTokenRequest & {
|
|
63
|
+
client_secret: string;
|
|
64
|
+
grant_type: "token_exchange";
|
|
65
|
+
scope: "trusted:user";
|
|
66
|
+
subject_token: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Integration API access
|
|
70
|
+
*/
|
|
71
|
+
export type IntegrationTokenRequest = BaseTokenRequest & {
|
|
72
|
+
client_secret: string;
|
|
73
|
+
grant_type: "client_credentials";
|
|
74
|
+
scope: "integ";
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Refresh token
|
|
78
|
+
*/
|
|
79
|
+
export type RefreshTokenRequest = BaseTokenRequest & {
|
|
80
|
+
grant_type: "refresh_token";
|
|
81
|
+
refresh_token: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Token introspection endpoint (no body)
|
|
85
|
+
*/
|
|
86
|
+
export type DetailsRequest = void;
|
|
87
|
+
/**
|
|
88
|
+
* All valid token request types
|
|
89
|
+
*/
|
|
90
|
+
export type TokenRequest = AnonymousTokenRequest | UserTokenRequest | UserTokenRequestWithAuthCode | LoginAsTokenRequest | TrustedUserTokenRequest | IntegrationTokenRequest | RefreshTokenRequest | DetailsRequest;
|
|
91
|
+
/**
|
|
92
|
+
* Login parameter
|
|
93
|
+
*/
|
|
94
|
+
export type LoginParameter<T extends LoginParameterType> = T extends "user" ? {
|
|
95
|
+
username: string;
|
|
96
|
+
password: string;
|
|
97
|
+
} : T extends "auth_code" ? {
|
|
98
|
+
code: string;
|
|
99
|
+
redirect_uri: string;
|
|
100
|
+
code_verifier: string;
|
|
101
|
+
} : never;
|
|
102
|
+
export type LoginWithIdpParameter = {
|
|
103
|
+
idpId: IdentityProviderId;
|
|
104
|
+
idpClientId: string;
|
|
105
|
+
idpToken: string;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Login with external IdP
|
|
109
|
+
*/
|
|
110
|
+
export type AuthWithIdpParameter = {
|
|
111
|
+
client_id: string;
|
|
112
|
+
client_secret: string;
|
|
113
|
+
} & LoginWithIdpParameter;
|
|
114
|
+
/**
|
|
115
|
+
* Successful token response
|
|
116
|
+
*/
|
|
117
|
+
export interface AuthToken {
|
|
118
|
+
access_token: string;
|
|
119
|
+
token_type: "bearer";
|
|
120
|
+
expires_in: number;
|
|
121
|
+
scope?: Scope | Scope[];
|
|
122
|
+
refresh_token?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Token introspection response
|
|
126
|
+
*/
|
|
127
|
+
export interface TokenDetails {
|
|
128
|
+
"client-id": string;
|
|
129
|
+
exp: number;
|
|
130
|
+
scope: Scope[];
|
|
131
|
+
isLoggedInAs?: UUID | null;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Token response by endpoint
|
|
135
|
+
*/
|
|
136
|
+
export type TokenResponse<T extends TokenRequest> = T extends DetailsRequest ? TokenDetails : AuthToken;
|
|
137
|
+
/**
|
|
138
|
+
* Revoke response
|
|
139
|
+
*/
|
|
140
|
+
export interface RevokeResponse {
|
|
141
|
+
revoked: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Auth info response
|
|
145
|
+
*/
|
|
146
|
+
export type AuthInfoResponse = {
|
|
147
|
+
scopes?: Scope[];
|
|
148
|
+
isAnonymous?: boolean;
|
|
149
|
+
grantType?: GrantType;
|
|
150
|
+
isLoggedInAs?: string;
|
|
151
|
+
};
|
|
152
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InternalAxiosRequestConfig } from "axios";
|
|
2
|
+
/**
|
|
3
|
+
* Extended type for Axios internal request configuration to include a retry flag.
|
|
4
|
+
*/
|
|
5
|
+
export type ExtendedInternalAxiosRequestConfig = InternalAxiosRequestConfig & {
|
|
6
|
+
/**
|
|
7
|
+
* Indicates whether the request has been retried.
|
|
8
|
+
*/
|
|
9
|
+
_retry: boolean;
|
|
10
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import UUID from "../sdkTypes/UUID";
|
|
2
|
+
import LatLng from "../sdkTypes/LatLng";
|
|
3
|
+
import Money from "../sdkTypes/Money";
|
|
4
|
+
import LatLngBounds from "../sdkTypes/LatLngBounds";
|
|
5
|
+
import BigDecimal from "../sdkTypes/BigDecimal";
|
|
6
|
+
import { Agent as HttpAgent } from "http";
|
|
7
|
+
import { Agent as HttpsAgent } from "https";
|
|
8
|
+
import { TokenStore } from "./store";
|
|
9
|
+
/**
|
|
10
|
+
* Supported SDK type classes.
|
|
11
|
+
*/
|
|
12
|
+
type SdkTypeClass = typeof UUID | typeof LatLng | typeof Money | typeof LatLngBounds | typeof BigDecimal;
|
|
13
|
+
/**
|
|
14
|
+
* Supported SDK type instances.
|
|
15
|
+
*/
|
|
16
|
+
type SdkTypeInstance = UUID | LatLng | Money | LatLngBounds | BigDecimal;
|
|
17
|
+
/**
|
|
18
|
+
* Represents application-specific types.
|
|
19
|
+
* `AppType` is set to `any` to allow flexibility.
|
|
20
|
+
*/
|
|
21
|
+
type AppType = any;
|
|
22
|
+
/**
|
|
23
|
+
* Interface for handling type transformations between SDK and application-specific types.
|
|
24
|
+
* T represents the specific SDK type instance (e.g., UUID, Money)
|
|
25
|
+
* U represents the specific application type
|
|
26
|
+
*/
|
|
27
|
+
export interface TypeHandler<T extends SdkTypeInstance = SdkTypeInstance, U = any> {
|
|
28
|
+
sdkType: SdkTypeClass;
|
|
29
|
+
appType: AppType;
|
|
30
|
+
/**
|
|
31
|
+
* Function to read and transform a specific SDK type instance into an application-specific type.
|
|
32
|
+
*/
|
|
33
|
+
reader?: (value: T) => U;
|
|
34
|
+
/**
|
|
35
|
+
* Function to write and transform an application-specific type into a specific SDK type instance.
|
|
36
|
+
*/
|
|
37
|
+
writer?: (value: U) => T;
|
|
38
|
+
/**
|
|
39
|
+
* Function to determine if a handler can process a specific key-value pair.
|
|
40
|
+
*/
|
|
41
|
+
canHandle?: (args: {
|
|
42
|
+
key: string;
|
|
43
|
+
value: any;
|
|
44
|
+
}) => boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Interface for SDK configuration settings.
|
|
48
|
+
*/
|
|
49
|
+
export interface SdkConfig {
|
|
50
|
+
/**
|
|
51
|
+
* The client ID. Must be non-empty (enforced at runtime).
|
|
52
|
+
*/
|
|
53
|
+
clientId: string;
|
|
54
|
+
/**
|
|
55
|
+
* The client secret (optional).
|
|
56
|
+
*/
|
|
57
|
+
clientSecret?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Base URL for the SDK. Should not end with '/' (enforced at runtime).
|
|
60
|
+
*/
|
|
61
|
+
baseUrl?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Base URL for asset CDN. Should not end with '/' (enforced at runtime).
|
|
64
|
+
*/
|
|
65
|
+
assetCdnBaseUrl?: string;
|
|
66
|
+
/**
|
|
67
|
+
* SDK version (optional).
|
|
68
|
+
*/
|
|
69
|
+
version?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Token store for managing authentication tokens.
|
|
72
|
+
*/
|
|
73
|
+
tokenStore?: TokenStore;
|
|
74
|
+
/**
|
|
75
|
+
* Whether to use secure connections.
|
|
76
|
+
*/
|
|
77
|
+
secure?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to enable verbose mode for Transit serialization.
|
|
80
|
+
*/
|
|
81
|
+
transitVerbose?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Predefined authentication token.
|
|
84
|
+
*/
|
|
85
|
+
authToken?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Custom type handlers for transforming data.
|
|
88
|
+
*/
|
|
89
|
+
typeHandlers?: TypeHandler<any, any>[];
|
|
90
|
+
/**
|
|
91
|
+
* Http Agent
|
|
92
|
+
*/
|
|
93
|
+
httpAgent?: HttpAgent;
|
|
94
|
+
/**
|
|
95
|
+
* Https Agent
|
|
96
|
+
*/
|
|
97
|
+
httpsAgent?: HttpsAgent;
|
|
98
|
+
}
|
|
99
|
+
export {};
|
|
@@ -1,62 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Provides the AssetsApi class for interacting with the Sharetribe Asset Delivery API.
|
|
3
|
-
* This class includes methods to retrieve assets by alias or version.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
* https://www.sharetribe.com/api-reference/asset-delivery-api.html
|
|
4
|
+
* @see https://www.sharetribe.com/api-reference/asset-delivery-api.html
|
|
7
5
|
*/
|
|
6
|
+
import type { AxiosResponse } from "axios";
|
|
8
7
|
import SharetribeSdk from "../../sdk";
|
|
9
|
-
import {
|
|
10
|
-
import { AssetByAliasParameter, AssetByVersionParameter, AssetResponse, AssetsByAliasParameter, AssetsByVersionParameter } from "../../types/assets";
|
|
11
|
-
/**
|
|
12
|
-
* Class representing the Assets API for interacting with the Sharetribe Asset Delivery API.
|
|
13
|
-
*/
|
|
8
|
+
import { AssetByAliasParameter, AssetByVersionParameter, AssetResponse, AssetsByAliasParameter, AssetsByVersionParameter } from "../../types";
|
|
14
9
|
declare class AssetsApi {
|
|
15
|
-
axios
|
|
16
|
-
endpoint
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Creates an instance of AssetsApi.
|
|
20
|
-
*
|
|
21
|
-
* @param {SharetribeSdk} sdk - The Sharetribe SDK instance for configuration and request handling.
|
|
22
|
-
*/
|
|
10
|
+
private readonly axios;
|
|
11
|
+
private readonly endpoint;
|
|
12
|
+
private readonly headers;
|
|
23
13
|
constructor(sdk: SharetribeSdk);
|
|
24
14
|
/**
|
|
25
|
-
*
|
|
15
|
+
* Fetch a single asset by alias (e.g. "latest")
|
|
26
16
|
*
|
|
27
17
|
* @template P
|
|
28
|
-
* @param {P & AssetByAliasParameter} params
|
|
29
|
-
* @returns {Promise<AssetResponse<
|
|
30
|
-
* @throws {Error} If the path starts with a leading slash.
|
|
18
|
+
* @param {P & AssetByAliasParameter} params
|
|
19
|
+
* @returns {Promise<AxiosResponse<AssetResponse<"assetByAlias", P & AssetByAliasParameter>>>}
|
|
31
20
|
*/
|
|
32
|
-
assetByAlias<P extends AssetByAliasParameter>(params: P): Promise<AxiosResponse<AssetResponse<"assetByAlias", P>>>;
|
|
21
|
+
assetByAlias<P extends AssetByAliasParameter>(params: P & AssetByAliasParameter): Promise<AxiosResponse<AssetResponse<"assetByAlias", P & AssetByAliasParameter>>>;
|
|
33
22
|
/**
|
|
34
|
-
*
|
|
23
|
+
* Fetch multiple assets by alias from the same directory
|
|
35
24
|
*
|
|
36
25
|
* @template P
|
|
37
|
-
* @param {P & AssetsByAliasParameter} params
|
|
38
|
-
* @returns {Promise<AssetResponse<
|
|
39
|
-
* @throws {Error} If any path starts with a leading slash or if paths are empty.
|
|
26
|
+
* @param {P & AssetsByAliasParameter} params
|
|
27
|
+
* @returns {Promise<AxiosResponse<AssetResponse<"assetsByAlias", P & AssetsByAliasParameter>>>}
|
|
40
28
|
*/
|
|
41
|
-
assetsByAlias<P extends AssetsByAliasParameter>(params: P): Promise<AxiosResponse<AssetResponse<"assetsByAlias", P>>>;
|
|
29
|
+
assetsByAlias<P extends AssetsByAliasParameter>(params: P & AssetsByAliasParameter): Promise<AxiosResponse<AssetResponse<"assetsByAlias", P & AssetsByAliasParameter>>>;
|
|
42
30
|
/**
|
|
43
|
-
*
|
|
31
|
+
* Fetch a single asset by version
|
|
44
32
|
*
|
|
45
33
|
* @template P
|
|
46
|
-
* @param {P & AssetByVersionParameter} params
|
|
47
|
-
* @returns {Promise<AssetResponse<
|
|
48
|
-
* @throws {Error} If the path starts with a leading slash.
|
|
34
|
+
* @param {P & AssetByVersionParameter} params
|
|
35
|
+
* @returns {Promise<AxiosResponse<AssetResponse<"assetByVersion", P & AssetByVersionParameter>>>}
|
|
49
36
|
*/
|
|
50
|
-
assetByVersion<P extends AssetByVersionParameter>(params: P): Promise<AxiosResponse<AssetResponse<"assetByVersion", P>>>;
|
|
37
|
+
assetByVersion<P extends AssetByVersionParameter>(params: P & AssetByVersionParameter): Promise<AxiosResponse<AssetResponse<"assetByVersion", P & AssetByVersionParameter>>>;
|
|
51
38
|
/**
|
|
52
|
-
*
|
|
39
|
+
* Fetch multiple assets by version from the same directory
|
|
53
40
|
*
|
|
54
41
|
* @template P
|
|
55
|
-
* @param {P & AssetsByVersionParameter} params
|
|
56
|
-
* @returns {Promise<AssetResponse<
|
|
57
|
-
* @throws {Error} If any path starts with a leading slash.
|
|
42
|
+
* @param {P & AssetsByVersionParameter} params
|
|
43
|
+
* @returns {Promise<AxiosResponse<AssetResponse<"assetsByVersion", P & AssetsByVersionParameter>>>}
|
|
58
44
|
*/
|
|
59
|
-
assetsByVersion<P extends AssetsByVersionParameter>(params: P): Promise<AxiosResponse<AssetResponse<"assetsByVersion", P>>>;
|
|
45
|
+
assetsByVersion<P extends AssetsByVersionParameter>(params: P & AssetsByVersionParameter): Promise<AxiosResponse<AssetResponse<"assetsByVersion", P & AssetsByVersionParameter>>>;
|
|
60
46
|
}
|
|
61
47
|
export default AssetsApi;
|
|
62
48
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/endpoints/assets/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/endpoints/assets/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAgB,aAAa,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,aAAa,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,aAAa,CAAC;AA8BrB,cAAM,SAAS;IACb,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;gBAErC,GAAG,EAAE,aAAa;IAO9B;;;;;;OAMG;IACG,YAAY,CAAC,CAAC,SAAS,qBAAqB,EAChD,MAAM,EAAE,CAAC,GAAG,qBAAqB,GAChC,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC;IAQnF;;;;;;OAMG;IACG,aAAa,CAAC,CAAC,SAAS,sBAAsB,EAClD,MAAM,EAAE,CAAC,GAAG,sBAAsB,GACjC,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC;IAerF;;;;;;OAMG;IACG,cAAc,CAAC,CAAC,SAAS,uBAAuB,EACpD,MAAM,EAAE,CAAC,GAAG,uBAAuB,GAClC,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC,GAAG,uBAAuB,CAAC,CAAC,CAAC;IAQvF;;;;;;OAMG;IACG,eAAe,CAAC,CAAC,SAAS,wBAAwB,EACtD,MAAM,EAAE,CAAC,GAAG,wBAAwB,GACnC,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,iBAAiB,EAAE,CAAC,GAAG,wBAAwB,CAAC,CAAC,CAAC;CAc1F;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,67 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview
|
|
3
|
-
* This class includes methods to obtain and manage access tokens for authenticating requests to the Marketplace API and Integration API.
|
|
2
|
+
* @fileoverview Client for Sharetribe Authentication API (OAuth2)
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
* https://www.sharetribe.com/api-reference/authentication.html
|
|
4
|
+
* @see https://www.sharetribe.com/api-reference/authentication.html
|
|
7
5
|
*/
|
|
8
|
-
import {
|
|
9
|
-
import { AxiosResponse } from "axios";
|
|
6
|
+
import type { AxiosResponse } from "axios";
|
|
10
7
|
import SharetribeSdk from "../../sdk";
|
|
11
8
|
import IntegrationSdk from "../../integrationSdk";
|
|
9
|
+
import { AuthWithIdpParameter, RevokeResponse, TokenDetails, TokenRequest, TokenResponse, UserTokenRequest } from "../../types";
|
|
12
10
|
/**
|
|
13
|
-
*
|
|
14
|
-
* Properly handles nested objects, arrays, and special types.
|
|
15
|
-
*
|
|
16
|
-
* @param {Record<string, any> | void} obj - The object to convert
|
|
17
|
-
* @returns {string} URL-encoded form data string
|
|
18
|
-
*/
|
|
19
|
-
export declare function urlEncodeFormData(obj: Record<string, any> | null | undefined | void): string;
|
|
20
|
-
/**
|
|
21
|
-
* Class representing the Authentication API for obtaining and managing access tokens.
|
|
22
|
-
*
|
|
23
|
-
* The Authentication API follows the OAuth2 framework and supports various grant types to issue tokens for authenticating requests.
|
|
24
|
-
*
|
|
25
|
-
* @see https://www.sharetribe.com/api-reference/authentication.html
|
|
11
|
+
* Encodes object as application/x-www-form-urlencoded
|
|
26
12
|
*/
|
|
13
|
+
export declare const urlEncodeFormData: (obj: Record<string, any> | null) => string;
|
|
27
14
|
declare class AuthenticationApi {
|
|
15
|
+
private readonly axios;
|
|
28
16
|
private readonly endpoint;
|
|
29
17
|
private readonly headers;
|
|
30
|
-
private axios;
|
|
31
|
-
/**
|
|
32
|
-
* Creates an instance of AuthenticationApi.
|
|
33
|
-
*
|
|
34
|
-
* @param {SharetribeSdk | IntegrationSdk} sdk - The Sharetribe SDK or Integration SDK instance for configuration and request handling.
|
|
35
|
-
*/
|
|
36
18
|
constructor(sdk: SharetribeSdk | IntegrationSdk);
|
|
37
19
|
/**
|
|
38
|
-
*
|
|
20
|
+
* Request a token using any supported OAuth2 grant
|
|
39
21
|
*
|
|
40
|
-
* @template
|
|
41
|
-
* @param {
|
|
42
|
-
* @returns {Promise<TokenResponse<
|
|
22
|
+
* @template T - Token request type
|
|
23
|
+
* @param {T} params - OAuth2 token request parameters
|
|
24
|
+
* @returns {Promise<AxiosResponse<TokenResponse<T>>>}
|
|
43
25
|
*/
|
|
44
|
-
token<
|
|
26
|
+
token<T extends TokenRequest>(params: T): Promise<AxiosResponse<TokenResponse<T>>>;
|
|
45
27
|
/**
|
|
46
|
-
*
|
|
28
|
+
* Authenticate via external Identity Provider
|
|
47
29
|
*
|
|
48
|
-
* @param {AuthWithIdpParameter} params
|
|
49
|
-
* @returns {Promise<TokenResponse<
|
|
30
|
+
* @param {AuthWithIdpParameter} params
|
|
31
|
+
* @returns {Promise<AxiosResponse<TokenResponse<UserTokenRequest>>>}
|
|
50
32
|
*/
|
|
51
|
-
authWithIdp
|
|
33
|
+
authWithIdp(params: AuthWithIdpParameter): Promise<AxiosResponse<TokenResponse<UserTokenRequest>>>;
|
|
52
34
|
/**
|
|
53
|
-
*
|
|
35
|
+
* Revoke a refresh token
|
|
54
36
|
*
|
|
55
|
-
* @param {string} token -
|
|
56
|
-
* @returns {Promise<RevokeResponse>} - A promise resolving to the revoke response.
|
|
37
|
+
* @param {string} token - Refresh token to revoke
|
|
57
38
|
*/
|
|
58
39
|
revoke(token: string): Promise<AxiosResponse<RevokeResponse>>;
|
|
59
40
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* @returns {Promise<TokenResponse<'details'>>} - A promise resolving to the token details response.
|
|
41
|
+
* Introspect current access token
|
|
63
42
|
*/
|
|
64
|
-
details(): Promise<AxiosResponse<
|
|
43
|
+
details(): Promise<AxiosResponse<TokenDetails>>;
|
|
65
44
|
}
|
|
66
45
|
export default AuthenticationApi;
|
|
67
46
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/endpoints/auth/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/endpoints/auth/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAgB,aAAa,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,aAAa,MAAM,WAAW,CAAC;AACtC,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAAG,MAenE,CAAC;AAEF,cAAM,iBAAiB;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;gBAErC,GAAG,EAAE,aAAa,GAAG,cAAc;IAO/C;;;;;;OAMG;IACG,KAAK,CAAC,CAAC,SAAS,YAAY,EAChC,MAAM,EAAE,CAAC,GACR,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAQ3C;;;;;OAKG;IACG,WAAW,CACf,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAQ1D;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAQnE;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;CAKtD;AAED,eAAe,iBAAiB,CAAC"}
|