# Class: `Sessions` [@jupyterlite/session](../modules/jupyterlite_session.md).Sessions A class to handle requests to /api/sessions ## Implements - [`ISessions`](../modules/jupyterlite_session.md#isessions) ## Constructors ### `constructor` > > **`new Sessions`**(`options`) Construct a new Sessions. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `options` | [`IOptions`](../interfaces/jupyterlite_session.Sessions.IOptions.md) | The instantiation options for a Sessions. | #### Defined in [packages/session/src/sessions.ts:22](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/session/src/sessions.ts#L22) ## Properties ### `_kernels` > > `Private` **`_kernels`**: `IKernels` #### Defined in [packages/session/src/sessions.ts:178](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/session/src/sessions.ts#L178) ### `_sessions` > > `Private` **`_sessions`**: `IModel`[] = `[]` #### Defined in [packages/session/src/sessions.ts:180](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/session/src/sessions.ts#L180) ## Methods ### `_handleKernelShutdown` > > `Private` **`_handleKernelShutdown`**(`«destructured»`): `Promise`<`void`\> Handle kernel shutdown #### Parameters | Name | Type | | :------ | :------ | | `«destructured»` | `Object` | | › `kernelId` | `string` | | › `sessionId` | `string` | #### Returns `Promise`<`void`\> #### Defined in [packages/session/src/sessions.ts:163](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/session/src/sessions.ts#L163) ### `get` > > **`get`**(`id`): `Promise`<`IModel`\> Get a session by id. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | The id of the session. | #### Returns `Promise`<`IModel`\> #### Implementation of ISessions.get #### Defined in [packages/session/src/sessions.ts:31](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/session/src/sessions.ts#L31) ### `list` > > **`list`**(): `Promise`<`IModel`[]\> List the running sessions #### Returns `Promise`<`IModel`[]\> #### Implementation of ISessions.list #### Defined in [packages/session/src/sessions.ts:42](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/session/src/sessions.ts#L42) ### `patch` > > **`patch`**(`options`): `Promise`<`IModel`\> Path an existing session. This can be used to rename a session. - path updates session to track renamed paths - kernel.name starts a new kernel with a given kernelspec #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `options` | `IModel` | The options to patch the session. | #### Returns `Promise`<`IModel`\> #### Implementation of ISessions.patch #### Defined in [packages/session/src/sessions.ts:55](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/session/src/sessions.ts#L55) ### `shutdown` > > **`shutdown`**(`id`): `Promise`<`void`\> Shut down a session. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | The id of the session to shut down. | #### Returns `Promise`<`void`\> #### Implementation of ISessions.shutdown #### Defined in [packages/session/src/sessions.ts:148](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/session/src/sessions.ts#L148) ### `startNew` > > **`startNew`**(`options`): `Promise`<`IModel`\> Start a new session TODO: read path and name #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `options` | `IModel` | The options to start a new session. | #### Returns `Promise`<`IModel`\> #### Implementation of ISessions.startNew #### Defined in [packages/session/src/sessions.ts:106](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/session/src/sessions.ts#L106)