1 | var winston = require('./winston');
|
2 |
|
3 | function Chat21(config){
|
4 | if (config.email && config.password) {
|
5 | config.authorization = 'Basic ' + new Buffer(config.email + ':' + config.password).toString('base64');
|
6 | winston.info("Chat21-node-sdk config.authorization: "+ config.authorization);
|
7 | }
|
8 |
|
9 |
|
10 | if (config.oauth) {
|
11 | config.authorization = 'Bearer ' + config.token;
|
12 | winston.info("Chat21-node-sdk config.authorization: "+ config.authorization);
|
13 | }
|
14 |
|
15 | return {
|
16 | messages: require('./messages.js')(config, 'message', 'messages'),
|
17 | conversations: require('./conversations.js')(config, 'conversation', 'conversations'),
|
18 | groups: require('./groups.js')(config, 'group', 'groups'),
|
19 | contacts: require('./contacts.js')(config, 'contact', 'contacts'),
|
20 | auth: require('./auth.js')(config),
|
21 | firebaseAuth: require('./firebaseAuth.js')(config)
|
22 | };
|
23 | }
|
24 |
|
25 | module.exports = Chat21 |
\ | No newline at end of file |