Skip to content

Commit

Permalink
Merge pull request #14 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.3
  • Loading branch information
wanjohiryan authored Jan 4, 2025
2 parents 822b453 + e3c2bda commit d6ff9e2
Show file tree
Hide file tree
Showing 21 changed files with 654 additions and 17 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.2"
".": "0.1.0-alpha.3"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 8
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nestri%2Fnestri-sdk-82a0a3ecc659cc86ed90fd9c59967fda4c8956b9a169e9aa59e82116010d386c.yml
configured_endpoints: 16
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nestri%2Fnestri-sdk-d41f3521b15659cbf7f06eff19bc1c16f38356804fb3dd517a1b2305dc31672a.yml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.3 (2025-01-04)

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

### Features

* **api:** manual updates ([#13](https://github.com/nestrilabs/nestri-node-sdk/issues/13)) ([e1dd97c](https://github.com/nestrilabs/nestri-node-sdk/commit/e1dd97c3a6005392d11aad73e52a5012d70cde1c))

## 0.1.0-alpha.2 (2025-01-04)

Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/nestrilabs/nestri-node-sdk/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
Expand Down
64 changes: 56 additions & 8 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,62 @@ Methods:

Types:

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

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>
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.2",
"version": "0.1.0-alpha.3",
"description": "The official TypeScript library for the Nestri API",
"author": "Nestri <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
23 changes: 22 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,23 @@ import {
MachineRetrieveResponse,
Machines,
} from './resources/machines';
import {
GameCreateResponse,
GameDeleteResponse,
GameListResponse,
GameRetrieveResponse,
GameUpdateParams,
GameUpdateResponse,
Games,
} from './resources/games/games';
import {
SessionCreateParams,
SessionCreateResponse,
SessionDeleteResponse,
SessionListResponse,
SessionRetrieveResponse,
Sessions,
} from './resources/sessions';
} from './resources/sessions/sessions';

export interface ClientOptions {
/**
Expand Down Expand Up @@ -136,6 +145,7 @@ export class Nestri extends Core.APIClient {

machines: API.Machines = new API.Machines(this);
sessions: API.Sessions = new API.Sessions(this);
games: API.Games = new API.Games(this);

protected override defaultQuery(): Core.DefaultQuery | undefined {
return this._options.defaultQuery;
Expand Down Expand Up @@ -175,6 +185,7 @@ export class Nestri extends Core.APIClient {

Nestri.Machines = Machines;
Nestri.Sessions = Sessions;
Nestri.Games = Games;
export declare namespace Nestri {
export type RequestOptions = Core.RequestOptions;

Expand All @@ -194,6 +205,16 @@ export declare namespace Nestri {
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 { toFile, fileFromPath } from './uploads';
Expand Down
144 changes: 144 additions & 0 deletions src/resources/games/games.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../resource';
import * as Core from '../../core';
import * as SessionsAPI from './sessions';
import { SessionListResponse, Sessions } from './sessions';

export class Games extends APIResource {
sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client);

/**
* Adds a game to the currently authenticated user's library. Once added, the user
* can play the game and share their progress with others
*/
create(steamId: number, options?: Core.RequestOptions): Core.APIPromise<GameCreateResponse> {
return this._client.post(`/games/${steamId}`, options);
}

/**
* Fetches detailed metadata about a specific game using its Steam ID
*/
retrieve(steamId: number, options?: Core.RequestOptions): Core.APIPromise<GameRetrieveResponse> {
return this._client.get(`/games/${steamId}`, options);
}

/**
* Updates the metadata about a specific game using its Steam ID
*/
update(body: GameUpdateParams, options?: Core.RequestOptions): Core.APIPromise<GameUpdateResponse> {
return this._client.put('/games', { body, ...options });
}

/**
* Returns a list of all (known) games associated with the authenticated user
*/
list(options?: Core.RequestOptions): Core.APIPromise<GameListResponse> {
return this._client.get('/games', options);
}

/**
* Removes a game from the authenticated user's library. The game remains in the
* system but will no longer be accessible to the user
*/
delete(steamId: number, options?: Core.RequestOptions): Core.APIPromise<GameDeleteResponse> {
return this._client.delete(`/games/${steamId}`, options);
}
}

export interface GameCreateResponse {
data: 'ok';
}

export interface GameRetrieveResponse {
/**
* Represents a Steam game that can be installed and played on a machine.
*/
data: GameRetrieveResponse.Data;
}

export namespace GameRetrieveResponse {
/**
* Represents a Steam game that can be installed and played on a machine.
*/
export interface Data {
/**
* Unique object identifier. The format and length of IDs may change over time.
*/
id: string;

/**
* A human-readable name for the game, used for easy identification.
*/
name: string;

/**
* The Steam ID of the game, used to identify it during installation and runtime.
*/
steamID: number;
}
}

export interface GameUpdateResponse {
data: 'ok';
}

export interface GameListResponse {
/**
* A list of games owned by the user
*/
data: Array<GameListResponse.Data>;
}

export namespace GameListResponse {
/**
* Represents a Steam game that can be installed and played on a machine.
*/
export interface Data {
/**
* Unique object identifier. The format and length of IDs may change over time.
*/
id: string;

/**
* A human-readable name for the game, used for easy identification.
*/
name: string;

/**
* The Steam ID of the game, used to identify it during installation and runtime.
*/
steamID: number;
}
}

export interface GameDeleteResponse {
data: 'ok';
}

export interface GameUpdateParams {
/**
* A human-readable name for the game, used for easy identification.
*/
name: string;

/**
* The Steam ID of the game, used to identify it during installation and runtime.
*/
steamID: number;
}

Games.Sessions = Sessions;

export declare namespace Games {
export {
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 { Sessions as Sessions, type SessionListResponse as SessionListResponse };
}
12 changes: 12 additions & 0 deletions src/resources/games/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export {
Games,
type GameCreateResponse,
type GameRetrieveResponse,
type GameUpdateResponse,
type GameListResponse,
type GameDeleteResponse,
type GameUpdateParams,
} from './games';
export { Sessions, type SessionListResponse } from './sessions';
60 changes: 60 additions & 0 deletions src/resources/games/sessions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../resource';
import * as Core from '../../core';

export class Sessions extends APIResource {
/**
* Fetches active and public game sessions associated with a specific game using
* its Steam ID
*/
list(steamId: number, options?: Core.RequestOptions): Core.APIPromise<SessionListResponse> {
return this._client.get(`/games/${steamId}/sessions`, options);
}
}

export interface SessionListResponse {
/**
* Publicly active sessions associated with the game
*/
data: Array<SessionListResponse.Data>;
}

export namespace SessionListResponse {
/**
* Represents a single game play session, tracking its lifetime and accessibility
* settings.
*/
export interface Data {
/**
* Unique object identifier. The format and length of IDs may change over time.
*/
id: string;

/**
* A human-readable name for the session to help identify it
*/
name: string;

/**
* If true, the session is publicly viewable by all users. If false, only
* authorized users can access it
*/
public: boolean;

/**
* The timestamp indicating when this session started.
*/
startedAt: string | number;

/**
* The timestamp indicating when this session was completed or terminated. Null if
* session is still active.
*/
endedAt?: string | number;
}
}

export declare namespace Sessions {
export { type SessionListResponse as SessionListResponse };
}
Loading

0 comments on commit d6ff9e2

Please sign in to comment.