@sonoransoftware/sonoran.js 1.0.19 → 1.0.22

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.
Files changed (89) hide show
  1. package/.eslintrc.js +10 -10
  2. package/.github/workflows/npm-publish.yml +34 -34
  3. package/.prettierrc.js +6 -6
  4. package/dist/builders/cad/DispatchCall.d.ts +92 -92
  5. package/dist/builders/cad/DispatchCall.js +144 -144
  6. package/dist/builders/cad/index.d.ts +1 -1
  7. package/dist/builders/cad/index.js +17 -17
  8. package/dist/builders/index.d.ts +1 -1
  9. package/dist/builders/index.js +19 -19
  10. package/dist/constants.d.ts +230 -230
  11. package/dist/constants.js +27 -27
  12. package/dist/errors/LibraryErrors.d.ts +19 -19
  13. package/dist/errors/LibraryErrors.js +47 -47
  14. package/dist/errors/Messages.d.ts +1 -1
  15. package/dist/errors/Messages.js +8 -8
  16. package/dist/errors/index.d.ts +2 -2
  17. package/dist/errors/index.js +18 -18
  18. package/dist/index.d.ts +4 -4
  19. package/dist/index.js +24 -24
  20. package/dist/instance/Instance.d.ts +24 -24
  21. package/dist/instance/Instance.js +139 -139
  22. package/dist/instance/instance.types.d.ts +17 -17
  23. package/dist/instance/instance.types.js +2 -2
  24. package/dist/libs/rest/src/index.d.ts +6 -6
  25. package/dist/libs/rest/src/index.js +22 -22
  26. package/dist/libs/rest/src/lib/REST.d.ts +101 -101
  27. package/dist/libs/rest/src/lib/REST.js +136 -129
  28. package/dist/libs/rest/src/lib/RequestManager.d.ts +59 -59
  29. package/dist/libs/rest/src/lib/RequestManager.js +191 -191
  30. package/dist/libs/rest/src/lib/errors/APIError.d.ts +9 -9
  31. package/dist/libs/rest/src/lib/errors/APIError.js +17 -17
  32. package/dist/libs/rest/src/lib/errors/HTTPError.d.ts +17 -17
  33. package/dist/libs/rest/src/lib/errors/HTTPError.js +23 -23
  34. package/dist/libs/rest/src/lib/errors/RateLimitError.d.ts +13 -13
  35. package/dist/libs/rest/src/lib/errors/RateLimitError.js +19 -19
  36. package/dist/libs/rest/src/lib/errors/index.d.ts +4 -4
  37. package/dist/libs/rest/src/lib/errors/index.js +20 -20
  38. package/dist/libs/rest/src/lib/handlers/IHandler.d.ts +7 -7
  39. package/dist/libs/rest/src/lib/handlers/IHandler.js +2 -2
  40. package/dist/libs/rest/src/lib/handlers/SequentialHandler.d.ts +45 -45
  41. package/dist/libs/rest/src/lib/handlers/SequentialHandler.js +143 -143
  42. package/dist/libs/rest/src/lib/utils/constants.d.ts +533 -527
  43. package/dist/libs/rest/src/lib/utils/constants.js +463 -455
  44. package/dist/libs/rest/src/lib/utils/utils.d.ts +1 -1
  45. package/dist/libs/rest/src/lib/utils/utils.js +22 -22
  46. package/dist/managers/BaseManager.d.ts +14 -14
  47. package/dist/managers/BaseManager.js +18 -18
  48. package/dist/managers/CADActiveUnitsManager.d.ts +15 -15
  49. package/dist/managers/CADActiveUnitsManager.js +38 -38
  50. package/dist/managers/CADManager.d.ts +29 -29
  51. package/dist/managers/CADManager.js +86 -86
  52. package/dist/managers/CADServerManager.d.ts +8 -8
  53. package/dist/managers/CADServerManager.js +28 -28
  54. package/dist/managers/CMSManager.d.ts +101 -101
  55. package/dist/managers/CMSManager.js +266 -266
  56. package/dist/managers/CMSServerManager.d.ts +8 -8
  57. package/dist/managers/CMSServerManager.js +34 -34
  58. package/dist/managers/CacheManager.d.ts +10 -10
  59. package/dist/managers/CacheManager.js +36 -36
  60. package/dist/managers/DataManager.d.ts +31 -31
  61. package/dist/managers/DataManager.js +58 -58
  62. package/dist/structures/Base.d.ts +9 -9
  63. package/dist/structures/Base.js +24 -24
  64. package/dist/structures/CADActiveUnit.d.ts +47 -47
  65. package/dist/structures/CADActiveUnit.js +66 -66
  66. package/dist/structures/CADServer.d.ts +26 -26
  67. package/dist/structures/CADServer.js +15 -15
  68. package/dist/structures/CMSServer.d.ts +18 -18
  69. package/dist/structures/CMSServer.js +12 -12
  70. package/dist/utils/index.d.ts +1 -1
  71. package/dist/utils/index.js +17 -17
  72. package/dist/utils/utils.d.ts +13 -13
  73. package/dist/utils/utils.js +79 -79
  74. package/docs/CAD-Methods-and-Usage.md +58 -58
  75. package/docs/CMS-Methods-and-Usage.md +211 -211
  76. package/docs/REST-Methods-and-Usage.md +46 -46
  77. package/package.json +48 -48
  78. package/readme.md +53 -53
  79. package/src/constants.ts +248 -248
  80. package/src/instance/Instance.ts +121 -121
  81. package/src/instance/instance.types.ts +17 -17
  82. package/src/libs/rest/src/lib/REST.ts +241 -234
  83. package/src/libs/rest/src/lib/RequestManager.ts +260 -260
  84. package/src/libs/rest/src/lib/handlers/SequentialHandler.ts +160 -160
  85. package/src/libs/rest/src/lib/utils/constants.ts +1012 -997
  86. package/src/managers/CADManager.ts +63 -63
  87. package/src/managers/CMSManager.ts +226 -226
  88. package/src/managers/CMSServerManager.ts +32 -32
  89. package/tsconfig.json +71 -71
@@ -1,212 +1,212 @@
1
- # Sonoran CMS Specific Methods & Usage
2
- The following methods can be accessed from the `cms` property of an instance.
3
-
4
- ## Basic General Usage
5
- ```js
6
- const Sonoran = require('sonoran.js');
7
- const instance = Sonoran.instance({
8
- communityId: 'mycommunity',
9
- apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
10
- product: Sonoran.productEnums.CMS
11
- });
12
-
13
-
14
- const whitelist = await instance.cms.verifyWhitelist('459798465498798432');
15
- ```
16
-
17
- ## verifyWhitelist(whitelistOptions)
18
- | Parameter | Optional | Type | Note |
19
- |----------|:-------------:|------:|-----:|
20
- | whitelistOptions | Yes | String | May just be a string if you'd like to not specify any additional options such as serverId to which will default to the 1 as default or whatever was instanciated with the instance. |
21
- | whitelistOptions.apiId | Yes | String | Must have at least apiId or accId |
22
- | whitelistOptions.accId | Yes | String | Must have at least apiId or accId |
23
- | whitelistOptions.serverId | Yes | Number | Checks whitelist of specific server Id instead of default or set server ID at instance initialization.. |
24
-
25
- Returns *whitelistResult*;
26
- | Property | Optional | Type | Note |
27
- |----------|:-------------:|------:|-----:|
28
- | whitelistResult.success | No | Boolean | Wether the whitelist verification was successful |
29
- | whitelistResult.reason | Yes | String | Username if success is truthy, fail reason if success is falsy |
30
-
31
- ### Example Code
32
- ```js
33
- const Sonoran = require('sonoran.js');
34
- const instance = Sonoran.instance({
35
- communityId: 'mycommunity',
36
- apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
37
- product: Sonoran.productEnums.CMS,
38
- serverId: 2
39
- });
40
-
41
- // This will verify the whitelist of the given API ID or account ID for server id 2 as specified above
42
- const verification = await instance.cms.verifyWhitelist('459798465498798432');
43
- // This will verify the whitelist of the given API ID for server id 1 since I specified that
44
- const verification = await instance.cms.verifyWhitelist({
45
- apiId: '459798465498798432',
46
- serverId: 1
47
- });
48
- // OR
49
- // This will verify the whitelist of the given account ID for server id 1 since I specified that
50
- const verification = await instance.cms.verifyWhitelist({
51
- accId: 'd5663516-ee35-11e9-9714-5600023b2434',
52
- serverId: 1
53
- });
54
-
55
- if (verification.success) {
56
- console.log('Success!', verification.reason);
57
- } else {
58
- console.log('Unsuccessful', verfication.reason); // Log the reason it was unsuccessful.
59
- }
60
- ```
61
-
62
- ## getComAccount(params)
63
- | Parameter | Optional | Type | Note |
64
- |----------|:-------------:|------:|-----:|
65
- | params.accId | Yes | String | Must have at least apiId, username or accId |
66
- | params.username | Yes | String | Must have at least apiId, username or accId |
67
- | params.apiId | Yes | String | Must have at least apiId, username or accId |
68
-
69
- Returns *accountResult*;
70
- | Property | Optional | Type | Note |
71
- |----------|:-------------:|------:|-----:|
72
- | accountResult.success | No | Boolean | Wether the whitelist verification was successful |
73
- | accountResult.account | Yes | Object | Object of the account data |
74
- | accountResult.reason | Yes | String | Fail reason if success is falsy |
75
-
76
- ### Example Account Data Object
77
- ```js
78
- {
79
- accId: '67ceebae-ee63-43c1-a6a6-5234b2210abf',
80
- active: true,
81
- username: 'Dawson G.',
82
- comName: 'Dawson G.',
83
- primaryIdentifier: '1A-1',
84
- secondaryIdentifiers: [],
85
- primaryRank: 'fc2c3825-df41-4485-ad9a-6c2ac900b4f4', // Rank UUID
86
- secondaryRanks: [
87
- '331d4ece-b582-4c9c-885b-7060341cf482' // Rank UUID
88
- ],
89
- primaryDepartment: '00116ef0-9d22-491e-964c-1eb1b6ffd167', // Department UUID
90
- secondaryDepartments: [
91
- '7dbedb0e-4df2-4405-b241-cb5dee253ab8' // Department UUID
92
- ],
93
- joinDate: '2022-02-22 20:28:40.000 -0800',
94
- totalRankPower: 100,
95
- comOwner: true,
96
- isBanned: false,
97
- lastLogin: '2022-02-22 22:43:46.000 -0800',
98
- activeApiIds: [
99
- '235947056630333440'
100
- ]
101
- }
102
-
103
- ```
104
-
105
- ### Example Code
106
- ```js
107
- const Sonoran = require('sonoran.js');
108
- const instance = Sonoran.instance({
109
- communityId: 'mycommunity',
110
- apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
111
- product: Sonoran.productEnums.CMS
112
- });
113
-
114
- // This will get the community account with the given API ID if there's one found
115
- const comAccount = await instance.cms.getComAccount({
116
- apiId: '235947056630333440'
117
- });
118
- // OR
119
- // This will get the community account with the given username if there's one found
120
- const comAccount = await instance.cms.getComAccount({
121
- username: 'Dawson G.'
122
- });
123
- // OR
124
- // This will get the community account with the given account ID if there's one found
125
- const comAccount = await instance.cms.getComAccount({
126
- accId: '67ceebae-ee63-43c1-a6a6-5234b2210abf'
127
- });
128
-
129
- if (comAccount.success) {
130
- console.log('Success! Account data:', comAccount.data);
131
- } else {
132
- console.log('Unsuccessful', comAccount.reason);
133
- }
134
- ```
135
-
136
- ## clockInOut(data)
137
- | Parameter | Optional | Type | Note |
138
- |----------|:-------------:|------:|-----:|
139
- | data.apiId | Yes | String | Must have at least apiId or accId |
140
- | data.accId | Yes | String | Must have at least apiId or accId |
141
- | data.forceClockIn | Yes | Boolean | Will start a new clock in and overrite any current clock in |
142
-
143
- Returns *clockResult*;
144
- | Property | Optional | Type | Note |
145
- |----------|:-------------:|------:|-----:|
146
- | clockResult.success | No | Boolean | Wether the whitelist verification was successful |
147
- | clockResult.clockedIn | Yes | Boolean | Wether the account was clocked in or out if success is truthy |
148
- | clockResult.reason | Yes | String | Fail reason if success is falsy |
149
-
150
- ### Example Code
151
- ```js
152
- const Sonoran = require('sonoran.js');
153
- const instance = Sonoran.instance({
154
- communityId: 'mycommunity',
155
- apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
156
- product: Sonoran.productEnums.CMS
157
- });
158
-
159
- // This will override any current clock in and will start a new one on the community account found by the specified API ID if found
160
- const clockResult = await instance.cms.clockInOut({
161
- apiId: '235947056630333440',
162
- forceClockIn: true
163
- });
164
- // OR
165
- // This will either clock in or out the community account found by the specified API ID if found.
166
- // Will determine to clock in or out depending on what is pending.
167
- const clockResult = await instance.cms.clockInOut({
168
- apiId: '235947056630333440'
169
- });
170
- // OR
171
- // This will either clock in or out the community account found by the specified accId if found.
172
- // Will determine to clock in or out depending on what is pending.
173
- const clockResult = await instance.cms.clockInOut({
174
- accId: '67ceebae-ee63-43c1-a6a6-5234b2210abf'
175
- });
176
-
177
- if (clockResult.success) {
178
- console.log(`Success! Clocked in? ${clockResult.clockedIn ? 'Yes!' : 'No!'}`);
179
- } else {
180
- console.log('Unsuccessful', comAccount.reason);
181
- }
182
- ```
183
-
184
- ## checkComApiId(apiId)
185
- | Parameter | Optional | Type |
186
- |----------|:-------------:|------:|
187
- | apiId | Yes | String |
188
-
189
- Returns *checkResult*;
190
- | Property | Optional | Type | Note |
191
- |----------|:-------------:|------:|-----:|
192
- | checkResult.success | No | Boolean | Wether the whitelist verification was successful |
193
- | checkResult.username | Yes | String | Username for the account found with the API ID given |
194
- | checkResult.reason | Yes | String | Fail reason if success is falsy |
195
-
196
- ### Example Code
197
- ```js
198
- const Sonoran = require('sonoran.js');
199
- const instance = Sonoran.instance({
200
- communityId: 'mycommunity',
201
- apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
202
- product: Sonoran.productEnums.CMS
203
- });
204
-
205
- const checkResult = await instance.cms.checkComApiId('235947056630333440');
206
-
207
- if (checkResult.success) {
208
- console.log(`Success! Account found: ${checkResult.username}`);
209
- } else {
210
- console.log('Unsuccessful', checkResult.reason);
211
- }
1
+ # Sonoran CMS Specific Methods & Usage
2
+ The following methods can be accessed from the `cms` property of an instance.
3
+
4
+ ## Basic General Usage
5
+ ```js
6
+ const Sonoran = require('sonoran.js');
7
+ const instance = Sonoran.instance({
8
+ communityId: 'mycommunity',
9
+ apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
10
+ product: Sonoran.productEnums.CMS
11
+ });
12
+
13
+
14
+ const whitelist = await instance.cms.verifyWhitelist('459798465498798432');
15
+ ```
16
+
17
+ ## verifyWhitelist(whitelistOptions)
18
+ | Parameter | Optional | Type | Note |
19
+ |----------|:-------------:|------:|-----:|
20
+ | whitelistOptions | Yes | String | May just be a string if you'd like to not specify any additional options such as serverId to which will default to the 1 as default or whatever was instanciated with the instance. |
21
+ | whitelistOptions.apiId | Yes | String | Must have at least apiId or accId |
22
+ | whitelistOptions.accId | Yes | String | Must have at least apiId or accId |
23
+ | whitelistOptions.serverId | Yes | Number | Checks whitelist of specific server Id instead of default or set server ID at instance initialization.. |
24
+
25
+ Returns *whitelistResult*;
26
+ | Property | Optional | Type | Note |
27
+ |----------|:-------------:|------:|-----:|
28
+ | whitelistResult.success | No | Boolean | Wether the whitelist verification was successful |
29
+ | whitelistResult.reason | Yes | String | Username if success is truthy, fail reason if success is falsy |
30
+
31
+ ### Example Code
32
+ ```js
33
+ const Sonoran = require('sonoran.js');
34
+ const instance = Sonoran.instance({
35
+ communityId: 'mycommunity',
36
+ apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
37
+ product: Sonoran.productEnums.CMS,
38
+ serverId: 2
39
+ });
40
+
41
+ // This will verify the whitelist of the given API ID or account ID for server id 2 as specified above
42
+ const verification = await instance.cms.verifyWhitelist('459798465498798432');
43
+ // This will verify the whitelist of the given API ID for server id 1 since I specified that
44
+ const verification = await instance.cms.verifyWhitelist({
45
+ apiId: '459798465498798432',
46
+ serverId: 1
47
+ });
48
+ // OR
49
+ // This will verify the whitelist of the given account ID for server id 1 since I specified that
50
+ const verification = await instance.cms.verifyWhitelist({
51
+ accId: 'd5663516-ee35-11e9-9714-5600023b2434',
52
+ serverId: 1
53
+ });
54
+
55
+ if (verification.success) {
56
+ console.log('Success!', verification.reason);
57
+ } else {
58
+ console.log('Unsuccessful', verfication.reason); // Log the reason it was unsuccessful.
59
+ }
60
+ ```
61
+
62
+ ## getComAccount(params)
63
+ | Parameter | Optional | Type | Note |
64
+ |----------|:-------------:|------:|-----:|
65
+ | params.accId | Yes | String | Must have at least apiId, username or accId |
66
+ | params.username | Yes | String | Must have at least apiId, username or accId |
67
+ | params.apiId | Yes | String | Must have at least apiId, username or accId |
68
+
69
+ Returns *accountResult*;
70
+ | Property | Optional | Type | Note |
71
+ |----------|:-------------:|------:|-----:|
72
+ | accountResult.success | No | Boolean | Wether the whitelist verification was successful |
73
+ | accountResult.account | Yes | Object | Object of the account data |
74
+ | accountResult.reason | Yes | String | Fail reason if success is falsy |
75
+
76
+ ### Example Account Data Object
77
+ ```js
78
+ {
79
+ accId: '67ceebae-ee63-43c1-a6a6-5234b2210abf',
80
+ active: true,
81
+ username: 'Dawson G.',
82
+ comName: 'Dawson G.',
83
+ primaryIdentifier: '1A-1',
84
+ secondaryIdentifiers: [],
85
+ primaryRank: 'fc2c3825-df41-4485-ad9a-6c2ac900b4f4', // Rank UUID
86
+ secondaryRanks: [
87
+ '331d4ece-b582-4c9c-885b-7060341cf482' // Rank UUID
88
+ ],
89
+ primaryDepartment: '00116ef0-9d22-491e-964c-1eb1b6ffd167', // Department UUID
90
+ secondaryDepartments: [
91
+ '7dbedb0e-4df2-4405-b241-cb5dee253ab8' // Department UUID
92
+ ],
93
+ joinDate: '2022-02-22 20:28:40.000 -0800',
94
+ totalRankPower: 100,
95
+ comOwner: true,
96
+ isBanned: false,
97
+ lastLogin: '2022-02-22 22:43:46.000 -0800',
98
+ activeApiIds: [
99
+ '235947056630333440'
100
+ ]
101
+ }
102
+
103
+ ```
104
+
105
+ ### Example Code
106
+ ```js
107
+ const Sonoran = require('sonoran.js');
108
+ const instance = Sonoran.instance({
109
+ communityId: 'mycommunity',
110
+ apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
111
+ product: Sonoran.productEnums.CMS
112
+ });
113
+
114
+ // This will get the community account with the given API ID if there's one found
115
+ const comAccount = await instance.cms.getComAccount({
116
+ apiId: '235947056630333440'
117
+ });
118
+ // OR
119
+ // This will get the community account with the given username if there's one found
120
+ const comAccount = await instance.cms.getComAccount({
121
+ username: 'Dawson G.'
122
+ });
123
+ // OR
124
+ // This will get the community account with the given account ID if there's one found
125
+ const comAccount = await instance.cms.getComAccount({
126
+ accId: '67ceebae-ee63-43c1-a6a6-5234b2210abf'
127
+ });
128
+
129
+ if (comAccount.success) {
130
+ console.log('Success! Account data:', comAccount.data);
131
+ } else {
132
+ console.log('Unsuccessful', comAccount.reason);
133
+ }
134
+ ```
135
+
136
+ ## clockInOut(data)
137
+ | Parameter | Optional | Type | Note |
138
+ |----------|:-------------:|------:|-----:|
139
+ | data.apiId | Yes | String | Must have at least apiId or accId |
140
+ | data.accId | Yes | String | Must have at least apiId or accId |
141
+ | data.forceClockIn | Yes | Boolean | Will start a new clock in and overrite any current clock in |
142
+
143
+ Returns *clockResult*;
144
+ | Property | Optional | Type | Note |
145
+ |----------|:-------------:|------:|-----:|
146
+ | clockResult.success | No | Boolean | Wether the whitelist verification was successful |
147
+ | clockResult.clockedIn | Yes | Boolean | Wether the account was clocked in or out if success is truthy |
148
+ | clockResult.reason | Yes | String | Fail reason if success is falsy |
149
+
150
+ ### Example Code
151
+ ```js
152
+ const Sonoran = require('sonoran.js');
153
+ const instance = Sonoran.instance({
154
+ communityId: 'mycommunity',
155
+ apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
156
+ product: Sonoran.productEnums.CMS
157
+ });
158
+
159
+ // This will override any current clock in and will start a new one on the community account found by the specified API ID if found
160
+ const clockResult = await instance.cms.clockInOut({
161
+ apiId: '235947056630333440',
162
+ forceClockIn: true
163
+ });
164
+ // OR
165
+ // This will either clock in or out the community account found by the specified API ID if found.
166
+ // Will determine to clock in or out depending on what is pending.
167
+ const clockResult = await instance.cms.clockInOut({
168
+ apiId: '235947056630333440'
169
+ });
170
+ // OR
171
+ // This will either clock in or out the community account found by the specified accId if found.
172
+ // Will determine to clock in or out depending on what is pending.
173
+ const clockResult = await instance.cms.clockInOut({
174
+ accId: '67ceebae-ee63-43c1-a6a6-5234b2210abf'
175
+ });
176
+
177
+ if (clockResult.success) {
178
+ console.log(`Success! Clocked in? ${clockResult.clockedIn ? 'Yes!' : 'No!'}`);
179
+ } else {
180
+ console.log('Unsuccessful', comAccount.reason);
181
+ }
182
+ ```
183
+
184
+ ## checkComApiId(apiId)
185
+ | Parameter | Optional | Type |
186
+ |----------|:-------------:|------:|
187
+ | apiId | Yes | String |
188
+
189
+ Returns *checkResult*;
190
+ | Property | Optional | Type | Note |
191
+ |----------|:-------------:|------:|-----:|
192
+ | checkResult.success | No | Boolean | Wether the whitelist verification was successful |
193
+ | checkResult.username | Yes | String | Username for the account found with the API ID given |
194
+ | checkResult.reason | Yes | String | Fail reason if success is falsy |
195
+
196
+ ### Example Code
197
+ ```js
198
+ const Sonoran = require('sonoran.js');
199
+ const instance = Sonoran.instance({
200
+ communityId: 'mycommunity',
201
+ apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
202
+ product: Sonoran.productEnums.CMS
203
+ });
204
+
205
+ const checkResult = await instance.cms.checkComApiId('235947056630333440');
206
+
207
+ if (checkResult.success) {
208
+ console.log(`Success! Account found: ${checkResult.username}`);
209
+ } else {
210
+ console.log('Unsuccessful', checkResult.reason);
211
+ }
212
212
  ```
@@ -1,47 +1,47 @@
1
- # REST Methods & Usage
2
- The following methods can be accessed from the `rest` property of an CAD Manager & CMS Manager.
3
-
4
- ## Basic General Usage
5
- ```js
6
- const Sonoran = require('sonoran.js');
7
- const instance = Sonoran.instance({
8
- communityId: 'mycommunity',
9
- apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
10
- product: Sonoran.productEnums.CMS
11
- });
12
-
13
- try {
14
- const subVersion = await instance.cms.rest.request('GET_SUB_VERSION');
15
- console.log(`Community version is: ${subVersion}`);
16
- } catch (err) {
17
- console.log(err);
18
- }
19
- ```
20
-
21
- ## request(type, [...args])
22
- | Parameter | Optional | Type | Note |
23
- |----------|:-------------:|------:|-----:|
24
- | type | No | String | Must be a valid Sonoran API type (AllAPITypesType) |
25
- | ...args | Yes | Any | Arguments based on the type given to construct a proper API request |
26
-
27
- returns *requestResult*;
28
- | Parameter | Optional | Type | Note |
29
- |----------|:-------------:|------:|-----:|
30
- | requestResult | No | Any | Response body from given API request |
31
-
32
- ### Example Code
33
- ```js
34
- const Sonoran = require('sonoran.js');
35
- const instance = Sonoran.instance({
36
- communityId: 'mycommunity',
37
- apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
38
- product: Sonoran.productEnums.CMS
39
- });
40
-
41
- try {
42
- const responseData = await instance.cms.rest.request('VERIFY_WHITELIST', '235947056630333440', undefined, instance.defaultServerId);
43
- console.log(responseData);
44
- } catch (err) {
45
- console.log(err);
46
- }
1
+ # REST Methods & Usage
2
+ The following methods can be accessed from the `rest` property of an CAD Manager & CMS Manager.
3
+
4
+ ## Basic General Usage
5
+ ```js
6
+ const Sonoran = require('sonoran.js');
7
+ const instance = Sonoran.instance({
8
+ communityId: 'mycommunity',
9
+ apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
10
+ product: Sonoran.productEnums.CMS
11
+ });
12
+
13
+ try {
14
+ const subVersion = await instance.cms.rest.request('GET_SUB_VERSION');
15
+ console.log(`Community version is: ${subVersion}`);
16
+ } catch (err) {
17
+ console.log(err);
18
+ }
19
+ ```
20
+
21
+ ## request(type, [...args])
22
+ | Parameter | Optional | Type | Note |
23
+ |----------|:-------------:|------:|-----:|
24
+ | type | No | String | Must be a valid Sonoran API type (AllAPITypesType) |
25
+ | ...args | Yes | Any | Arguments based on the type given to construct a proper API request |
26
+
27
+ returns *requestResult*;
28
+ | Parameter | Optional | Type | Note |
29
+ |----------|:-------------:|------:|-----:|
30
+ | requestResult | No | Any | Response body from given API request |
31
+
32
+ ### Example Code
33
+ ```js
34
+ const Sonoran = require('sonoran.js');
35
+ const instance = Sonoran.instance({
36
+ communityId: 'mycommunity',
37
+ apiKey: 'e6ba9d68-ca7a-4e59-a9e2-93e275b4e0bf',
38
+ product: Sonoran.productEnums.CMS
39
+ });
40
+
41
+ try {
42
+ const responseData = await instance.cms.rest.request('VERIFY_WHITELIST', '235947056630333440', undefined, instance.defaultServerId);
43
+ console.log(responseData);
44
+ } catch (err) {
45
+ console.log(err);
46
+ }
47
47
  ```
package/package.json CHANGED
@@ -1,48 +1,48 @@
1
- {
2
- "name": "@sonoransoftware/sonoran.js",
3
- "version": "1.0.19",
4
- "description": "Sonoran.js is a library that allows you to interact with the Sonoran CAD and Sonoran CMS API. Based off of and utilizes several Discord.js library techniques for ease of use.",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1",
9
- "start": "ts-node src/index.ts",
10
- "build": "rimraf ./dist && tsc"
11
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "https://github.com/Sonoran-Software/Sonoran.js.git"
15
- },
16
- "keywords": [],
17
- "author": "",
18
- "license": "ISC",
19
- "devDependencies": {
20
- "@types/node": "^17.0.21",
21
- "@types/node-fetch": "^2.6.2",
22
- "eslint": "^8.10.0",
23
- "eslint-config-prettier": "^8.5.0",
24
- "eslint-plugin-import": "^2.25.4",
25
- "eslint-plugin-prettier": "^4.0.0",
26
- "prettier": "^2.5.1",
27
- "rimraf": "^3.0.2",
28
- "ts-loader": "^9.2.7",
29
- "ts-node": "^10.7.0",
30
- "tslint": "^6.1.3",
31
- "typescript": "^4.6.2"
32
- },
33
- "engines": {
34
- "node": ">=16.9.0"
35
- },
36
- "nodemonConfig": {
37
- "ext": "*.ts, *.json"
38
- },
39
- "dependencies": {
40
- "@discordjs/collection": "^1.5.0",
41
- "@sapphire/async-queue": "^1.5.0",
42
- "@sapphire/snowflake": "^3.2.0",
43
- "events": "^3.3.0",
44
- "node-abort-controller": "^3.0.1",
45
- "node-fetch": "^2.6.5"
46
- },
47
- "prepublish": "npm run build"
48
- }
1
+ {
2
+ "name": "@sonoransoftware/sonoran.js",
3
+ "version": "1.0.22",
4
+ "description": "Sonoran.js is a library that allows you to interact with the Sonoran CAD and Sonoran CMS API. Based off of and utilizes several Discord.js library techniques for ease of use.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "start": "ts-node src/index.ts",
10
+ "build": "rimraf ./dist && tsc"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/Sonoran-Software/Sonoran.js.git"
15
+ },
16
+ "keywords": [],
17
+ "author": "",
18
+ "license": "ISC",
19
+ "devDependencies": {
20
+ "@types/node": "^17.0.21",
21
+ "@types/node-fetch": "^2.6.2",
22
+ "eslint": "^8.10.0",
23
+ "eslint-config-prettier": "^8.5.0",
24
+ "eslint-plugin-import": "^2.25.4",
25
+ "eslint-plugin-prettier": "^4.0.0",
26
+ "prettier": "^2.5.1",
27
+ "rimraf": "^3.0.2",
28
+ "ts-loader": "^9.2.7",
29
+ "ts-node": "^10.7.0",
30
+ "tslint": "^6.1.3",
31
+ "typescript": "^4.6.2"
32
+ },
33
+ "engines": {
34
+ "node": ">=16.9.0"
35
+ },
36
+ "nodemonConfig": {
37
+ "ext": "*.ts, *.json"
38
+ },
39
+ "dependencies": {
40
+ "@discordjs/collection": "^1.5.0",
41
+ "@sapphire/async-queue": "^1.5.0",
42
+ "@sapphire/snowflake": "^3.2.0",
43
+ "events": "^3.3.0",
44
+ "node-abort-controller": "^3.0.1",
45
+ "node-fetch": "^2.6.5"
46
+ },
47
+ "prepublish": "npm run build"
48
+ }