Skip to content

Commit

Permalink
Merge pull request #50 from nestrilabs/release-please--branches--main…
Browse files Browse the repository at this point in the history
…--changes--next--components--sdk

release: 0.1.0-alpha.12
  • Loading branch information
wanjohiryan authored Jan 31, 2025
2 parents df088f4 + 7ca8954 commit 21d3e60
Show file tree
Hide file tree
Showing 28 changed files with 333 additions and 1,117 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.11"
".": "0.1.0-alpha.12"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 25
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nestri%2Fnestri-sdk-95529b26c5ca5a1a5e59375d4d20274d836b51018d67db117b016373289807a8.yml
configured_endpoints: 14
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nestri%2Fnestri-sdk-a70f3a633153500d9d455e8ede51aa239cd16e444185cf60a54b392ad7f89152.yml
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.1.0-alpha.12 (2025-01-31)

Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/nestrilabs/nestri-node-sdk/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)

### Features

* **api:** Add tasks and remove old resources ([#53](https://github.com/nestrilabs/nestri-node-sdk/issues/53)) ([d334b13](https://github.com/nestrilabs/nestri-node-sdk/commit/d334b132128d8367e2504c126db0e25a580a98b1))
* **api:** api update ([#51](https://github.com/nestrilabs/nestri-node-sdk/issues/51)) ([b8280da](https://github.com/nestrilabs/nestri-node-sdk/commit/b8280da35f96f5af07426bb1ad6767d84a6628eb))
* **api:** api update ([#52](https://github.com/nestrilabs/nestri-node-sdk/issues/52)) ([39e0834](https://github.com/nestrilabs/nestri-node-sdk/commit/39e0834c6a58b5a0bbb39a4117dc193fc98c1b9d))
* **api:** code samples ([#49](https://github.com/nestrilabs/nestri-node-sdk/issues/49)) ([51964d9](https://github.com/nestrilabs/nestri-node-sdk/commit/51964d9dfdc5a50e2cdeb685a25bb6eb656645cc))

## 0.1.0-alpha.11 (2025-01-18)

Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/nestrilabs/nestri-node-sdk/compare/v0.1.0-alpha.10...v0.1.0-alpha.11)
Expand Down
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const client = new Nestri({
});

async function main() {
const game = await client.games.retrieve(870780);
const session = await client.sessions.create({ public: true });

console.log(game.data);
console.log(session.data);
}

main();
Expand All @@ -48,7 +48,8 @@ const client = new Nestri({
});

async function main() {
const game: Nestri.GameRetrieveResponse = await client.games.retrieve(870780);
const params: Nestri.SessionCreateParams = { public: true };
const session: Nestri.SessionCreateResponse = await client.sessions.create(params);
}

main();
Expand All @@ -65,7 +66,7 @@ a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```ts
async function main() {
const game = await client.games.retrieve(870780).catch(async (err) => {
const session = await client.sessions.create({ public: true }).catch(async (err) => {
if (err instanceof Nestri.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
Expand Down Expand Up @@ -108,7 +109,7 @@ const client = new Nestri({
});

// Or, configure per-request:
await client.games.retrieve(870780, {
await client.sessions.create({ public: true }, {
maxRetries: 5,
});
```
Expand All @@ -125,7 +126,7 @@ const client = new Nestri({
});

// Override per-request:
await client.games.retrieve(870780, {
await client.sessions.create({ public: true }, {
timeout: 5 * 1000,
});
```
Expand All @@ -146,13 +147,13 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
```ts
const client = new Nestri();

const response = await client.games.retrieve(870780).asResponse();
const response = await client.sessions.create({ public: true }).asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: game, response: raw } = await client.games.retrieve(870780).withResponse();
const { data: session, response: raw } = await client.sessions.create({ public: true }).withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(game.data);
console.log(session.data);
```

### Making custom/undocumented requests
Expand Down Expand Up @@ -256,9 +257,12 @@ const client = new Nestri({
});

// Override per-request:
await client.games.retrieve(870780, {
httpAgent: new http.Agent({ keepAlive: false }),
});
await client.sessions.create(
{ public: true },
{
httpAgent: new http.Agent({ keepAlive: false }),
},
);
```

## Semantic versioning
Expand Down
96 changes: 22 additions & 74 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,82 +1,26 @@
# Machines

Types:

- <code><a href="./src/resources/machines.ts">MachineCreateResponse</a></code>
- <code><a href="./src/resources/machines.ts">MachineRetrieveResponse</a></code>
- <code><a href="./src/resources/machines.ts">MachineListResponse</a></code>
- <code><a href="./src/resources/machines.ts">MachineDeleteResponse</a></code>

Methods:

- <code title="post /machines/{fingerprint}">client.machines.<a href="./src/resources/machines.ts">create</a>(fingerprint) -> MachineCreateResponse</code>
- <code title="get /machines/{fingerprint}">client.machines.<a href="./src/resources/machines.ts">retrieve</a>(fingerprint) -> MachineRetrieveResponse</code>
- <code title="get /machines">client.machines.<a href="./src/resources/machines.ts">list</a>() -> MachineListResponse</code>
- <code title="delete /machines/{fingerprint}">client.machines.<a href="./src/resources/machines.ts">delete</a>(fingerprint) -> MachineDeleteResponse</code>

# Sessions

Types:

- <code><a href="./src/resources/sessions/sessions.ts">SessionCreateResponse</a></code>
- <code><a href="./src/resources/sessions/sessions.ts">SessionRetrieveResponse</a></code>
- <code><a href="./src/resources/sessions/sessions.ts">SessionListResponse</a></code>
- <code><a href="./src/resources/sessions/sessions.ts">SessionDeleteResponse</a></code>

Methods:

- <code title="post /sessions">client.sessions.<a href="./src/resources/sessions/sessions.ts">create</a>({ ...params }) -> SessionCreateResponse</code>
- <code title="get /sessions/{id}">client.sessions.<a href="./src/resources/sessions/sessions.ts">retrieve</a>(id) -> SessionRetrieveResponse</code>
- <code title="get /sessions">client.sessions.<a href="./src/resources/sessions/sessions.ts">list</a>() -> SessionListResponse</code>
- <code title="delete /sessions/{id}">client.sessions.<a href="./src/resources/sessions/sessions.ts">delete</a>(id) -> SessionDeleteResponse</code>

## Active

Types:

- <code><a href="./src/resources/sessions/active/active.ts">ActiveListResponse</a></code>

Methods:

- <code title="get /sessions/active">client.sessions.active.<a href="./src/resources/sessions/active/active.ts">list</a>() -> ActiveListResponse</code>

### Public

Types:

- <code><a href="./src/resources/sessions/active/public.ts">PublicListResponse</a></code>

Methods:

- <code title="get /sessions/active/public">client.sessions.active.public.<a href="./src/resources/sessions/active/public.ts">list</a>() -> PublicListResponse</code>

# Games

Types:

- <code><a href="./src/resources/games/games.ts">GameCreateResponse</a></code>
- <code><a href="./src/resources/games/games.ts">GameRetrieveResponse</a></code>
- <code><a href="./src/resources/games/games.ts">GameUpdateResponse</a></code>
- <code><a href="./src/resources/games/games.ts">GameListResponse</a></code>
- <code><a href="./src/resources/games/games.ts">GameDeleteResponse</a></code>
- <code><a href="./src/resources/sessions/active.ts">ActiveListResponse</a></code>

Methods:

- <code title="post /games/{steamID}">client.games.<a href="./src/resources/games/games.ts">create</a>(steamId) -> GameCreateResponse</code>
- <code title="get /games/{steamID}">client.games.<a href="./src/resources/games/games.ts">retrieve</a>(steamId) -> GameRetrieveResponse</code>
- <code title="put /games">client.games.<a href="./src/resources/games/games.ts">update</a>({ ...params }) -> GameUpdateResponse</code>
- <code title="get /games">client.games.<a href="./src/resources/games/games.ts">list</a>() -> GameListResponse</code>
- <code title="delete /games/{steamID}">client.games.<a href="./src/resources/games/games.ts">delete</a>(steamId) -> GameDeleteResponse</code>

## Sessions

Types:

- <code><a href="./src/resources/games/sessions.ts">SessionListResponse</a></code>

Methods:

- <code title="get /games/{steamID}/sessions">client.games.sessions.<a href="./src/resources/games/sessions.ts">list</a>(steamId) -> SessionListResponse</code>
- <code title="get /sessions/active">client.sessions.active.<a href="./src/resources/sessions/active.ts">list</a>() -> ActiveListResponse</code>

# Users

Expand All @@ -90,22 +34,6 @@ Methods:

# Teams

Types:

- <code><a href="./src/resources/teams.ts">TeamCreateResponse</a></code>
- <code><a href="./src/resources/teams.ts">TeamRetrieveResponse</a></code>
- <code><a href="./src/resources/teams.ts">TeamListResponse</a></code>
- <code><a href="./src/resources/teams.ts">TeamDeleteResponse</a></code>
- <code><a href="./src/resources/teams.ts">TeamInviteResponse</a></code>

Methods:

- <code title="post /teams">client.teams.<a href="./src/resources/teams.ts">create</a>({ ...params }) -> TeamCreateResponse</code>
- <code title="get /teams/{slug}">client.teams.<a href="./src/resources/teams.ts">retrieve</a>(slug) -> TeamRetrieveResponse</code>
- <code title="get /teams">client.teams.<a href="./src/resources/teams.ts">list</a>() -> TeamListResponse</code>
- <code title="delete /teams/{slug}">client.teams.<a href="./src/resources/teams.ts">delete</a>(slug) -> TeamDeleteResponse</code>
- <code title="post /teams/{slug}/invite/{email}">client.teams.<a href="./src/resources/teams.ts">invite</a>(slug, email) -> TeamInviteResponse</code>

# Subscriptions

Types:
Expand All @@ -119,3 +47,23 @@ Methods:
- <code title="post /subscriptions">client.subscriptions.<a href="./src/resources/subscriptions.ts">create</a>({ ...params }) -> SubscriptionCreateResponse</code>
- <code title="get /subscriptions">client.subscriptions.<a href="./src/resources/subscriptions.ts">list</a>() -> SubscriptionListResponse</code>
- <code title="delete /subscriptions/{id}">client.subscriptions.<a href="./src/resources/subscriptions.ts">delete</a>(id) -> SubscriptionDeleteResponse</code>

# Tasks

Types:

- <code><a href="./src/resources/tasks.ts">TaskCreateResponse</a></code>
- <code><a href="./src/resources/tasks.ts">TaskRetrieveResponse</a></code>
- <code><a href="./src/resources/tasks.ts">TaskUpdateResponse</a></code>
- <code><a href="./src/resources/tasks.ts">TaskListResponse</a></code>
- <code><a href="./src/resources/tasks.ts">TaskDeleteResponse</a></code>
- <code><a href="./src/resources/tasks.ts">TaskSessionResponse</a></code>

Methods:

- <code title="post /tasks">client.tasks.<a href="./src/resources/tasks.ts">create</a>() -> TaskCreateResponse</code>
- <code title="get /tasks/{id}">client.tasks.<a href="./src/resources/tasks.ts">retrieve</a>(id) -> TaskRetrieveResponse</code>
- <code title="put /tasks/{id}">client.tasks.<a href="./src/resources/tasks.ts">update</a>(id) -> TaskUpdateResponse</code>
- <code title="get /tasks">client.tasks.<a href="./src/resources/tasks.ts">list</a>() -> TaskListResponse</code>
- <code title="delete /tasks/{id}">client.tasks.<a href="./src/resources/tasks.ts">delete</a>(id) -> TaskDeleteResponse</code>
- <code title="get /tasks/{id}/session">client.tasks.<a href="./src/resources/tasks.ts">session</a>(id) -> TaskSessionResponse</code>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestri/sdk",
"version": "0.1.0-alpha.11",
"version": "0.1.0-alpha.12",
"description": "The official TypeScript library for the Nestri API",
"author": "Nestri <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
79 changes: 22 additions & 57 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ import * as Core from './core';
import * as Errors from './error';
import * as Uploads from './uploads';
import * as API from './resources/index';
import {
MachineCreateResponse,
MachineDeleteResponse,
MachineListResponse,
MachineRetrieveResponse,
Machines,
} from './resources/machines';
import {
SubscriptionCreateParams,
SubscriptionCreateResponse,
Expand All @@ -20,29 +13,20 @@ import {
Subscriptions,
} from './resources/subscriptions';
import {
TeamCreateParams,
TeamCreateResponse,
TeamDeleteResponse,
TeamInviteResponse,
TeamListResponse,
TeamRetrieveResponse,
Teams,
} from './resources/teams';
TaskCreateResponse,
TaskDeleteResponse,
TaskListResponse,
TaskRetrieveResponse,
TaskSessionResponse,
TaskUpdateResponse,
Tasks,
} from './resources/tasks';
import { Teams } from './resources/teams';
import { UserRetrieveResponse, Users } from './resources/users';
import {
GameCreateResponse,
GameDeleteResponse,
GameListResponse,
GameRetrieveResponse,
GameUpdateParams,
GameUpdateResponse,
Games,
} from './resources/games/games';
import {
SessionCreateParams,
SessionCreateResponse,
SessionDeleteResponse,
SessionListResponse,
SessionRetrieveResponse,
Sessions,
} from './resources/sessions/sessions';
Expand Down Expand Up @@ -160,12 +144,11 @@ export class Nestri extends Core.APIClient {
this.bearerToken = bearerToken;
}

machines: API.Machines = new API.Machines(this);
sessions: API.Sessions = new API.Sessions(this);
games: API.Games = new API.Games(this);
users: API.Users = new API.Users(this);
teams: API.Teams = new API.Teams(this);
subscriptions: API.Subscriptions = new API.Subscriptions(this);
tasks: API.Tasks = new API.Tasks(this);

protected override defaultQuery(): Core.DefaultQuery | undefined {
return this._options.defaultQuery;
Expand Down Expand Up @@ -203,53 +186,25 @@ export class Nestri extends Core.APIClient {
static fileFromPath = Uploads.fileFromPath;
}

Nestri.Machines = Machines;
Nestri.Sessions = Sessions;
Nestri.Games = Games;
Nestri.Users = Users;
Nestri.Teams = Teams;
Nestri.Subscriptions = Subscriptions;
Nestri.Tasks = Tasks;
export declare namespace Nestri {
export type RequestOptions = Core.RequestOptions;

export {
Machines as Machines,
type MachineCreateResponse as MachineCreateResponse,
type MachineRetrieveResponse as MachineRetrieveResponse,
type MachineListResponse as MachineListResponse,
type MachineDeleteResponse as MachineDeleteResponse,
};

export {
Sessions as Sessions,
type SessionCreateResponse as SessionCreateResponse,
type SessionRetrieveResponse as SessionRetrieveResponse,
type SessionListResponse as SessionListResponse,
type SessionDeleteResponse as SessionDeleteResponse,
type SessionCreateParams as SessionCreateParams,
};

export {
Games as Games,
type GameCreateResponse as GameCreateResponse,
type GameRetrieveResponse as GameRetrieveResponse,
type GameUpdateResponse as GameUpdateResponse,
type GameListResponse as GameListResponse,
type GameDeleteResponse as GameDeleteResponse,
type GameUpdateParams as GameUpdateParams,
};

export { Users as Users, type UserRetrieveResponse as UserRetrieveResponse };

export {
Teams as Teams,
type TeamCreateResponse as TeamCreateResponse,
type TeamRetrieveResponse as TeamRetrieveResponse,
type TeamListResponse as TeamListResponse,
type TeamDeleteResponse as TeamDeleteResponse,
type TeamInviteResponse as TeamInviteResponse,
type TeamCreateParams as TeamCreateParams,
};
export { Teams as Teams };

export {
Subscriptions as Subscriptions,
Expand All @@ -258,6 +213,16 @@ export declare namespace Nestri {
type SubscriptionDeleteResponse as SubscriptionDeleteResponse,
type SubscriptionCreateParams as SubscriptionCreateParams,
};

export {
Tasks as Tasks,
type TaskCreateResponse as TaskCreateResponse,
type TaskRetrieveResponse as TaskRetrieveResponse,
type TaskUpdateResponse as TaskUpdateResponse,
type TaskListResponse as TaskListResponse,
type TaskDeleteResponse as TaskDeleteResponse,
type TaskSessionResponse as TaskSessionResponse,
};
}

export { toFile, fileFromPath } from './uploads';
Expand Down
Loading

0 comments on commit 21d3e60

Please sign in to comment.