Skip to content

Commit a26aa53

Browse files
authored
Add base methods (#391)
1 parent a18fa2e commit a26aa53

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/src/services/generic.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import '../../protos/common/common.dart';
44
import '../gen/common/v1/common.pb.dart';
55
import '../gen/service/generic/v1/generic.pbgrpc.dart' as generic_pb;
66
import '../resource/base.dart';
7+
import '../robot/client.dart';
78
import '../utils.dart';
89

910
/// {@category Services}
@@ -29,4 +30,14 @@ class GenericServiceClient extends Resource with RPCDebugLoggerMixin implements
2930
final response = await client.doCommand(request, options: callOptions);
3031
return response.result.toMap();
3132
}
33+
34+
/// Get the [ResourceName] for this [GenericServiceClient] with the given [name]
35+
static ResourceName getResourceName(String name) {
36+
return GenericServiceClient.subtype.getResourceName(name);
37+
}
38+
39+
/// Get the [GenericServiceClient] named [name] from the provided robot.
40+
static GenericServiceClient fromRobot(RobotClient robot, String name) {
41+
return robot.getResource(GenericServiceClient.getResourceName(name));
42+
}
3243
}

0 commit comments

Comments
 (0)