Skip to content

Add base methods #391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/src/services/generic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import '../../protos/common/common.dart';
import '../gen/common/v1/common.pb.dart';
import '../gen/service/generic/v1/generic.pbgrpc.dart' as generic_pb;
import '../resource/base.dart';
import '../robot/client.dart';
import '../utils.dart';

/// {@category Services}
Expand All @@ -29,4 +30,14 @@ class GenericServiceClient extends Resource with RPCDebugLoggerMixin implements
final response = await client.doCommand(request, options: callOptions);
return response.result.toMap();
}

/// Get the [ResourceName] for this [GenericServiceClient] with the given [name]
static ResourceName getResourceName(String name) {
return GenericServiceClient.subtype.getResourceName(name);
}

/// Get the [GenericServiceClient] named [name] from the provided robot.
static GenericServiceClient fromRobot(RobotClient robot, String name) {
return robot.getResource(GenericServiceClient.getResourceName(name));
}
}