Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions rosette_api/Gender.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace rosette_api
{
/// <summary>
/// Possible gender options for the Name objects
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum Gender
{
Female,
NonBinary,
Male
}
}
13 changes: 12 additions & 1 deletion rosette_api/Name.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ public class Name
/// <param name="Language">(string, optional): Language: ISO 639-3 code (ignored for the /language endpoint)</param>
/// <param name="Script">(string, optional): ISO 15924 code for the name's script</param>
/// <param name="EntityType">(string, optional): Entity type of the name: PERSON, LOCATION, or ORGANIZATION</param>
public Name(string Text = null, string Language = null, string Script = null, string EntityType = null)
/// <param name="Gender">(Gender, optional): gender: Gender of the name: Female, Male, NonBinary</param>
public Name(string Text = null, string Language = null, string Script = null, string EntityType = null, Gender? Gender = null)
{
text = Text;
language = Language;
script = Script;
entityType = EntityType;
gender = Gender;
}

/// <summary>text
Expand Down Expand Up @@ -56,5 +58,14 @@ public Name(string Text = null, string Language = null, string Script = null, st
/// </para>
/// </summary>
public string entityType { get; set; }

/// <summary>gender
/// <para>
/// Getter, Setter for the gender
/// gender: Gender of the name
/// </para>
/// </summary>
public Gender? gender { get; set; }

}
}
1 change: 1 addition & 0 deletions rosette_api/rosette_api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<Compile Include="EntitiesResponse.cs" />
<Compile Include="EntityID.cs" />
<Compile Include="FieldedAddress.cs" />
<Compile Include="Gender.cs" />
<Compile Include="IAddress.cs" />
<Compile Include="InfoResponse.cs" />
<Compile Include="KeyPhrase.cs" />
Expand Down
2 changes: 1 addition & 1 deletion rosette_apiUnitTests/rosette_apiUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ public void NameSimilarityTestFull()
String mockedContent = expected.ContentToString();
HttpResponseMessage mockedMessage = MakeMockedMessage(responseHeaders, HttpStatusCode.OK, mockedContent);
_mockHttp.When(_testUrl + "name-similarity").Respond(req => mockedMessage);
NameSimilarityResponse response = _rosetteApi.NameSimilarity(new Name("Влади́мир Влади́мирович Пу́тин", "rus", null, "PERSON"), new Name("Vladmir Putin", "eng", null, "PERSON"));
NameSimilarityResponse response = _rosetteApi.NameSimilarity(new Name("Влади́мир Влади́мирович Пу́тин", "rus", null, "PERSON", Gender.Male), new Name("Vladmir Putin", "eng", null, "PERSON"));
Assert.AreEqual(expected, response);
}

Expand Down