diff --git a/lib/src/token_source/room_configuration.dart b/lib/src/token_source/room_configuration.dart index 24ce8af8b..82a3898b1 100644 --- a/lib/src/token_source/room_configuration.dart +++ b/lib/src/token_source/room_configuration.dart @@ -26,9 +26,13 @@ class RoomAgentDispatch { /// Metadata for the agent. final String? metadata; + /// Optional deployment to target. Leave empty to target the production deployment. + final String? deployment; + const RoomAgentDispatch({ this.agentName, this.metadata, + this.deployment, }); factory RoomAgentDispatch.fromJson(Map json) => _$RoomAgentDispatchFromJson(json); diff --git a/lib/src/token_source/room_configuration.g.dart b/lib/src/token_source/room_configuration.g.dart index c7517a575..9bfaee4d2 100644 --- a/lib/src/token_source/room_configuration.g.dart +++ b/lib/src/token_source/room_configuration.g.dart @@ -9,11 +9,13 @@ part of 'room_configuration.dart'; RoomAgentDispatch _$RoomAgentDispatchFromJson(Map json) => RoomAgentDispatch( agentName: json['agent_name'] as String?, metadata: json['metadata'] as String?, + deployment: json['deployment'] as String?, ); Map _$RoomAgentDispatchToJson(RoomAgentDispatch instance) => { if (instance.agentName case final value?) 'agent_name': value, if (instance.metadata case final value?) 'metadata': value, + if (instance.deployment case final value?) 'deployment': value, }; RoomConfiguration _$RoomConfigurationFromJson(Map json) => RoomConfiguration( diff --git a/lib/src/token_source/token_source.dart b/lib/src/token_source/token_source.dart index f2f4e8304..392c62557 100644 --- a/lib/src/token_source/token_source.dart +++ b/lib/src/token_source/token_source.dart @@ -43,6 +43,9 @@ class TokenRequestOptions { /// Metadata passed to the agent job. final String? agentMetadata; + /// Optional deployment to target. Leave empty to target the production deployment. + final String? agentDeployment; + const TokenRequestOptions({ this.roomName, this.participantName, @@ -51,6 +54,7 @@ class TokenRequestOptions { this.participantAttributes, this.agentName, this.agentMetadata, + this.agentDeployment, }); factory TokenRequestOptions.fromJson(Map json) => _$TokenRequestOptionsFromJson(json); @@ -58,8 +62,8 @@ class TokenRequestOptions { /// Converts this options object to a wire-format request. TokenSourceRequest toRequest() { - final List? agents = (agentName != null || agentMetadata != null) - ? [RoomAgentDispatch(agentName: agentName, metadata: agentMetadata)] + final List? agents = (agentName != null || agentMetadata != null || agentDeployment != null) + ? [RoomAgentDispatch(agentName: agentName, metadata: agentMetadata, deployment: agentDeployment)] : null; return TokenSourceRequest( @@ -83,6 +87,7 @@ class TokenRequestOptions { other.participantMetadata == participantMetadata && other.agentName == agentName && other.agentMetadata == agentMetadata && + other.agentDeployment == agentDeployment && const MapEquality().equals(other.participantAttributes, participantAttributes); } @@ -95,6 +100,7 @@ class TokenRequestOptions { participantMetadata, agentName, agentMetadata, + agentDeployment, const MapEquality().hash(participantAttributes), ); } diff --git a/lib/src/token_source/token_source.g.dart b/lib/src/token_source/token_source.g.dart index a5ac7308e..ec930e18c 100644 --- a/lib/src/token_source/token_source.g.dart +++ b/lib/src/token_source/token_source.g.dart @@ -16,6 +16,7 @@ TokenRequestOptions _$TokenRequestOptionsFromJson(Map json) => ), agentName: json['agentName'] as String?, agentMetadata: json['agentMetadata'] as String?, + agentDeployment: json['agentDeployment'] as String?, ); Map _$TokenRequestOptionsToJson(TokenRequestOptions instance) => { @@ -26,6 +27,7 @@ Map _$TokenRequestOptionsToJson(TokenRequestOptions instance) = if (instance.participantAttributes case final value?) 'participantAttributes': value, if (instance.agentName case final value?) 'agentName': value, if (instance.agentMetadata case final value?) 'agentMetadata': value, + if (instance.agentDeployment case final value?) 'agentDeployment': value, }; TokenSourceRequest _$TokenSourceRequestFromJson(Map json) => TokenSourceRequest(