checkout-intents 0.1.0 → 0.2.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/CHANGELOG.md +35 -0
- package/LICENSE +4 -198
- package/README.md +103 -22
- package/client.d.mts +21 -7
- package/client.d.mts.map +1 -1
- package/client.d.ts +21 -7
- package/client.d.ts.map +1 -1
- package/client.js +20 -10
- package/client.js.map +1 -1
- package/client.mjs +20 -10
- package/client.mjs.map +1 -1
- package/internal/to-file.d.mts +1 -1
- package/internal/to-file.d.ts +1 -1
- package/internal/to-file.js +1 -1
- package/internal/to-file.mjs +1 -1
- package/internal/tslib.js +17 -17
- package/internal/utils/values.js +3 -3
- package/internal/utils/values.js.map +1 -1
- package/internal/utils/values.mjs +3 -3
- package/internal/utils/values.mjs.map +1 -1
- package/package.json +3 -3
- package/resources/brands.d.mts +31 -0
- package/resources/brands.d.mts.map +1 -0
- package/resources/brands.d.ts +31 -0
- package/resources/brands.d.ts.map +1 -0
- package/resources/{api/v1/brands.js → brands.js} +5 -5
- package/resources/brands.js.map +1 -0
- package/resources/brands.mjs +15 -0
- package/resources/brands.mjs.map +1 -0
- package/resources/{api/v1/checkout-intents.d.mts → checkout-intents.d.mts} +93 -13
- package/resources/checkout-intents.d.mts.map +1 -0
- package/resources/{api/v1/checkout-intents.d.ts → checkout-intents.d.ts} +93 -13
- package/resources/checkout-intents.d.ts.map +1 -0
- package/resources/checkout-intents.js +88 -0
- package/resources/checkout-intents.js.map +1 -0
- package/resources/checkout-intents.mjs +84 -0
- package/resources/checkout-intents.mjs.map +1 -0
- package/resources/index.d.mts +2 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -5
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -2
- package/resources/index.mjs.map +1 -1
- package/src/client.ts +62 -14
- package/src/internal/to-file.ts +1 -1
- package/src/internal/utils/values.ts +3 -3
- package/src/resources/{api/v1/brands.ts → brands.ts} +9 -9
- package/src/resources/{api/v1/checkout-intents.ts → checkout-intents.ts} +116 -14
- package/src/resources/index.ts +14 -2
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/api/api.d.mts +0 -10
- package/resources/api/api.d.mts.map +0 -1
- package/resources/api/api.d.ts +0 -10
- package/resources/api/api.d.ts.map +0 -1
- package/resources/api/api.js +0 -17
- package/resources/api/api.js.map +0 -1
- package/resources/api/api.mjs +0 -12
- package/resources/api/api.mjs.map +0 -1
- package/resources/api/index.d.mts +0 -3
- package/resources/api/index.d.mts.map +0 -1
- package/resources/api/index.d.ts +0 -3
- package/resources/api/index.d.ts.map +0 -1
- package/resources/api/index.js +0 -9
- package/resources/api/index.js.map +0 -1
- package/resources/api/index.mjs +0 -4
- package/resources/api/index.mjs.map +0 -1
- package/resources/api/v1/brands.d.mts +0 -31
- package/resources/api/v1/brands.d.mts.map +0 -1
- package/resources/api/v1/brands.d.ts +0 -31
- package/resources/api/v1/brands.d.ts.map +0 -1
- package/resources/api/v1/brands.js.map +0 -1
- package/resources/api/v1/brands.mjs +0 -15
- package/resources/api/v1/brands.mjs.map +0 -1
- package/resources/api/v1/checkout-intents.d.mts.map +0 -1
- package/resources/api/v1/checkout-intents.d.ts.map +0 -1
- package/resources/api/v1/checkout-intents.js +0 -33
- package/resources/api/v1/checkout-intents.js.map +0 -1
- package/resources/api/v1/checkout-intents.mjs +0 -29
- package/resources/api/v1/checkout-intents.mjs.map +0 -1
- package/resources/api/v1/index.d.mts +0 -4
- package/resources/api/v1/index.d.mts.map +0 -1
- package/resources/api/v1/index.d.ts +0 -4
- package/resources/api/v1/index.d.ts.map +0 -1
- package/resources/api/v1/index.js +0 -11
- package/resources/api/v1/index.js.map +0 -1
- package/resources/api/v1/index.mjs +0 -5
- package/resources/api/v1/index.mjs.map +0 -1
- package/resources/api/v1/v1.d.mts +0 -14
- package/resources/api/v1/v1.d.mts.map +0 -1
- package/resources/api/v1/v1.d.ts +0 -14
- package/resources/api/v1/v1.d.ts.map +0 -1
- package/resources/api/v1/v1.js +0 -21
- package/resources/api/v1/v1.js.map +0 -1
- package/resources/api/v1/v1.mjs +0 -16
- package/resources/api/v1/v1.mjs.map +0 -1
- package/resources/api/v1.d.mts +0 -2
- package/resources/api/v1.d.mts.map +0 -1
- package/resources/api/v1.d.ts +0 -2
- package/resources/api/v1.d.ts.map +0 -1
- package/resources/api/v1.js +0 -6
- package/resources/api/v1.js.map +0 -1
- package/resources/api/v1.mjs +0 -3
- package/resources/api/v1.mjs.map +0 -1
- package/resources/api.d.mts +0 -2
- package/resources/api.d.mts.map +0 -1
- package/resources/api.d.ts +0 -2
- package/resources/api.d.ts.map +0 -1
- package/resources/api.js +0 -6
- package/resources/api.js.map +0 -1
- package/resources/api.mjs +0 -3
- package/resources/api.mjs.map +0 -1
- package/resources/health.d.mts +0 -17
- package/resources/health.d.mts.map +0 -1
- package/resources/health.d.ts +0 -17
- package/resources/health.d.ts.map +0 -1
- package/resources/health.js +0 -15
- package/resources/health.js.map +0 -1
- package/resources/health.mjs +0 -11
- package/resources/health.mjs.map +0 -1
- package/src/resources/api/api.ts +0 -15
- package/src/resources/api/index.ts +0 -4
- package/src/resources/api/v1/index.ts +0 -15
- package/src/resources/api/v1/v1.ts +0 -41
- package/src/resources/api/v1.ts +0 -3
- package/src/resources/api.ts +0 -3
- package/src/resources/health.ts +0 -24
package/src/client.ts
CHANGED
|
@@ -16,8 +16,20 @@ import * as Errors from './core/error';
|
|
|
16
16
|
import * as Uploads from './core/uploads';
|
|
17
17
|
import * as API from './resources/index';
|
|
18
18
|
import { APIPromise } from './core/api-promise';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
19
|
+
import { BrandRetrieveResponse, Brands } from './resources/brands';
|
|
20
|
+
import {
|
|
21
|
+
BaseCheckoutIntent,
|
|
22
|
+
Buyer,
|
|
23
|
+
CheckoutIntent,
|
|
24
|
+
CheckoutIntentAddPaymentParams,
|
|
25
|
+
CheckoutIntentConfirmParams,
|
|
26
|
+
CheckoutIntentCreateParams,
|
|
27
|
+
CheckoutIntentsResource,
|
|
28
|
+
Money,
|
|
29
|
+
Offer,
|
|
30
|
+
PaymentMethod,
|
|
31
|
+
VariantSelection,
|
|
32
|
+
} from './resources/checkout-intents';
|
|
21
33
|
import { type Fetch } from './internal/builtin-types';
|
|
22
34
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
23
35
|
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
@@ -31,12 +43,27 @@ import {
|
|
|
31
43
|
} from './internal/utils/log';
|
|
32
44
|
import { isEmptyObj } from './internal/utils/values';
|
|
33
45
|
|
|
46
|
+
const environments = {
|
|
47
|
+
staging: 'https://staging.api.rye.com/',
|
|
48
|
+
production: 'https://api.rye.com/',
|
|
49
|
+
};
|
|
50
|
+
type Environment = keyof typeof environments;
|
|
51
|
+
|
|
34
52
|
export interface ClientOptions {
|
|
35
53
|
/**
|
|
36
|
-
* Rye API key. Format: `
|
|
54
|
+
* Rye API key. Format: `RYE/{environment}-abcdef`
|
|
37
55
|
*/
|
|
38
56
|
apiKey?: string | undefined;
|
|
39
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Specifies the environment to use for the API.
|
|
60
|
+
*
|
|
61
|
+
* Each environment maps to a different base URL:
|
|
62
|
+
* - `staging` corresponds to `https://staging.api.rye.com/`
|
|
63
|
+
* - `production` corresponds to `https://api.rye.com/`
|
|
64
|
+
*/
|
|
65
|
+
environment?: Environment | undefined;
|
|
66
|
+
|
|
40
67
|
/**
|
|
41
68
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
42
69
|
*
|
|
@@ -128,6 +155,7 @@ export class CheckoutIntents {
|
|
|
128
155
|
* API Client for interfacing with the Checkout Intents API.
|
|
129
156
|
*
|
|
130
157
|
* @param {string | undefined} [opts.apiKey=process.env['CHECKOUT_INTENTS_API_KEY'] ?? undefined]
|
|
158
|
+
* @param {Environment} [opts.environment=staging] - Specifies the environment URL to use for the API.
|
|
131
159
|
* @param {string} [opts.baseURL=process.env['CHECKOUT_INTENTS_BASE_URL'] ?? https://staging.api.rye.com/] - Override the default base URL for the API.
|
|
132
160
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
133
161
|
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
@@ -150,10 +178,17 @@ export class CheckoutIntents {
|
|
|
150
178
|
const options: ClientOptions = {
|
|
151
179
|
apiKey,
|
|
152
180
|
...opts,
|
|
153
|
-
baseURL
|
|
181
|
+
baseURL,
|
|
182
|
+
environment: opts.environment ?? 'staging',
|
|
154
183
|
};
|
|
155
184
|
|
|
156
|
-
|
|
185
|
+
if (baseURL && opts.environment) {
|
|
186
|
+
throw new Errors.CheckoutIntentsError(
|
|
187
|
+
'Ambiguous URL; The `baseURL` option (or CHECKOUT_INTENTS_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null',
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
this.baseURL = options.baseURL || environments[options.environment || 'staging'];
|
|
157
192
|
this.timeout = options.timeout ?? CheckoutIntents.DEFAULT_TIMEOUT /* 1 minute */;
|
|
158
193
|
this.logger = options.logger ?? console;
|
|
159
194
|
const defaultLogLevel = 'warn';
|
|
@@ -179,7 +214,8 @@ export class CheckoutIntents {
|
|
|
179
214
|
withOptions(options: Partial<ClientOptions>): this {
|
|
180
215
|
const client = new (this.constructor as any as new (props: ClientOptions) => typeof this)({
|
|
181
216
|
...this._options,
|
|
182
|
-
|
|
217
|
+
environment: options.environment ? options.environment : undefined,
|
|
218
|
+
baseURL: options.environment ? undefined : this.baseURL,
|
|
183
219
|
maxRetries: this.maxRetries,
|
|
184
220
|
timeout: this.timeout,
|
|
185
221
|
logger: this.logger,
|
|
@@ -196,7 +232,7 @@ export class CheckoutIntents {
|
|
|
196
232
|
* Check whether the base URL is set to its default.
|
|
197
233
|
*/
|
|
198
234
|
#baseURLOverridden(): boolean {
|
|
199
|
-
return this.baseURL !==
|
|
235
|
+
return this.baseURL !== environments[this._options.environment || 'staging'];
|
|
200
236
|
}
|
|
201
237
|
|
|
202
238
|
protected defaultQuery(): Record<string, string | undefined> | undefined {
|
|
@@ -715,17 +751,29 @@ export class CheckoutIntents {
|
|
|
715
751
|
|
|
716
752
|
static toFile = Uploads.toFile;
|
|
717
753
|
|
|
718
|
-
|
|
719
|
-
|
|
754
|
+
checkoutIntents: API.CheckoutIntentsResource = new API.CheckoutIntentsResource(this);
|
|
755
|
+
brands: API.Brands = new API.Brands(this);
|
|
720
756
|
}
|
|
721
757
|
|
|
722
|
-
CheckoutIntents.
|
|
723
|
-
CheckoutIntents.
|
|
758
|
+
CheckoutIntents.CheckoutIntentsResource = CheckoutIntentsResource;
|
|
759
|
+
CheckoutIntents.Brands = Brands;
|
|
724
760
|
|
|
725
761
|
export declare namespace CheckoutIntents {
|
|
726
762
|
export type RequestOptions = Opts.RequestOptions;
|
|
727
763
|
|
|
728
|
-
export {
|
|
729
|
-
|
|
730
|
-
|
|
764
|
+
export {
|
|
765
|
+
CheckoutIntentsResource as CheckoutIntentsResource,
|
|
766
|
+
type BaseCheckoutIntent as BaseCheckoutIntent,
|
|
767
|
+
type Buyer as Buyer,
|
|
768
|
+
type CheckoutIntent as CheckoutIntent,
|
|
769
|
+
type Money as Money,
|
|
770
|
+
type Offer as Offer,
|
|
771
|
+
type PaymentMethod as PaymentMethod,
|
|
772
|
+
type VariantSelection as VariantSelection,
|
|
773
|
+
type CheckoutIntentCreateParams as CheckoutIntentCreateParams,
|
|
774
|
+
type CheckoutIntentAddPaymentParams as CheckoutIntentAddPaymentParams,
|
|
775
|
+
type CheckoutIntentConfirmParams as CheckoutIntentConfirmParams,
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
export { Brands as Brands, type BrandRetrieveResponse as BrandRetrieveResponse };
|
|
731
779
|
}
|
package/src/internal/to-file.ts
CHANGED
|
@@ -73,7 +73,7 @@ export type ToFileInput =
|
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
|
|
76
|
-
* @param value the raw content of the file.
|
|
76
|
+
* @param value the raw content of the file. Can be an {@link Uploadable}, BlobLikePart, or AsyncIterable of BlobLikeParts
|
|
77
77
|
* @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible
|
|
78
78
|
* @param {Object=} options additional properties
|
|
79
79
|
* @param {string=} options.type the MIME type of the content
|
|
@@ -76,21 +76,21 @@ export const coerceBoolean = (value: unknown): boolean => {
|
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
export const maybeCoerceInteger = (value: unknown): number | undefined => {
|
|
79
|
-
if (value
|
|
79
|
+
if (value == null) {
|
|
80
80
|
return undefined;
|
|
81
81
|
}
|
|
82
82
|
return coerceInteger(value);
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
export const maybeCoerceFloat = (value: unknown): number | undefined => {
|
|
86
|
-
if (value
|
|
86
|
+
if (value == null) {
|
|
87
87
|
return undefined;
|
|
88
88
|
}
|
|
89
89
|
return coerceFloat(value);
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
export const maybeCoerceBoolean = (value: unknown): boolean | undefined => {
|
|
93
|
-
if (value
|
|
93
|
+
if (value == null) {
|
|
94
94
|
return undefined;
|
|
95
95
|
}
|
|
96
96
|
return coerceBoolean(value);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from '
|
|
4
|
-
import { APIPromise } from '
|
|
5
|
-
import { RequestOptions } from '
|
|
6
|
-
import { path } from '
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../internal/request-options';
|
|
6
|
+
import { path } from '../internal/utils/path';
|
|
7
7
|
|
|
8
8
|
export class Brands extends APIResource {
|
|
9
9
|
/**
|
|
10
10
|
* Retrieve brand information by domain name
|
|
11
11
|
*
|
|
12
|
-
* Look up a brand by its domain name (e.g. "aloyoga.com").
|
|
13
|
-
* information including the marketplace type if the lookup succeeds.
|
|
12
|
+
* Look up a brand by its domain name (e.g. "aloyoga.com" or "www.amazon.com").
|
|
13
|
+
* Returns brand information including the marketplace type if the lookup succeeds.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
retrieve(domain: string, options?: RequestOptions): APIPromise<BrandRetrieveResponse> {
|
|
16
16
|
return this._client.get(path`/api/v1/brands/domain/${domain}`, options);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export interface
|
|
20
|
+
export interface BrandRetrieveResponse {
|
|
21
21
|
/**
|
|
22
22
|
* A unique identifier for the brand.
|
|
23
23
|
*/
|
|
@@ -36,5 +36,5 @@ export interface BrandRetrieveByDomainResponse {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export declare namespace Brands {
|
|
39
|
-
export { type
|
|
39
|
+
export { type BrandRetrieveResponse as BrandRetrieveResponse };
|
|
40
40
|
}
|
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from '
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
4
|
import * as CheckoutIntentsAPI from './checkout-intents';
|
|
5
|
-
import { APIPromise } from '
|
|
6
|
-
import { RequestOptions } from '
|
|
7
|
-
import { path } from '
|
|
5
|
+
import { APIPromise } from '../core/api-promise';
|
|
6
|
+
import { RequestOptions } from '../internal/request-options';
|
|
7
|
+
import { path } from '../internal/utils/path';
|
|
8
8
|
|
|
9
|
-
export class
|
|
9
|
+
export class CheckoutIntentsResource extends APIResource {
|
|
10
10
|
/**
|
|
11
11
|
* Create a checkout intent with the given request body.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const checkoutIntent = await client.checkoutIntents.create({
|
|
16
|
+
* buyer: {
|
|
17
|
+
* address1: '123 Main St',
|
|
18
|
+
* city: 'New York',
|
|
19
|
+
* country: 'United States',
|
|
20
|
+
* email: 'john.doe@example.com',
|
|
21
|
+
* firstName: 'John',
|
|
22
|
+
* lastName: 'Doe',
|
|
23
|
+
* phone: '+1234567890',
|
|
24
|
+
* postalCode: '10001',
|
|
25
|
+
* province: 'NY',
|
|
26
|
+
* },
|
|
27
|
+
* productUrl: 'productUrl',
|
|
28
|
+
* quantity: 1,
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
12
31
|
*/
|
|
13
32
|
create(body: CheckoutIntentCreateParams, options?: RequestOptions): APIPromise<CheckoutIntent> {
|
|
14
33
|
return this._client.post('/api/v1/checkout-intents', { body, ...options });
|
|
@@ -18,16 +37,57 @@ export class CheckoutIntents extends APIResource {
|
|
|
18
37
|
* Retrieve a checkout intent by id
|
|
19
38
|
*
|
|
20
39
|
* Returns checkout intent information if the lookup succeeds.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const checkoutIntent =
|
|
44
|
+
* await client.checkoutIntents.retrieve('id');
|
|
45
|
+
* ```
|
|
21
46
|
*/
|
|
22
47
|
retrieve(id: string, options?: RequestOptions): APIPromise<CheckoutIntent> {
|
|
23
48
|
return this._client.get(path`/api/v1/checkout-intents/${id}`, options);
|
|
24
49
|
}
|
|
25
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Add payment details to a checkout intent
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const checkoutIntent =
|
|
57
|
+
* await client.checkoutIntents.addPayment('id', {
|
|
58
|
+
* paymentMethod: {
|
|
59
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
60
|
+
* type: 'stripe_token',
|
|
61
|
+
* },
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
addPayment(
|
|
66
|
+
id: string,
|
|
67
|
+
body: CheckoutIntentAddPaymentParams,
|
|
68
|
+
options?: RequestOptions,
|
|
69
|
+
): APIPromise<CheckoutIntent> {
|
|
70
|
+
return this._client.post(path`/api/v1/checkout-intents/${id}/payment`, { body, ...options });
|
|
71
|
+
}
|
|
72
|
+
|
|
26
73
|
/**
|
|
27
74
|
* Confirm a checkout intent with provided payment information
|
|
28
75
|
*
|
|
29
76
|
* Confirm means we have buyer's name, address and payment info, so we can move
|
|
30
77
|
* forward to place the order.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const checkoutIntent = await client.checkoutIntents.confirm(
|
|
82
|
+
* 'id',
|
|
83
|
+
* {
|
|
84
|
+
* paymentMethod: {
|
|
85
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
86
|
+
* type: 'stripe_token',
|
|
87
|
+
* },
|
|
88
|
+
* },
|
|
89
|
+
* );
|
|
90
|
+
* ```
|
|
31
91
|
*/
|
|
32
92
|
confirm(
|
|
33
93
|
id: string,
|
|
@@ -48,6 +108,8 @@ export interface BaseCheckoutIntent {
|
|
|
48
108
|
productUrl: string;
|
|
49
109
|
|
|
50
110
|
quantity: number;
|
|
111
|
+
|
|
112
|
+
variantSelections?: Array<VariantSelection>;
|
|
51
113
|
}
|
|
52
114
|
|
|
53
115
|
export interface Buyer {
|
|
@@ -88,12 +150,14 @@ export namespace CheckoutIntent {
|
|
|
88
150
|
offer: CheckoutIntentsAPI.Offer;
|
|
89
151
|
|
|
90
152
|
state: 'awaiting_confirmation';
|
|
153
|
+
|
|
154
|
+
paymentMethod?: CheckoutIntentsAPI.PaymentMethod;
|
|
91
155
|
}
|
|
92
156
|
|
|
93
157
|
export interface PlacingOrderCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
|
|
94
158
|
offer: CheckoutIntentsAPI.Offer;
|
|
95
159
|
|
|
96
|
-
paymentMethod: CheckoutIntentsAPI.
|
|
160
|
+
paymentMethod: CheckoutIntentsAPI.PaymentMethod;
|
|
97
161
|
|
|
98
162
|
state: 'placing_order';
|
|
99
163
|
}
|
|
@@ -101,7 +165,7 @@ export namespace CheckoutIntent {
|
|
|
101
165
|
export interface CompletedCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
|
|
102
166
|
offer: CheckoutIntentsAPI.Offer;
|
|
103
167
|
|
|
104
|
-
paymentMethod: CheckoutIntentsAPI.
|
|
168
|
+
paymentMethod: CheckoutIntentsAPI.PaymentMethod;
|
|
105
169
|
|
|
106
170
|
state: 'completed';
|
|
107
171
|
}
|
|
@@ -113,7 +177,7 @@ export namespace CheckoutIntent {
|
|
|
113
177
|
|
|
114
178
|
offer?: CheckoutIntentsAPI.Offer;
|
|
115
179
|
|
|
116
|
-
paymentMethod?: CheckoutIntentsAPI.
|
|
180
|
+
paymentMethod?: CheckoutIntentsAPI.PaymentMethod;
|
|
117
181
|
}
|
|
118
182
|
|
|
119
183
|
export namespace FailedCheckoutIntent {
|
|
@@ -175,10 +239,40 @@ export namespace Offer {
|
|
|
175
239
|
}
|
|
176
240
|
}
|
|
177
241
|
|
|
178
|
-
export
|
|
179
|
-
|
|
242
|
+
export type PaymentMethod =
|
|
243
|
+
| PaymentMethod.StripeTokenPaymentMethod
|
|
244
|
+
| PaymentMethod.BasisTheoryPaymentMethod
|
|
245
|
+
| PaymentMethod.NekudaPaymentMethod;
|
|
246
|
+
|
|
247
|
+
export namespace PaymentMethod {
|
|
248
|
+
export interface StripeTokenPaymentMethod {
|
|
249
|
+
stripeToken: string;
|
|
250
|
+
|
|
251
|
+
type: 'stripe_token';
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface BasisTheoryPaymentMethod {
|
|
255
|
+
basisTheoryToken: string;
|
|
256
|
+
|
|
257
|
+
type: 'basis_theory_token';
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface NekudaPaymentMethod {
|
|
261
|
+
nekudaUserId: string;
|
|
262
|
+
|
|
263
|
+
type: 'nekuda_token';
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Construct a type with a set of properties K of type T
|
|
267
|
+
*/
|
|
268
|
+
nekudaMandateData?: { [key: string]: string | number };
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface VariantSelection {
|
|
273
|
+
label: string;
|
|
180
274
|
|
|
181
|
-
|
|
275
|
+
value: string | number;
|
|
182
276
|
}
|
|
183
277
|
|
|
184
278
|
export interface CheckoutIntentCreateParams {
|
|
@@ -187,21 +281,29 @@ export interface CheckoutIntentCreateParams {
|
|
|
187
281
|
productUrl: string;
|
|
188
282
|
|
|
189
283
|
quantity: number;
|
|
284
|
+
|
|
285
|
+
variantSelections?: Array<VariantSelection>;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface CheckoutIntentAddPaymentParams {
|
|
289
|
+
paymentMethod: PaymentMethod;
|
|
190
290
|
}
|
|
191
291
|
|
|
192
292
|
export interface CheckoutIntentConfirmParams {
|
|
193
|
-
paymentMethod:
|
|
293
|
+
paymentMethod: PaymentMethod;
|
|
194
294
|
}
|
|
195
295
|
|
|
196
|
-
export declare namespace
|
|
296
|
+
export declare namespace CheckoutIntentsResource {
|
|
197
297
|
export {
|
|
198
298
|
type BaseCheckoutIntent as BaseCheckoutIntent,
|
|
199
299
|
type Buyer as Buyer,
|
|
200
300
|
type CheckoutIntent as CheckoutIntent,
|
|
201
301
|
type Money as Money,
|
|
202
302
|
type Offer as Offer,
|
|
203
|
-
type
|
|
303
|
+
type PaymentMethod as PaymentMethod,
|
|
304
|
+
type VariantSelection as VariantSelection,
|
|
204
305
|
type CheckoutIntentCreateParams as CheckoutIntentCreateParams,
|
|
306
|
+
type CheckoutIntentAddPaymentParams as CheckoutIntentAddPaymentParams,
|
|
205
307
|
type CheckoutIntentConfirmParams as CheckoutIntentConfirmParams,
|
|
206
308
|
};
|
|
207
309
|
}
|
package/src/resources/index.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { Brands, type BrandRetrieveResponse } from './brands';
|
|
4
|
+
export {
|
|
5
|
+
CheckoutIntentsResource,
|
|
6
|
+
type BaseCheckoutIntent,
|
|
7
|
+
type Buyer,
|
|
8
|
+
type CheckoutIntent,
|
|
9
|
+
type Money,
|
|
10
|
+
type Offer,
|
|
11
|
+
type PaymentMethod,
|
|
12
|
+
type VariantSelection,
|
|
13
|
+
type CheckoutIntentCreateParams,
|
|
14
|
+
type CheckoutIntentAddPaymentParams,
|
|
15
|
+
type CheckoutIntentConfirmParams,
|
|
16
|
+
} from './checkout-intents';
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.2.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.2.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.2.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.2.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
package/resources/api/api.d.mts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
-
import * as V1API from "./v1/v1.mjs";
|
|
3
|
-
import { V1 } from "./v1/v1.mjs";
|
|
4
|
-
export declare class API extends APIResource {
|
|
5
|
-
v1: V1API.V1;
|
|
6
|
-
}
|
|
7
|
-
export declare namespace API {
|
|
8
|
-
export { V1 as V1 };
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=api.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/resources/api/api.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,KAAK;OACV,EAAE,EAAE,EAAE;AAEb,qBAAa,GAAI,SAAQ,WAAW;IAClC,EAAE,EAAE,KAAK,CAAC,EAAE,CAA8B;CAC3C;AAID,MAAM,CAAC,OAAO,WAAW,GAAG,CAAC;IAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;CACrB"}
|
package/resources/api/api.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { APIResource } from "../../core/resource.js";
|
|
2
|
-
import * as V1API from "./v1/v1.js";
|
|
3
|
-
import { V1 } from "./v1/v1.js";
|
|
4
|
-
export declare class API extends APIResource {
|
|
5
|
-
v1: V1API.V1;
|
|
6
|
-
}
|
|
7
|
-
export declare namespace API {
|
|
8
|
-
export { V1 as V1 };
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/resources/api/api.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,KAAK;OACV,EAAE,EAAE,EAAE;AAEb,qBAAa,GAAI,SAAQ,WAAW;IAClC,EAAE,EAAE,KAAK,CAAC,EAAE,CAA8B;CAC3C;AAID,MAAM,CAAC,OAAO,WAAW,GAAG,CAAC;IAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;CACrB"}
|
package/resources/api/api.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.API = void 0;
|
|
5
|
-
const tslib_1 = require("../../internal/tslib.js");
|
|
6
|
-
const resource_1 = require("../../core/resource.js");
|
|
7
|
-
const V1API = tslib_1.__importStar(require("./v1/v1.js"));
|
|
8
|
-
const v1_1 = require("./v1/v1.js");
|
|
9
|
-
class API extends resource_1.APIResource {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this.v1 = new V1API.V1(this._client);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.API = API;
|
|
16
|
-
API.V1 = v1_1.V1;
|
|
17
|
-
//# sourceMappingURL=api.js.map
|
package/resources/api/api.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/resources/api/api.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,0DAAiC;AACjC,mCAA6B;AAE7B,MAAa,GAAI,SAAQ,sBAAW;IAApC;;QACE,OAAE,GAAa,IAAI,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;CAAA;AAFD,kBAEC;AAED,GAAG,CAAC,EAAE,GAAG,OAAE,CAAC"}
|
package/resources/api/api.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
-
import * as V1API from "./v1/v1.mjs";
|
|
4
|
-
import { V1 } from "./v1/v1.mjs";
|
|
5
|
-
export class API extends APIResource {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.v1 = new V1API.V1(this._client);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
API.V1 = V1;
|
|
12
|
-
//# sourceMappingURL=api.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.mjs","sourceRoot":"","sources":["../../src/resources/api/api.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,KAAK;OACV,EAAE,EAAE,EAAE;AAEb,MAAM,OAAO,GAAI,SAAQ,WAAW;IAApC;;QACE,OAAE,GAAa,IAAI,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;CAAA;AAED,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/api/index.ts"],"names":[],"mappings":"OAEO,EAAE,GAAG,EAAE;OACP,EAAE,EAAE,EAAE"}
|
package/resources/api/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/api/index.ts"],"names":[],"mappings":"OAEO,EAAE,GAAG,EAAE;OACP,EAAE,EAAE,EAAE"}
|
package/resources/api/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.V1 = exports.API = void 0;
|
|
5
|
-
var api_1 = require("./api.js");
|
|
6
|
-
Object.defineProperty(exports, "API", { enumerable: true, get: function () { return api_1.API; } });
|
|
7
|
-
var index_1 = require("./v1/index.js");
|
|
8
|
-
Object.defineProperty(exports, "V1", { enumerable: true, get: function () { return index_1.V1; } });
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/api/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gCAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,uCAAgC;AAAvB,2FAAA,EAAE,OAAA"}
|
package/resources/api/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/api/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,GAAG,EAAE;OACP,EAAE,EAAE,EAAE"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { APIResource } from "../../../core/resource.mjs";
|
|
2
|
-
import { APIPromise } from "../../../core/api-promise.mjs";
|
|
3
|
-
import { RequestOptions } from "../../../internal/request-options.mjs";
|
|
4
|
-
export declare class Brands extends APIResource {
|
|
5
|
-
/**
|
|
6
|
-
* Retrieve brand information by domain name
|
|
7
|
-
*
|
|
8
|
-
* Look up a brand by its domain name (e.g. "aloyoga.com"). Returns brand
|
|
9
|
-
* information including the marketplace type if the lookup succeeds.
|
|
10
|
-
*/
|
|
11
|
-
retrieveByDomain(domain: string, options?: RequestOptions): APIPromise<BrandRetrieveByDomainResponse>;
|
|
12
|
-
}
|
|
13
|
-
export interface BrandRetrieveByDomainResponse {
|
|
14
|
-
/**
|
|
15
|
-
* A unique identifier for the brand.
|
|
16
|
-
*/
|
|
17
|
-
id: string;
|
|
18
|
-
/**
|
|
19
|
-
* Indicates what ecommerce platform the brand uses.
|
|
20
|
-
*/
|
|
21
|
-
marketplace: 'AMAZON' | 'SHOPIFY' | 'UNKNOWN';
|
|
22
|
-
/**
|
|
23
|
-
* If `false`, then products from this brand cannot be purchased through the Sell
|
|
24
|
-
* Anything API.
|
|
25
|
-
*/
|
|
26
|
-
supported: boolean;
|
|
27
|
-
}
|
|
28
|
-
export declare namespace Brands {
|
|
29
|
-
export { type BrandRetrieveByDomainResponse as BrandRetrieveByDomainResponse };
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=brands.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"brands.d.mts","sourceRoot":"","sources":["../../../src/resources/api/v1/brands.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;OAKG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,6BAA6B,CAAC;CAGtG;AAED,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,WAAW,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IAE9C;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EAAE,KAAK,6BAA6B,IAAI,6BAA6B,EAAE,CAAC;CAChF"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { APIResource } from "../../../core/resource.js";
|
|
2
|
-
import { APIPromise } from "../../../core/api-promise.js";
|
|
3
|
-
import { RequestOptions } from "../../../internal/request-options.js";
|
|
4
|
-
export declare class Brands extends APIResource {
|
|
5
|
-
/**
|
|
6
|
-
* Retrieve brand information by domain name
|
|
7
|
-
*
|
|
8
|
-
* Look up a brand by its domain name (e.g. "aloyoga.com"). Returns brand
|
|
9
|
-
* information including the marketplace type if the lookup succeeds.
|
|
10
|
-
*/
|
|
11
|
-
retrieveByDomain(domain: string, options?: RequestOptions): APIPromise<BrandRetrieveByDomainResponse>;
|
|
12
|
-
}
|
|
13
|
-
export interface BrandRetrieveByDomainResponse {
|
|
14
|
-
/**
|
|
15
|
-
* A unique identifier for the brand.
|
|
16
|
-
*/
|
|
17
|
-
id: string;
|
|
18
|
-
/**
|
|
19
|
-
* Indicates what ecommerce platform the brand uses.
|
|
20
|
-
*/
|
|
21
|
-
marketplace: 'AMAZON' | 'SHOPIFY' | 'UNKNOWN';
|
|
22
|
-
/**
|
|
23
|
-
* If `false`, then products from this brand cannot be purchased through the Sell
|
|
24
|
-
* Anything API.
|
|
25
|
-
*/
|
|
26
|
-
supported: boolean;
|
|
27
|
-
}
|
|
28
|
-
export declare namespace Brands {
|
|
29
|
-
export { type BrandRetrieveByDomainResponse as BrandRetrieveByDomainResponse };
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=brands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"brands.d.ts","sourceRoot":"","sources":["../../../src/resources/api/v1/brands.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;OAKG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,6BAA6B,CAAC;CAGtG;AAED,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,WAAW,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IAE9C;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EAAE,KAAK,6BAA6B,IAAI,6BAA6B,EAAE,CAAC;CAChF"}
|