2016-06-22 01:39:04 +02:00
|
|
|
'use strict'
|
|
|
|
|
2017-11-12 14:52:04 +01:00
|
|
|
const defaultProfile = require('./lib/default-profile')
|
2017-11-11 22:49:04 +01:00
|
|
|
const request = require('./lib/request')
|
2016-06-22 02:09:02 +02:00
|
|
|
|
2017-11-11 22:49:04 +01:00
|
|
|
const createClient = (profile) => {
|
|
|
|
profile = Object.assign({}, defaultProfile, profile)
|
2017-11-12 01:23:34 +01:00
|
|
|
if ('string' !== typeof profile.timezone) {
|
|
|
|
throw new Error('profile.timezone must be a string.')
|
2016-06-22 01:39:59 +02:00
|
|
|
}
|
2017-10-03 17:36:42 +02:00
|
|
|
|
2017-11-11 22:49:04 +01:00
|
|
|
const client = data => request(profile, data)
|
|
|
|
return client
|
2016-06-22 01:39:59 +02:00
|
|
|
}
|
|
|
|
|
2017-11-12 14:52:04 +01:00
|
|
|
module.exports = createClient
|