Skip to content

Commit fe406de

Browse files
authored
RSDK-6664 Get cloud metadata client (#248)
1 parent 99bea13 commit fe406de

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export {
1616
type DialDirectConf,
1717
type DialWebRTCConf,
1818
type RobotStatusStream,
19+
type CloudMetadata,
1920
RobotClient,
2021
createRobotClient,
2122
} from './robot';

src/robot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export type { Robot, RobotStatusStream } from './robot/robot';
1+
export type { Robot, RobotStatusStream, CloudMetadata } from './robot/robot';
22
export { RobotClient } from './robot/client';
33
export {
44
type DialConf,

src/robot/client.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,18 @@ export class RobotClient extends EventDispatcher implements Robot {
704704
return response.getDiscoveryList();
705705
}
706706

707+
// GET CLOUD METADATA
708+
709+
async getCloudMetadata() {
710+
const { robotService } = this;
711+
const request = new proto.GetCloudMetadataRequest();
712+
const response = await promisify<
713+
proto.GetCloudMetadataRequest,
714+
proto.GetCloudMetadataResponse
715+
>(robotService.getCloudMetadata.bind(robotService), request);
716+
return response.toObject();
717+
}
718+
707719
// RESOURCES
708720

709721
async resourceNames() {

src/robot/robot.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type proto from '../gen/robot/v1/robot_pb';
99
import type { ResponseStream } from '../gen/robot/v1/robot_pb_service';
1010

1111
export type RobotStatusStream = ResponseStream<proto.Status[]>;
12+
export type CloudMetadata = proto.GetCloudMetadataResponse.AsObject;
1213

1314
type Callback = (args: unknown) => void;
1415

@@ -164,4 +165,12 @@ export interface Robot {
164165
type: typeof RECONNECTED | typeof DISCONNECTED,
165166
listener: Callback
166167
) => void;
168+
169+
/**
170+
* Get app-related information about the robot.
171+
*
172+
* @group App/Cloud
173+
* @alpha
174+
*/
175+
getCloudMetadata(): Promise<CloudMetadata>;
167176
}

0 commit comments

Comments
 (0)