smartystreets-javascript-sdk
Version:
Quick and easy Smarty address validation.
113 lines (112 loc) • 4.95 kB
TypeScript
export = ClientBuilder;
/**
* The ClientBuilder class helps you build a client object for one of the supported Smarty 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.
*/
declare class ClientBuilder {
constructor(signer: any);
signer: any;
httpSender: any;
maxRetries: number;
maxTimeout: number;
baseUrl: any;
proxy: {
host: any;
port: any;
protocol: any;
} | undefined;
customHeaders: {};
debug: boolean | undefined;
licenses: any[];
customQueries: Map<any, any>;
/**
* @param retries The maximum number of times to retry sending the request to the API. (Default is 5)
* @return ClientBuilder <b>this</b> to accommodate method chaining.
*/
withMaxRetries(retries: any): this;
/**
* @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 ClientBuilder <b>this</b> to accommodate method chaining.
*/
withMaxTimeout(timeout: any): this;
/**
* @param sender Default is a series of nested senders. See <b>buildSender()</b>.
* @return ClientBuilder <b>this</b> to accommodate method chaining.
*/
withSender(sender: any): this;
/**
* This may be useful when using a local installation of the Smarty APIs.
* @param url Defaults to the URL for the API corresponding to the <b>Client</b> object being built.
* @return ClientBuilder <b>this</b> to accommodate method chaining.
*/
withBaseUrl(url: any): this;
/**
* 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 protocol The protocol on the proxy server to which you wish to connect. If the proxy server uses HTTPS, then you must set the protocol to 'https'.
* @param username The username to login to the proxy.
* @param password The password to login to the proxy.
* @return ClientBuilder <b>this</b> to accommodate method chaining.
*/
withProxy(host: any, port: any, protocol: any, username: any, password: any): this;
/**
* Use this to add any additional headers you need.
* @param customHeaders A String to Object <b>Map</b> of header name/value pairs.
* @return ClientBuilder <b>this</b> to accommodate method chaining.
*/
withCustomHeaders(customHeaders: any): this;
/**
* Enables debug mode, which will print information about the HTTP request and response to console.log
* @return ClientBuilder <b>this</b> to accommodate method chaining.
*/
withDebug(): this;
/**
* Allows the caller to specify the subscription license (aka "track") they wish to use.
* @param licenses A String Array of licenses.
* @returns ClientBuilder <b>this</b> to accommodate method chaining.
*/
withLicenses(licenses: any): this;
/**
* Allows the caller to specify key and value pair that is added to the request
* @param {string} key - The query parameter key
* @param {string} value - The query parameter value
* @return ClientBuilder <b>this</b> to accommodate method chaining.
*/
withCustomQuery(key: string, value: string): this;
/**
* Allows the caller to specify key and value pair and appends the value associated with the key, seperated by a comma.
* @param {string} key - The query parameter key
* @param {string} value - The query parameter value
* @return ClientBuilder <b>this</b> to accommodate method chaining.
*/
withCustomCommaSeperatedQuery(key: string, value: string): this;
/**
* Adds to the request query to use the component analysis feature.
* @return ClientBuilder <b>this</b> to accommodate method chaining.
*/
withFeatureComponentAnalysis(): this;
/**
* Adds to the request query to use the financial history feature.
* @return ClientBuilder <b>this</b> to accommodate method chaining.
*/
withFinancialHistory(): this;
/**
* Adds to the request query to use the occupant use feature.
* @return ClientBuilder <b>this</b> to accommodate method chaining.
*/
withOccupantUse(): this;
buildSender(): any;
buildClient(baseUrl: any, Client: any): any;
buildUsStreetApiClient(): any;
buildUsZipcodeClient(): any;
buildInternationalPostalCodeClient(): any;
buildUsAutocompleteProClient(): any;
buildUsExtractClient(): any;
buildInternationalStreetClient(): any;
buildUsReverseGeoClient(): any;
buildInternationalAddressAutocompleteClient(): any;
buildUsEnrichmentClient(): any;
}