Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and Stainless Bot committed Jul 10, 2024
1 parent 5b5b9bb commit b3332ad
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 30 deletions.
12 changes: 6 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ Methods:
- <code title="get /entities/{entity_id}">client.entities.<a href="./src/resources/entities/entities.ts">retrieve</a>(entityId) -> Entity</code>
- <code title="get /entities">client.entities.<a href="./src/resources/entities/entities.ts">list</a>() -> EntityListResponse</code>

## PnlSummary
## PnlSummaries

Methods:

- <code title="get /entities/{entity_id}/pnl-summary">client.entities.pnlSummary.<a href="./src/resources/entities/pnl-summary.ts">retrieve</a>(entityId) -> PnlSummary</code>
- <code title="get /entities/{entity_id}/pnl-summary">client.entities.pnlSummaries.<a href="./src/resources/entities/pnl-summaries.ts">retrieve</a>(entityId) -> PnlSummary</code>

## RegtMargin
## RegtMargins

Methods:

- <code title="get /entities/{entity_id}/regt-margin">client.entities.regtMargin.<a href="./src/resources/entities/regt-margin.ts">retrieve</a>(entityId) -> RegtMargin</code>
- <code title="get /entities/{entity_id}/regt-margin">client.entities.regtMargins.<a href="./src/resources/entities/regt-margins.ts">retrieve</a>(entityId) -> RegtMargin</code>

## PortfolioMargin
## PortfolioMargins

Methods:

- <code title="get /entities/{entity_id}/portfolio-margin">client.entities.portfolioMargin.<a href="./src/resources/entities/portfolio-margin.ts">retrieve</a>(entityId) -> PortfolioMargin</code>
- <code title="get /entities/{entity_id}/portfolio-margin">client.entities.portfolioMargins.<a href="./src/resources/entities/portfolio-margins.ts">retrieve</a>(entityId) -> PortfolioMargin</code>

## RegtMarginSimulations

Expand Down
20 changes: 11 additions & 9 deletions src/resources/entities/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@

import { APIResource } from '@clear-street/studio-sdk/resource';
import * as Core from '@clear-street/studio-sdk/core';
import { PnlSummary } from './pnl-summary';
import { RegtMargin } from './regt-margin';
import { PortfolioMargin } from './portfolio-margin';
import * as EntitiesAPI from '@clear-street/studio-sdk/resources/entities/entities';
import * as PnlSummaryAPI from '@clear-street/studio-sdk/resources/entities/pnl-summary';
import * as PortfolioMarginAPI from '@clear-street/studio-sdk/resources/entities/portfolio-margin';
import * as RegtMarginAPI from '@clear-street/studio-sdk/resources/entities/regt-margin';
import * as PnlSummariesAPI from '@clear-street/studio-sdk/resources/entities/pnl-summaries';
import * as PortfolioMarginsAPI from '@clear-street/studio-sdk/resources/entities/portfolio-margins';
import * as RegtMarginSimulationsAPI from '@clear-street/studio-sdk/resources/entities/regt-margin-simulations';
import * as RegtMarginsAPI from '@clear-street/studio-sdk/resources/entities/regt-margins';

export class Entities extends APIResource {
pnlSummary: PnlSummaryAPI.PnlSummary = new PnlSummaryAPI.PnlSummary(this._client);
regtMargin: RegtMarginAPI.RegtMargin = new RegtMarginAPI.RegtMargin(this._client);
portfolioMargin: PortfolioMarginAPI.PortfolioMargin = new PortfolioMarginAPI.PortfolioMargin(this._client);
pnlSummaries: PnlSummariesAPI.PnlSummaries = new PnlSummariesAPI.PnlSummaries(this._client);
regtMargins: RegtMarginsAPI.RegtMargins = new RegtMarginsAPI.RegtMargins(this._client);
portfolioMargins: PortfolioMarginsAPI.PortfolioMargins = new PortfolioMarginsAPI.PortfolioMargins(
this._client,
);
regtMarginSimulations: RegtMarginSimulationsAPI.RegtMarginSimulations =
new RegtMarginSimulationsAPI.RegtMarginSimulations(this._client);

Expand Down Expand Up @@ -553,6 +552,9 @@ export namespace Entities {
export import PortfolioMargin = EntitiesAPI.PortfolioMargin;
export import RegtMargin = EntitiesAPI.RegtMargin;
export import EntityListResponse = EntitiesAPI.EntityListResponse;
export import PnlSummaries = PnlSummariesAPI.PnlSummaries;
export import RegtMargins = RegtMarginsAPI.RegtMargins;
export import PortfolioMargins = PortfolioMarginsAPI.PortfolioMargins;
export import RegtMarginSimulations = RegtMarginSimulationsAPI.RegtMarginSimulations;
export import SimulationID = RegtMarginSimulationsAPI.SimulationID;
export import RegtMarginSimulationCreateResponse = RegtMarginSimulationsAPI.RegtMarginSimulationCreateResponse;
Expand Down
6 changes: 3 additions & 3 deletions src/resources/entities/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { Entity, PnlSummary, PortfolioMargin, RegtMargin, EntityListResponse, Entities } from './entities';
export { PnlSummary } from './pnl-summary';
export { PortfolioMargin } from './portfolio-margin';
export { RegtMargin } from './regt-margin';
export { PnlSummaries } from './pnl-summaries';
export { PortfolioMargins } from './portfolio-margins';
export { RegtMargins } from './regt-margins';
export {
SimulationID,
RegtMarginSimulationCreateResponse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { APIResource } from '@clear-street/studio-sdk/resource';
import * as Core from '@clear-street/studio-sdk/core';
import * as EntitiesAPI from '@clear-street/studio-sdk/resources/entities/entities';

export class PnlSummary extends APIResource {
export class PnlSummaries extends APIResource {
/**
* Get PNL summary for all accounts in an entity.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { APIResource } from '@clear-street/studio-sdk/resource';
import * as Core from '@clear-street/studio-sdk/core';
import * as EntitiesAPI from '@clear-street/studio-sdk/resources/entities/entities';

export class PortfolioMargin extends APIResource {
export class PortfolioMargins extends APIResource {
/**
* Get latest portfolio margin calculation for the given entity
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { APIResource } from '@clear-street/studio-sdk/resource';
import * as Core from '@clear-street/studio-sdk/core';
import * as EntitiesAPI from '@clear-street/studio-sdk/resources/entities/entities';

export class RegtMargin extends APIResource {
export class RegtMargins extends APIResource {
/**
* Get the latest Reg-T margin calculation for the given entity
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const studioSDK = new StudioSDK({
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});

describe('resource pnlSummary', () => {
describe('resource pnlSummaries', () => {
test('retrieve', async () => {
const responsePromise = studioSDK.entities.pnlSummary.retrieve('x');
const responsePromise = studioSDK.entities.pnlSummaries.retrieve('x');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -23,7 +23,7 @@ describe('resource pnlSummary', () => {
test('retrieve: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
studioSDK.entities.pnlSummary.retrieve('x', { path: '/_stainless_unknown_path' }),
studioSDK.entities.pnlSummaries.retrieve('x', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(StudioSDK.NotFoundError);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const studioSDK = new StudioSDK({
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});

describe('resource portfolioMargin', () => {
describe('resource portfolioMargins', () => {
test('retrieve', async () => {
const responsePromise = studioSDK.entities.portfolioMargin.retrieve('x');
const responsePromise = studioSDK.entities.portfolioMargins.retrieve('x');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -23,7 +23,7 @@ describe('resource portfolioMargin', () => {
test('retrieve: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
studioSDK.entities.portfolioMargin.retrieve('x', { path: '/_stainless_unknown_path' }),
studioSDK.entities.portfolioMargins.retrieve('x', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(StudioSDK.NotFoundError);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const studioSDK = new StudioSDK({
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});

describe('resource regtMargin', () => {
describe('resource regtMargins', () => {
test('retrieve', async () => {
const responsePromise = studioSDK.entities.regtMargin.retrieve('x');
const responsePromise = studioSDK.entities.regtMargins.retrieve('x');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -23,7 +23,7 @@ describe('resource regtMargin', () => {
test('retrieve: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
studioSDK.entities.regtMargin.retrieve('x', { path: '/_stainless_unknown_path' }),
studioSDK.entities.regtMargins.retrieve('x', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(StudioSDK.NotFoundError);
});
});

0 comments on commit b3332ad

Please sign in to comment.