Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to NPM in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/flowglad/flowglad-ts/actions/workflows/publish-npm.yml
# You can run this workflow by navigating to https://www.github.com/flowglad/flowglad-node/actions/workflows/publish-npm.yml
name: Publish NPM
on:
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'flowglad/flowglad-ts' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
if: github.repository == 'flowglad/flowglad-node' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.0.1-alpha.0"
".": "0.1.0-alpha.1"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/flowglad%2Fflowglad-21870271879fc260da63af686a116fc7e99c28c684ca92c127d6d9cbbd456c46.yml
configured_endpoints: 11
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/flowglad%2Fflowglad-cbe092963a0dbbc2eddd8cd406d288a766607a771441afb939424b13e2895151.yml
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Changelog

## 0.1.0-alpha.1 (2025-01-24)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/flowglad/flowglad-node/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)

### Features

* **api:** clean up ambiguous types, rm installment amounts ([#7](https://github.com/flowglad/flowglad-node/issues/7)) ([4d683db](https://github.com/flowglad/flowglad-node/commit/4d683db6df39ea87f265a1c2b75cce56d50dc674))
<<<<<<< HEAD
=======
* **api:** Config update for agreea/dev ([#8](https://github.com/flowglad/flowglad-node/issues/8)) ([5e67321](https://github.com/flowglad/flowglad-node/commit/5e6732112006af37941429877446b3435d8d3dce))
>>>>>>> f1544f8fc9d31b06bc5756f15107c060ce2cfa11
* **api:** Fix flowglad API key ([#5](https://github.com/flowglad/flowglad-node/issues/5)) ([8664078](https://github.com/flowglad/flowglad-node/commit/8664078e6a187fd41107c92ad218d6e4ea0c618d))
* **api:** update environments ([#4](https://github.com/flowglad/flowglad-node/issues/4)) ([89660fa](https://github.com/flowglad/flowglad-node/commit/89660fa46a132f14db52872c02c8af1bd6db4d41))
* **api:** update README ([#3](https://github.com/flowglad/flowglad-node/issues/3)) ([f85399a](https://github.com/flowglad/flowglad-node/commit/f85399ac9f8fcc029b94a4e5d4bef93fd9c142f8))
* **api:** update via SDK Studio ([ad440b3](https://github.com/flowglad/flowglad-node/commit/ad440b3c874102554e9b49c46e50a527adf3d39d))
* **api:** update via SDK Studio ([eed05a8](https://github.com/flowglad/flowglad-node/commit/eed05a8f65579e7ec6fe6057531c4eb05c6d4633))
* **api:** update via SDK Studio ([25bf945](https://github.com/flowglad/flowglad-node/commit/25bf9459857098b79f15d735cfd7b4684793f2db))
* **api:** update via SDK Studio ([5101375](https://github.com/flowglad/flowglad-node/commit/51013751991b0104e25992e58e7b7c5acc6e9e11))


### Chores

* go live ([#1](https://github.com/flowglad/flowglad-node/issues/1)) ([b235c12](https://github.com/flowglad/flowglad-node/commit/b235c12823b0ae452a85a45094f42fe6f527fc9e))
* go live ([#2](https://github.com/flowglad/flowglad-node/issues/2)) ([0724d46](https://github.com/flowglad/flowglad-node/commit/0724d469b1711f6ff2e26d0d7073cd2d1d9d1e81))
* **internal:** add test ([#6](https://github.com/flowglad/flowglad-node/issues/6)) ([b479989](https://github.com/flowglad/flowglad-node/commit/b479989a2de24caeee2d590d9304fcf6c53a59aa))
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ If you’d like to use the repository from source, you can either install from g
To install via git:

```sh
$ npm install git+ssh://[email protected]:flowglad/flowglad-ts.git
$ npm install git+ssh://[email protected]:flowglad/flowglad-node.git
```

Alternatively, to link a local copy of the repo:

```sh
# Clone
$ git clone https://www.github.com/flowglad/flowglad-ts
$ cd flowglad-ts
$ git clone https://www.github.com/flowglad/flowglad-node
$ cd flowglad-node

# With yarn
$ yarn link
Expand Down Expand Up @@ -99,7 +99,7 @@ the changes aren't made through the automated pipeline, you may want to make rel

### Publish with a GitHub workflow

You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/flowglad/flowglad-ts/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/flowglad/flowglad-node/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.

### Publish manually

Expand Down
102 changes: 16 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,13 @@ The full API of this library can be found in [api.md](api.md).
```js
import Flowglad from '@flowglad/node';

const client = new Flowglad();
const client = new Flowglad({
environment: 'staging', // defaults to 'production'
});

async function main() {
const customerProfile = await client.customerProfiles.create({
customerProfile: {
'0': 'R',
'1': 'E',
'2': 'P',
'3': 'L',
'4': 'A',
'5': 'C',
'6': 'E',
'7': '_',
'8': 'M',
'9': 'E',
},
customerProfile: { externalId: 'myId', email: '[email protected]', name: 'Scrooge McDuck' },
});

console.log(customerProfile.data);
Expand All @@ -54,22 +45,13 @@ This library includes TypeScript definitions for all request params and response
```ts
import Flowglad from '@flowglad/node';

const client = new Flowglad();
const client = new Flowglad({
environment: 'staging', // defaults to 'production'
});

async function main() {
const params: Flowglad.CustomerProfileCreateParams = {
customerProfile: {
'0': 'R',
'1': 'E',
'2': 'P',
'3': 'L',
'4': 'A',
'5': 'C',
'6': 'E',
'7': '_',
'8': 'M',
'9': 'E',
},
customerProfile: { externalId: 'myId', email: '[email protected]', name: 'Scrooge McDuck' },
};
const customerProfile: Flowglad.CustomerProfileCreateResponse = await client.customerProfiles.create(
params,
Expand All @@ -91,20 +73,7 @@ a subclass of `APIError` will be thrown:
```ts
async function main() {
const customerProfile = await client.customerProfiles
.create({
customerProfile: {
'0': 'R',
'1': 'E',
'2': 'P',
'3': 'L',
'4': 'A',
'5': 'C',
'6': 'E',
'7': '_',
'8': 'M',
'9': 'E',
},
})
.create({ customerProfile: { externalId: 'myId', email: '[email protected]', name: 'Scrooge McDuck' } })
.catch(async (err) => {
if (err instanceof Flowglad.APIError) {
console.log(err.status); // 400
Expand Down Expand Up @@ -148,7 +117,7 @@ const client = new Flowglad({
});

// Or, configure per-request:
await client.customerProfiles.create({ customerProfile: { '0': 'R', '1': 'E', '2': 'P', '3': 'L', '4': 'A', '5': 'C', '6': 'E', '7': '_', '8': 'M', '9': 'E' } }, {
await client.customerProfiles.create({ customerProfile: { externalId: 'myId', email: '[email protected]', name: 'Scrooge McDuck' } }, {
maxRetries: 5,
});
```
Expand All @@ -165,7 +134,7 @@ const client = new Flowglad({
});

// Override per-request:
await client.customerProfiles.create({ customerProfile: { '0': 'R', '1': 'E', '2': 'P', '3': 'L', '4': 'A', '5': 'C', '6': 'E', '7': '_', '8': 'M', '9': 'E' } }, {
await client.customerProfiles.create({ customerProfile: { externalId: 'myId', email: '[email protected]', name: 'Scrooge McDuck' } }, {
timeout: 5 * 1000,
});
```
Expand All @@ -187,39 +156,13 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
const client = new Flowglad();

const response = await client.customerProfiles
.create({
customerProfile: {
'0': 'R',
'1': 'E',
'2': 'P',
'3': 'L',
'4': 'A',
'5': 'C',
'6': 'E',
'7': '_',
'8': 'M',
'9': 'E',
},
})
.create({ customerProfile: { externalId: 'myId', email: '[email protected]', name: 'Scrooge McDuck' } })
.asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: customerProfile, response: raw } = await client.customerProfiles
.create({
customerProfile: {
'0': 'R',
'1': 'E',
'2': 'P',
'3': 'L',
'4': 'A',
'5': 'C',
'6': 'E',
'7': '_',
'8': 'M',
'9': 'E',
},
})
.create({ customerProfile: { externalId: 'myId', email: '[email protected]', name: 'Scrooge McDuck' } })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(customerProfile.data);
Expand Down Expand Up @@ -285,7 +228,7 @@ import Flowglad from '@flowglad/node';
```

To do the inverse, add `import "@flowglad/node/shims/node"` (which does import polyfills).
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/flowglad/flowglad-ts/tree/main/src/_shims#readme)).
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/flowglad/flowglad-node/tree/main/src/_shims#readme)).

### Logging and middleware

Expand Down Expand Up @@ -327,20 +270,7 @@ const client = new Flowglad({

// Override per-request:
await client.customerProfiles.create(
{
customerProfile: {
'0': 'R',
'1': 'E',
'2': 'P',
'3': 'L',
'4': 'A',
'5': 'C',
'6': 'E',
'7': '_',
'8': 'M',
'9': 'E',
},
},
{ customerProfile: { externalId: 'myId', email: '[email protected]', name: 'Scrooge McDuck' } },
{
httpAgent: new http.Agent({ keepAlive: false }),
},
Expand All @@ -357,7 +287,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/flowglad/flowglad-ts/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/flowglad/flowglad-node/issues) with questions, bugs, or suggestions.

## Requirements

Expand Down
56 changes: 54 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,61 @@
# PurchaseSessions

Types:

- <code><a href="./src/resources/purchase-sessions.ts">PurchaseSessionCreateResponse</a></code>

Methods:

- <code title="post /api/v1/purchase-sessions">client.purchaseSessions.<a href="./src/resources/purchase-sessions.ts">create</a>({ ...params }) -> PurchaseSessionCreateResponse</code>

# Products

Types:

- <code><a href="./src/resources/products.ts">ProductCreateResponse</a></code>
- <code><a href="./src/resources/products.ts">ProductUpdateResponse</a></code>
- <code><a href="./src/resources/products.ts">ProductListResponse</a></code>

Methods:

- <code title="post /api/v1/products">client.products.<a href="./src/resources/products.ts">create</a>({ ...params }) -> ProductCreateResponse</code>
- <code title="put /api/v1/products/{id}">client.products.<a href="./src/resources/products.ts">update</a>(id, { ...params }) -> ProductUpdateResponse</code>
- <code title="get /api/v1/products">client.products.<a href="./src/resources/products.ts">list</a>({ ...params }) -> ProductListResponse</code>

# Variants

Types:

- <code><a href="./src/resources/variants.ts">VariantCreateResponse</a></code>
- <code><a href="./src/resources/variants.ts">VariantUpdateResponse</a></code>
- <code><a href="./src/resources/variants.ts">VariantListResponse</a></code>

Methods:

- <code title="post /api/v1/variants">client.variants.<a href="./src/resources/variants.ts">create</a>({ ...params }) -> VariantCreateResponse</code>
- <code title="put /api/v1/variants/{id}">client.variants.<a href="./src/resources/variants.ts">update</a>(id, { ...params }) -> VariantUpdateResponse</code>
- <code title="get /api/v1/variants">client.variants.<a href="./src/resources/variants.ts">list</a>({ ...params }) -> VariantListResponse</code>

# CustomerProfiles

Types:

- <code><a href="./src/resources/customer-profiles.ts">CustomerProfileCreateResponse</a></code>
- <code><a href="./src/resources/customer-profiles/customer-profiles.ts">CustomerProfileCreateResponse</a></code>
- <code><a href="./src/resources/customer-profiles/customer-profiles.ts">CustomerProfileRetrieveResponse</a></code>
- <code><a href="./src/resources/customer-profiles/customer-profiles.ts">CustomerProfileUpdateResponse</a></code>

Methods:

- <code title="post /api/v1/customer-profiles">client.customerProfiles.<a href="./src/resources/customer-profiles/customer-profiles.ts">create</a>({ ...params }) -> CustomerProfileCreateResponse</code>
- <code title="get /api/v1/customer-profiles/{externalId}">client.customerProfiles.<a href="./src/resources/customer-profiles/customer-profiles.ts">retrieve</a>(externalId) -> CustomerProfileRetrieveResponse</code>
- <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>

## Billing

Types:

- <code><a href="./src/resources/customer-profiles/billing.ts">BillingRetrieveResponse</a></code>

Methods:

- <code title="post /api/v1/customer-profiles">client.customerProfiles.<a href="./src/resources/customer-profiles.ts">create</a>({ ...params }) -> CustomerProfileCreateResponse</code>
- <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>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@flowglad/node",
"version": "0.0.1-alpha.0",
"version": "0.1.0-alpha.1",
"description": "The official TypeScript library for the Flowglad API",
"author": "Flowglad <[email protected]>",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"type": "commonjs",
"repository": "github:flowglad/flowglad-ts",
"repository": "github:flowglad/flowglad-node",
"license": "Apache-2.0",
"packageManager": "[email protected]",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion src/_shims/index-deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function getDefaultAgent(url: string) {
}
export function fileFromPath() {
throw new Error(
'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/flowglad/flowglad-ts#file-uploads',
'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/flowglad/flowglad-node#file-uploads',
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/_shims/web-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function getRuntime({ manuallyImported }: { manuallyImported?: boolean }
getDefaultAgent: (url: string) => undefined,
fileFromPath: () => {
throw new Error(
'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/flowglad/flowglad-ts#file-uploads',
'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/flowglad/flowglad-node#file-uploads',
);
},
isFsReadStream: (value: any) => false,
Expand Down
Loading
Loading