Skip to content

Commit 9247c20

Browse files
committed
added getTeam() v #0.8.18
1 parent e03e93f commit 9247c20

File tree

8 files changed

+293
-317
lines changed

8 files changed

+293
-317
lines changed

docs/TiledeskClient.html

Lines changed: 176 additions & 39 deletions
Large diffs are not rendered by default.

docs/global.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ <h5 class="subsection-title">Properties:</h5>
323323

324324
<dt class="tag-source">Source:</dt>
325325
<dd class="tag-source"><ul class="dummy"><li>
326-
<a href="index.js.html">index.js</a>, <a href="index.js.html#line1967">line 1967</a>
326+
<a href="index.js.html">index.js</a>, <a href="index.js.html#line1884">line 1884</a>
327327
</li></ul></dd>
328328

329329

@@ -627,7 +627,7 @@ <h5 class="subsection-title">Properties:</h5>
627627

628628
<dt class="tag-source">Source:</dt>
629629
<dd class="tag-source"><ul class="dummy"><li>
630-
<a href="index.js.html">index.js</a>, <a href="index.js.html#line596">line 596</a>
630+
<a href="index.js.html">index.js</a>, <a href="index.js.html#line513">line 513</a>
631631
</li></ul></dd>
632632

633633

@@ -912,7 +912,7 @@ <h5 class="subsection-title">Properties:</h5>
912912

913913
<dt class="tag-source">Source:</dt>
914914
<dd class="tag-source"><ul class="dummy"><li>
915-
<a href="index.js.html">index.js</a>, <a href="index.js.html#line889">line 889</a>
915+
<a href="index.js.html">index.js</a>, <a href="index.js.html#line806">line 806</a>
916916
</li></ul></dd>
917917

918918

@@ -1058,7 +1058,7 @@ <h5>Parameters:</h5>
10581058

10591059
<dt class="tag-source">Source:</dt>
10601060
<dd class="tag-source"><ul class="dummy"><li>
1061-
<a href="index.js.html">index.js</a>, <a href="index.js.html#line998">line 998</a>
1061+
<a href="index.js.html">index.js</a>, <a href="index.js.html#line915">line 915</a>
10621062
</li></ul></dd>
10631063

10641064

@@ -1108,7 +1108,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="TiledeskC
11081108
<br class="clear">
11091109

11101110
<footer>
1111-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Sun Mar 27 2022 12:21:33 GMT+0200 (Central European Summer Time)
1111+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Tue Mar 29 2022 16:18:31 GMT+0200 (Central European Summer Time)
11121112
</footer>
11131113

11141114
<script> prettyPrint(); </script>

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="TiledeskC
5656
<br class="clear">
5757

5858
<footer>
59-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Sun Mar 27 2022 12:21:33 GMT+0200 (Central European Summer Time)
59+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Tue Mar 29 2022 16:18:31 GMT+0200 (Central European Summer Time)
6060
</footer>
6161

6262
<script> prettyPrint(); </script>

docs/index.js.html

Lines changed: 36 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -196,127 +196,44 @@ <h1 class="page-title">Source: index.js</h1>
196196
}, this.log);
197197
}
198198

199-
// /**
200-
// * Updates the request's properties.&lt;br>
201-
// * &lt;a href='https://developer.tiledesk.com/apis/rest-api/requests#update-a-request-by-request_id' target='_blank'>REST API&lt;/a>
202-
// *
203-
// * @param {string} requestId - The request ID
204-
// * @param {Object} properties - The request properties to update.
205-
// * @param {resultCallback} callback - The callback that handles the response.
206-
// * @param {Object} options - Optional configuration.
207-
// * @param {string} options.token - The token for this request. Overrides instance token (if) provided in constructor.
208-
// * @param {string} options.projectId - The token for this request. Overrides instance token (if) provided in constructor.
209-
// */
210-
// updateRequestProperties(requestId, properties, callback, options) {
211-
// let token;
212-
// if (options &amp;&amp; options.token) {
213-
// token = options.token;
214-
// }
215-
// else if (this.token) {
216-
// token = this.token;
217-
// }
218-
// else {
219-
// throw new Error('token can NOT be null.');
220-
// }
221-
// let projectId;
222-
// if (options &amp;&amp; options.projectId) {
223-
// projectId = options.projectId;
224-
// }
225-
// else if (this.projectId) {
226-
// projectId = this.projectId;
227-
// }
228-
// else {
229-
// throw new Error('projectId can NOT be null.');
230-
// }
231-
// const jwt_token = TiledeskClient.fixToken(token)
232-
// var URL = `${this.APIURL}/${projectId}/requests/${requestId}`
233-
// data = properties;
234-
// const HTTPREQUEST = {
235-
// url: URL,
236-
// headers: {
237-
// 'Content-Type' : 'application/json',
238-
// 'Authorization': jwt_token
239-
// },
240-
// json: data,
241-
// method: 'PATCH'
242-
// };
243-
// TiledeskClient.myrequest(
244-
// HTTPREQUEST,
245-
// function(err, response, resbody) {
246-
// if (response.status === 200) {
247-
// if (callback) {
248-
// callback(null, resbody)
249-
// }
250-
// }
251-
// else if (callback) {
252-
// callback(TiledeskClient.getErr(err, HTTPREQUEST, response, resbody), null);
253-
// }
254-
// }, this.log
255-
// );
256-
// }
199+
// ***************************************************
200+
// ********************* TEAM ************************
201+
// ***************************************************
257202

258-
// /**
259-
// * Updates the request's attributes.&lt;br>
260-
// * &lt;a href='https://developer.tiledesk.com/apis/rest-api/requests#update-the-request-attributes' target='_blank'>REST API&lt;/a>
261-
// *
262-
// * @param {string} requestId - The request ID
263-
// * @param {Object} attributes - The request attributes to update.
264-
// * @param {resultCallback} callback - The callback that handles the response.
265-
// * @param {Object} options - Optional configuration.
266-
// * @param {string} options.token - The token for this request. Overrides instance token (if) provided in constructor.
267-
// * @param {string} options.projectId - The token for this request. Overrides instance token (if) provided in constructor.
268-
// */
269-
// updateRequestAttributes(requestId, attributes, callback, options) {
270-
// let token;
271-
// if (options &amp;&amp; options.token) {
272-
// token = options.token;
273-
// }
274-
// else if (this.token) {
275-
// token = this.token;
276-
// }
277-
// else {
278-
// throw new Error('token can NOT be null.');
279-
// }
280-
// let projectId;
281-
// if (options &amp;&amp; options.projectId) {
282-
// projectId = options.projectId;
283-
// }
284-
// else if (this.projectId) {
285-
// projectId = this.projectId;
286-
// }
287-
// else {
288-
// throw new Error('projectId can NOT be null.');
289-
// }
290-
// const jwt_token = TiledeskClient.fixToken(token)
291-
// var URL = `${this.APIURL}/${projectId}/requests/${requestId}/attributes`
292-
// var data = attributes;
293-
// const HTTPREQUEST = {
294-
// url: URL,
295-
// headers: {
296-
// 'Content-Type' : 'application/json',
297-
// 'Authorization': jwt_token
298-
// },
299-
// json: data,
300-
// method: 'PATCH'
301-
// };
302-
// TiledeskClient.myrequest(
303-
// HTTPREQUEST,
304-
// function(err, response, resbody) {
305-
// if (response.status === 200) {
306-
// if (callback) {
307-
// callback(null, resbody)
308-
// }
309-
// }
310-
// else if (callback) {
311-
// callback(TiledeskClient.getErr(err, HTTPREQUEST, response, resbody), null);
312-
// }
313-
// }, this.log
314-
// );
315-
// }
203+
/**
204+
* Returns all teammates (aka Project Users, Tiledesk Users invited on a specific project are named "Teammates". They have additional properties and a specific project-userId)
205+
* @param {resultCallback} callback - The callback that handles the response.
206+
*/
207+
getTeam(callback) {
208+
const URL = `${this.APIURL}/${this.projectId}/project_users`
209+
const HTTPREQUEST = {
210+
url: URL,
211+
headers: {
212+
'Content-Type' : 'application/json',
213+
'Authorization': this.jwt_token
214+
},
215+
method: 'GET'
216+
};
217+
TiledeskClient.myrequest(
218+
HTTPREQUEST,
219+
function(err, resbody) {
220+
if (err) {
221+
if (callback) {
222+
callback(err);
223+
}
224+
}
225+
else {
226+
if (callback) {
227+
callback(null, resbody);
228+
}
229+
}
230+
}, this.log
231+
);
232+
}
316233

317234
/**
318-
* Returns a project's User (aka Teammate, is a User invited on a project, with additional properties and a spcific project-userId)
319-
* @param {string} userId - The Teammate ID. Is the specific ID for this user on this project
235+
* Returns a project's User (aka Teammate, is a User invited on a project, with additional properties and a specific project-userId)
236+
* @param {string} userId - The Teammate ID. It is the specific ID for this user on this project
320237
* @param {resultCallback} callback - The callback that handles the response.
321238
*/
322239
getProjectUser(userId, callback) {
@@ -2253,7 +2170,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="TiledeskC
22532170
<br class="clear">
22542171

22552172
<footer>
2256-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Sun Mar 27 2022 12:21:32 GMT+0200 (Central European Summer Time)
2173+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Tue Mar 29 2022 16:18:31 GMT+0200 (Central European Summer Time)
22572174
</footer>
22582175

22592176
<script> prettyPrint(); </script>

tiledesk-client/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
This library is on npm: https://www.npmjs.com/package/@tiledesk/tiledesk-client
44

5+
### 0.8.18 - online
6+
- added getTeam()
7+
58
### 0.8.17 - online
69
- log fix
710

tiledesk-client/index.js

Lines changed: 35 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -168,127 +168,44 @@ class TiledeskClient {
168168
}, this.log);
169169
}
170170

171-
// /**
172-
// * Updates the request's properties.<br>
173-
// * <a href='https://developer.tiledesk.com/apis/rest-api/requests#update-a-request-by-request_id' target='_blank'>REST API</a>
174-
// *
175-
// * @param {string} requestId - The request ID
176-
// * @param {Object} properties - The request properties to update.
177-
// * @param {resultCallback} callback - The callback that handles the response.
178-
// * @param {Object} options - Optional configuration.
179-
// * @param {string} options.token - The token for this request. Overrides instance token (if) provided in constructor.
180-
// * @param {string} options.projectId - The token for this request. Overrides instance token (if) provided in constructor.
181-
// */
182-
// updateRequestProperties(requestId, properties, callback, options) {
183-
// let token;
184-
// if (options && options.token) {
185-
// token = options.token;
186-
// }
187-
// else if (this.token) {
188-
// token = this.token;
189-
// }
190-
// else {
191-
// throw new Error('token can NOT be null.');
192-
// }
193-
// let projectId;
194-
// if (options && options.projectId) {
195-
// projectId = options.projectId;
196-
// }
197-
// else if (this.projectId) {
198-
// projectId = this.projectId;
199-
// }
200-
// else {
201-
// throw new Error('projectId can NOT be null.');
202-
// }
203-
// const jwt_token = TiledeskClient.fixToken(token)
204-
// var URL = `${this.APIURL}/${projectId}/requests/${requestId}`
205-
// data = properties;
206-
// const HTTPREQUEST = {
207-
// url: URL,
208-
// headers: {
209-
// 'Content-Type' : 'application/json',
210-
// 'Authorization': jwt_token
211-
// },
212-
// json: data,
213-
// method: 'PATCH'
214-
// };
215-
// TiledeskClient.myrequest(
216-
// HTTPREQUEST,
217-
// function(err, response, resbody) {
218-
// if (response.status === 200) {
219-
// if (callback) {
220-
// callback(null, resbody)
221-
// }
222-
// }
223-
// else if (callback) {
224-
// callback(TiledeskClient.getErr(err, HTTPREQUEST, response, resbody), null);
225-
// }
226-
// }, this.log
227-
// );
228-
// }
171+
// ***************************************************
172+
// ********************* TEAM ************************
173+
// ***************************************************
229174

230-
// /**
231-
// * Updates the request's attributes.<br>
232-
// * <a href='https://developer.tiledesk.com/apis/rest-api/requests#update-the-request-attributes' target='_blank'>REST API</a>
233-
// *
234-
// * @param {string} requestId - The request ID
235-
// * @param {Object} attributes - The request attributes to update.
236-
// * @param {resultCallback} callback - The callback that handles the response.
237-
// * @param {Object} options - Optional configuration.
238-
// * @param {string} options.token - The token for this request. Overrides instance token (if) provided in constructor.
239-
// * @param {string} options.projectId - The token for this request. Overrides instance token (if) provided in constructor.
240-
// */
241-
// updateRequestAttributes(requestId, attributes, callback, options) {
242-
// let token;
243-
// if (options && options.token) {
244-
// token = options.token;
245-
// }
246-
// else if (this.token) {
247-
// token = this.token;
248-
// }
249-
// else {
250-
// throw new Error('token can NOT be null.');
251-
// }
252-
// let projectId;
253-
// if (options && options.projectId) {
254-
// projectId = options.projectId;
255-
// }
256-
// else if (this.projectId) {
257-
// projectId = this.projectId;
258-
// }
259-
// else {
260-
// throw new Error('projectId can NOT be null.');
261-
// }
262-
// const jwt_token = TiledeskClient.fixToken(token)
263-
// var URL = `${this.APIURL}/${projectId}/requests/${requestId}/attributes`
264-
// var data = attributes;
265-
// const HTTPREQUEST = {
266-
// url: URL,
267-
// headers: {
268-
// 'Content-Type' : 'application/json',
269-
// 'Authorization': jwt_token
270-
// },
271-
// json: data,
272-
// method: 'PATCH'
273-
// };
274-
// TiledeskClient.myrequest(
275-
// HTTPREQUEST,
276-
// function(err, response, resbody) {
277-
// if (response.status === 200) {
278-
// if (callback) {
279-
// callback(null, resbody)
280-
// }
281-
// }
282-
// else if (callback) {
283-
// callback(TiledeskClient.getErr(err, HTTPREQUEST, response, resbody), null);
284-
// }
285-
// }, this.log
286-
// );
287-
// }
175+
/**
176+
* Returns all teammates (aka Project Users, Tiledesk Users invited on a specific project are named "Teammates". They have additional properties and a specific project-userId)
177+
* @param {resultCallback} callback - The callback that handles the response.
178+
*/
179+
getTeam(callback) {
180+
const URL = `${this.APIURL}/${this.projectId}/project_users`
181+
const HTTPREQUEST = {
182+
url: URL,
183+
headers: {
184+
'Content-Type' : 'application/json',
185+
'Authorization': this.jwt_token
186+
},
187+
method: 'GET'
188+
};
189+
TiledeskClient.myrequest(
190+
HTTPREQUEST,
191+
function(err, resbody) {
192+
if (err) {
193+
if (callback) {
194+
callback(err);
195+
}
196+
}
197+
else {
198+
if (callback) {
199+
callback(null, resbody);
200+
}
201+
}
202+
}, this.log
203+
);
204+
}
288205

289206
/**
290-
* Returns a project's User (aka Teammate, is a User invited on a project, with additional properties and a spcific project-userId)
291-
* @param {string} userId - The Teammate ID. Is the specific ID for this user on this project
207+
* Returns a project's User (aka Teammate, is a User invited on a project, with additional properties and a specific project-userId)
208+
* @param {string} userId - The Teammate ID. It is the specific ID for this user on this project
292209
* @param {resultCallback} callback - The callback that handles the response.
293210
*/
294211
getProjectUser(userId, callback) {

0 commit comments

Comments
 (0)