smartystreets-javascript-sdk
Advanced tools
Comparing version 1.0.4 to 1.0.6
{ | ||
"name": "smartystreets-javascript-sdk", | ||
"version": "1.0.4", | ||
"version": "1.0.6", | ||
"description": "Quick and easy SmartyStreets address validation.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
# SmartyStreets JavaScript SDK | ||
The official client libraries for accessing SmartyStreets APIs with Javascript. | ||
The official client libraries for accessing SmartyStreets APIs with JavaScript. | ||
[![asciicast](https://asciinema.org/a/189101.png)](https://asciinema.org/a/189101) | ||
You may have noticed this page is curiously sparse. Don't panic, there's [documentation](https://smartystreets.com/docs/sdk/javascript) as well as working [examples](examples) over on our website. | ||
[Apache 2.0 License](LICENSE) |
const BatchFullError = require("./Errors").BatchFullError; | ||
/** | ||
* This class contains a collection of up to 100 lookups to be sent to one of the SmartyStreets APIs<br> | ||
* all at once. This is more efficient than sending them one at a time. | ||
*/ | ||
class Batch { | ||
@@ -32,2 +36,6 @@ constructor () { | ||
/** | ||
* Clears the lookups stored in the batch so it can be used again.<br> | ||
* This helps avoid the overhead of building a new Batch object for each group of lookups. | ||
*/ | ||
clear () { | ||
@@ -34,0 +42,0 @@ this.lookups = []; |
@@ -24,2 +24,7 @@ const HttpSender = require("./HttpSender"); | ||
/** | ||
* The ClientBuilder class helps you build a client object for one of the supported SmartyStreets APIs.<br> | ||
* You can use ClientBuilder's methods to customize settings like maximum retries or timeout duration. These methods<br> | ||
* are chainable, so you can usually get set up with one line of code. | ||
*/ | ||
class ClientBuilder { | ||
@@ -42,2 +47,6 @@ constructor(signer) { | ||
/** | ||
* @param retries The maximum number of times to retry sending the request to the API. (Default is 5) | ||
* @return Returns <b>this</b> to accommodate method chaining. | ||
*/ | ||
withMaxRetries(retries) { | ||
@@ -48,2 +57,7 @@ this.maxRetries = retries; | ||
/** | ||
* @param timeout The maximum time (in milliseconds) to wait for a connection, and also to wait for <br> | ||
* the response to be read. (Default is 10000) | ||
* @return Returns <b>this</b> to accommodate method chaining. | ||
*/ | ||
withMaxTimeout(timeout) { | ||
@@ -54,2 +68,6 @@ this.maxTimeout = timeout; | ||
/** | ||
* @param sender Default is a series of nested senders. See <b>buildSender()</b>. | ||
* @return Returns <b>this</b> to accommodate method chaining. | ||
*/ | ||
withSender(sender) { | ||
@@ -60,2 +78,7 @@ this.httpSender = sender; | ||
/** | ||
* This may be useful when using a local installation of the SmartyStreets APIs. | ||
* @param url Defaults to the URL for the API corresponding to the <b>Client</b> object being built. | ||
* @return Returns <b>this</b> to accommodate method chaining. | ||
*/ | ||
withBaseUrl(url) { | ||
@@ -66,2 +89,10 @@ this.baseUrl = url; | ||
/** | ||
* Use this to specify a proxy through which to send all lookups. | ||
* @param host The host of the proxy server (do not include the port). | ||
* @param port The port on the proxy server to which you wish to connect. | ||
* @param username The username to login to the proxy. | ||
* @param password The password to login to the proxy. | ||
* @return Returns <b>this</b> to accommodate method chaining. | ||
*/ | ||
withProxy(host, port, username, password) { | ||
@@ -83,2 +114,7 @@ this.proxy = { | ||
/** | ||
* Use this to add any additional headers you need. | ||
* @param customHeaders A String to Object <b>Map</b> of header name/value pairs. | ||
* @return Returns <b>this</b> to accommodate method chaining. | ||
*/ | ||
withCustomHeaders(customHeaders) { | ||
@@ -85,0 +121,0 @@ this.customHeaders = customHeaders; |
@@ -0,1 +1,7 @@ | ||
/** | ||
* A candidate is a possible match for an address that was submitted.<br> | ||
* A lookup can have multiple candidates if the address was ambiguous. | ||
* | ||
* @see "https://smartystreets.com/docs/cloud/international-street-api#root" | ||
*/ | ||
class Candidate { | ||
@@ -2,0 +8,0 @@ constructor(responseData) { |
@@ -8,2 +8,6 @@ const Request = require("../Request"); | ||
/** | ||
* This client sends lookups to the SmartyStreets International Street API, <br> | ||
* and attaches the results to the appropriate Lookup objects. | ||
*/ | ||
class Client { | ||
@@ -10,0 +14,0 @@ constructor(sender) { |
@@ -10,2 +10,10 @@ const UnprocessableEntityError = require("../Errors").UnprocessableEntityError; | ||
/** | ||
* In addition to holding all of the input data for this lookup, this class also<br> | ||
* will contain the result of the lookup after it comes back from the API. | ||
* <p><b>Note: </b><i>Lookups must have certain required fields set with non-blank values. <br> | ||
* These can be found at the URL below.</i></p> | ||
* @see "https://smartystreets.com/docs/cloud/international-street-api#http-input-fields" | ||
*/ | ||
class Lookup { | ||
@@ -12,0 +20,0 @@ constructor(country, freeform) { |
@@ -6,2 +6,6 @@ const Errors = require("../Errors"); | ||
/** | ||
* This client sends lookups to the SmartyStreets US Autocomplete API, <br> | ||
* and attaches the results to the appropriate Lookup objects. | ||
*/ | ||
class Client { | ||
@@ -8,0 +12,0 @@ constructor(sender) { |
@@ -0,2 +1,10 @@ | ||
/** | ||
* In addition to holding all of the input data for this lookup, this class also<br> | ||
* will contain the result of the lookup after it comes back from the API. | ||
* @see "https://smartystreets.com/docs/cloud/us-autocomplete-api#http-request-input-fields" | ||
*/ | ||
class Lookup { | ||
/** | ||
* @param prefix The beginning of an address. This is required to be set. | ||
*/ | ||
constructor(prefix) { | ||
@@ -3,0 +11,0 @@ this.result = []; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @see "https://smartystreets.com/docs/cloud/us-autocomplete-api#http-response" | ||
*/ | ||
class Suggestion { | ||
@@ -2,0 +5,0 @@ constructor(responseData) { |
const Candidate = require("../us_street/Candidate"); | ||
/** | ||
* @see <a href="https://smartystreets.com/docs/cloud/us-extract-api#http-response-status">SmartyStreets US Extract API docs</a> | ||
*/ | ||
class Address { | ||
@@ -4,0 +7,0 @@ constructor (responseData) { |
@@ -6,2 +6,6 @@ const Errors = require("../Errors"); | ||
/** | ||
* This client sends lookups to the SmartyStreets US Extract API, <br> | ||
* and attaches the results to the Lookup objects. | ||
*/ | ||
class Client { | ||
@@ -8,0 +12,0 @@ constructor(sender) { |
@@ -0,2 +1,10 @@ | ||
/** | ||
* In addition to holding all of the input data for this lookup, this class also<br> | ||
* will contain the result of the lookup after it comes back from the API. | ||
* @see "https://smartystreets.com/docs/cloud/us-extract-api#http-request-input-fields" | ||
*/ | ||
class Lookup { | ||
/** | ||
* @param text The text that is to have addresses extracted out of it for verification (required) | ||
*/ | ||
constructor(text) { | ||
@@ -3,0 +11,0 @@ this.result = { |
const Address = require("./Address"); | ||
/** | ||
* @see <a href="https://smartystreets.com/docs/cloud/us-extract-api#http-response-status">SmartyStreets US Extract API docs</a> | ||
*/ | ||
class Result { | ||
@@ -4,0 +7,0 @@ constructor({meta, addresses}) { |
@@ -0,1 +1,8 @@ | ||
/** | ||
* A candidate is a possible match for an address that was submitted.<br> | ||
* A lookup can have multiple candidates if the address was ambiguous, and<br> | ||
* the maxCandidates field is set higher than 1. | ||
* | ||
* @see "https://smartystreets.com/docs/cloud/us-street-api#root" | ||
*/ | ||
class Candidate { | ||
@@ -2,0 +9,0 @@ constructor(responseData) { |
@@ -8,2 +8,6 @@ const Candidate = require("./Candidate"); | ||
/** | ||
* This client sends lookups to the SmartyStreets US Street API, <br> | ||
* and attaches the results to the appropriate Lookup objects. | ||
*/ | ||
class Client { | ||
@@ -14,2 +18,7 @@ constructor(sender) { | ||
/** | ||
* Sends up to 100 lookups for validation. | ||
* @param data May be a Lookup object, or a Batch which must contain between 1 and 100 Lookup objects | ||
* @throws SmartyException | ||
*/ | ||
send(data) { | ||
@@ -16,0 +25,0 @@ const dataIsBatch = data instanceof Batch; |
@@ -0,1 +1,6 @@ | ||
/** | ||
* In addition to holding all of the input data for this lookup, this class also<br> | ||
* will contain the result of the lookup after it comes back from the API. | ||
* @see "https://smartystreets.com/docs/cloud/us-street-api#input-fields" | ||
*/ | ||
class Lookup { | ||
@@ -2,0 +7,0 @@ constructor(street, street2, secondary, city, state, zipCode, lastLine, addressee, urbanization, match, maxCandidates, inputId) { |
@@ -8,2 +8,6 @@ const Lookup = require("./Lookup"); | ||
/** | ||
* This client sends lookups to the SmartyStreets US ZIP Code API, <br> | ||
* and attaches the results to the appropriate Lookup objects. | ||
*/ | ||
class Client { | ||
@@ -14,2 +18,7 @@ constructor(sender) { | ||
/** | ||
* Sends up to 100 lookups for validation. | ||
* @param data May be a Lookup object, or a Batch which must contain between 1 and 100 Lookup objects | ||
* @throws SmartyException | ||
*/ | ||
send(data) { | ||
@@ -16,0 +25,0 @@ const dataIsBatch = data instanceof Batch; |
@@ -0,1 +1,6 @@ | ||
/** | ||
* In addition to holding all of the input data for this lookup, this class also<br> | ||
* will contain the result of the lookup after it comes back from the API. | ||
* @see "https://smartystreets.com/docs/cloud/us-zipcode-api#http-request-input-fields" | ||
*/ | ||
class Lookup { | ||
@@ -2,0 +7,0 @@ constructor(city, state, zipCode, inputId) { |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @see "https://smartystreets.com/docs/cloud/us-zipcode-api#root" | ||
*/ | ||
class Result { | ||
@@ -2,0 +5,0 @@ constructor(responseData) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118114
70
2703
10