Skip to content

Commit 7eed905

Browse files
Add getSessions Wrapper to RobotClient (#344)
1 parent 381ee27 commit 7eed905

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/robot/client.ts

+12
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,18 @@ export class RobotClient extends EventDispatcher implements Robot {
631631
}
632632
}
633633

634+
// SESSIONS
635+
636+
async getSessions() {
637+
const { robotService } = this;
638+
const request = new proto.GetSessionsRequest();
639+
const response = await promisify<
640+
proto.GetSessionsRequest,
641+
proto.GetSessionsResponse
642+
>(robotService.getSessions.bind(robotService), request);
643+
return response.getSessionsList().map((session) => session.toObject());
644+
}
645+
634646
// OPERATIONS
635647

636648
async getOperations() {

src/robot/robot.ts

+8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ export type CloudMetadata = proto.GetCloudMetadataResponse.AsObject;
1414
type Callback = (args: unknown) => void;
1515

1616
export interface Robot {
17+
/**
18+
* Get the list of sessions currently connected to the robot.
19+
*
20+
* @group Sessions
21+
* @alpha
22+
*/
23+
getSessions(): Promise<proto.Session.AsObject[]>;
24+
1725
/**
1826
* Get the list of operations currently running on the robot.
1927
*

0 commit comments

Comments
 (0)