diff --git a/src/main.ts b/src/main.ts index cd363e02a..f79062b01 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,6 +16,7 @@ export { type DialDirectConf, type DialWebRTCConf, type RobotStatusStream, + type CloudMetadata, RobotClient, createRobotClient, } from './robot'; diff --git a/src/robot.ts b/src/robot.ts index ebd5ca687..de425fd6f 100644 --- a/src/robot.ts +++ b/src/robot.ts @@ -1,4 +1,4 @@ -export type { Robot, RobotStatusStream } from './robot/robot'; +export type { Robot, RobotStatusStream, CloudMetadata } from './robot/robot'; export { RobotClient } from './robot/client'; export { type DialConf, diff --git a/src/robot/client.ts b/src/robot/client.ts index 2ce3edd91..6b34f6d22 100644 --- a/src/robot/client.ts +++ b/src/robot/client.ts @@ -704,6 +704,18 @@ export class RobotClient extends EventDispatcher implements Robot { return response.getDiscoveryList(); } + // GET CLOUD METADATA + + async getCloudMetadata() { + const { robotService } = this; + const request = new proto.GetCloudMetadataRequest(); + const response = await promisify< + proto.GetCloudMetadataRequest, + proto.GetCloudMetadataResponse + >(robotService.getCloudMetadata.bind(robotService), request); + return response.toObject(); + } + // RESOURCES async resourceNames() { diff --git a/src/robot/robot.ts b/src/robot/robot.ts index a343e6933..c924cfccc 100644 --- a/src/robot/robot.ts +++ b/src/robot/robot.ts @@ -9,6 +9,7 @@ import type proto from '../gen/robot/v1/robot_pb'; import type { ResponseStream } from '../gen/robot/v1/robot_pb_service'; export type RobotStatusStream = ResponseStream; +export type CloudMetadata = proto.GetCloudMetadataResponse.AsObject; type Callback = (args: unknown) => void; @@ -164,4 +165,12 @@ export interface Robot { type: typeof RECONNECTED | typeof DISCONNECTED, listener: Callback ) => void; + + /** + * Get app-related information about the robot. + * + * @group App/Cloud + * @alpha + */ + getCloudMetadata(): Promise; }