Skip to content

Commit 650d49a

Browse files
authored
Merge pull request #51 from neuroglia-io/feat-align-part-with-a2a-0.3.0
feat: align the `Part` model with A2A specification `v0.3.0`
2 parents e9fa191 + 338af41 commit 650d49a

File tree

22 files changed

+50
-50
lines changed

22 files changed

+50
-50
lines changed

src/A2A.Client.Abstractions/A2A.Client.Abstractions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<RootNamespace>A2A.Client</RootNamespace>
8-
<VersionPrefix>0.19.0</VersionPrefix>
8+
<VersionPrefix>0.20.0</VersionPrefix>
99
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
1010
<FileVersion>$(VersionPrefix)</FileVersion>
1111
<NeutralLanguage>en</NeutralLanguage>

src/A2A.Client.Transports.Grpc/A2A.Client.Transports.Grpc.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<RootNamespace>A2A.Client.Transports</RootNamespace>
8-
<VersionPrefix>0.19.0</VersionPrefix>
8+
<VersionPrefix>0.20.0</VersionPrefix>
99
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
1010
<FileVersion>$(VersionPrefix)</FileVersion>
1111
<NeutralLanguage>en</NeutralLanguage>

src/A2A.Client.Transports.Grpc/A2AGrpcMapper.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ public static Models.Part MapFromGrpc(Part source)
135135
},
136136
Part.PartOneofCase.File => new Models.FilePart()
137137
{
138-
Name = source.File.Name,
138+
FileName = source.File.Name,
139139
MediaType = source.File.MediaType,
140-
Uri = string.IsNullOrWhiteSpace(source.File.FileWithUri) ? null : new Uri(source.File.FileWithUri),
141-
Bytes = source.File.FileWithBytes.IsEmpty ? null : source.File.FileWithBytes.ToByteArray()
140+
Url = string.IsNullOrWhiteSpace(source.File.FileWithUri) ? null : new Uri(source.File.FileWithUri),
141+
Raw = source.File.FileWithBytes.IsEmpty ? null : source.File.FileWithBytes.ToByteArray()
142142
},
143143
Part.PartOneofCase.Data => new Models.DataPart()
144144
{
@@ -281,10 +281,10 @@ public static Part MapToGrpc(Models.Part source)
281281
{
282282
File = new FilePart()
283283
{
284-
Name = filePart.Name,
284+
Name = filePart.FileName,
285285
MediaType = filePart.MediaType,
286-
FileWithUri = filePart.Uri?.OriginalString ?? string.Empty,
287-
FileWithBytes = filePart.Bytes == null ? ByteString.Empty : ByteString.CopyFrom(filePart.Bytes.Value.ToArray())
286+
FileWithUri = filePart.Url?.OriginalString ?? string.Empty,
287+
FileWithBytes = filePart.Raw == null ? ByteString.Empty : ByteString.CopyFrom(filePart.Raw.Value.ToArray())
288288
}
289289
},
290290
Models.DataPart dataPart => new Part()

src/A2A.Client.Transports.Http/A2A.Client.Transports.Http.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<RootNamespace>A2A.Client.Transports</RootNamespace>
8-
<VersionPrefix>0.19.0</VersionPrefix>
8+
<VersionPrefix>0.20.0</VersionPrefix>
99
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
1010
<FileVersion>$(VersionPrefix)</FileVersion>
1111
<NeutralLanguage>en</NeutralLanguage>

src/A2A.Client.Transports.JsonRpc/A2A.Client.Transports.JsonRpc.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<RootNamespace>A2A.Client.Transports</RootNamespace>
8-
<VersionPrefix>0.19.0</VersionPrefix>
8+
<VersionPrefix>0.20.0</VersionPrefix>
99
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
1010
<FileVersion>$(VersionPrefix)</FileVersion>
1111
<NeutralLanguage>en</NeutralLanguage>

src/A2A.Client/A2A.Client.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<RootNamespace>A2A.Client</RootNamespace>
8-
<VersionPrefix>0.19.0</VersionPrefix>
8+
<VersionPrefix>0.20.0</VersionPrefix>
99
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
1010
<FileVersion>$(VersionPrefix)</FileVersion>
1111
<NeutralLanguage>en</NeutralLanguage>

src/A2A.Core.JsonRpc/A2A.Core.JsonRpc.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<RootNamespace>A2A</RootNamespace>
8-
<VersionPrefix>0.19.0</VersionPrefix>
8+
<VersionPrefix>0.20.0</VersionPrefix>
99
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
1010
<FileVersion>$(VersionPrefix)</FileVersion>
1111
<NeutralLanguage>en</NeutralLanguage>

src/A2A.Core/A2A.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<RootNamespace>A2A</RootNamespace>
8-
<VersionPrefix>0.19.0</VersionPrefix>
8+
<VersionPrefix>0.20.0</VersionPrefix>
99
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
1010
<FileVersion>$(VersionPrefix)</FileVersion>
1111
<NeutralLanguage>en</NeutralLanguage>

src/A2A.Core/Models/FilePart.cs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,21 @@ public sealed record FilePart
2626
/// Gets the file's name, if any.
2727
/// </summary>
2828
[Description("The file's name, if any.")]
29-
[DataMember(Order = 1, Name = "name"), JsonPropertyOrder(1), JsonPropertyName("name")]
30-
public string? Name { get; init; }
29+
[DataMember(Order = 1, Name = "filename"), JsonPropertyOrder(1), JsonPropertyName("filename")]
30+
public string? FileName { get; init; }
3131

3232
/// <summary>
33-
/// Gets the file's media type, if any.
33+
/// Gets the file's URL, if any. Required if 'raw' is not set.
3434
/// </summary>
35-
[Description("The file's media type, if any.")]
36-
[DataMember(Order = 2, Name = "mediaType"), JsonPropertyOrder(2), JsonPropertyName("mediaType")]
37-
public string? MediaType { get; init; }
35+
[Description("The file's URL, if any. Required if 'raw' is not set.")]
36+
[DataMember(Order = 3, Name = "url"), JsonPropertyOrder(3), JsonPropertyName("url")]
37+
public Uri? Url { get; init; }
3838

3939
/// <summary>
40-
/// Gets the file's URI, if any. Required if 'bytes' is not set.
40+
/// Gets the file's bytes, if any. Required if 'url' is not set.
4141
/// </summary>
42-
[Description("The file's URI, if any. Required if 'bytes' is not set.")]
43-
[DataMember(Order = 3, Name = "fileWithUri"), JsonPropertyOrder(3), JsonPropertyName("fileWithUri")]
44-
public Uri? Uri { get; init; }
45-
46-
/// <summary>
47-
/// Gets the file's bytes, if any. Required if 'uri' is not set.
48-
/// </summary>
49-
[Description("The file's bytes, if any. Required if 'uri' is not set.")]
50-
[DataMember(Order = 4, Name = "fileWithBytes"), JsonPropertyOrder(4), JsonPropertyName("fileWithBytes")]
51-
public ReadOnlyMemory<byte>? Bytes { get; init; }
42+
[Description("The file's bytes, if any. Required if 'url' is not set.")]
43+
[DataMember(Order = 4, Name = "raw"), JsonPropertyOrder(4), JsonPropertyName("raw")]
44+
public ReadOnlyMemory<byte>? Raw { get; init; }
5245

5346
}

src/A2A.Core/Models/Part.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ namespace A2A.Models;
2525
public abstract record Part
2626
{
2727

28+
/// <summary>
29+
/// Gets the part content's media type, if any.
30+
/// </summary>
31+
[Description("The part content's media type, if any.")]
32+
[DataMember(Order = 0, Name = "mediaType"), JsonPropertyOrder(0), JsonPropertyName("mediaType")]
33+
public string? MediaType { get; init; }
34+
2835
/// <summary>
2936
/// Gets a key/value mapping, if any, containing metadata associated with the part.
3037
/// </summary>

0 commit comments

Comments
 (0)