zocrmsdkmiblu 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
- # BLUELABEL PROGRAMERS SDK ZOHOCRM
2
-
3
- Please Install
4
-
5
- npm i zocrmsdk
6
-
7
- GET RECORD CRM V4
8
-
9
- await zcrm.initialize({
10
- client_id: "",
11
- client_secret: "",
12
- user_identifier: "",
13
- redirect_url: "",
14
- mysql_username: "",
15
- mysql_password: ""
16
- })
17
-
18
- var response = await zcrm.API.MODULES.get({ module: "", id: "" })
19
-
1
+ # BLUELABEL PROGRAMERS SDK ZOHOCRM
2
+
3
+ Please Install
4
+
5
+ npm i zocrmsdk
6
+
7
+ GET RECORD CRM V4
8
+
9
+ await zcrm.initialize({
10
+ client_id: "",
11
+ client_secret: "",
12
+ user_identifier: "",
13
+ redirect_url: "",
14
+ mysql_username: "",
15
+ mysql_password: ""
16
+ })
17
+
18
+ var response = await zcrm.API.MODULES.get({ module: "", id: "" })
19
+
package/lib/js/OAuth.js CHANGED
@@ -1,65 +1,65 @@
1
-
2
- var config = null;
3
- var qs = require('querystring');
4
- var httpclient = require('request');
5
-
6
- var actionvsurl = {
7
-
8
- generate_token:'/oauth/v2/token'
9
- }
10
-
11
- var mand_configurations = {
12
-
13
- generate_token : ['client_id','client_secret','redirect_uri','code','grant_type'],
14
- refresh_access_token : ['client_id','client_secret','grant_type','refresh_token']
15
- }
16
-
17
-
18
- var OAuth = function (configuration,action) {
19
- if (!configuration) throw new Error('Missing configuration for Zoho OAuth2 service');
20
- assertConfigAttributesAreSet(configuration, mand_configurations[action]);
21
- config = configuration;
22
- };
23
-
24
-
25
- function assertConfigAttributesAreSet(configuration, attributes) {
26
- attributes.forEach(function (attribute) {
27
- if (!configuration[attribute])
28
- throw new Error('Missing configuration for Zoho OAuth service: '+ attribute);
29
- });
30
- }
31
-
32
- OAuth.constructurl=function(action){
33
-
34
- var crmclient = require('./ZCRMRestClient');
35
- var url = "https://"+crmclient.getIAMUrl()+actionvsurl[action]+'?' + qs.stringify(config);
36
- return url;
37
-
38
- }
39
-
40
- OAuth.generateTokens=function(url){
41
- return new Promise(function(resolve,reject){
42
-
43
- httpclient.post(url,{
44
-
45
- },function (err, response) {
46
-
47
- var resultObj = {};
48
-
49
- if(err){
50
-
51
- resolve(err);
52
- }
53
- resolve(response);
54
-
55
- });
56
- })
57
- }
58
-
59
-
60
- module.exports = OAuth;
61
-
62
-
63
-
64
-
65
-
1
+
2
+ var config = null;
3
+ var qs = require('querystring');
4
+ var httpclient = require('request');
5
+
6
+ var actionvsurl = {
7
+
8
+ generate_token:'/oauth/v2/token'
9
+ }
10
+
11
+ var mand_configurations = {
12
+
13
+ generate_token : ['client_id','client_secret','redirect_uri','code','grant_type'],
14
+ refresh_access_token : ['client_id','client_secret','grant_type','refresh_token']
15
+ }
16
+
17
+
18
+ var OAuth = function (configuration,action) {
19
+ if (!configuration) throw new Error('Missing configuration for Zoho OAuth2 service');
20
+ assertConfigAttributesAreSet(configuration, mand_configurations[action]);
21
+ config = configuration;
22
+ };
23
+
24
+
25
+ function assertConfigAttributesAreSet(configuration, attributes) {
26
+ attributes.forEach(function (attribute) {
27
+ if (!configuration[attribute])
28
+ throw new Error('Missing configuration for Zoho OAuth service: '+ attribute);
29
+ });
30
+ }
31
+
32
+ OAuth.constructurl=function(action){
33
+
34
+ var crmclient = require('./ZCRMRestClient');
35
+ var url = "https://"+crmclient.getIAMUrl()+actionvsurl[action]+'?' + qs.stringify(config);
36
+ return url;
37
+
38
+ }
39
+
40
+ OAuth.generateTokens=function(url){
41
+ return new Promise(function(resolve,reject){
42
+
43
+ httpclient.post(url,{
44
+
45
+ },function (err, response) {
46
+
47
+ var resultObj = {};
48
+
49
+ if(err){
50
+
51
+ resolve(err);
52
+ }
53
+ resolve(response);
54
+
55
+ });
56
+ })
57
+ }
58
+
59
+
60
+ module.exports = OAuth;
61
+
62
+
63
+
64
+
65
+
@@ -1,83 +1,91 @@
1
- var util = require('../util');
2
-
3
- var modules = function modules()
4
- {
5
-
6
- return {
7
- get : function(input)
8
- {
9
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}", HTTP_METHODS.GET, false));//No I18N
10
- },
11
- getRelated : function(input)
12
- {
13
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}/"+input.related_module, HTTP_METHODS.GET, false));//No I18N
14
- },
15
- post : function(input)
16
- {
17
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}", HTTP_METHODS.POST, false));//No I18N
18
- },
19
- put : function(input)
20
- {
21
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}", HTTP_METHODS.PUT, false));//No I18N
22
- },
23
- delete : function (input)
24
- {
25
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}", HTTP_METHODS.DELETE, false));//No I18N
26
- },
27
- getAllDeletedRecords : function (input)
28
- {
29
- if (input.params)
30
- {
31
- input.params.type = "all";
32
- }
33
- else
34
- {
35
- input.params = {
36
- "type" : "all"//No I18N
37
- };
38
- }
39
-
40
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/deleted", HTTP_METHODS.GET, false));//No I18N
41
- },
42
- getRecycleBinRecords : function (input)
43
- {
44
- if (input.params)
45
- {
46
- input.type = "recycle";
47
- }
48
- else
49
- {
50
- input.params = {
51
- "type" : "recycle"//No I18N
52
- };
53
- }
54
-
55
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/deleted", HTTP_METHODS.GET, false));//No I18N
56
- },
57
- getPermanentlyDeletedRecords : function (input)
58
- {
59
- if (input.params)
60
- {
61
- input.type = "permanent";
62
- }
63
- else
64
- {
65
- input.params = {
66
- "type" : "permanent"//No I18N
67
- };
68
- }
69
-
70
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/deleted", HTTP_METHODS.GET, false));//No I18N
71
- },
72
- search : function (input)
73
- {
74
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/search", HTTP_METHODS.GET, false));//No I18N
75
- },
76
- coql: function(input) {
77
- input.api_name = 'coql';
78
- return util.promiseResponse(util.constructRequestDetails(input, input.api_name, HTTP_METHODS.POST, false));//No I18N
79
- }
80
- }
81
- }
82
-
1
+ var util = require('../util');
2
+
3
+ var modules = function modules()
4
+ {
5
+
6
+ return {
7
+ get : function(input)
8
+ {
9
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}", HTTP_METHODS.GET, false));//No I18N
10
+ },
11
+ getRelated : function(input)
12
+ {
13
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}/"+input.related_module, HTTP_METHODS.GET, false));//No I18N
14
+ },
15
+ post : function(input)
16
+ {
17
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}", HTTP_METHODS.POST, false));//No I18N
18
+ },
19
+ put : function(input)
20
+ {
21
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}", HTTP_METHODS.PUT, false));//No I18N
22
+ },
23
+ delete : function (input)
24
+ {
25
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}", HTTP_METHODS.DELETE, false));//No I18N
26
+ },
27
+ getAllDeletedRecords : function (input)
28
+ {
29
+ if (input.params)
30
+ {
31
+ input.params.type = "all";
32
+ }
33
+ else
34
+ {
35
+ input.params = {
36
+ "type" : "all"//No I18N
37
+ };
38
+ }
39
+
40
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/deleted", HTTP_METHODS.GET, false));//No I18N
41
+ },
42
+ getRecycleBinRecords : function (input)
43
+ {
44
+ if (input.params)
45
+ {
46
+ input.type = "recycle";
47
+ }
48
+ else
49
+ {
50
+ input.params = {
51
+ "type" : "recycle"//No I18N
52
+ };
53
+ }
54
+
55
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/deleted", HTTP_METHODS.GET, false));//No I18N
56
+ },
57
+ getPermanentlyDeletedRecords : function (input)
58
+ {
59
+ if (input.params)
60
+ {
61
+ input.type = "permanent";
62
+ }
63
+ else
64
+ {
65
+ input.params = {
66
+ "type" : "permanent"//No I18N
67
+ };
68
+ }
69
+
70
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/deleted", HTTP_METHODS.GET, false));//No I18N
71
+ },
72
+ search : function (input)
73
+ {
74
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/search", HTTP_METHODS.GET, false));//No I18N
75
+ },
76
+ coql: function(input) {
77
+ input.api_name = 'coql';
78
+ return util.promiseResponse(util.constructRequestDetails(input, input.api_name, HTTP_METHODS.POST, false));//No I18N
79
+ },
80
+ getAllRecords : function (input)
81
+ {
82
+ return util.promiseResponse(util.constructRequestDetails(input, "settings/users", HTTP_METHODS.GET, true));//No I18N
83
+ },
84
+ updateBulk : function (input)
85
+ {
86
+ return util.promiseResponse(util.constructRequestDetails(input, "settings/users", HTTP_METHODS.PUT, true));//No I18N
87
+ },
88
+ }
89
+ }
90
+
83
91
  module.exports = modules;
@@ -1,31 +1,31 @@
1
- var util = require("../util");
2
-
3
- var actions = function actions()
4
- {
5
- return {
6
- convert : function (input)
7
- {
8
-
9
- return util.promiseResponse(util.constructRequestDetails(input, "Leads/{id}/actions/convert", HTTP_METHODS.POST, false));//No I18N
10
- },
11
- blueprint : function (input)
12
- {
13
-
14
- return util.promiseResponse(util.constructRequestDetails(input, input.module+"/{id}/actions/blueprint", HTTP_METHODS.PUT, false));//No I18N
15
- },
16
- getblueprint : function (input)
17
- {
18
- return util.promiseResponse(util.constructRequestDetails(input, input.module+"/{id}/actions/blueprint", HTTP_METHODS.GET, false));//No I18N
19
- },
20
- sendemail : function (input)
21
- {
22
- return util.promiseResponse(util.constructRequestDetails(input, input.module+"/{id}/actions/send_mail", HTTP_METHODS.POST, false));//No I18N
23
- },
24
- emailAttchDownload : function (input)
25
- {
26
- return util.promiseResponse(util.constructRequestDetails(input, input.module+"/{id}/Emails/actions/download_attachments", HTTP_METHODS.GET, false));//No I18N
27
- },
28
- }
29
- }
30
-
1
+ var util = require("../util");
2
+
3
+ var actions = function actions()
4
+ {
5
+ return {
6
+ convert : function (input)
7
+ {
8
+
9
+ return util.promiseResponse(util.constructRequestDetails(input, "Leads/{id}/actions/convert", HTTP_METHODS.POST, false));//No I18N
10
+ },
11
+ blueprint : function (input)
12
+ {
13
+
14
+ return util.promiseResponse(util.constructRequestDetails(input, input.module+"/{id}/actions/blueprint", HTTP_METHODS.PUT, false));//No I18N
15
+ },
16
+ getblueprint : function (input)
17
+ {
18
+ return util.promiseResponse(util.constructRequestDetails(input, input.module+"/{id}/actions/blueprint", HTTP_METHODS.GET, false));//No I18N
19
+ },
20
+ sendemail : function (input)
21
+ {
22
+ return util.promiseResponse(util.constructRequestDetails(input, input.module+"/{id}/actions/send_mail", HTTP_METHODS.POST, false));//No I18N
23
+ },
24
+ emailAttchDownload : function (input)
25
+ {
26
+ return util.promiseResponse(util.constructRequestDetails(input, input.module+"/{id}/Emails/actions/download_attachments", HTTP_METHODS.GET, false));//No I18N
27
+ },
28
+ }
29
+ }
30
+
31
31
  module.exports = actions;
@@ -1,44 +1,44 @@
1
-
2
- var util = require('../util');
3
- var attachments = function attachments()
4
- {
5
-
6
- return {
7
- uploadFile : function (input)
8
- {
9
- return util.promiseResponse(util.constructRequestDetails(input, input.module+ "/{id}/Attachments", HTTP_METHODS.POST, false));//No I18N
10
- },
11
- deleteFile : function (input)
12
- {
13
- return util.promiseResponse(util.constructRequestDetails(input, input.module+ "/{id}/Attachments/"+input.relatedId, HTTP_METHODS.DELETE, false));//No I18N
14
- },
15
- downloadFile : function (input)
16
- {
17
- input.download_file = true;
18
- return util.promiseResponse(util.constructRequestDetails(input, input.module+ "/{id}/Attachments/"+input.relatedId, HTTP_METHODS.GET, false));//No I18N
19
- },
20
- uploadLink : function (input)
21
- {
22
- return util.promiseResponse(util.constructRequestDetails(input, input.module+ "/{id}/Attachments", HTTP_METHODS.POST, false));//No I18N
23
- },
24
- uploadPhoto : function (input)
25
- {
26
- return util.promiseResponse(util.constructRequestDetails(input, input.module+ "/{id}/photo", HTTP_METHODS.POST, false));//No I18N
27
- },
28
- downloadPhoto : function (input)
29
- {
30
- input.download_file = true;
31
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}/photo", HTTP_METHODS.GET, false));//No I18N
32
- },
33
- deletePhoto : function (input)
34
- {
35
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}/photo", HTTP_METHODS.DELETE, false));//No I18N
36
- },
37
- getAllAttachments : function (input)
38
- {
39
- return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}/attachments", HTTP_METHODS.GET, false));//No I18N
40
- }
41
- }
42
- }
43
-
1
+
2
+ var util = require('../util');
3
+ var attachments = function attachments()
4
+ {
5
+
6
+ return {
7
+ uploadFile : function (input)
8
+ {
9
+ return util.promiseResponse(util.constructRequestDetails(input, input.module+ "/{id}/Attachments", HTTP_METHODS.POST, false));//No I18N
10
+ },
11
+ deleteFile : function (input)
12
+ {
13
+ return util.promiseResponse(util.constructRequestDetails(input, input.module+ "/{id}/Attachments/"+input.relatedId, HTTP_METHODS.DELETE, false));//No I18N
14
+ },
15
+ downloadFile : function (input)
16
+ {
17
+ input.download_file = true;
18
+ return util.promiseResponse(util.constructRequestDetails(input, input.module+ "/{id}/Attachments/"+input.relatedId, HTTP_METHODS.GET, false));//No I18N
19
+ },
20
+ uploadLink : function (input)
21
+ {
22
+ return util.promiseResponse(util.constructRequestDetails(input, input.module+ "/{id}/Attachments", HTTP_METHODS.POST, false));//No I18N
23
+ },
24
+ uploadPhoto : function (input)
25
+ {
26
+ return util.promiseResponse(util.constructRequestDetails(input, input.module+ "/{id}/photo", HTTP_METHODS.POST, false));//No I18N
27
+ },
28
+ downloadPhoto : function (input)
29
+ {
30
+ input.download_file = true;
31
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}/photo", HTTP_METHODS.GET, false));//No I18N
32
+ },
33
+ deletePhoto : function (input)
34
+ {
35
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}/photo", HTTP_METHODS.DELETE, false));//No I18N
36
+ },
37
+ getAllAttachments : function (input)
38
+ {
39
+ return util.promiseResponse(util.constructRequestDetails(input, input.module + "/{id}/attachments", HTTP_METHODS.GET, false));//No I18N
40
+ }
41
+ }
42
+ }
43
+
44
44
  module.exports = attachments;
@@ -1,22 +1,22 @@
1
- var util = require('../util');
2
- var url = "functions/{api_name}/actions/execute";
3
-
4
- var functions = function functions(){
5
-
6
- return{
7
-
8
- executeFunctionsInGet :function(input){
9
-
10
-
11
- return util.promiseResponse(util.constructRequestDetails(input, url , HTTP_METHODS.GET, true));//No I18N
12
- },
13
-
14
- executeFunctionsInPost :function(input){
15
-
16
- return util.promiseResponse(util.constructRequestDetails(input, url , HTTP_METHODS.POST, true));//No I18N
17
- }
18
- }
19
-
20
- }
21
-
22
- module.exports = functions;
1
+ var util = require('../util');
2
+ var url = "functions/{api_name}/actions/execute";
3
+
4
+ var functions = function functions(){
5
+
6
+ return{
7
+
8
+ executeFunctionsInGet :function(input){
9
+
10
+
11
+ return util.promiseResponse(util.constructRequestDetails(input, url , HTTP_METHODS.GET, true));//No I18N
12
+ },
13
+
14
+ executeFunctionsInPost :function(input){
15
+
16
+ return util.promiseResponse(util.constructRequestDetails(input, url , HTTP_METHODS.POST, true));//No I18N
17
+ }
18
+ }
19
+
20
+ }
21
+
22
+ module.exports = functions;
@@ -1,18 +1,18 @@
1
-
2
- var util = require('../util');
3
-
4
- var org = function org()
5
- {
6
- return {
7
- get : function (input)
8
- {
9
- return util.promiseResponse(util.constructRequestDetails(input, "org", HTTP_METHODS.GET, true));//No I18N
10
- },
11
- authoken:function(isInvalid=false)
12
- {
13
- return util.getAuthToken(isInvalid)
14
- }
15
- }
16
- }
17
-
1
+
2
+ var util = require('../util');
3
+
4
+ var org = function org()
5
+ {
6
+ return {
7
+ get : function (input)
8
+ {
9
+ return util.promiseResponse(util.constructRequestDetails(input, "org", HTTP_METHODS.GET, true));//No I18N
10
+ },
11
+ authoken:function(isInvalid=false)
12
+ {
13
+ return util.getAuthToken(isInvalid)
14
+ }
15
+ }
16
+ }
17
+
18
18
  module.exports = org;