Skip to content

Commit d14fb04

Browse files
authored
Add method to get the gender just by name
1 parent c33fe5d commit d14fb04

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/GenderApiClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ public Task<GenderApiNameResponse> GetByNameAndCountry2Alpha(string name, string
5454
});
5555
}
5656

57+
public Task<GenderApiNameResponse> GetByName(string name)
58+
{
59+
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(name));
60+
return ExecuteRequest<GenderApiNameResponse>("get", new Dictionary<string, object>
61+
{
62+
{ "name", GetUrlFormatted(name) }
63+
});
64+
}
65+
5766
public Task<GenderApiNameResponse> GetByNameAndCountryType(string name, CountryType countryType)
5867
{
5968
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(name));
@@ -197,4 +206,4 @@ public Task<GenderApiStatisticsResponse> GetStatistics()
197206
}
198207

199208
}
200-
}
209+
}

0 commit comments

Comments
 (0)