Skip to content

Commit 83735fa

Browse files
authored
Merge pull request #124 from rosette-api/ws-3270-1.31-upgrades
WS-3224: 1.31.0 upgrades
2 parents e0d6625 + 1ede537 commit 83735fa

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

rosette_api/Gender.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Newtonsoft.Json;
2+
using Newtonsoft.Json.Converters;
3+
4+
namespace rosette_api
5+
{
6+
/// <summary>
7+
/// Possible gender options for the Name objects
8+
/// </summary>
9+
[JsonConverter(typeof(StringEnumConverter))]
10+
public enum Gender
11+
{
12+
Female,
13+
NonBinary,
14+
Male
15+
}
16+
}

rosette_api/Name.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ public class Name
1717
/// <param name="Language">(string, optional): Language: ISO 639-3 code (ignored for the /language endpoint)</param>
1818
/// <param name="Script">(string, optional): ISO 15924 code for the name's script</param>
1919
/// <param name="EntityType">(string, optional): Entity type of the name: PERSON, LOCATION, or ORGANIZATION</param>
20-
public Name(string Text = null, string Language = null, string Script = null, string EntityType = null)
20+
/// <param name="Gender">(Gender, optional): gender: Gender of the name: Female, Male, NonBinary</param>
21+
public Name(string Text = null, string Language = null, string Script = null, string EntityType = null, Gender? Gender = null)
2122
{
2223
text = Text;
2324
language = Language;
2425
script = Script;
2526
entityType = EntityType;
27+
gender = Gender;
2628
}
2729

2830
/// <summary>text
@@ -56,5 +58,14 @@ public Name(string Text = null, string Language = null, string Script = null, st
5658
/// </para>
5759
/// </summary>
5860
public string entityType { get; set; }
61+
62+
/// <summary>gender
63+
/// <para>
64+
/// Getter, Setter for the gender
65+
/// gender: Gender of the name
66+
/// </para>
67+
/// </summary>
68+
public Gender? gender { get; set; }
69+
5970
}
6071
}

rosette_api/rosette_api.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
<Compile Include="EntitiesResponse.cs" />
6262
<Compile Include="EntityID.cs" />
6363
<Compile Include="FieldedAddress.cs" />
64+
<Compile Include="Gender.cs" />
6465
<Compile Include="IAddress.cs" />
6566
<Compile Include="InfoResponse.cs" />
6667
<Compile Include="KeyPhrase.cs" />

rosette_apiUnitTests/rosette_apiUnitTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ public void NameSimilarityTestFull()
11751175
String mockedContent = expected.ContentToString();
11761176
HttpResponseMessage mockedMessage = MakeMockedMessage(responseHeaders, HttpStatusCode.OK, mockedContent);
11771177
_mockHttp.When(_testUrl + "name-similarity").Respond(req => mockedMessage);
1178-
NameSimilarityResponse response = _rosetteApi.NameSimilarity(new Name("Влади́мир Влади́мирович Пу́тин", "rus", null, "PERSON"), new Name("Vladmir Putin", "eng", null, "PERSON"));
1178+
NameSimilarityResponse response = _rosetteApi.NameSimilarity(new Name("Влади́мир Влади́мирович Пу́тин", "rus", null, "PERSON", Gender.Male), new Name("Vladmir Putin", "eng", null, "PERSON"));
11791179
Assert.AreEqual(expected, response);
11801180
}
11811181

0 commit comments

Comments
 (0)