Initializes library.
Arguments:
config.key
required (string): Merchant API key.
config.user
optional (user): User object. Could be provided either at initialization or at request.
config.method
optional ('jsonp' || 'post'): Request method. Default 'jsonp'.
config.log
optional (boolean): Defines, should Findify log requests on server.
Types:
user.uid
required (string): Unique customer id.
user.sid
required (string): Session id.
user.email
optional (string): Customer email.
user.ip
optional (number): Customer ip.
user.ua
optional (string): Customer user agent.
user.lang
optional (string[]): Languages.
Returns:
Client instance, which could be used further for sending requests to the server.
Examples of usage:
var client = FindifySDK.init({
key: 'b9h348b89h439g43',
user: {
uid: 'f892hf2938f2g9p2',
sid: 'g2984hg2jg9823g9',
}
});
// After, you can send requests to server:
client.autocomplete(request).then(function (response) {
// handle autocomplete response
});