Skip to content

Commit b50474f

Browse files
feat(api): purchase session to checkout session, variant to price (#78)
1 parent b8483ef commit b50474f

File tree

15 files changed

+222
-472
lines changed

15 files changed

+222
-472
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 31
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/flowglad%2Fflowglad-e0f2d502c07fb887c6a052c9ddf01b436886c3a9d4ce8c32bf8438f5015f2f3a.yml
1+
configured_endpoints: 25
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/flowglad%2Fflowglad-65c1f71edb01f32a0a5cdf1afdb6a6154e3dc32708a062ed8ba347f8caf6243d.yml

api.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@ Methods:
2424

2525
# PurchaseSessions
2626

27-
Types:
28-
29-
- <code><a href="./src/resources/purchase-sessions.ts">PurchaseSessionCreateResponse</a></code>
30-
- <code><a href="./src/resources/purchase-sessions.ts">PurchaseSessionRetrieveResponse</a></code>
31-
- <code><a href="./src/resources/purchase-sessions.ts">PurchaseSessionListResponse</a></code>
32-
33-
Methods:
34-
35-
- <code title="post /api/v1/purchase-sessions">client.purchaseSessions.<a href="./src/resources/purchase-sessions.ts">create</a>({ ...params }) -> PurchaseSessionCreateResponse</code>
36-
- <code title="get /api/v1/purchase-sessions/{id}">client.purchaseSessions.<a href="./src/resources/purchase-sessions.ts">retrieve</a>(id) -> PurchaseSessionRetrieveResponse</code>
37-
- <code title="get /api/v1/purchase-sessions">client.purchaseSessions.<a href="./src/resources/purchase-sessions.ts">list</a>({ ...params }) -> PurchaseSessionListResponse</code>
38-
3927
# Products
4028

4129
Types:
@@ -54,18 +42,6 @@ Methods:
5442

5543
# Variants
5644

57-
Types:
58-
59-
- <code><a href="./src/resources/variants.ts">VariantCreateResponse</a></code>
60-
- <code><a href="./src/resources/variants.ts">VariantUpdateResponse</a></code>
61-
- <code><a href="./src/resources/variants.ts">VariantListResponse</a></code>
62-
63-
Methods:
64-
65-
- <code title="post /api/v1/variants">client.variants.<a href="./src/resources/variants.ts">create</a>({ ...params }) -> VariantCreateResponse</code>
66-
- <code title="put /api/v1/variants/{id}">client.variants.<a href="./src/resources/variants.ts">update</a>(id, { ...params }) -> VariantUpdateResponse</code>
67-
- <code title="get /api/v1/variants">client.variants.<a href="./src/resources/variants.ts">list</a>({ ...params }) -> VariantListResponse</code>
68-
6945
# Discounts
7046

7147
Types:

src/client.ts

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,7 @@ import {
7373
ProductUpdateResponse,
7474
Products,
7575
} from './resources/products';
76-
import {
77-
PurchaseSessionCreateParams,
78-
PurchaseSessionCreateResponse,
79-
PurchaseSessionListParams,
80-
PurchaseSessionListResponse,
81-
PurchaseSessionRetrieveResponse,
82-
PurchaseSessions,
83-
} from './resources/purchase-sessions';
76+
import { PurchaseSessions } from './resources/purchase-sessions';
8477
import {
8578
SubscriptionAdjustParams,
8679
SubscriptionAdjustResponse,
@@ -91,15 +84,7 @@ import {
9184
SubscriptionRetrieveResponse,
9285
Subscriptions,
9386
} from './resources/subscriptions';
94-
import {
95-
VariantCreateParams,
96-
VariantCreateResponse,
97-
VariantListParams,
98-
VariantListResponse,
99-
VariantUpdateParams,
100-
VariantUpdateResponse,
101-
Variants,
102-
} from './resources/variants';
87+
import { Variants } from './resources/variants';
10388
import { readEnv } from './internal/utils/env';
10489
import { formatRequestDetails, loggerFor } from './internal/utils/log';
10590
import { isEmptyObj } from './internal/utils/values';
@@ -835,14 +820,7 @@ export declare namespace Flowglad {
835820
type InvoiceLineItemListParams as InvoiceLineItemListParams,
836821
};
837822

838-
export {
839-
PurchaseSessions as PurchaseSessions,
840-
type PurchaseSessionCreateResponse as PurchaseSessionCreateResponse,
841-
type PurchaseSessionRetrieveResponse as PurchaseSessionRetrieveResponse,
842-
type PurchaseSessionListResponse as PurchaseSessionListResponse,
843-
type PurchaseSessionCreateParams as PurchaseSessionCreateParams,
844-
type PurchaseSessionListParams as PurchaseSessionListParams,
845-
};
823+
export { PurchaseSessions as PurchaseSessions };
846824

847825
export {
848826
Products as Products,
@@ -855,15 +833,7 @@ export declare namespace Flowglad {
855833
type ProductListParams as ProductListParams,
856834
};
857835

858-
export {
859-
Variants as Variants,
860-
type VariantCreateResponse as VariantCreateResponse,
861-
type VariantUpdateResponse as VariantUpdateResponse,
862-
type VariantListResponse as VariantListResponse,
863-
type VariantCreateParams as VariantCreateParams,
864-
type VariantUpdateParams as VariantUpdateParams,
865-
type VariantListParams as VariantListParams,
866-
};
836+
export { Variants as Variants };
867837

868838
export {
869839
Discounts as Discounts,

src/resources/customer-profiles.ts

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -373,55 +373,13 @@ export namespace CustomerProfileRetrieveBillingResponse {
373373

374374
export namespace Catalog {
375375
export interface Product {
376-
product: Product.Product;
376+
prices: Array<Product.SubscriptionPrice | Product.SinglePaymentPrice>;
377377

378-
variants: Array<Product.SubscriptionVariant | Product.SinglePaymentVariant>;
378+
product: Product.Product;
379379
}
380380

381381
export namespace Product {
382-
export interface Product {
383-
id: string;
384-
385-
active: boolean;
386-
387-
/**
388-
* safeZodDate
389-
*/
390-
createdAt: (string & {}) | string;
391-
392-
description: string | null;
393-
394-
displayFeatures: Array<Product.DisplayFeature> | null;
395-
396-
imageURL: string | null;
397-
398-
livemode: boolean;
399-
400-
name: string;
401-
402-
organizationId: string;
403-
404-
pluralQuantityLabel: string | null;
405-
406-
singularQuantityLabel: string | null;
407-
408-
/**
409-
* safeZodDate
410-
*/
411-
updatedAt: (string & {}) | string;
412-
}
413-
414-
export namespace Product {
415-
export interface DisplayFeature {
416-
enabled: boolean;
417-
418-
label: string;
419-
420-
details?: string | null;
421-
}
422-
}
423-
424-
export interface SubscriptionVariant {
382+
export interface SubscriptionPrice {
425383
id: string;
426384

427385
active: boolean;
@@ -577,8 +535,6 @@ export namespace CustomerProfileRetrieveBillingResponse {
577535

578536
name: string | null;
579537

580-
priceType: 'subscription';
581-
582538
productId: string;
583539

584540
/**
@@ -591,6 +547,8 @@ export namespace CustomerProfileRetrieveBillingResponse {
591547
*/
592548
trialPeriodDays: number | 0 | null;
593549

550+
type: 'subscription';
551+
594552
/**
595553
* safeZodPositiveInteger
596554
*/
@@ -599,7 +557,7 @@ export namespace CustomerProfileRetrieveBillingResponse {
599557
updatedAt: string | null;
600558
}
601559

602-
export interface SinglePaymentVariant {
560+
export interface SinglePaymentPrice {
603561
id: string;
604562

605563
active: boolean;
@@ -748,10 +706,10 @@ export namespace CustomerProfileRetrieveBillingResponse {
748706

749707
name: string | null;
750708

751-
priceType: 'single_payment';
752-
753709
productId: string;
754710

711+
type: 'single_payment';
712+
755713
/**
756714
* safeZodPositiveInteger
757715
*/
@@ -779,6 +737,48 @@ export namespace CustomerProfileRetrieveBillingResponse {
779737
*/
780738
trialPeriodDays?: unknown | unknown | null;
781739
}
740+
741+
export interface Product {
742+
id: string;
743+
744+
active: boolean;
745+
746+
/**
747+
* safeZodDate
748+
*/
749+
createdAt: (string & {}) | string;
750+
751+
description: string | null;
752+
753+
displayFeatures: Array<Product.DisplayFeature> | null;
754+
755+
imageURL: string | null;
756+
757+
livemode: boolean;
758+
759+
name: string;
760+
761+
organizationId: string;
762+
763+
pluralQuantityLabel: string | null;
764+
765+
singularQuantityLabel: string | null;
766+
767+
/**
768+
* safeZodDate
769+
*/
770+
updatedAt: (string & {}) | string;
771+
}
772+
773+
export namespace Product {
774+
export interface DisplayFeature {
775+
enabled: boolean;
776+
777+
label: string;
778+
779+
details?: string | null;
780+
}
781+
}
782782
}
783783
}
784784

@@ -2244,14 +2244,14 @@ export namespace CustomerProfileRetrieveBillingResponse {
22442244

22452245
price: number;
22462246

2247+
priceId: string | null;
2248+
22472249
/**
22482250
* safeZodPositiveInteger
22492251
*/
22502252
quantity: number;
22512253

22522254
updatedAt: string | null;
2253-
2254-
variantId: string | null;
22552255
}
22562256
}
22572257

@@ -2347,6 +2347,8 @@ export namespace CustomerProfileRetrieveBillingResponse {
23472347

23482348
planName: string | null;
23492349

2350+
priceId: string;
2351+
23502352
status:
23512353
| 'incomplete'
23522354
| 'incomplete_expired'
@@ -2363,8 +2365,6 @@ export namespace CustomerProfileRetrieveBillingResponse {
23632365
trialEnd: string | null;
23642366

23652367
updatedAt: string | null;
2366-
2367-
variantId: string;
23682368
}
23692369

23702370
export namespace Subscription {
@@ -2381,6 +2381,8 @@ export namespace CustomerProfileRetrieveBillingResponse {
23812381

23822382
name: string | null;
23832383

2384+
priceId: string;
2385+
23842386
/**
23852387
* safeZodPositiveInteger
23862388
*/
@@ -2396,8 +2398,6 @@ export namespace CustomerProfileRetrieveBillingResponse {
23962398
updatedAt: string | null;
23972399

23982400
variant: SubscriptionItem.Variant;
2399-
2400-
variantId: string;
24012401
}
24022402

24032403
export namespace SubscriptionItem {
@@ -2557,8 +2557,6 @@ export namespace CustomerProfileRetrieveBillingResponse {
25572557

25582558
name: string | null;
25592559

2560-
priceType: 'subscription';
2561-
25622560
productId: string;
25632561

25642562
/**
@@ -2571,6 +2569,8 @@ export namespace CustomerProfileRetrieveBillingResponse {
25712569
*/
25722570
trialPeriodDays: number | 0 | null;
25732571

2572+
type: 'subscription';
2573+
25742574
/**
25752575
* safeZodPositiveInteger
25762576
*/
@@ -2617,6 +2617,8 @@ export namespace CustomerProfileRetrieveBillingResponse {
26172617

26182618
planName: string | null;
26192619

2620+
priceId: string;
2621+
26202622
status:
26212623
| 'incomplete'
26222624
| 'incomplete_expired'
@@ -2633,8 +2635,6 @@ export namespace CustomerProfileRetrieveBillingResponse {
26332635
trialEnd: string | null;
26342636

26352637
updatedAt: string | null;
2636-
2637-
variantId: string;
26382638
}
26392639

26402640
export namespace CurrentSubscription {
@@ -2651,6 +2651,8 @@ export namespace CustomerProfileRetrieveBillingResponse {
26512651

26522652
name: string | null;
26532653

2654+
priceId: string;
2655+
26542656
/**
26552657
* safeZodPositiveInteger
26562658
*/
@@ -2666,8 +2668,6 @@ export namespace CustomerProfileRetrieveBillingResponse {
26662668
updatedAt: string | null;
26672669

26682670
variant: SubscriptionItem.Variant;
2669-
2670-
variantId: string;
26712671
}
26722672

26732673
export namespace SubscriptionItem {
@@ -2827,8 +2827,6 @@ export namespace CustomerProfileRetrieveBillingResponse {
28272827

28282828
name: string | null;
28292829

2830-
priceType: 'subscription';
2831-
28322830
productId: string;
28332831

28342832
/**
@@ -2841,6 +2839,8 @@ export namespace CustomerProfileRetrieveBillingResponse {
28412839
*/
28422840
trialPeriodDays: number | 0 | null;
28432841

2842+
type: 'subscription';
2843+
28442844
/**
28452845
* safeZodPositiveInteger
28462846
*/

0 commit comments

Comments
 (0)