From 1f63de270b0b9d25876096bd4cee4d50bacae867 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2024 19:27:29 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#19) --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 895adb2..b2f70f7 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ import StudioSDK from '@clear-street/studio-sdk'; const studioSDK = new StudioSDK(); async function main() { - const entity = await studioSDK.entities.retrieve(''); + const entity = await studioSDK.entities.retrieve(''); console.log(entity.entity_id); } @@ -44,7 +44,7 @@ import StudioSDK from '@clear-street/studio-sdk'; const studioSDK = new StudioSDK(); async function main() { - const entity: StudioSDK.Entity = await studioSDK.entities.retrieve(''); + const entity: StudioSDK.Entity = await studioSDK.entities.retrieve(''); } main(); @@ -61,7 +61,7 @@ a subclass of `APIError` will be thrown: ```ts async function main() { - const entity = await studioSDK.entities.retrieve('').catch(async (err) => { + const entity = await studioSDK.entities.retrieve('').catch(async (err) => { if (err instanceof StudioSDK.APIError) { console.log(err.status); // 400 console.log(err.name); // BadRequestError @@ -104,7 +104,7 @@ const studioSDK = new StudioSDK({ }); // Or, configure per-request: -await studioSDK.entities.retrieve('', { +await studioSDK.entities.retrieve('', { maxRetries: 5, }); ``` @@ -121,7 +121,7 @@ const studioSDK = new StudioSDK({ }); // Override per-request: -await studioSDK.entities.retrieve('', { +await studioSDK.entities.retrieve('', { timeout: 5 * 1000, }); ``` @@ -142,11 +142,11 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi ```ts const studioSDK = new StudioSDK(); -const response = await studioSDK.entities.retrieve('').asResponse(); +const response = await studioSDK.entities.retrieve('').asResponse(); console.log(response.headers.get('X-My-Header')); console.log(response.statusText); // access the underlying Response object -const { data: entity, response: raw } = await studioSDK.entities.retrieve('').withResponse(); +const { data: entity, response: raw } = await studioSDK.entities.retrieve('').withResponse(); console.log(raw.headers.get('X-My-Header')); console.log(entity.entity_id); ``` @@ -252,7 +252,7 @@ const studioSDK = new StudioSDK({ }); // Override per-request: -await studioSDK.entities.retrieve('', { +await studioSDK.entities.retrieve('', { httpAgent: new http.Agent({ keepAlive: false }), }); ```