Skip to content

Commit 4d683db

Browse files
feat(api): clean up ambiguous types, rm installment amounts (#7)
1 parent b479989 commit 4d683db

File tree

17 files changed

+2249
-160
lines changed

17 files changed

+2249
-160
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: 1
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/flowglad%2Fflowglad-21870271879fc260da63af686a116fc7e99c28c684ca92c127d6d9cbbd456c46.yml
1+
configured_endpoints: 11
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/flowglad%2Fflowglad-f8356bf4639d34c01c43a6911b1076905884a152b63f60872f2db5b96bfb7169.yml

api.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,61 @@
1+
# PurchaseSessions
2+
3+
Types:
4+
5+
- <code><a href="./src/resources/purchase-sessions.ts">PurchaseSessionCreateResponse</a></code>
6+
7+
Methods:
8+
9+
- <code title="post /api/v1/purchase-sessions">client.purchaseSessions.<a href="./src/resources/purchase-sessions.ts">create</a>({ ...params }) -> PurchaseSessionCreateResponse</code>
10+
11+
# Products
12+
13+
Types:
14+
15+
- <code><a href="./src/resources/products.ts">ProductCreateResponse</a></code>
16+
- <code><a href="./src/resources/products.ts">ProductUpdateResponse</a></code>
17+
- <code><a href="./src/resources/products.ts">ProductListResponse</a></code>
18+
19+
Methods:
20+
21+
- <code title="post /api/v1/products">client.products.<a href="./src/resources/products.ts">create</a>({ ...params }) -> ProductCreateResponse</code>
22+
- <code title="put /api/v1/products/{id}">client.products.<a href="./src/resources/products.ts">update</a>(id, { ...params }) -> ProductUpdateResponse</code>
23+
- <code title="get /api/v1/products">client.products.<a href="./src/resources/products.ts">list</a>({ ...params }) -> ProductListResponse</code>
24+
25+
# Variants
26+
27+
Types:
28+
29+
- <code><a href="./src/resources/variants.ts">VariantCreateResponse</a></code>
30+
- <code><a href="./src/resources/variants.ts">VariantUpdateResponse</a></code>
31+
- <code><a href="./src/resources/variants.ts">VariantListResponse</a></code>
32+
33+
Methods:
34+
35+
- <code title="post /api/v1/variants">client.variants.<a href="./src/resources/variants.ts">create</a>({ ...params }) -> VariantCreateResponse</code>
36+
- <code title="put /api/v1/variants/{id}">client.variants.<a href="./src/resources/variants.ts">update</a>(id, { ...params }) -> VariantUpdateResponse</code>
37+
- <code title="get /api/v1/variants">client.variants.<a href="./src/resources/variants.ts">list</a>({ ...params }) -> VariantListResponse</code>
38+
139
# CustomerProfiles
240

341
Types:
442

5-
- <code><a href="./src/resources/customer-profiles.ts">CustomerProfileCreateResponse</a></code>
43+
- <code><a href="./src/resources/customer-profiles/customer-profiles.ts">CustomerProfileCreateResponse</a></code>
44+
- <code><a href="./src/resources/customer-profiles/customer-profiles.ts">CustomerProfileRetrieveResponse</a></code>
45+
- <code><a href="./src/resources/customer-profiles/customer-profiles.ts">CustomerProfileUpdateResponse</a></code>
46+
47+
Methods:
48+
49+
- <code title="post /api/v1/customer-profiles">client.customerProfiles.<a href="./src/resources/customer-profiles/customer-profiles.ts">create</a>({ ...params }) -> CustomerProfileCreateResponse</code>
50+
- <code title="get /api/v1/customer-profiles/{externalId}">client.customerProfiles.<a href="./src/resources/customer-profiles/customer-profiles.ts">retrieve</a>(externalId) -> CustomerProfileRetrieveResponse</code>
51+
- <code title="put /api/v1/customer-profiles/{externalId}">client.customerProfiles.<a href="./src/resources/customer-profiles/customer-profiles.ts">update</a>(externalId, { ...params }) -> CustomerProfileUpdateResponse</code>
52+
53+
## Billing
54+
55+
Types:
56+
57+
- <code><a href="./src/resources/customer-profiles/billing.ts">BillingRetrieveResponse</a></code>
658

759
Methods:
860

9-
- <code title="post /api/v1/customer-profiles">client.customerProfiles.<a href="./src/resources/customer-profiles.ts">create</a>({ ...params }) -> CustomerProfileCreateResponse</code>
61+
- <code title="get /api/v1/customer-profiles/{externalId}/billing">client.customerProfiles.billing.<a href="./src/resources/customer-profiles/billing.ts">retrieve</a>(externalId) -> BillingRetrieveResponse</code>

src/index.ts

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,37 @@ import * as Core from './core';
55
import * as Errors from './error';
66
import * as Uploads from './uploads';
77
import * as API from './resources/index';
8+
import {
9+
ProductCreateParams,
10+
ProductCreateResponse,
11+
ProductListParams,
12+
ProductListResponse,
13+
ProductUpdateParams,
14+
ProductUpdateResponse,
15+
Products,
16+
} from './resources/products';
17+
import {
18+
PurchaseSessionCreateParams,
19+
PurchaseSessionCreateResponse,
20+
PurchaseSessions,
21+
} from './resources/purchase-sessions';
22+
import {
23+
VariantCreateParams,
24+
VariantCreateResponse,
25+
VariantListParams,
26+
VariantListResponse,
27+
VariantUpdateParams,
28+
VariantUpdateResponse,
29+
Variants,
30+
} from './resources/variants';
831
import {
932
CustomerProfileCreateParams,
1033
CustomerProfileCreateResponse,
34+
CustomerProfileRetrieveResponse,
35+
CustomerProfileUpdateParams,
36+
CustomerProfileUpdateResponse,
1137
CustomerProfiles,
12-
} from './resources/customer-profiles';
38+
} from './resources/customer-profiles/customer-profiles';
1339

1440
const environments = {
1541
production: 'https://app.flowglad.com/api/v1',
@@ -19,7 +45,7 @@ type Environment = keyof typeof environments;
1945

2046
export interface ClientOptions {
2147
/**
22-
* API key used for authentication in the 'Authorization' header
48+
* API key required for authentication, provided in the 'Authorization' header.
2349
*/
2450
apiKey?: string | undefined;
2551

@@ -100,7 +126,7 @@ export class Flowglad extends Core.APIClient {
100126
/**
101127
* API Client for interfacing with the Flowglad API.
102128
*
103-
* @param {string | undefined} [opts.apiKey=process.env['FLOWGLAD_API_KEY'] ?? undefined]
129+
* @param {string | undefined} [opts.apiKey=process.env['AUTHORIZATION_KEY'] ?? undefined]
104130
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
105131
* @param {string} [opts.baseURL=process.env['FLOWGLAD_BASE_URL'] ?? https://app.flowglad.com/api/v1] - Override the default base URL for the API.
106132
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
@@ -112,12 +138,12 @@ export class Flowglad extends Core.APIClient {
112138
*/
113139
constructor({
114140
baseURL = Core.readEnv('FLOWGLAD_BASE_URL'),
115-
apiKey = Core.readEnv('FLOWGLAD_API_KEY'),
141+
apiKey = Core.readEnv('AUTHORIZATION_KEY'),
116142
...opts
117143
}: ClientOptions = {}) {
118144
if (apiKey === undefined) {
119145
throw new Errors.FlowgladError(
120-
"The FLOWGLAD_API_KEY environment variable is missing or empty; either provide it, or instantiate the Flowglad client with an apiKey option, like new Flowglad({ apiKey: 'My API Key' }).",
146+
"The AUTHORIZATION_KEY environment variable is missing or empty; either provide it, or instantiate the Flowglad client with an apiKey option, like new Flowglad({ apiKey: 'My API Key' }).",
121147
);
122148
}
123149

@@ -147,6 +173,9 @@ export class Flowglad extends Core.APIClient {
147173
this.apiKey = apiKey;
148174
}
149175

176+
purchaseSessions: API.PurchaseSessions = new API.PurchaseSessions(this);
177+
products: API.Products = new API.Products(this);
178+
variants: API.Variants = new API.Variants(this);
150179
customerProfiles: API.CustomerProfiles = new API.CustomerProfiles(this);
151180

152181
protected override defaultQuery(): Core.DefaultQuery | undefined {
@@ -185,14 +214,46 @@ export class Flowglad extends Core.APIClient {
185214
static fileFromPath = Uploads.fileFromPath;
186215
}
187216

217+
Flowglad.PurchaseSessions = PurchaseSessions;
218+
Flowglad.Products = Products;
219+
Flowglad.Variants = Variants;
188220
Flowglad.CustomerProfiles = CustomerProfiles;
189221
export declare namespace Flowglad {
190222
export type RequestOptions = Core.RequestOptions;
191223

224+
export {
225+
PurchaseSessions as PurchaseSessions,
226+
type PurchaseSessionCreateResponse as PurchaseSessionCreateResponse,
227+
type PurchaseSessionCreateParams as PurchaseSessionCreateParams,
228+
};
229+
230+
export {
231+
Products as Products,
232+
type ProductCreateResponse as ProductCreateResponse,
233+
type ProductUpdateResponse as ProductUpdateResponse,
234+
type ProductListResponse as ProductListResponse,
235+
type ProductCreateParams as ProductCreateParams,
236+
type ProductUpdateParams as ProductUpdateParams,
237+
type ProductListParams as ProductListParams,
238+
};
239+
240+
export {
241+
Variants as Variants,
242+
type VariantCreateResponse as VariantCreateResponse,
243+
type VariantUpdateResponse as VariantUpdateResponse,
244+
type VariantListResponse as VariantListResponse,
245+
type VariantCreateParams as VariantCreateParams,
246+
type VariantUpdateParams as VariantUpdateParams,
247+
type VariantListParams as VariantListParams,
248+
};
249+
192250
export {
193251
CustomerProfiles as CustomerProfiles,
194252
type CustomerProfileCreateResponse as CustomerProfileCreateResponse,
253+
type CustomerProfileRetrieveResponse as CustomerProfileRetrieveResponse,
254+
type CustomerProfileUpdateResponse as CustomerProfileUpdateResponse,
195255
type CustomerProfileCreateParams as CustomerProfileCreateParams,
256+
type CustomerProfileUpdateParams as CustomerProfileUpdateParams,
196257
};
197258
}
198259

src/resources/customer-profiles.ts

Lines changed: 0 additions & 129 deletions
This file was deleted.

0 commit comments

Comments
 (0)