smartystreets-javascript-sdk 5.2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/dist/cjs/AgentSender.cjs +1 -0
  2. package/dist/cjs/BaseUrlSender.cjs +1 -0
  3. package/dist/cjs/Batch.cjs +1 -0
  4. package/dist/cjs/ClientBuilder.cjs +1 -0
  5. package/dist/cjs/CustomHeaderSender.cjs +1 -0
  6. package/dist/cjs/Errors.cjs +1 -0
  7. package/dist/cjs/HttpSender.cjs +1 -0
  8. package/dist/cjs/InputData.cjs +1 -0
  9. package/dist/cjs/LicenseSender.cjs +1 -0
  10. package/dist/cjs/Request.cjs +1 -0
  11. package/dist/cjs/Response.cjs +1 -0
  12. package/dist/cjs/RetrySender.cjs +1 -0
  13. package/dist/cjs/SharedCredentials.cjs +1 -0
  14. package/dist/cjs/SigningSender.cjs +1 -0
  15. package/dist/cjs/StaticCredentials.cjs +1 -0
  16. package/dist/cjs/StatusCodeSender.cjs +1 -0
  17. package/dist/cjs/_virtual/Batch.cjs +1 -0
  18. package/dist/cjs/_virtual/Candidate.cjs +1 -0
  19. package/dist/cjs/_virtual/Candidate2.cjs +1 -0
  20. package/dist/cjs/_virtual/ClientBuilder.cjs +1 -0
  21. package/dist/cjs/_virtual/Errors.cjs +1 -0
  22. package/dist/cjs/_virtual/Lookup.cjs +1 -0
  23. package/dist/cjs/_virtual/Lookup2.cjs +1 -0
  24. package/dist/cjs/_virtual/Lookup3.cjs +1 -0
  25. package/dist/cjs/_virtual/Lookup4.cjs +1 -0
  26. package/dist/cjs/_virtual/Lookup5.cjs +1 -0
  27. package/dist/cjs/_virtual/Lookup6.cjs +1 -0
  28. package/dist/cjs/_virtual/Lookup7.cjs +1 -0
  29. package/dist/cjs/_virtual/Lookup8.cjs +1 -0
  30. package/dist/cjs/_virtual/Response.cjs +1 -0
  31. package/dist/cjs/_virtual/Result.cjs +1 -0
  32. package/dist/cjs/_virtual/Result2.cjs +1 -0
  33. package/dist/cjs/_virtual/SharedCredentials.cjs +1 -0
  34. package/dist/cjs/_virtual/StaticCredentials.cjs +1 -0
  35. package/dist/cjs/_virtual/Suggestion.cjs +1 -0
  36. package/dist/cjs/_virtual/Suggestion2.cjs +1 -0
  37. package/dist/cjs/_virtual/_axios.cjs +1 -0
  38. package/dist/cjs/_virtual/_commonjsHelpers.cjs +1 -0
  39. package/dist/cjs/_virtual/buildClients.cjs +1 -0
  40. package/dist/cjs/index.cjs +1 -0
  41. package/dist/cjs/international_address_autocomplete/Client.cjs +1 -0
  42. package/dist/cjs/international_address_autocomplete/Lookup.cjs +1 -0
  43. package/dist/cjs/international_address_autocomplete/Suggestion.cjs +1 -0
  44. package/dist/cjs/international_street/Candidate.cjs +1 -0
  45. package/dist/cjs/international_street/Client.cjs +1 -0
  46. package/dist/cjs/international_street/Lookup.cjs +1 -0
  47. package/dist/cjs/package.json.cjs +1 -0
  48. package/dist/cjs/us_autocomplete_pro/Client.cjs +1 -0
  49. package/dist/cjs/us_autocomplete_pro/Lookup.cjs +1 -0
  50. package/dist/cjs/us_autocomplete_pro/Suggestion.cjs +1 -0
  51. package/dist/cjs/us_enrichment/Client.cjs +1 -0
  52. package/dist/cjs/us_enrichment/Lookup.cjs +1 -0
  53. package/dist/cjs/us_enrichment/Response.cjs +1 -0
  54. package/dist/cjs/us_extract/Address.cjs +1 -0
  55. package/dist/cjs/us_extract/Client.cjs +1 -0
  56. package/dist/cjs/us_extract/Lookup.cjs +1 -0
  57. package/dist/cjs/us_extract/Result.cjs +1 -0
  58. package/dist/cjs/us_reverse_geo/Client.cjs +1 -0
  59. package/dist/cjs/us_reverse_geo/Lookup.cjs +1 -0
  60. package/dist/cjs/us_reverse_geo/Response.cjs +1 -0
  61. package/dist/cjs/us_reverse_geo/Result.cjs +1 -0
  62. package/dist/cjs/us_street/Candidate.cjs +1 -0
  63. package/dist/cjs/us_street/Client.cjs +1 -0
  64. package/dist/cjs/us_street/Lookup.cjs +1 -0
  65. package/dist/cjs/us_zipcode/Client.cjs +1 -0
  66. package/dist/cjs/us_zipcode/Lookup.cjs +1 -0
  67. package/dist/cjs/us_zipcode/Result.cjs +1 -0
  68. package/dist/cjs/util/Sleeper.cjs +1 -0
  69. package/dist/cjs/util/apiToSDKKeyMap.cjs +1 -0
  70. package/dist/cjs/util/buildClients.cjs +1 -0
  71. package/dist/cjs/util/buildInputData.cjs +1 -0
  72. package/dist/cjs/util/buildSmartyResponse.cjs +1 -0
  73. package/dist/cjs/util/sendBatch.cjs +1 -0
  74. package/dist/esm/AgentSender.mjs +1 -0
  75. package/dist/esm/BaseUrlSender.mjs +1 -0
  76. package/dist/esm/Batch.mjs +1 -0
  77. package/dist/esm/ClientBuilder.mjs +1 -0
  78. package/dist/esm/CustomHeaderSender.mjs +1 -0
  79. package/dist/esm/Errors.mjs +1 -0
  80. package/dist/esm/HttpSender.mjs +1 -0
  81. package/dist/esm/InputData.mjs +1 -0
  82. package/dist/esm/LicenseSender.mjs +1 -0
  83. package/dist/esm/Request.mjs +1 -0
  84. package/dist/esm/Response.mjs +1 -0
  85. package/dist/esm/RetrySender.mjs +1 -0
  86. package/dist/esm/SharedCredentials.mjs +1 -0
  87. package/dist/esm/SigningSender.mjs +1 -0
  88. package/dist/esm/StaticCredentials.mjs +1 -0
  89. package/dist/esm/StatusCodeSender.mjs +1 -0
  90. package/dist/esm/_virtual/Batch.mjs +1 -0
  91. package/dist/esm/_virtual/Candidate.mjs +1 -0
  92. package/dist/esm/_virtual/Candidate2.mjs +1 -0
  93. package/dist/esm/_virtual/ClientBuilder.mjs +1 -0
  94. package/dist/esm/_virtual/Errors.mjs +1 -0
  95. package/dist/esm/_virtual/Lookup.mjs +1 -0
  96. package/dist/esm/_virtual/Lookup2.mjs +1 -0
  97. package/dist/esm/_virtual/Lookup3.mjs +1 -0
  98. package/dist/esm/_virtual/Lookup4.mjs +1 -0
  99. package/dist/esm/_virtual/Lookup5.mjs +1 -0
  100. package/dist/esm/_virtual/Lookup6.mjs +1 -0
  101. package/dist/esm/_virtual/Lookup7.mjs +1 -0
  102. package/dist/esm/_virtual/Lookup8.mjs +1 -0
  103. package/dist/esm/_virtual/Response.mjs +1 -0
  104. package/dist/esm/_virtual/Result.mjs +1 -0
  105. package/dist/esm/_virtual/Result2.mjs +1 -0
  106. package/dist/esm/_virtual/SharedCredentials.mjs +1 -0
  107. package/dist/esm/_virtual/StaticCredentials.mjs +1 -0
  108. package/dist/esm/_virtual/Suggestion.mjs +1 -0
  109. package/dist/esm/_virtual/Suggestion2.mjs +1 -0
  110. package/dist/esm/_virtual/_axios.mjs +1 -0
  111. package/dist/esm/_virtual/_commonjsHelpers.mjs +1 -0
  112. package/dist/esm/_virtual/buildClients.mjs +1 -0
  113. package/dist/esm/index.mjs +1 -0
  114. package/dist/esm/international_address_autocomplete/Client.mjs +1 -0
  115. package/dist/esm/international_address_autocomplete/Lookup.mjs +1 -0
  116. package/dist/esm/international_address_autocomplete/Suggestion.mjs +1 -0
  117. package/dist/esm/international_street/Candidate.mjs +1 -0
  118. package/dist/esm/international_street/Client.mjs +1 -0
  119. package/dist/esm/international_street/Lookup.mjs +1 -0
  120. package/dist/esm/package.json.mjs +1 -0
  121. package/dist/esm/us_autocomplete_pro/Client.mjs +1 -0
  122. package/dist/esm/us_autocomplete_pro/Lookup.mjs +1 -0
  123. package/dist/esm/us_autocomplete_pro/Suggestion.mjs +1 -0
  124. package/dist/esm/us_enrichment/Client.mjs +1 -0
  125. package/dist/esm/us_enrichment/Lookup.mjs +1 -0
  126. package/dist/esm/us_enrichment/Response.mjs +1 -0
  127. package/dist/esm/us_extract/Address.mjs +1 -0
  128. package/dist/esm/us_extract/Client.mjs +1 -0
  129. package/dist/esm/us_extract/Lookup.mjs +1 -0
  130. package/dist/esm/us_extract/Result.mjs +1 -0
  131. package/dist/esm/us_reverse_geo/Client.mjs +1 -0
  132. package/dist/esm/us_reverse_geo/Lookup.mjs +1 -0
  133. package/dist/esm/us_reverse_geo/Response.mjs +1 -0
  134. package/dist/esm/us_reverse_geo/Result.mjs +1 -0
  135. package/dist/esm/us_street/Candidate.mjs +1 -0
  136. package/dist/esm/us_street/Client.mjs +1 -0
  137. package/dist/esm/us_street/Lookup.mjs +1 -0
  138. package/dist/esm/us_zipcode/Client.mjs +1 -0
  139. package/dist/esm/us_zipcode/Lookup.mjs +1 -0
  140. package/dist/esm/us_zipcode/Result.mjs +1 -0
  141. package/dist/esm/util/Sleeper.mjs +1 -0
  142. package/dist/esm/util/apiToSDKKeyMap.mjs +1 -0
  143. package/dist/esm/util/buildClients.mjs +1 -0
  144. package/dist/esm/util/buildInputData.mjs +1 -0
  145. package/dist/esm/util/buildSmartyResponse.mjs +1 -0
  146. package/dist/esm/util/sendBatch.mjs +1 -0
  147. package/package.json +26 -6
  148. package/.github/workflows/node-tests.yml +0 -27
  149. package/CHANGELOG.md +0 -5
  150. package/Makefile +0 -28
  151. package/examples/international_address_autocomplete.js +0 -58
  152. package/examples/international_street.js +0 -56
  153. package/examples/us_autocomplete_pro.js +0 -63
  154. package/examples/us_enrichment.js +0 -36
  155. package/examples/us_extract.js +0 -40
  156. package/examples/us_reverse_geo.js +0 -40
  157. package/examples/us_street.js +0 -73
  158. package/examples/us_zipcode.js +0 -57
  159. package/index.js +0 -41
  160. package/js-sdk-demo.cast +0 -95
  161. package/src/AgentSender.js +0 -16
  162. package/src/BaseUrlSender.js +0 -18
  163. package/src/Batch.js +0 -49
  164. package/src/ClientBuilder.js +0 -212
  165. package/src/CustomHeaderSender.js +0 -20
  166. package/src/Errors.js +0 -100
  167. package/src/HttpSender.js +0 -66
  168. package/src/InputData.js +0 -21
  169. package/src/LicenseSender.js +0 -20
  170. package/src/Request.js +0 -12
  171. package/src/Response.js +0 -10
  172. package/src/RetrySender.js +0 -50
  173. package/src/SharedCredentials.js +0 -13
  174. package/src/SigningSender.js +0 -26
  175. package/src/StaticCredentials.js +0 -13
  176. package/src/StatusCodeSender.js +0 -35
  177. package/src/international_address_autocomplete/Client.js +0 -41
  178. package/src/international_address_autocomplete/Lookup.js +0 -14
  179. package/src/international_address_autocomplete/Suggestion.js +0 -14
  180. package/src/international_street/Candidate.js +0 -153
  181. package/src/international_street/Client.js +0 -42
  182. package/src/international_street/Lookup.js +0 -85
  183. package/src/us_autocomplete_pro/Client.js +0 -41
  184. package/src/us_autocomplete_pro/Lookup.js +0 -29
  185. package/src/us_autocomplete_pro/Suggestion.js +0 -19
  186. package/src/us_enrichment/Client.js +0 -112
  187. package/src/us_enrichment/Lookup.js +0 -13
  188. package/src/us_enrichment/Response.js +0 -559
  189. package/src/us_extract/Address.js +0 -17
  190. package/src/us_extract/Client.js +0 -35
  191. package/src/us_extract/Lookup.js +0 -24
  192. package/src/us_extract/Result.js +0 -21
  193. package/src/us_reverse_geo/Client.js +0 -40
  194. package/src/us_reverse_geo/Lookup.js +0 -17
  195. package/src/us_reverse_geo/Response.js +0 -17
  196. package/src/us_reverse_geo/Result.js +0 -36
  197. package/src/us_street/Candidate.js +0 -89
  198. package/src/us_street/Client.js +0 -43
  199. package/src/us_street/Lookup.js +0 -25
  200. package/src/us_zipcode/Client.js +0 -39
  201. package/src/us_zipcode/Lookup.js +0 -16
  202. package/src/us_zipcode/Result.js +0 -45
  203. package/src/util/Sleeper.js +0 -8
  204. package/src/util/apiToSDKKeyMap.js +0 -75
  205. package/src/util/buildClients.js +0 -48
  206. package/src/util/buildInputData.js +0 -11
  207. package/src/util/buildSmartyResponse.js +0 -10
  208. package/src/util/sendBatch.js +0 -39
  209. package/tests/fixtures/MockSleeper.js +0 -10
  210. package/tests/fixtures/mock_senders.js +0 -43
  211. package/tests/international_address_autocomplete/test_Client.js +0 -86
  212. package/tests/international_address_autocomplete/test_Lookup.js +0 -55
  213. package/tests/international_street/test_Candidate.js +0 -268
  214. package/tests/international_street/test_Client.js +0 -70
  215. package/tests/international_street/test_Lookup.js +0 -108
  216. package/tests/test_AgentSender.js +0 -25
  217. package/tests/test_BaseUrlSender.js +0 -31
  218. package/tests/test_Batch.js +0 -73
  219. package/tests/test_CustomHeaderSender.js +0 -31
  220. package/tests/test_ExtractExample.js +0 -167
  221. package/tests/test_HttpSender.js +0 -93
  222. package/tests/test_LicenseSender.js +0 -40
  223. package/tests/test_RetrySender.js +0 -98
  224. package/tests/test_SigningSender.js +0 -56
  225. package/tests/test_StatusCodeSender.js +0 -95
  226. package/tests/us_autocomplete_pro/test_Client.js +0 -116
  227. package/tests/us_autocomplete_pro/test_Lookup.js +0 -11
  228. package/tests/us_autocomplete_pro/test_Suggestion.js +0 -24
  229. package/tests/us_enrichment/test_Client.js +0 -455
  230. package/tests/us_enrichment/test_Lookup.js +0 -22
  231. package/tests/us_enrichment/test_Response.js +0 -739
  232. package/tests/us_extract/test_Address.js +0 -67
  233. package/tests/us_extract/test_Client.js +0 -148
  234. package/tests/us_extract/test_Lookup.js +0 -19
  235. package/tests/us_extract/test_Result.js +0 -39
  236. package/tests/us_reverse_geo/test_Client.js +0 -48
  237. package/tests/us_reverse_geo/test_Lookup.js +0 -14
  238. package/tests/us_reverse_geo/test_Response.js +0 -44
  239. package/tests/us_street/test_Candidate.js +0 -133
  240. package/tests/us_street/test_Client.js +0 -150
  241. package/tests/us_street/test_Lookup.js +0 -29
  242. package/tests/us_zipcode/test_Client.js +0 -150
  243. package/tests/us_zipcode/test_Result.js +0 -81
@@ -1,85 +0,0 @@
1
- const UnprocessableEntityError = require("../Errors").UnprocessableEntityError;
2
- const messages = {
3
- countryRequired: "Country field is required.",
4
- freeformOrAddress1Required: "Either freeform or address1 is required.",
5
- insufficientInformation: "Insufficient information: One or more required fields were not set on the lookup.",
6
- badGeocode: "Invalid input: geocode can only be set to 'true' (default is 'false'.",
7
- invalidLanguage: "Invalid input: language can only be set to 'latin' or 'native'. When not set, the the output language will match the language of the input values."
8
- };
9
-
10
-
11
- /**
12
- * In addition to holding all of the input data for this lookup, this class also<br>
13
- * will contain the result of the lookup after it comes back from the API.
14
- * <p><b>Note: </b><i>Lookups must have certain required fields set with non-blank values. <br>
15
- * These can be found at the URL below.</i></p>
16
- * @see "https://www.smarty.com/docs/cloud/international-street-api#http-input-fields"
17
- */
18
- class Lookup {
19
- constructor(country, freeform) {
20
- this.result = [];
21
-
22
- this.country = country;
23
- this.freeform = freeform;
24
- this.address1 = undefined;
25
- this.address2 = undefined;
26
- this.address3 = undefined;
27
- this.address4 = undefined;
28
- this.organization = undefined;
29
- this.locality = undefined;
30
- this.administrativeArea = undefined;
31
- this.postalCode = undefined;
32
- this.geocode = undefined;
33
- this.language = undefined;
34
- this.inputId = undefined;
35
-
36
- this.ensureEnoughInfo = this.ensureEnoughInfo.bind(this);
37
- this.ensureValidData = this.ensureValidData.bind(this);
38
- }
39
-
40
- ensureEnoughInfo() {
41
- if (fieldIsMissing(this.country)) throw new UnprocessableEntityError(messages.countryRequired);
42
-
43
- if (fieldIsSet(this.freeform)) return true;
44
-
45
- if (fieldIsMissing(this.address1)) throw new UnprocessableEntityError(messages.freeformOrAddress1Required);
46
-
47
- if (fieldIsSet(this.postalCode)) return true;
48
-
49
- if (fieldIsMissing(this.locality) || fieldIsMissing(this.administrativeArea)) throw new UnprocessableEntityError(messages.insufficientInformation);
50
-
51
- return true;
52
- }
53
-
54
- ensureValidData() {
55
- let languageIsSetIncorrectly = () => {
56
- let isLanguage = language => this.language.toLowerCase() === language;
57
-
58
- return fieldIsSet(this.language) && !(isLanguage("latin") || isLanguage("native"));
59
- };
60
-
61
- let geocodeIsSetIncorrectly = () => {
62
- return fieldIsSet(this.geocode) && this.geocode.toLowerCase() !== "true";
63
- };
64
-
65
- if (geocodeIsSetIncorrectly()) throw new UnprocessableEntityError(messages.badGeocode);
66
-
67
- if (languageIsSetIncorrectly()) throw new UnprocessableEntityError(messages.invalidLanguage);
68
-
69
- return true;
70
- }
71
- }
72
-
73
- function fieldIsMissing (field) {
74
- if (!field) return true;
75
-
76
- const whitespaceCharacters = /\s/g;
77
-
78
- return field.replace(whitespaceCharacters, "").length < 1;
79
- }
80
-
81
- function fieldIsSet (field) {
82
- return !fieldIsMissing(field);
83
- }
84
-
85
- module.exports = Lookup;
@@ -1,41 +0,0 @@
1
- const Errors = require("../Errors");
2
- const Request = require("../Request");
3
- const Suggestion = require("./Suggestion");
4
- const buildInputData = require("../util/buildInputData");
5
- const keyTranslationFormat = require("../util/apiToSDKKeyMap").usAutocompletePro;
6
-
7
- /**
8
- * This client sends lookups to the Smarty US Autocomplete Pro API, <br>
9
- * and attaches the suggestions to the appropriate Lookup objects.
10
- */
11
- class Client {
12
- constructor(sender) {
13
- this.sender = sender;
14
- }
15
-
16
- send(lookup) {
17
- if (typeof lookup === "undefined") throw new Errors.UndefinedLookupError();
18
-
19
- let request = new Request();
20
- request.parameters = buildInputData(lookup, keyTranslationFormat);
21
-
22
- return new Promise((resolve, reject) => {
23
- this.sender.send(request)
24
- .then(response => {
25
- if (response.error) reject(response.error);
26
-
27
- lookup.result = buildSuggestionsFromResponse(response.payload);
28
- resolve(lookup);
29
- })
30
- .catch(reject);
31
- });
32
-
33
- function buildSuggestionsFromResponse(payload) {
34
- if (payload.suggestions === null) return [];
35
-
36
- return payload.suggestions.map(suggestion => new Suggestion(suggestion));
37
- }
38
- }
39
- }
40
-
41
- module.exports = Client;
@@ -1,29 +0,0 @@
1
- /**
2
- * In addition to holding all of the input data for this lookup, this class also<br>
3
- * will contain the result of the lookup after it comes back from the API.
4
- * @see "https://www.smarty.com/docs/cloud/us-autocomplete-api#pro-http-request-input-fields"
5
- */
6
- class Lookup {
7
- /**
8
- * @param search The beginning of an address. This is required to be set.
9
- */
10
- constructor(search) {
11
- this.result = [];
12
-
13
- this.search = search;
14
- this.selected = undefined;
15
- this.maxResults = undefined;
16
- this.includeOnlyCities = [];
17
- this.includeOnlyStates = [];
18
- this.includeOnlyZIPCodes = [];
19
- this.excludeStates = [];
20
- this.preferCities = [];
21
- this.preferStates = [];
22
- this.preferZIPCodes = [];
23
- this.preferRatio = undefined;
24
- this.preferGeolocation = undefined;
25
- this.source = undefined
26
- }
27
- }
28
-
29
- module.exports = Lookup;
@@ -1,19 +0,0 @@
1
- /**
2
- * @see "https://www.smarty.com/docs/cloud/us-autocomplete-api#pro-http-response"
3
- */
4
- class Suggestion {
5
- constructor(responseData) {
6
- this.streetLine = responseData.street_line;
7
- this.secondary = responseData.secondary;
8
- this.city = responseData.city;
9
- this.state = responseData.state;
10
- this.zipcode = responseData.zipcode;
11
- this.entries = responseData.entries;
12
-
13
- if (responseData.source) {
14
- this.source = responseData.source;
15
- }
16
- }
17
- }
18
-
19
- module.exports = Suggestion;
@@ -1,112 +0,0 @@
1
- const Errors = require("../Errors");
2
- const Request = require("../Request");
3
- const buildInputData = require("../util/buildInputData");
4
- const {usEnrichment: keyTranslationFormat} = require("../util/apiToSDKKeyMap");
5
-
6
- class Client {
7
- constructor(sender) {
8
- this.sender = sender;
9
- }
10
-
11
- sendPrincipal(lookup) {
12
- if (typeof lookup === "undefined") throw new Errors.UndefinedLookupError();
13
-
14
- let request = new Request();
15
- request.parameters = buildInputData(lookup, keyTranslationFormat);
16
-
17
- request.baseUrlParam = lookup.smartyKey + "/property/principal";
18
-
19
- return new Promise((resolve, reject) => {
20
- this.sender.send(request)
21
- .then(response => {
22
- if (response.error) reject(response.error);
23
-
24
- lookup.response = response.payload;
25
- resolve(lookup);
26
- })
27
- .catch(reject);
28
- });
29
- }
30
-
31
- sendFinancial(lookup) {
32
- if (typeof lookup === "undefined") throw new Errors.UndefinedLookupError();
33
-
34
- let request = new Request();
35
- request.parameters = buildInputData(lookup, keyTranslationFormat);
36
-
37
- request.baseUrlParam = lookup.smartyKey + "/property/financial";
38
-
39
- return new Promise((resolve, reject) => {
40
- this.sender.send(request)
41
- .then(response => {
42
- if (response.error) reject(response.error);
43
-
44
- lookup.response = response.payload;
45
- resolve(lookup);
46
- })
47
- .catch(reject);
48
- });
49
- }
50
-
51
- sendGeo(lookup) {
52
- if (typeof lookup === "undefined") throw new Errors.UndefinedLookupError();
53
-
54
- let request = new Request();
55
- request.parameters = buildInputData(lookup, keyTranslationFormat);
56
-
57
- request.baseUrlParam = lookup.smartyKey + "/geo-reference";
58
-
59
- return new Promise((resolve, reject) => {
60
- this.sender.send(request)
61
- .then(response => {
62
- if (response.error) reject(response.error);
63
-
64
- lookup.response = response.payload;
65
- resolve(lookup);
66
- })
67
- .catch(reject);
68
- });
69
- }
70
-
71
- sendSecondary(lookup) {
72
- if (typeof lookup === "undefined") throw new Errors.UndefinedLookupError();
73
-
74
- let request = new Request();
75
- request.parameters = buildInputData(lookup, keyTranslationFormat);
76
-
77
- request.baseUrlParam = lookup.smartyKey + "/secondary";
78
-
79
- return new Promise((resolve, reject) => {
80
- this.sender.send(request)
81
- .then(response => {
82
- if (response.error) reject(response.error);
83
-
84
- lookup.response = response.payload;
85
- resolve(lookup);
86
- })
87
- .catch(reject);
88
- });
89
- }
90
-
91
- sendSecondaryCount(lookup) {
92
- if (typeof lookup === "undefined") throw new Errors.UndefinedLookupError();
93
-
94
- let request = new Request();
95
- request.parameters = buildInputData(lookup, keyTranslationFormat);
96
-
97
- request.baseUrlParam = lookup.smartyKey + "/secondary/count";
98
-
99
- return new Promise((resolve, reject) => {
100
- this.sender.send(request)
101
- .then(response => {
102
- if (response.error) reject(response.error);
103
-
104
- lookup.response = response.payload;
105
- resolve(lookup);
106
- })
107
- .catch(reject);
108
- });
109
- }
110
- }
111
-
112
- module.exports = Client;
@@ -1,13 +0,0 @@
1
- class Lookup {
2
- constructor(smartyKey, include, exclude, dataset, dataSubset) {
3
- this.smartyKey = smartyKey;
4
- this.include = include;
5
- this.exclude = exclude;
6
- this.dataset = dataset;
7
- this.dataSubset = dataSubset;
8
-
9
- this.response = {};
10
- };
11
- }
12
-
13
- module.exports = Lookup;