Skip to content

Commit

Permalink
feat(api): update via SDK Studio
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Jul 10, 2024
1 parent 95c8902 commit 2c5f002
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import StudioSDK from '@clear-street/studio-sdk';
const studioSDK = new StudioSDK();

async function main() {
const entity = await studioSDK.entities.retrieve('<your entity_id>');
const entity = await studioSDK.entities.retrieve('<your_entity_id>');

console.log(entity.entity_id);
}
Expand All @@ -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('<your entity_id>');
const entity: StudioSDK.Entity = await studioSDK.entities.retrieve('<your_entity_id>');
}

main();
Expand All @@ -61,7 +61,7 @@ a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```ts
async function main() {
const entity = await studioSDK.entities.retrieve('<your entity_id>').catch(async (err) => {
const entity = await studioSDK.entities.retrieve('<your_entity_id>').catch(async (err) => {
if (err instanceof StudioSDK.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
Expand Down Expand Up @@ -104,7 +104,7 @@ const studioSDK = new StudioSDK({
});

// Or, configure per-request:
await studioSDK.entities.retrieve('<your entity_id>', {
await studioSDK.entities.retrieve('<your_entity_id>', {
maxRetries: 5,
});
```
Expand All @@ -121,7 +121,7 @@ const studioSDK = new StudioSDK({
});

// Override per-request:
await studioSDK.entities.retrieve('<your entity_id>', {
await studioSDK.entities.retrieve('<your_entity_id>', {
timeout: 5 * 1000,
});
```
Expand All @@ -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('<your entity_id>').asResponse();
const response = await studioSDK.entities.retrieve('<your_entity_id>').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('<your entity_id>').withResponse();
const { data: entity, response: raw } = await studioSDK.entities.retrieve('<your_entity_id>').withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(entity.entity_id);
```
Expand Down Expand Up @@ -252,7 +252,7 @@ const studioSDK = new StudioSDK({
});

// Override per-request:
await studioSDK.entities.retrieve('<your entity_id>', {
await studioSDK.entities.retrieve('<your_entity_id>', {
httpAgent: new http.Agent({ keepAlive: false }),
});
```
Expand Down

0 comments on commit 2c5f002

Please sign in to comment.