Categorygithub.com/namsor/namsor-golang-sdk2
modulepackage
2.0.15+incompatible
Repository: https://github.com/namsor/namsor-golang-sdk2.git
Documentation: pkg.go.dev

# README

Go API client for namsorapi

NamSor API v2 : enpoints to process personal names (gender, cultural origin or ethnicity) in all alphabets or languages. By default, enpoints use 1 unit per name (ex. Gender), but Ethnicity classification uses 10 to 20 units per name depending on taxonomy. Use GET methods for small tests, but prefer POST methods for higher throughput (batch processing of up to 100 names at a time). Need something you can't find here? We have many more features coming soon. Let us know, we'll do our best to add it!

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2.0.15
  • Package version: 2.0.15
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit http://www.namsor.com/

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./namsorapi"

Documentation for API Endpoints

All URIs are relative to https://v2.namsor.com/NamSorAPIv2

ClassMethodHTTP requestDescription
AdminApiAnonymizeGet /api2/json/anonymize/{source}/{anonymized}Activate/deactivate anonymization for a source.
AdminApiApiStatusGet /api2/json/apiStatusPrints the current status of the classifiers. A classifier name in apiStatus corresponds to a service name in apiServices.
AdminApiApiUsageGet /api2/json/apiUsagePrint current API usage.
AdminApiApiUsageHistoryGet /api2/json/apiUsageHistoryPrint historical API usage.
AdminApiApiUsageHistoryAggregateGet /api2/json/apiUsageHistoryAggregatePrint historical API usage (in an aggregated view, by service, by day/hour/min).
AdminApiAvailableServicesGet /api2/json/apiServicesList of classification services and usage cost in Units per classification (default is 1=ONE Unit). Some API endpoints (ex. Corridor) combine multiple classifiers.
AdminApiDisableGet /api2/json/disable/{source}/{disabled}Activate/deactivate an API Key.
AdminApiLearnableGet /api2/json/learnable/{source}/{learnable}Activate/deactivate learning from a source.
AdminApiSoftwareVersionGet /api2/json/softwareVersionGet the current software version
AdminApiTaxonomyClassesGet /api2/json/taxonomyClasses/{classifierName}Print the taxonomy classes valid for the given classifier.
ChineseApiChineseNameCandidatesGet /api2/json/chineseNameCandidates/{chineseSurnameLatin}/{chineseGivenNameLatin}Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming
ChineseApiChineseNameCandidatesBatchPost /api2/json/chineseNameCandidatesBatchIdentify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming
ChineseApiChineseNameCandidatesGenderBatchPost /api2/json/chineseNameCandidatesGenderBatchIdentify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname) ex. Wang Xiaoming.
ChineseApiChineseNameGenderCandidatesGet /api2/json/chineseNameGenderCandidates/{chineseSurnameLatin}/{chineseGivenNameLatin}/{knownGender}Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming - having a known gender ('male' or 'female')
ChineseApiChineseNameMatchGet /api2/json/chineseNameMatch/{chineseSurnameLatin}/{chineseGivenNameLatin}/{chineseName}Return a score for matching Chinese name ex. 王晓明 with a romanized name ex. Wang Xiaoming
ChineseApiChineseNameMatchBatchPost /api2/json/chineseNameMatchBatchIdentify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming
ChineseApiGenderChineseNameGet /api2/json/genderChineseName/{chineseName}Infer the likely gender of a Chinese full name ex. 王晓明
ChineseApiGenderChineseNameBatchPost /api2/json/genderChineseNameBatchInfer the likely gender of up to 100 full names ex. 王晓明
ChineseApiGenderChineseNamePinyinGet /api2/json/genderChineseNamePinyin/{chineseSurnameLatin}/{chineseGivenNameLatin}Infer the likely gender of a Chinese name in LATIN (Pinyin).
ChineseApiGenderChineseNamePinyinBatchPost /api2/json/genderChineseNamePinyinBatchInfer the likely gender of up to 100 Chinese names in LATIN (Pinyin).
ChineseApiParseChineseNameGet /api2/json/parseChineseName/{chineseName}Infer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name)
ChineseApiParseChineseNameBatchPost /api2/json/parseChineseNameBatchInfer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name).
ChineseApiPinyinChineseNameGet /api2/json/pinyinChineseName/{chineseName}Romanize the Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name)
ChineseApiPinyinChineseNameBatchPost /api2/json/pinyinChineseNameBatchRomanize a list of Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name).
GeneralApiNameTypeGet /api2/json/nameType/{properNoun}Infer the likely type of a proper noun (personal name, brand name, place name etc.)
GeneralApiNameTypeBatchPost /api2/json/nameTypeBatchInfer the likely common type of up to 100 proper nouns (personal name, brand name, place name etc.)
GeneralApiNameTypeGeoGet /api2/json/nameTypeGeo/{properNoun}/{countryIso2}Infer the likely type of a proper noun (personal name, brand name, place name etc.)
GeneralApiNameTypeGeoBatchPost /api2/json/nameTypeGeoBatchInfer the likely common type of up to 100 proper nouns (personal name, brand name, place name etc.)
JapaneseApiGenderJapaneseNameFullGet /api2/json/genderJapaneseNameFull/{japaneseName}Infer the likely gender of a Japanese full name ex. 王晓明
JapaneseApiGenderJapaneseNameFullBatchPost /api2/json/genderJapaneseNameFullBatchInfer the likely gender of up to 100 full names
JapaneseApiGenderJapaneseNamePinyinGet /api2/json/genderJapaneseName/{japaneseSurname}/{japaneseGivenName}Infer the likely gender of a Japanese name in LATIN (Pinyin).
JapaneseApiGenderJapaneseNamePinyinBatchPost /api2/json/genderJapaneseNameBatchInfer the likely gender of up to 100 Japanese names in LATIN (Pinyin).
JapaneseApiJapaneseNameGenderKanjiCandidatesBatchPost /api2/json/japaneseNameGenderKanjiCandidatesBatchIdentify japanese name candidates in KANJI, based on the romanized name (firstName = japaneseGivenName; lastName=japaneseSurname) with KNOWN gender, ex. Yamamoto Sanae
JapaneseApiJapaneseNameKanjiCandidatesGet /api2/json/japaneseNameKanjiCandidates/{japaneseSurnameLatin}/{japaneseGivenNameLatin}/{knownGender}Identify japanese name candidates in KANJI, based on the romanized name ex. Yamamoto Sanae - and a known gender.
JapaneseApiJapaneseNameKanjiCandidates1Get /api2/json/japaneseNameKanjiCandidates/{japaneseSurnameLatin}/{japaneseGivenNameLatin}Identify japanese name candidates in KANJI, based on the romanized name ex. Yamamoto Sanae
JapaneseApiJapaneseNameKanjiCandidatesBatchPost /api2/json/japaneseNameKanjiCandidatesBatchIdentify japanese name candidates in KANJI, based on the romanized name (firstName = japaneseGivenName; lastName=japaneseSurname), ex. Yamamoto Sanae
JapaneseApiJapaneseNameLatinCandidatesGet /api2/json/japaneseNameLatinCandidates/{japaneseSurnameKanji}/{japaneseGivenNameKanji}Romanize japanese name, based on the name in Kanji.
JapaneseApiJapaneseNameLatinCandidatesBatchPost /api2/json/japaneseNameLatinCandidatesBatchRomanize japanese names, based on the name in KANJI
JapaneseApiJapaneseNameMatchGet /api2/json/japaneseNameMatch/{japaneseSurnameLatin}/{japaneseGivenNameLatin}/{japaneseName}Return a score for matching Japanese name in KANJI ex. 山本 早苗 with a romanized name ex. Yamamoto Sanae
JapaneseApiJapaneseNameMatchBatchPost /api2/json/japaneseNameMatchBatchReturn a score for matching a list of Japanese names in KANJI ex. 山本 早苗 with romanized names ex. Yamamoto Sanae
JapaneseApiJapaneseNameMatchFeedbackLoopGet /api2/json/japaneseNameMatchFeedbackLoop/{japaneseSurnameLatin}/{japaneseGivenNameLatin}/{japaneseName}[CREDITS 1 UNIT] Feedback loop to better perform matching Japanese name in KANJI ex. 山本 早苗 with a romanized name ex. Yamamoto Sanae
JapaneseApiParseJapaneseNameGet /api2/json/parseJapaneseName/{japaneseName}Infer the likely first/last name structure of a name, ex. 山本 早苗 or Yamamoto Sanae
JapaneseApiParseJapaneseNameBatchPost /api2/json/parseJapaneseNameBatchInfer the likely first/last name structure of a name, ex. 山本 早苗 or Yamamoto Sanae
PersonalApiCorridorGet /api2/json/corridor/{countryIso2From}/{firstNameFrom}/{lastNameFrom}/{countryIso2To}/{firstNameTo}/{lastNameTo}[USES 20 UNITS PER NAME COUPLE] Infer several classifications for a cross border interaction between names (ex. remit, travel, intl com)
PersonalApiCorridorBatchPost /api2/json/corridorBatch[USES 20 UNITS PER NAME PAIR] Infer several classifications for up to 100 cross border interaction between names (ex. remit, travel, intl com)
PersonalApiCountryGet /api2/json/country/{personalNameFull}[USES 10 UNITS PER NAME] Infer the likely country of residence of a personal full name, or one surname. Assumes names as they are in the country of residence OR the country of origin.
PersonalApiCountryBatchPost /api2/json/countryBatch[USES 10 UNITS PER NAME] Infer the likely country of residence of up to 100 personal full names, or surnames. Assumes names as they are in the country of residence OR the country of origin.
PersonalApiDiasporaGet /api2/json/diaspora/{countryIso2}/{firstName}/{lastName}[USES 20 UNITS PER NAME] Infer the likely ethnicity/diaspora of a personal name, given a country of residence ISO2 code (ex. US, CA, AU, NZ etc.)
PersonalApiDiasporaBatchPost /api2/json/diasporaBatch[USES 20 UNITS PER NAME] Infer the likely ethnicity/diaspora of up to 100 personal names, given a country of residence ISO2 code (ex. US, CA, AU, NZ etc.)
PersonalApiGenderGet /api2/json/gender/{firstName}/{lastName}Infer the likely gender of a name.
PersonalApiGenderBatchPost /api2/json/genderBatchInfer the likely gender of up to 100 names, detecting automatically the cultural context.
PersonalApiGenderFullGet /api2/json/genderFull/{fullName}Infer the likely gender of a full name, ex. John H. Smith
PersonalApiGenderFullBatchPost /api2/json/genderFullBatchInfer the likely gender of up to 100 full names, detecting automatically the cultural context.
PersonalApiGenderFullGeoGet /api2/json/genderFullGeo/{fullName}/{countryIso2}Infer the likely gender of a full name, given a local context (ISO2 country code).
PersonalApiGenderFullGeoBatchPost /api2/json/genderFullGeoBatchInfer the likely gender of up to 100 full names, with a given cultural context (country ISO2 code).
PersonalApiGenderGeoGet /api2/json/genderGeo/{firstName}/{lastName}/{countryIso2}Infer the likely gender of a name, given a local context (ISO2 country code).
PersonalApiGenderGeoBatchPost /api2/json/genderGeoBatchInfer the likely gender of up to 100 names, each given a local context (ISO2 country code).
PersonalApiOriginGet /api2/json/origin/{firstName}/{lastName}[USES 10 UNITS PER NAME] Infer the likely country of origin of a personal name. Assumes names as they are in the country of origin. For US, CA, AU, NZ and other melting-pots : use 'diaspora' instead.
PersonalApiOriginBatchPost /api2/json/originBatch[USES 10 UNITS PER NAME] Infer the likely country of origin of up to 100 names, detecting automatically the cultural context.
PersonalApiParseNameGet /api2/json/parseName/{nameFull}Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John.
PersonalApiParseNameBatchPost /api2/json/parseNameBatchInfer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John.
PersonalApiParseNameGeoGet /api2/json/parseName/{nameFull}/{countryIso2}Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John. For better accuracy, provide a geographic context.
PersonalApiParseNameGeoBatchPost /api2/json/parseNameGeoBatchInfer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John. Giving a local context improves precision.
PersonalApiUsRaceEthnicityGet /api2/json/usRaceEthnicity/{firstName}/{lastName}[USES 10 UNITS PER NAME] Infer a US resident's likely race/ethnicity according to US Census taxonomy W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
PersonalApiUsRaceEthnicityBatchPost /api2/json/usRaceEthnicityBatch[USES 10 UNITS PER NAME] Infer up-to 100 US resident's likely race/ethnicity according to US Census taxonomy. Output is W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
PersonalApiUsRaceEthnicityZIP5Get /api2/json/usRaceEthnicityZIP5/{firstName}/{lastName}/{zip5Code}[USES 10 UNITS PER NAME] Infer a US resident's likely race/ethnicity according to US Census taxonomy, using (optional) ZIP5 code info. Output is W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
PersonalApiUsZipRaceEthnicityBatchPost /api2/json/usZipRaceEthnicityBatch[USES 10 UNITS PER NAME] Infer up-to 100 US resident's likely race/ethnicity according to US Census taxonomy, with (optional) ZIP code. Output is W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino). Optionally add header X-OPTION-USRACEETHNICITY-TAXONOMY: USRACEETHNICITY-6CLASSES for two additional classes, AI_AN (American Indian or Alaskan Native) and PI (Pacific Islander).
SocialApiPhoneCodeGet /api2/json/phoneCode/{firstName}/{lastName}/{phoneNumber}[USES 11 UNITS PER NAME] Infer the likely country and phone prefix, given a personal name and formatted / unformatted phone number.
SocialApiPhoneCodeBatchPost /api2/json/phoneCodeBatch[USES 11 UNITS PER NAME] Infer the likely country and phone prefix, of up to 100 personal names, detecting automatically the local context given a name and formatted / unformatted phone number.
SocialApiPhoneCodeGeoGet /api2/json/phoneCodeGeo/{firstName}/{lastName}/{phoneNumber}/{countryIso2}[USES 11 UNITS PER NAME] Infer the likely phone prefix, given a personal name and formatted / unformatted phone number, with a local context (ISO2 country of residence).
SocialApiPhoneCodeGeoBatchPost /api2/json/phoneCodeGeoBatch[USES 11 UNITS PER NAME] Infer the likely country and phone prefix, of up to 100 personal names, with a local context (ISO2 country of residence).
SocialApiPhoneCodeGeoFeedbackLoopGet /api2/json/phoneCodeGeoFeedbackLoop/{firstName}/{lastName}/{phoneNumber}/{phoneNumberE164}/{countryIso2}[CREDITS 1 UNIT] Feedback loop to better infer the likely phone prefix, given a personal name and formatted / unformatted phone number, with a local context (ISO2 country of residence).

Documentation For Models

Documentation For Authorization

api_key

  • Type: API key

Example

auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
	Key: "APIKEY",
	Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)

Author

[email protected]

# Functions

CacheExpires helper function to determine remaining time before repeating a request.
NewAPIClient creates a new API client.
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAPIKey takes an APIKey as authentication for the request.
ContextBasicAuth takes BasicAuth as authentication for the request.
ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.

# Structs

The current billing period.
The list of classifiers and versions.
No description provided by the author
No description provided by the author
APIClient manages communication with the NamSor API v2 API v2.0.15 In most cases there should be only one, shared, APIClient.
Detailed usage as reported by the deduplicating API counter.
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
The API Key.
No description provided by the author
No description provided by the author
No description provided by the author
The API Plan governing the subscription.
No description provided by the author
List of API Services.
No description provided by the author
No description provided by the author
No description provided by the author
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
No description provided by the author
No description provided by the author
Represents the output of inferring the LIKELY ethnicity from a personal name, given an country of residence.
Represents the output of inferring the LIKELY gender from a list of personal names.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Represents the output of inferring the LIKELY origin from a list of personal names.
Represents the output of inferring the LIKELY country and phone code of personal names+phones.
No description provided by the author
No description provided by the author
Represents the output of inferring the LIKELY US 'race/ethnicity' from a personal name, given US country of residence and (optionally) a ZIP5 code.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Represents the output of inferring the common type (anthroponym, toponym, brand, etc.) from a list of proper names.
No description provided by the author
No description provided by the author
Simple metrics system caches.
No description provided by the author
No description provided by the author
No description provided by the author
Simple metrics on a classifier.
No description provided by the author
No description provided by the author
Represent any transnational interaction between names (ex.
Represent multiple classifications for corridor sender and receiver (gender, country, origin, diaspora).
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Simple metrics on a classifier, for a given expected class.
No description provided by the author
Represents the output of inferring the LIKELY ethnicity from a personal name, given an country of residence.
Represents the output of inferring the LIKELY gender from a personal name.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Represents the output of inferring the LIKELY country of Origin from a personal name.
First / last name structure corresponding to the most likely parsing.
Represents the output of inferring the LIKELY country and phone code from a personal name and phone number.
No description provided by the author
No description provided by the author
Represents the output of inferring the LIKELY US 'race/ethnicity' from a personal name, given US country of residence and (optionally) a ZIP5 code.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GenericOpenAPIError Provides access to the body, error and model on returned errors.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
The ordered list of name matching candidates.
Classified matched names.
Classified matched names.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Classified genderized names.
No description provided by the author
Classified geo names.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Classified typed proper names.
No description provided by the author
The software version.
Simple metrics on source, with details by classifier.
Simple metrics on a classifier, for a given source.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author