Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.10.0-alpha #145

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 .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.9.0-alpha"
".": "0.10.0-alpha"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 30
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/terminal%2Fterminal-d05a14360ad19c97c022f9f0fbc0e129c234aa471d5e4446f38ff07b97cef937.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/terminal%2Fterminal-a43b29f8663937be7722b27c8dd9a7aadfe29c40d575f0f39def413015bc535d.yml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.10.0-alpha (2025-02-17)

Full Changelog: [v0.9.0-alpha...v0.10.0-alpha](https://github.com/terminaldotshop/terminal-sdk-js/compare/v0.9.0-alpha...v0.10.0-alpha)

### Features

* **api:** manual updates ([#144](https://github.com/terminaldotshop/terminal-sdk-js/issues/144)) ([beb3548](https://github.com/terminaldotshop/terminal-sdk-js/commit/beb3548144ddd5c3ea79151f2d6a1dab89e09ab9))

## 0.9.0-alpha (2025-02-16)

Full Changelog: [v0.8.0-alpha...v0.9.0-alpha](https://github.com/terminaldotshop/terminal-sdk-js/compare/v0.8.0-alpha...v0.9.0-alpha)
Expand Down
92 changes: 20 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,9 @@ const client = new Terminal({
});

async function main() {
const subscription = await client.subscription.create({
id: 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX',
addressID: 'shp_XXXXXXXXXXXXXXXXXXXXXXXXX',
cardID: 'crd_XXXXXXXXXXXXXXXXXXXXXXXXX',
frequency: 'fixed',
productVariantID: 'var_XXXXXXXXXXXXXXXXXXXXXXXXX',
quantity: 1,
});
const product = await client.product.list();

console.log(subscription.data);
console.log(product.data);
}

main();
Expand All @@ -57,15 +50,7 @@ const client = new Terminal({
});

async function main() {
const params: Terminal.SubscriptionCreateParams = {
id: 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX',
addressID: 'shp_XXXXXXXXXXXXXXXXXXXXXXXXX',
cardID: 'crd_XXXXXXXXXXXXXXXXXXXXXXXXX',
frequency: 'fixed',
productVariantID: 'var_XXXXXXXXXXXXXXXXXXXXXXXXX',
quantity: 1,
};
const subscription: Terminal.SubscriptionCreateResponse = await client.subscription.create(params);
const product: Terminal.ProductListResponse = await client.product.list();
}

main();
Expand All @@ -82,24 +67,15 @@ a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```ts
async function main() {
const subscription = await client.subscription
.create({
id: 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX',
addressID: 'shp_XXXXXXXXXXXXXXXXXXXXXXXXX',
cardID: 'crd_XXXXXXXXXXXXXXXXXXXXXXXXX',
frequency: 'fixed',
productVariantID: 'var_XXXXXXXXXXXXXXXXXXXXXXXXX',
quantity: 1,
})
.catch(async (err) => {
if (err instanceof Terminal.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
const product = await client.product.list().catch(async (err) => {
if (err instanceof Terminal.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
}

main();
Expand Down Expand Up @@ -134,7 +110,7 @@ const client = new Terminal({
});

// Or, configure per-request:
await client.subscription.create({ id: 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX', addressID: 'shp_XXXXXXXXXXXXXXXXXXXXXXXXX', cardID: 'crd_XXXXXXXXXXXXXXXXXXXXXXXXX', frequency: 'fixed', productVariantID: 'var_XXXXXXXXXXXXXXXXXXXXXXXXX', quantity: 1 }, {
await client.product.list({
maxRetries: 5,
});
```
Expand All @@ -151,7 +127,7 @@ const client = new Terminal({
});

// Override per-request:
await client.subscription.create({ id: 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX', addressID: 'shp_XXXXXXXXXXXXXXXXXXXXXXXXX', cardID: 'crd_XXXXXXXXXXXXXXXXXXXXXXXXX', frequency: 'fixed', productVariantID: 'var_XXXXXXXXXXXXXXXXXXXXXXXXX', quantity: 1 }, {
await client.product.list({
timeout: 5 * 1000,
});
```
Expand All @@ -172,31 +148,13 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
```ts
const client = new Terminal();

const response = await client.subscription
.create({
id: 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX',
addressID: 'shp_XXXXXXXXXXXXXXXXXXXXXXXXX',
cardID: 'crd_XXXXXXXXXXXXXXXXXXXXXXXXX',
frequency: 'fixed',
productVariantID: 'var_XXXXXXXXXXXXXXXXXXXXXXXXX',
quantity: 1,
})
.asResponse();
const response = await client.product.list().asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: subscription, response: raw } = await client.subscription
.create({
id: 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX',
addressID: 'shp_XXXXXXXXXXXXXXXXXXXXXXXXX',
cardID: 'crd_XXXXXXXXXXXXXXXXXXXXXXXXX',
frequency: 'fixed',
productVariantID: 'var_XXXXXXXXXXXXXXXXXXXXXXXXX',
quantity: 1,
})
.withResponse();
const { data: product, response: raw } = await client.product.list().withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(subscription.data);
console.log(product.data);
```

### Making custom/undocumented requests
Expand Down Expand Up @@ -300,19 +258,9 @@ const client = new Terminal({
});

// Override per-request:
await client.subscription.create(
{
id: 'sub_XXXXXXXXXXXXXXXXXXXXXXXXX',
addressID: 'shp_XXXXXXXXXXXXXXXXXXXXXXXXX',
cardID: 'crd_XXXXXXXXXXXXXXXXXXXXXXXXX',
frequency: 'fixed',
productVariantID: 'var_XXXXXXXXXXXXXXXXXXXXXXXXX',
quantity: 1,
},
{
httpAgent: new http.Agent({ keepAlive: false }),
},
);
await client.product.list({
httpAgent: new http.Agent({ keepAlive: false }),
});
```

## Semantic versioning
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@terminaldotshop/sdk",
"version": "0.9.0-alpha",
"version": "0.10.0-alpha",
"description": "The official TypeScript library for the Terminal API",
"author": "Terminal <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
12 changes: 6 additions & 6 deletions src/resources/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ export interface Subscription {
/**
* Schedule of the subscription.
*/
schedule?: Subscription.Type | Subscription.UnionMember1;
schedule?: Subscription.Fixed | Subscription.Weekly;
}

export namespace Subscription {
export interface Type {
export interface Fixed {
type: 'fixed';
}

export interface UnionMember1 {
export interface Weekly {
interval: number;

type: 'weekly';
Expand Down Expand Up @@ -140,15 +140,15 @@ export interface SubscriptionCreateParams {
/**
* Schedule of the subscription.
*/
schedule?: SubscriptionCreateParams.Type | SubscriptionCreateParams.UnionMember1;
schedule?: SubscriptionCreateParams.Fixed | SubscriptionCreateParams.Weekly;
}

export namespace SubscriptionCreateParams {
export interface Type {
export interface Fixed {
type: 'fixed';
}

export interface UnionMember1 {
export interface Weekly {
interval: number;

type: 'weekly';
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.9.0-alpha'; // x-release-please-version
export const VERSION = '0.10.0-alpha'; // x-release-please-version