2.0.11-b • Published 4 years ago

@namsor/nam_sor_api_v2 v2.0.11-b

Weekly downloads
-
License
AGPL-3.0-or-later
Repository
github
Last release
4 years ago

nam_sor_api_v2

NamSorApiV2 - JavaScript client for nam_sor_api_v2 NamSor API v2 : enpoints to process personal names (gender, cultural origin or ethnicity) in all alphabets or languages. 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! This SDK is automatically generated by the OpenAPI Generator project:

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

Installation

For Node.js

npm

Install it via:

npm install @namsor/nam_sor_api_v2
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your nam_sor_api_v2 from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('nam_sor_api_v2') in javascript files from the directory you ran the last command above from.

git

If the library is hosted at a git repository, e.g. https://github.com/namsor/namsor-javascript-sdk2 then install it via:

    npm install namsor/namsor-javascript-sdk2 --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var NamSorApiV2 = require('nam_sor_api_v2');

var defaultClient = NamSorApiV2.ApiClient.instance;

// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['X-API-KEY'] = "Token"

var api = new NamSorApiV2.AdminApi()
var apiKey = "apiKey_example"; // {String} 
var usageCredits = 789; // {Number} 
var userMessage = "userMessage_example"; // {String} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.addCredits(apiKey, usageCredits, userMessage, callback);

Documentation for Authorization

api_key

  • Type: API key
  • API key parameter name: X-API-KEY
  • Location: HTTP header

Documentation for API Endpoints

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

ClassMethodHTTP requestDescription
NamSorApiV2.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.
NamSorApiV2.PersonalApicountryBatchPOST /api2/json/countryBatchUSES 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.
NamSorApiV2.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.)
NamSorApiV2.PersonalApidiasporaBatchPOST /api2/json/diasporaBatchUSES 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.)
NamSorApiV2.PersonalApigenderGET /api2/json/gender/{firstName}/{lastName}Infer the likely gender of a name.
NamSorApiV2.PersonalApigenderBatchPOST /api2/json/genderBatchInfer the likely gender of up to 100 names, detecting automatically the cultural context.
NamSorApiV2.PersonalApigenderFullGET /api2/json/genderFull/{fullName}Infer the likely gender of a full name, ex. John H. Smith
NamSorApiV2.PersonalApigenderFullBatchPOST /api2/json/genderFullBatchInfer the likely gender of up to 100 full names, detecting automatically the cultural context.
NamSorApiV2.PersonalApigenderFullGeoGET /api2/json/genderFullGeo/{fullName}/{countryIso2}Infer the likely gender of a full name, given a local context (ISO2 country code).
NamSorApiV2.PersonalApigenderFullGeoBatchPOST /api2/json/genderFullGeoBatchInfer the likely gender of up to 100 full names, with a given cultural context (country ISO2 code).
NamSorApiV2.PersonalApigenderGeoGET /api2/json/genderGeo/{firstName}/{lastName}/{countryIso2}Infer the likely gender of a name, given a local context (ISO2 country code).
NamSorApiV2.PersonalApigenderGeoBatchPOST /api2/json/genderGeoBatchInfer the likely gender of up to 100 names, each given a local context (ISO2 country code).
NamSorApiV2.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.
NamSorApiV2.PersonalApioriginBatchPOST /api2/json/originBatchUSES 10 UNITS PER NAME Infer the likely country of origin of up to 100 names, detecting automatically the cultural context.
NamSorApiV2.PersonalApiparseNameGET /api2/json/parseName/{nameFull}Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John.
NamSorApiV2.PersonalApiparseNameBatchPOST /api2/json/parseNameBatchInfer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John.
NamSorApiV2.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.
NamSorApiV2.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.
NamSorApiV2.PersonalApiparsedGenderBatchPOST /api2/json/parsedGenderBatchInfer the likely gender of up to 100 fully parsed names, detecting automatically the cultural context.
NamSorApiV2.PersonalApiparsedGenderGeoBatchPOST /api2/json/parsedGenderGeoBatchInfer the likely gender of up to 100 fully parsed names, detecting automatically the cultural context.
NamSorApiV2.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).
NamSorApiV2.PersonalApiusRaceEthnicityBatchPOST /api2/json/usRaceEthnicityBatchUSES 10 UNITS PER NAME Infer up-to 100 US resident's likely race/ethnicity according to US Census taxonomy.
NamSorApiV2.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).
NamSorApiV2.PersonalApiusZipRaceEthnicityBatchPOST /api2/json/usZipRaceEthnicityBatchUSES 10 UNITS PER NAME Infer up-to 100 US resident's likely race/ethnicity according to US Census taxonomy, with (optional) ZIP code.
NamSorApiV2.AdminApiaddCreditsGET /api2/json/addCredits/{apiKey}/{usageCredits}/{userMessage}Add usage credits to an API Key.
NamSorApiV2.AdminApianonymizeGET /api2/json/anonymize/{source}/{anonymized}Activate/deactivate anonymization for a source.
NamSorApiV2.AdminApiapiStatusGET /api2/json/apiStatusPrints the current status of the classifiers.
NamSorApiV2.AdminApiapiUsageGET /api2/json/apiUsagePrint current API usage.
NamSorApiV2.AdminApiapiUsageHistoryGET /api2/json/apiUsageHistoryPrint historical API usage.
NamSorApiV2.AdminApiapiUsageHistoryAggregateGET /api2/json/apiUsageHistoryAggregatePrint historical API usage (in an aggregated view, by service, by day/hour/min).
NamSorApiV2.AdminApiavailablePlansGET /api2/json/availablePlans/{token}List all available plans in the user's preferred currency.
NamSorApiV2.AdminApiavailablePlans1GET /api2/json/availablePlansList all available plans in the default currency (usd).
NamSorApiV2.AdminApiavailableServicesGET /api2/json/apiServicesList of API services and usage cost in Units (default is 1=ONE Unit).
NamSorApiV2.AdminApibillingCurrenciesGET /api2/json/billingCurrenciesList possible currency options for billing (USD, EUR, GBP, ...)
NamSorApiV2.AdminApibillingHistoryGET /api2/json/billingHistory/{token}Read the history billing information (invoices paid via Stripe or manually).
NamSorApiV2.AdminApibillingInfoGET /api2/json/billingInfo/{token}Read the billing information (company name, address, phone, vat ID)
NamSorApiV2.AdminApichargePOST /api2/json/chargeCreate a Stripe Customer, based on a payment card token (from secure StripeJS) and email.
NamSorApiV2.AdminApicorporateKeyGET /api2/json/corporateKey/{apiKey}/{corporate}Setting an API Key to a corporate status.
NamSorApiV2.AdminApidebugLevelGET /api2/json/debugLevel/{logger}/{level}Update debug level for a classifier
NamSorApiV2.AdminApiflushGET /api2/json/flushFlush counters.
NamSorApiV2.AdminApiinvalidateCacheGET /api2/json/invalidateCacheInvalidate system caches.
NamSorApiV2.AdminApilearnableGET /api2/json/learnable/{source}/{learnable}Activate/deactivate learning from a source.
NamSorApiV2.AdminApinamsorCounterGET /api2/json/namsorCounterGet the overall API counter
NamSorApiV2.AdminApipaymentInfoGET /api2/json/paymentInfo/{token}Get the Stripe payment information associated with the current google auth session token.
NamSorApiV2.AdminApiprocureKeyGET /api2/json/procureKey/{token}Procure an API Key (sent via Email), based on an auth token. Keep your API Key secret.
NamSorApiV2.AdminApiredeployUIGET /api2/json/redeployUI/{live}Redeploy UI from current dev branch.
NamSorApiV2.AdminApiredeployUI1GET /api2/json/redeployUIRedeploy UI from current dev branch.
NamSorApiV2.AdminApiremoveUserAccountGET /api2/json/removeUserAccount/{token}Remove the user account.
NamSorApiV2.AdminApiremoveUserAccountOnBehalfGET /api2/json/removeUserAccountOnBehalf/{apiKey}Remove (on behalf) a user account.
NamSorApiV2.AdminApishutdownGET /api2/json/shutdownStop learning and shutdown system.
NamSorApiV2.AdminApisoftwareVersionGET /api2/json/softwareVersionGet the current software version
NamSorApiV2.AdminApisourceStatsGET /api2/json/sourceStats/{source}Print basic source statistics.
NamSorApiV2.AdminApistatsGET /api2/json/statsPrint basic system statistics.
NamSorApiV2.AdminApistripeConnectGET /api2/json/stripeConnectConnects a Stripe Account.
NamSorApiV2.AdminApisubscribePlanGET /api2/json/subscribePlan/{planName}/{token}Subscribe to a give API plan, using the user's preferred or default currency.
NamSorApiV2.AdminApisubscribePlanOnBehalfGET /api2/json/subscribePlanOnBehalf/{planName}/{apiKey}Subscribe to a give API plan, using the user's preferred or default currency (admin only).
NamSorApiV2.AdminApitaxonomyClassesGET /api2/json/taxonomyClasses/{classifierName}Print the taxonomy classes valid for the given classifier.
NamSorApiV2.AdminApiupdateBillingInfoPOST /api2/json/updateBillingInfo/{token}Sets or update the billing information (company name, address, phone, vat ID)
NamSorApiV2.AdminApiupdateLimitGET /api2/json/updateLimit/{usageLimit}/{hardOrSoft}/{token}Modifies the hard/soft limit on the API plan's overages (default is 0$ soft limit).
NamSorApiV2.AdminApiupdatePaymentDefaultGET /api2/json/updatePaymentDefault/{defautSourceId}/{token}Update the default Stripe card associated with the current google auth session token.
NamSorApiV2.AdminApiuserInfoGET /api2/json/userInfo/{token}Get the user profile associated with the current google auth session token.
NamSorApiV2.AdminApiverifyEmailGET /api2/json/verifyEmail/{emailToken}Verifies an email, based on token sent to that email
NamSorApiV2.AdminApiverifyRemoveEmailGET /api2/json/verifyRemoveEmail/{emailToken}Verifies an email, based on token sent to that email
NamSorApiV2.AdminApivetGET /api2/json/vetting/{source}/{vetted}Vetting of a source.
NamSorApiV2.ChineseApichineseNameCandidatesGET /api2/json/chineseNameCandidates/{chineseSurnameLatin}/{chineseGivenNameLatin}Identify Chinese name candidates, based on the romanized name ex. Wang Xiaoming
NamSorApiV2.ChineseApichineseNameCandidatesBatchPOST /api2/json/chineseNameCandidatesBatchIdentify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming
NamSorApiV2.ChineseApichineseNameCandidatesGenderBatchPOST /api2/json/chineseNameCandidatesGenderBatchIdentify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname) ex. Wang Xiaoming.
NamSorApiV2.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')
NamSorApiV2.ChineseApichineseNameMatchGET /api2/json/chineseNameMatch/{chineseSurnameLatin}/{chineseGivenNameLatin}/{chineseName}Return a score for matching Chinese name ex. 王晓明 with a romanized name ex. Wang Xiaoming
NamSorApiV2.ChineseApichineseNameMatchBatchPOST /api2/json/chineseNameMatchBatchIdentify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname), ex. Wang Xiaoming
NamSorApiV2.ChineseApigenderChineseNameGET /api2/json/genderChineseName/{chineseName}Infer the likely gender of a Chinese full name ex. 王晓明
NamSorApiV2.ChineseApigenderChineseNameBatchPOST /api2/json/genderChineseNameBatchInfer the likely gender of up to 100 full names ex. 王晓明
NamSorApiV2.ChineseApigenderChineseNamePinyinGET /api2/json/genderChineseNamePinyin/{chineseSurnameLatin}/{chineseGivenNameLatin}Infer the likely gender of a Chinese name in LATIN (Pinyin).
NamSorApiV2.ChineseApigenderChineseNamePinyinBatchPOST /api2/json/genderChineseNamePinyinBatchInfer the likely gender of up to 100 Chinese names in LATIN (Pinyin).
NamSorApiV2.ChineseApiparseChineseNameGET /api2/json/parseChineseName/{chineseName}Infer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name)
NamSorApiV2.ChineseApiparseChineseNameBatchPOST /api2/json/parseChineseNameBatchInfer the likely first/last name structure of a name, ex. 王晓明 -> 王(surname) 晓明(given name).
NamSorApiV2.ChineseApipinyinChineseNameGET /api2/json/pinyinChineseName/{chineseName}Romanize the Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name)
NamSorApiV2.ChineseApipinyinChineseNameBatchPOST /api2/json/pinyinChineseNameBatchRomanize a list of Chinese name to Pinyin, ex. 王晓明 -> Wang (surname) Xiaoming (given name).
NamSorApiV2.GeneralApinameTypeGET /api2/json/nameType/{properNoun}Infer the likely type of a proper noun (personal name, brand name, place name etc.)
NamSorApiV2.GeneralApinameType1GET /api2/json/nameType/{properNoun}/{countryIso2}Infer the likely type of a proper noun (personal name, brand name, place name etc.)
NamSorApiV2.JapaneseApigenderJapaneseNameFullGET /api2/json/genderJapaneseNameFull/{japaneseName}Infer the likely gender of a Japanese full name ex. 王晓明
NamSorApiV2.JapaneseApigenderJapaneseNameFullBatchPOST /api2/json/genderJapaneseNameFullBatchInfer the likely gender of up to 100 full names
NamSorApiV2.JapaneseApigenderJapaneseNamePinyinGET /api2/json/genderJapaneseName/{japaneseSurname}/{japaneseGivenName}Infer the likely gender of a Japanese name in LATIN (Pinyin).
NamSorApiV2.JapaneseApigenderJapaneseNamePinyinBatchPOST /api2/json/genderJapaneseNameBatchInfer the likely gender of up to 100 Japanese names in LATIN (Pinyin).
NamSorApiV2.JapaneseApijapaneseNameKanjiCandidatesGET /api2/json/japaneseNameKanjiCandidates/{japaneseSurnameLatin}/{japaneseGivenNameLatin}Identify japanese name candidates in KANJI, based on the romanized name ex. Yamamoto Sanae
NamSorApiV2.JapaneseApijapaneseNameKanjiCandidatesBatchPOST /api2/json/japaneseNameKanjiCandidatesBatchIdentify japanese name candidates in KANJI, based on the romanized name (firstName = japaneseGivenName; lastName=japaneseSurname), ex. Yamamoto Sanae
NamSorApiV2.JapaneseApijapaneseNameLatinCandidatesGET /api2/json/japaneseNameLatinCandidates/{japaneseSurnameKanji}/{japaneseGivenNameKanji}Romanize japanese name, based on the name in Kanji.
NamSorApiV2.JapaneseApijapaneseNameLatinCandidatesBatchPOST /api2/json/japaneseNameLatinCandidatesBatchRomanize japanese names, based on the name in KANJI
NamSorApiV2.JapaneseApijapaneseNameMatchGET /api2/json/japaneseNameMatch/{japaneseSurnameLatin}/{japaneseGivenNameLatin}/{japaneseName}Return a score for matching Japanese name in KANJI ex. 山本 早苗 with a romanized name ex. Yamamoto Sanae
NamSorApiV2.JapaneseApijapaneseNameMatchBatchPOST /api2/json/japaneseNameMatchBatchReturn a score for matching a list of Japanese names in KANJI ex. 山本 早苗 with romanized names ex. Yamamoto Sanae
NamSorApiV2.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
NamSorApiV2.JapaneseApiparseJapaneseNameGET /api2/json/parseJapaneseName/{japaneseName}Infer the likely first/last name structure of a name, ex. 山本 早苗 or Yamamoto Sanae
NamSorApiV2.JapaneseApiparseJapaneseNameBatchPOST /api2/json/parseJapaneseNameBatchInfer the likely first/last name structure of a name, ex. 山本 早苗 or Yamamoto Sanae
NamSorApiV2.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.
NamSorApiV2.SocialApiphoneCodeBatchPOST /api2/json/phoneCodeBatchUSES 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.
NamSorApiV2.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).
NamSorApiV2.SocialApiphoneCodeGeoBatchPOST /api2/json/phoneCodeGeoBatchUSES 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).
NamSorApiV2.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