Skip to content

SteelPangolin/go-genderize

Repository files navigation

Genderize

Github license Travis CI build status Codecov code coverage

Go client for the Genderize.io web service.

Full API documentation is available on GoDocs.

Basic usage

Simple interface with minimal configuration.

Code

responses, err := Get([]string{"James", "Eva", "Thunderhorse"})
if err != nil {
    panic(err)
}
for _, response := range responses {
    fmt.Printf("%s: %s\n", response.Name, response.Gender)
}

Output

James: male
Eva: female
Thunderhorse:

Advanced usage

Client with custom API key and user agent, query with language and country IDs.

Code

client, err := NewClient(Config{
    UserAgent: "GoGenderizeDocs/0.0",
    // Note that you'll need to use your own API key.
    APIKey: "",
})
if err != nil {
    panic(err)
}
responses, err := client.Get(Query{
    Names:      []string{"Kim"},
    CountryID:  "dk",
    LanguageID: "da",
})
if err != nil {
    panic(err)
}
for _, response := range responses {
    fmt.Printf("%s: %s\n", response.Name, response.Gender)
}

Output

Kim: male

Release checklist

  1. Generate a new version number: major.minor.micro. It should be compatible with SemVer 2.0.0.
  2. Update Version in genderize.go.
  3. Add a changelog entry and date for the new version in CHANGES.md.
  4. Commit the changes. This may be done as part of another change.
  5. Tag the commit with git tag major.minor.micro.
  6. Push the tag to GitHub with git push origin major.minor.micro.