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

feat(api): update via SDK Studio #17

Merged
merged 1 commit into from
Jul 10, 2024
Merged
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
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