Skip to content

Commit

Permalink
chore: 🐝 Update SDK - Generate 2.14.1 (#94)
Browse files Browse the repository at this point in the history
* ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.401.2

* write tests to verify shipments paging

---------

Co-authored-by: speakeasybot <[email protected]>
Co-authored-by: Randall Keur <[email protected]>
  • Loading branch information
3 people authored Nov 26, 2024
1 parent 9b2685a commit d653350
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 16 deletions.
7 changes: 4 additions & 3 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: 4f7e8ab5-4c00-496a-9710-e7c707e4ee78
management:
docChecksum: bda7f4add5fb510fe4737e3adbe45aea
docChecksum: 256e7d68eaf807fc9ef86f8311e8a13f
docVersion: "2018-02-08"
speakeasyVersion: 1.401.2
generationVersion: 2.421.3
releaseVersion: 2.13.0
configChecksum: d4256e5ea6287869f60153cb7c8c4927
releaseVersion: 2.14.1
configChecksum: bcfebe2c39e567249ac9def567cd98fe
repoURL: https://github.com/goshippo/shippo-javascript-sdk.git
installationURL: https://github.com/goshippo/shippo-javascript-sdk
published: true
Expand Down Expand Up @@ -1525,3 +1525,4 @@ examples:
parameters:
path:
webhookId: "<value>"
generatedTests: {}
3 changes: 2 additions & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: true
typescript:
version: 2.13.0
version: 2.14.1
additionalDependencies:
dependencies: {}
devDependencies:
Expand All @@ -27,6 +27,7 @@ typescript:
author: Shippo
clientServerStatusCodesAsErrors: true
defaultErrorName: SDKError
enableReactQuery: false
enumFormat: union
flattenGlobalSecurity: true
flatteningOrder: body-first
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ speakeasyVersion: 1.401.2
sources:
openapi:
sourceNamespace: openapi
sourceRevisionDigest: sha256:6a8ece3e0152d024847477a897bf45f36db26ce973667fe87361980077ef713f
sourceBlobDigest: sha256:9ed21afb1191003cf67f0c0e5735d08eb0d8b07ae141d7479d5c84ef9f221fb4
sourceRevisionDigest: sha256:67380a5740d2ebf50c6b5d4ecd48d398c184e281c8302c0d0306220da7535048
sourceBlobDigest: sha256:d1d1d6dbb27ba9c1d86549fa879da10167c9890d2d3443c087c7b8555971a12c
tags:
- latest
- main
targets:
first-target:
source: openapi
sourceNamespace: openapi
sourceRevisionDigest: sha256:6a8ece3e0152d024847477a897bf45f36db26ce973667fe87361980077ef713f
sourceBlobDigest: sha256:9ed21afb1191003cf67f0c0e5735d08eb0d8b07ae141d7479d5c84ef9f221fb4
sourceRevisionDigest: sha256:67380a5740d2ebf50c6b5d4ecd48d398c184e281c8302c0d0306220da7535048
sourceBlobDigest: sha256:d1d1d6dbb27ba9c1d86549fa879da10167c9890d2d3443c087c7b8555971a12c
codeSamplesNamespace: openapi-code-samples
codeSamplesRevisionDigest: sha256:5ffb891db6f12ae97b0d2a11181e5615a72e70854e5de83469968ae8e02ba333
codeSamplesRevisionDigest: sha256:df1a9ca170bc417e1e111efbc10b1f07765943764cb1cbd046d9b6efc18cfc43
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,14 @@ Based on:
### Generated
- [typescript v2.13.0] .
### Releases
- [NPM v2.13.0] https://www.npmjs.com/package/shippo/v/2.13.0 - .
- [NPM v2.13.0] https://www.npmjs.com/package/shippo/v/2.13.0 - .

## 2024-11-26 16:00:17
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.401.2 (2.421.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v2.14.1] .
### Releases
- [NPM v2.14.1] https://www.npmjs.com/package/shippo/v/2.14.1 - .
1 change: 1 addition & 0 deletions docs/models/operations/listshipmentsrequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let value: ListShipmentsRequest = {};

| Field | Type | Required | Description |
| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `pageToken` | *string* | :heavy_minus_sign: | The page token for paginated results |
| `page` | *number* | :heavy_minus_sign: | The page number you want to select |
| `results` | *number* | :heavy_minus_sign: | The number of results to return per page (max 100) |
| `objectCreatedGt` | *string* | :heavy_minus_sign: | Object(s) created greater than a provided date and time. |
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "shippo",
"version": "2.13.0",
"version": "2.14.1",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shippo",
"version": "2.13.0",
"version": "2.14.1",
"author": "Shippo",
"license": "MIT",
"main": "./index.js",
Expand Down
1 change: 1 addition & 0 deletions src/funcs/shipmentsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export async function shipmentsList(
"object_created_lt": payload.object_created_lt,
"object_created_lte": payload.object_created_lte,
"page": payload.page,
"page_token": payload.page_token,
"results": payload.results,
});

Expand Down
4 changes: 2 additions & 2 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "2018-02-08",
sdkVersion: "2.13.0",
sdkVersion: "2.14.1",
genVersion: "2.421.3",
userAgent: "speakeasy-sdk/typescript 2.13.0 2.421.3 2018-02-08 shippo",
userAgent: "speakeasy-sdk/typescript 2.14.1 2.421.3 2018-02-08 shippo",
} as const;
9 changes: 9 additions & 0 deletions src/models/operations/listshipments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export type ListShipmentsGlobals = {
};

export type ListShipmentsRequest = {
/**
* The page token for paginated results
*/
pageToken?: string | undefined;
/**
* The page number you want to select
*/
Expand Down Expand Up @@ -89,6 +93,7 @@ export const ListShipmentsRequest$inboundSchema: z.ZodType<
z.ZodTypeDef,
unknown
> = z.object({
page_token: z.string().optional(),
page: z.number().int().default(1),
results: z.number().int().default(25),
object_created_gt: z.string().optional(),
Expand All @@ -97,6 +102,7 @@ export const ListShipmentsRequest$inboundSchema: z.ZodType<
object_created_lte: z.string().optional(),
}).transform((v) => {
return remap$(v, {
"page_token": "pageToken",
"object_created_gt": "objectCreatedGt",
"object_created_gte": "objectCreatedGte",
"object_created_lt": "objectCreatedLt",
Expand All @@ -106,6 +112,7 @@ export const ListShipmentsRequest$inboundSchema: z.ZodType<

/** @internal */
export type ListShipmentsRequest$Outbound = {
page_token?: string | undefined;
page: number;
results: number;
object_created_gt?: string | undefined;
Expand All @@ -120,6 +127,7 @@ export const ListShipmentsRequest$outboundSchema: z.ZodType<
z.ZodTypeDef,
ListShipmentsRequest
> = z.object({
pageToken: z.string().optional(),
page: z.number().int().default(1),
results: z.number().int().default(25),
objectCreatedGt: z.string().optional(),
Expand All @@ -128,6 +136,7 @@ export const ListShipmentsRequest$outboundSchema: z.ZodType<
objectCreatedLte: z.string().optional(),
}).transform((v) => {
return remap$(v, {
pageToken: "page_token",
objectCreatedGt: "object_created_gt",
objectCreatedGte: "object_created_gte",
objectCreatedLt: "object_created_lt",
Expand Down
45 changes: 45 additions & 0 deletions test/shipment.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {shippoSdk} from "./helpers";
import {expect} from "chai";

describe('TestShipments', function () {
it('testListAllShipments', async() => {
const response = await shippoSdk.shipments.list({});

expect(response).to.not.be.null;
expect(response).to.be.an('object');

expect(response).to.have.property('results').that.is.an('array');
assertShipmentResults(response.results);
});

it('testListAllShipmentsPagination', async() => {
const response = await shippoSdk.shipments.list({ page: 1, results: 2 });

// Basic response assertions
expect(response).to.not.be.null;
expect(response).to.have.property('results').that.is.an('array');
assertShipmentResults(response.results);

if (response.next) {
const pageTokenMatch = response.next.match(/page_token=([^&]+)/);
if (pageTokenMatch) {
const pageToken = pageTokenMatch[1];
const secondResponse = await shippoSdk.shipments.list({ page_token: pageToken, page: 2, results: 2 });

expect(secondResponse).to.not.be.null;
expect(secondResponse).to.have.property('results').that.is.an('array');
assertShipmentResults(secondResponse.results);
}
}
});
});

function assertShipmentResults(results) {
if (results.length > 0) {
results.forEach(result => {
expect(result).to.have.property('objectId').that.is.a('string').and.is.not.empty;
expect(result).to.have.property('addressFrom').that.is.an('object');
expect(result).to.have.property('addressTo').that.is.an('object');
});
}
}

0 comments on commit d653350

Please sign in to comment.