@@ -196,127 +196,44 @@ <h1 class="page-title">Source: index.js</h1>
196196 }, this.log);
197197 }
198198
199- // /**
200- // * Updates the request's properties.<br>
201- // * <a href='https://developer.tiledesk.com/apis/rest-api/requests#update-a-request-by-request_id' target='_blank'> REST API</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 && 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 && 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.<br>
260- // * <a href='https://developer.tiledesk.com/apis/rest-api/requests#update-the-request-attributes' target='_blank'> REST API</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 && 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 && 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 >
0 commit comments