Continuar → Visão geral

Bibliotecas de cliente

Wrappers finos sobre a API REST. Enviam sua chave, montam cada requisição e transformam respostas de erro em exceções.

Você não precisa de uma. A API é só um punhado de endpoints de JSON simples; uma biblioteca economiza uma tarde, não um projeto. Se sua linguagem não está listada, a referência REST tem exemplos para copiar e colar.

Referência da REST API →
JavaScript
Node.js · Deno · Bun · npm
Instalar
npm install namegender

Falha ao copiar. Selecione e copie o texto.

Uso
import { NameGender } from 'namegender';

const client = new NameGender('YOUR_API_KEY');

const result = await client.name('Ayşe', { country: 'TR' });
console.log(result.gender);      // "female"
console.log(result.confidence);  // "unverified" | "low" | "medium" | "high"

// Many names in one request
const many = await client.bulk(['Ayşe', 'Mehmet', 'Priya']);

Falha ao copiar. Selecione e copie o texto.

Command line
macOS · Linux · Windows · Node.js 18+
Instalar
npm install -g namegender

Falha ao copiar. Selecione e copie o texto.

Uso
export NAMEGENDER_API_KEY=YOUR_API_KEY

npx namegender Andrea --country IT
npx namegender --email jane.doe@example.com

# One value per line in, CSV out
cat names.txt | npx namegender --csv > genders.csv

Falha ao copiar. Selecione e copie o texto.

PHP
PHP 8.1+
Instalar
composer require namegender/namegender

Falha ao copiar. Selecione e copie o texto.

Uso
use NameGender\Client;

$client = new Client('YOUR_API_KEY');

$result = $client->name('Ayşe', country: 'TR');
echo $result['gender'];      // "female"
echo $result['confidence'];  // "unverified" | "low" | "medium" | "high"

// Many names in one request
$many = $client->bulk(['Ayşe', 'Mehmet', 'Priya']);

Falha ao copiar. Selecione e copie o texto.

Python
Python 3.9+
Instalar
pip install namegender-client

Falha ao copiar. Selecione e copie o texto.

Uso
from namegender import NameGender

client = NameGender("YOUR_API_KEY")

result = client.name("Ayşe", country="TR")
print(result["gender"])      # "female"
print(result["confidence"])  # evidence level

# Many names in one request
many = client.bulk(["Ayşe", "Mehmet", "Priya"])

Falha ao copiar. Selecione e copie o texto.

Ruby
Ruby 3.0+
Instalar
gem install namegender

Falha ao copiar. Selecione e copie o texto.

Uso
require "namegender"

client = NameGender::Client.new("YOUR_API_KEY")

result = client.name("Ayşe", country: "TR")
puts result["gender"]      # "female"
puts result["confidence"]  # evidence level

Falha ao copiar. Selecione e copie o texto.

Java
Java 17+ · JitPack
Instalar
<repository>
  <id>jitpack.io</id>
  <url>https://jitpack.io</url>
</repository>

<dependency>
  <groupId>com.github.anpekesen</groupId>
  <artifactId>namegender-java</artifactId>
  <version>v0.9.0</version>
</dependency>

Falha ao copiar. Selecione e copie o texto.

Uso
var client = new NameGender("YOUR_API_KEY");

var result = client.name("Ayşe", "TR");
System.out.println(result.gender());       // "female"
System.out.println(result.confidence());

Falha ao copiar. Selecione e copie o texto.

C# / .NET
.NET Standard 2.0 · .NET 8 · NuGet
Instalar
dotnet add package NameGender --version 0.6.0

Falha ao copiar. Selecione e copie o texto.

Uso
using var client = new NameGenderClient("YOUR_API_KEY");

var result = await client.NameAsync("Ayşe", new LookupOptions { Country = "TR" });
Console.WriteLine(result.Gender);      // "female"
Console.WriteLine(result.Confidence);

Falha ao copiar. Selecione e copie o texto.

Go
Go 1.21+
Instalar
go get github.com/anpekesen/namegender-go@v0.7.0

Falha ao copiar. Selecione e copie o texto.

Uso
client := namegender.New("YOUR_API_KEY")

result, err := client.Name(ctx, "Ayşe", namegender.Options{Country: "TR"})
fmt.Println(result.Gender)      // "female"
fmt.Println(result.Confidence)

Falha ao copiar. Selecione e copie o texto.

R
R 4.1+ · GitHub
Instalar
remotes::install_github('anpekesen/namegender-r', ref = 'v0.7.0')

Falha ao copiar. Selecione e copie o texto.

Uso
library(namegender)

client <- namegender("YOUR_API_KEY")

result <- ng_name(client, "Ayşe", country = "TR")
result$gender       # "female"
result$confidence

# A whole data frame in one call
df$gender <- ng_bulk(client, df$name)$results$gender

Falha ao copiar. Selecione e copie o texto.

PowerShell
Windows PowerShell 5.1 · PowerShell 7 · PowerShell Gallery
Instalar
Install-Module NameGender

Falha ao copiar. Selecione e copie o texto.

Uso
$env:NAMEGENDER_API_KEY = 'YOUR_API_KEY'

Get-NameGender Andrea -Country IT

# A whole file: pipeline input goes out in bulk requests
Get-Content names.txt | Get-NameGender | Export-Csv genders.csv -NoTypeInformation

Falha ao copiar. Selecione e copie o texto.

Rust
async · reqwest + rustls · crates.io
Instalar
cargo add namegender

Falha ao copiar. Selecione e copie o texto.

Uso
use namegender::{NameGender, Options};

let client = NameGender::new("YOUR_API_KEY");

let r = client
    .name("Ayşe", &Options { country: Some("TR".into()), ..Default::default() })
    .await?;
println!("{:?}", r.gender); // Some("female")

Falha ao copiar. Selecione e copie o texto.

Precisa de outra linguagem?

Nos diga qual e avaliaremos. A superfície da API é pequena o suficiente para que um wrapper da comunidade seja um fim de semana de trabalho, e o vincularemos aqui.

Contatar suporte