@dlenroc/testrail
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -1,2 +0,2 @@ | ||
"use strict";const t=require("http"),e=require("https"),s=require("node-fetch"),r=require("form-data"),a={keepAlive:!0},n=new t.Agent(a),i=new e.Agent(a),_=t=>"http:"===t.protocol?n:i,u=(t,e)=>s(t,{agent:_,...e});class o extends Error{constructor(t){super(t),this.name="TestRailException"}}class p{constructor(t){this.username=(null==t?void 0:t.username)||(null==t?void 0:t.user),this.password=null==t?void 0:t.password,this.baseURL=((null==t?void 0:t.host)||"")+"/index.php?/api/v2/"}addAttachmentToCase(t,e){return this._api("POST",`add_attachment_to_case/${t}`,{form:{attachment:e}})}addAttachmentToPlan(t,e){return this._api("POST",`add_attachment_to_plan/${t}`,{form:{attachment:e}})}addAttachmentToPlanEntry(t,e,s){return this._api("POST",`add_attachment_to_plan_entry/${t}/${e}`,{form:{attachment:s}})}addAttachmentToResult(t,e){return this._api("POST",`add_attachment_to_result/${t}`,{form:{attachment:e}})}addAttachmentToRun(t,e){return this._api("POST",`add_attachment_to_run/${t}`,{form:{attachment:e}})}getAttachmentsForCase(t,e){return d("attachments",e,(e=>this._api("GET",`get_attachments_for_case/${t}`,{query:e})))}getAttachmentsForPlan(t,e){return d("attachments",e,(e=>this._api("GET",`get_attachments_for_plan/${t}`,{query:e})))}getAttachmentsForPlanEntry(t,e){return this._api("GET",`get_attachments_for_plan_entry/${t}/${e}`)}getAttachmentsForRun(t,e){return d("attachments",e,(e=>this._api("GET",`get_attachments_for_run/${t}`,{query:e})))}getAttachmentsForTest(t){return this._api("GET",`get_attachments_for_test/${t}`)}getAttachment(t){return this._api("GET",`get_attachment/${t}`)}deleteAttachment(t){return this._api("POST",`delete_attachment/${t}`)}getCase(t){return this._api("GET",`get_case/${t}`)}getCases(t,e){return d("cases",e,(e=>this._api("GET",`get_cases/${t}`,{query:e})))}getHistoryForCase(t,e){return d("history",e,(e=>this._api("GET",`get_history_for_case/${t}`,{query:e})))}addCase(t,e){return this._api("POST",`add_case/${t}`,{json:e})}copyCasesToSection(t,e){return this._api("POST",`copy_cases_to_section/${t}`,{json:e})}updateCase(t,e){return this._api("POST",`update_case/${t}`,{json:e})}updateCases(t,e){return this._api("POST",`update_cases/${t}`,{json:e})}moveCasesToSection(t,e){return this._api("POST",`move_cases_to_section/${t}`,{json:e})}deleteCase(t){return this._api("POST",`delete_case/${t}`)}deleteCases(t,e){return this._api("POST",`delete_cases/${t}`,{json:e})}getCaseFields(){return this._api("GET","get_case_fields")}addCaseField(t){return this._api("POST","add_case_field",{json:t})}getCaseTypes(){return this._api("GET","get_case_types")}getConfigs(t){return this._api("GET",`get_configs/${t}`)}addConfigGroup(t,e){return this._api("POST",`add_config_group/${t}`,{json:e})}addConfig(t,e){return this._api("POST",`add_config/${t}`,{json:e})}updateConfigGroup(t,e){return this._api("POST",`update_config_group/${t}`,{json:e})}updateConfig(t,e){return this._api("POST",`update_config/${t}`,{json:e})}deleteConfigGroup(t){return this._api("POST",`delete_config_group/${t}`)}deleteConfig(t){return this._api("POST",`delete_config/${t}`)}getMilestone(t){return this._api("GET",`get_milestone/${t}`)}getMilestones(t,e){return d("milestones",e,(e=>this._api("GET",`get_milestones/${t}`,{query:e})))}addMilestone(t,e){return this._api("POST",`add_milestone/${t}`,{json:e})}updateMilestone(t,e){return this._api("POST",`update_milestone/${t}`,{json:e})}deleteMilestone(t){return this._api("POST",`delete_milestone/${t}`)}getPlan(t){return this._api("GET",`get_plan/${t}`)}getPlans(t,e){return d("plans",e,(e=>this._api("GET",`get_plans/${t}`,{query:e})))}addPlan(t,e){return this._api("POST",`add_plan/${t}`,{json:e})}addPlanEntry(t,e){return this._api("POST",`add_plan_entry/${t}`,{json:e})}addRunToPlanEntry(t,e,s){return this._api("POST",`add_run_to_plan_entry/${t}/${e}`,{json:s})}updatePlan(t,e){return this._api("POST",`update_plan/${t}`,{json:e})}updatePlanEntry(t,e,s){return this._api("POST",`update_plan_entry/${t}/${e}`,{json:s})}updateRunInPlanEntry(t,e){return this._api("POST",`update_run_in_plan_entry/${t}`,{json:e})}closePlan(t){return this._api("POST",`close_plan/${t}`)}deletePlan(t){return this._api("POST",`delete_plan/${t}`)}deletePlanEntry(t,e){return this._api("POST",`delete_plan_entry/${t}/${e}`)}deleteRunFromPlanEntry(t){return this._api("POST",`delete_run_from_plan_entry/${t}`)}getPriorities(){return this._api("GET","get_priorities")}getProject(t){return this._api("GET",`get_project/${t}`)}getProjects(t){return d("projects",t,(t=>this._api("GET","get_projects",{query:t})))}addProject(t){return this._api("POST","add_project",{json:t})}updateProject(t,e){return this._api("POST",`update_project/${t}`,{json:e})}deleteProject(t){return this._api("POST",`delete_project/${t}`)}getReports(t){return this._api("GET",`get_reports/${t}`)}runReport(t){return this._api("POST",`run_report/${t}`)}getResults(t,e){return d("results",e,(e=>this._api("GET",`get_results/${t}`,{query:e})))}getResultsForCase(t,e,s){return d("results",s,(s=>this._api("GET",`get_results_for_case/${t}/${e}`,{query:s})))}getResultsForRun(t,e){return d("results",e,(e=>this._api("GET",`get_results_for_run/${t}`,{query:e})))}addResult(t,e){return this._api("POST",`add_result/${t}`,{json:e})}addResultForCase(t,e,s){return this._api("POST",`add_result_for_case/${t}/${e}`,{json:s})}addResults(t,e){return this._api("POST",`add_results/${t}`,{json:e})}addResultsForCases(t,e){return this._api("POST",`add_results_for_cases/${t}`,{json:e})}getResultFields(){return this._api("GET","get_result_fields")}getRun(t){return this._api("GET",`get_run/${t}`)}getRuns(t,e){return d("runs",e,(e=>this._api("GET",`get_runs/${t}`,{query:e})))}addRun(t,e){return this._api("POST",`add_run/${t}`,{json:e})}updateRun(t,e){return this._api("POST",`update_run/${t}`,{json:e})}closeRun(t){return this._api("POST",`close_run/${t}`)}deleteRun(t){return this._api("POST",`delete_run/${t}`)}getSection(t){return this._api("GET",`get_section/${t}`)}getSections(t,e){return d("sections",e,(e=>this._api("GET",`get_sections/${t}`,{query:e})))}addSection(t,e){return this._api("POST",`add_section/${t}`,{json:e})}moveSection(t,e){return this._api("POST",`move_section/${t}`,{json:e})}updateSection(t,e){return this._api("POST",`update_section/${t}`,{json:e})}deleteSection(t){return this._api("POST",`delete_section/${t}`)}getSharedStep(t){return this._api("GET",`get_shared_step/${t}`)}getSharedSteps(t,e){return d("shared_steps",e,(e=>this._api("GET",`get_shared_steps/${t}`,{query:e})))}getSharedStepHistory(t,e){return d("step_history",e,(e=>this._api("GET",`get_shared_step_history/${t}`,{query:e})))}addSharedStep(t,e){return this._api("POST",`add_shared_step/${t}`,{json:e})}updateSharedStep(t,e){return this._api("POST",`update_shared_step/${t}`,{json:e})}deleteSharedStep(t,e){return this._api("POST",`delete_shared_step/${t}`,{json:e})}getStatuses(){return this._api("GET","get_statuses")}getCaseStatuses(t){return d("case_statuses",t,(t=>this._api("GET","get_case_statuses",{query:t})))}getSuite(t){return this._api("GET",`get_suite/${t}`)}getSuites(t){return this._api("GET",`get_suites/${t}`)}addSuite(t,e){return this._api("POST",`add_suite/${t}`,{json:e})}updateSuite(t,e){return this._api("POST",`update_suite/${t}`,{json:e})}deleteSuite(t){return this._api("POST",`delete_suite/${t}`)}getTemplates(t){return this._api("GET",`get_templates/${t}`)}getTest(t){return this._api("GET",`get_test/${t}`)}getTests(t,e){return d("tests",e,(e=>this._api("GET",`get_tests/${t}`,{query:e})))}getUser(t){return this._api("GET",`get_user/${t}`)}getCurrentUser(){return this._api("GET","get_current_user")}getUserByEmail(t){return this._api("GET","get_user_by_email",{query:{email:t}})}getUsers(t){return this._api("GET","get_users",{query:t})}async _api(t,e,{query:s,json:a,form:n}={}){var i;const _={},o=this.baseURL+e+function(t){if(!t)return"";let e="";for(const[s,r]of Object.entries(t)){let t=r;"boolean"==typeof r?t=+r:Array.isArray(r)&&(t=r.join(",")),e+=`&${s}=${encodeURIComponent(t)}`}return e}(s);var d;let c;if(this.username&&this.password&&(_.Authorization=`Basic ${d=`${this.username}:${this.password}`,"undefined"!=typeof btoa?btoa(d):Buffer.from(d).toString("base64")}`),n||(_["Content-Type"]="application/json"),a)c=JSON.stringify(a);else if(n){c=new r;for(const[t,e]of Object.entries(n))e.name&&e.value?h(c,t,e.value,e.name):h(c,t,e)}for(;;){const e=await u(o,{method:t,body:c,headers:_});if(429===e.status){const t=1e3*parseInt(e.headers.get("Retry-After")||"1");await l(t);continue}if(409===e.status){await l(1e4);continue}const s=(null===(i=e.headers.get("Content-Type"))||void 0===i?void 0:i.includes("json"))?await e.json().catch((()=>({}))):await e.blob();if(e.ok)return s;throw new p.Exception(s.error||"No additional error message received")}}}async function d(t,e,s){if(e&&(e.hasOwnProperty("limit")||e.hasOwnProperty("offset"))){const r=await s(e);return Array.isArray(r)?r:r[t]||[]}let r=0,a=0;const n=[],i=new Set;for(;;){a=250*r++;let _=await d(t,{...e,limit:250,offset:a},s);if(_=_.filter((t=>!i.has(t.id)&&i.add(t.id))),n.push(..._),250!=_.length)break}return n}function h(t,e,s,r){if(r&&"undefined"!=typeof Blob){const a=s instanceof Blob?s:new Blob([s]);t.append(e,a,r)}else t.append(e,s,r)}function l(t){return new Promise((e=>setTimeout(e,t)))}p.Exception=o,module.exports=p; | ||
"use strict";const t=require("http"),e=require("https"),r=require("node-fetch"),s=require("form-data"),a={keepAlive:!0},n=new t.Agent(a),i=new e.Agent(a),u=t=>"http:"===t.protocol?n:i,_=(t,e)=>r(t,{agent:u,...e});class o extends Error{constructor(t){super(t),this.name="TestRailException"}}class p{constructor(t){this.username=(null==t?void 0:t.username)||(null==t?void 0:t.user),this.password=null==t?void 0:t.password,this.baseURL=((null==t?void 0:t.host)||"")+"/index.php?/api/v2/"}addAttachmentToCase(t,e){return this._api("POST",`add_attachment_to_case/${t}`,{form:{attachment:e}})}addAttachmentToPlan(t,e){return this._api("POST",`add_attachment_to_plan/${t}`,{form:{attachment:e}})}addAttachmentToPlanEntry(t,e,r){return this._api("POST",`add_attachment_to_plan_entry/${t}/${e}`,{form:{attachment:r}})}addAttachmentToResult(t,e){return this._api("POST",`add_attachment_to_result/${t}`,{form:{attachment:e}})}addAttachmentToRun(t,e){return this._api("POST",`add_attachment_to_run/${t}`,{form:{attachment:e}})}getAttachmentsForCase(t,e){return d("attachments",e,(e=>this._api("GET",`get_attachments_for_case/${t}`,{query:e})))}getAttachmentsForPlan(t,e){return d("attachments",e,(e=>this._api("GET",`get_attachments_for_plan/${t}`,{query:e})))}getAttachmentsForPlanEntry(t,e){return this._api("GET",`get_attachments_for_plan_entry/${t}/${e}`)}getAttachmentsForRun(t,e){return d("attachments",e,(e=>this._api("GET",`get_attachments_for_run/${t}`,{query:e})))}getAttachmentsForTest(t){return this._api("GET",`get_attachments_for_test/${t}`)}getAttachment(t){return this._api("GET",`get_attachment/${t}`)}deleteAttachment(t){return this._api("POST",`delete_attachment/${t}`)}getCase(t){return this._api("GET",`get_case/${t}`)}getCases(t,e){return d("cases",e,(e=>this._api("GET",`get_cases/${t}`,{query:e})))}getHistoryForCase(t,e){return d("history",e,(e=>this._api("GET",`get_history_for_case/${t}`,{query:e})))}addCase(t,e){return this._api("POST",`add_case/${t}`,{json:e})}copyCasesToSection(t,e){return this._api("POST",`copy_cases_to_section/${t}`,{json:e})}updateCase(t,e){return this._api("POST",`update_case/${t}`,{json:e})}updateCases(t,e){return this._api("POST",`update_cases/${t}`,{json:e})}moveCasesToSection(t,e){return this._api("POST",`move_cases_to_section/${t}`,{json:e})}deleteCase(t){return this._api("POST",`delete_case/${t}`)}deleteCases(t,e){return this._api("POST",`delete_cases/${t}`,{json:e})}getCaseFields(){return this._api("GET","get_case_fields")}addCaseField(t){return this._api("POST","add_case_field",{json:t})}getCaseTypes(){return this._api("GET","get_case_types")}getConfigs(t){return this._api("GET",`get_configs/${t}`)}addConfigGroup(t,e){return this._api("POST",`add_config_group/${t}`,{json:e})}addConfig(t,e){return this._api("POST",`add_config/${t}`,{json:e})}updateConfigGroup(t,e){return this._api("POST",`update_config_group/${t}`,{json:e})}updateConfig(t,e){return this._api("POST",`update_config/${t}`,{json:e})}deleteConfigGroup(t){return this._api("POST",`delete_config_group/${t}`)}deleteConfig(t){return this._api("POST",`delete_config/${t}`)}getGroup(t){return this._api("GET",`get_group/${t}`)}getGroups(t){return d("groups",t,(t=>this._api("GET","get_groups",{query:t})))}addGroup(t){return this._api("POST","add_group",{json:t})}updateGroup(t,e){return this._api("POST",`update_group/${t}`,{json:e})}deleteGroup(t){return this._api("POST",`delete_group/${t}`)}getMilestone(t){return this._api("GET",`get_milestone/${t}`)}getMilestones(t,e){return d("milestones",e,(e=>this._api("GET",`get_milestones/${t}`,{query:e})))}addMilestone(t,e){return this._api("POST",`add_milestone/${t}`,{json:e})}updateMilestone(t,e){return this._api("POST",`update_milestone/${t}`,{json:e})}deleteMilestone(t){return this._api("POST",`delete_milestone/${t}`)}getPlan(t){return this._api("GET",`get_plan/${t}`)}getPlans(t,e){return d("plans",e,(e=>this._api("GET",`get_plans/${t}`,{query:e})))}addPlan(t,e){return this._api("POST",`add_plan/${t}`,{json:e})}addPlanEntry(t,e){return this._api("POST",`add_plan_entry/${t}`,{json:e})}addRunToPlanEntry(t,e,r){return this._api("POST",`add_run_to_plan_entry/${t}/${e}`,{json:r})}updatePlan(t,e){return this._api("POST",`update_plan/${t}`,{json:e})}updatePlanEntry(t,e,r){return this._api("POST",`update_plan_entry/${t}/${e}`,{json:r})}updateRunInPlanEntry(t,e){return this._api("POST",`update_run_in_plan_entry/${t}`,{json:e})}closePlan(t){return this._api("POST",`close_plan/${t}`)}deletePlan(t){return this._api("POST",`delete_plan/${t}`)}deletePlanEntry(t,e){return this._api("POST",`delete_plan_entry/${t}/${e}`)}deleteRunFromPlanEntry(t){return this._api("POST",`delete_run_from_plan_entry/${t}`)}getPriorities(){return this._api("GET","get_priorities")}getProject(t){return this._api("GET",`get_project/${t}`)}getProjects(t){return d("projects",t,(t=>this._api("GET","get_projects",{query:t})))}addProject(t){return this._api("POST","add_project",{json:t})}updateProject(t,e){return this._api("POST",`update_project/${t}`,{json:e})}deleteProject(t){return this._api("POST",`delete_project/${t}`)}getReports(t){return this._api("GET",`get_reports/${t}`)}runReport(t){return this._api("POST",`run_report/${t}`)}getResults(t,e){return d("results",e,(e=>this._api("GET",`get_results/${t}`,{query:e})))}getResultsForCase(t,e,r){return d("results",r,(r=>this._api("GET",`get_results_for_case/${t}/${e}`,{query:r})))}getResultsForRun(t,e){return d("results",e,(e=>this._api("GET",`get_results_for_run/${t}`,{query:e})))}addResult(t,e){return this._api("POST",`add_result/${t}`,{json:e})}addResultForCase(t,e,r){return this._api("POST",`add_result_for_case/${t}/${e}`,{json:r})}addResults(t,e){return this._api("POST",`add_results/${t}`,{json:e})}addResultsForCases(t,e){return this._api("POST",`add_results_for_cases/${t}`,{json:e})}getResultFields(){return this._api("GET","get_result_fields")}getRoles(t){return d("roles",t,(t=>this._api("GET","get_roles",{query:t})))}getRun(t){return this._api("GET",`get_run/${t}`)}getRuns(t,e){return d("runs",e,(e=>this._api("GET",`get_runs/${t}`,{query:e})))}addRun(t,e){return this._api("POST",`add_run/${t}`,{json:e})}updateRun(t,e){return this._api("POST",`update_run/${t}`,{json:e})}closeRun(t){return this._api("POST",`close_run/${t}`)}deleteRun(t){return this._api("POST",`delete_run/${t}`)}getSection(t){return this._api("GET",`get_section/${t}`)}getSections(t,e){return d("sections",e,(e=>this._api("GET",`get_sections/${t}`,{query:e})))}addSection(t,e){return this._api("POST",`add_section/${t}`,{json:e})}moveSection(t,e){return this._api("POST",`move_section/${t}`,{json:e})}updateSection(t,e){return this._api("POST",`update_section/${t}`,{json:e})}deleteSection(t){return this._api("POST",`delete_section/${t}`)}getSharedStep(t){return this._api("GET",`get_shared_step/${t}`)}getSharedSteps(t,e){return d("shared_steps",e,(e=>this._api("GET",`get_shared_steps/${t}`,{query:e})))}getSharedStepHistory(t,e){return d("step_history",e,(e=>this._api("GET",`get_shared_step_history/${t}`,{query:e})))}addSharedStep(t,e){return this._api("POST",`add_shared_step/${t}`,{json:e})}updateSharedStep(t,e){return this._api("POST",`update_shared_step/${t}`,{json:e})}deleteSharedStep(t,e){return this._api("POST",`delete_shared_step/${t}`,{json:e})}getStatuses(){return this._api("GET","get_statuses")}getCaseStatuses(t){return d("case_statuses",t,(t=>this._api("GET","get_case_statuses",{query:t})))}getSuite(t){return this._api("GET",`get_suite/${t}`)}getSuites(t){return this._api("GET",`get_suites/${t}`)}addSuite(t,e){return this._api("POST",`add_suite/${t}`,{json:e})}updateSuite(t,e){return this._api("POST",`update_suite/${t}`,{json:e})}deleteSuite(t){return this._api("POST",`delete_suite/${t}`)}getTemplates(t){return this._api("GET",`get_templates/${t}`)}getTest(t){return this._api("GET",`get_test/${t}`)}getTests(t,e){return d("tests",e,(e=>this._api("GET",`get_tests/${t}`,{query:e})))}getUser(t){return this._api("GET",`get_user/${t}`)}getCurrentUser(){return this._api("GET","get_current_user")}getUserByEmail(t){return this._api("GET","get_user_by_email",{query:{email:t}})}getUsers(t){return this._api("GET","get_users",{query:t})}addUser(t){return this._api("POST","add_user",{json:t})}updateUser(t,e){return this._api("POST",`update_user/${t}`,{json:e})}async _api(t,e,{query:r,json:a,form:n}={}){var i;const u={},o=this.baseURL+e+function(t){if(!t)return"";let e="";for(const[r,s]of Object.entries(t)){let t=s;"boolean"==typeof s?t=+s:Array.isArray(s)&&(t=s.join(",")),e+=`&${r}=${encodeURIComponent(t)}`}return e}(r);var d;let c;if(this.username&&this.password&&(u.Authorization=`Basic ${d=`${this.username}:${this.password}`,"undefined"!=typeof btoa?btoa(d):Buffer.from(d).toString("base64")}`),n||(u["Content-Type"]="application/json"),a)c=JSON.stringify(a);else if(n){c=new s;for(const[t,e]of Object.entries(n))e.name&&e.value?h(c,t,e.value,e.name):h(c,t,e)}for(;;){const e=await _(o,{method:t,body:c,headers:u});if(429===e.status){const t=1e3*parseInt(e.headers.get("Retry-After")||"1");await l(t);continue}if(409===e.status){await l(1e4);continue}const r=(null===(i=e.headers.get("Content-Type"))||void 0===i?void 0:i.includes("json"))?await e.json().catch((()=>({}))):await e.blob();if(e.ok)return r;throw new p.Exception(r.error||"No additional error message received")}}}async function d(t,e,r){if(e&&(e.hasOwnProperty("limit")||e.hasOwnProperty("offset"))){const s=await r(e);return Array.isArray(s)?s:s[t]||[]}let s=0,a=0;const n=[],i=new Set;for(;;){a=250*s++;let u=await d(t,{...e,limit:250,offset:a},r);if(u=u.filter((t=>!i.has(t.id)&&i.add(t.id))),n.push(...u),250!=u.length)break}return n}function h(t,e,r,s){if(s&&"undefined"!=typeof Blob){const a=r instanceof Blob?r:new Blob([r]);t.append(e,a,s)}else t.append(e,r,s)}function l(t){return new Promise((e=>setTimeout(e,t)))}p.Exception=o,module.exports=p; | ||
//# sourceMappingURL=TestRail.node.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).TestRail=e()}(this,(function(){"use strict";class t extends Error{constructor(t){super(t),this.name="TestRailException"}}class e{constructor(t){this.username=(null==t?void 0:t.username)||(null==t?void 0:t.user),this.password=null==t?void 0:t.password,this.baseURL=((null==t?void 0:t.host)||"")+"/index.php?/api/v2/"}addAttachmentToCase(t,e){return this._api("POST",`add_attachment_to_case/${t}`,{form:{attachment:e}})}addAttachmentToPlan(t,e){return this._api("POST",`add_attachment_to_plan/${t}`,{form:{attachment:e}})}addAttachmentToPlanEntry(t,e,s){return this._api("POST",`add_attachment_to_plan_entry/${t}/${e}`,{form:{attachment:s}})}addAttachmentToResult(t,e){return this._api("POST",`add_attachment_to_result/${t}`,{form:{attachment:e}})}addAttachmentToRun(t,e){return this._api("POST",`add_attachment_to_run/${t}`,{form:{attachment:e}})}getAttachmentsForCase(t,e){return s("attachments",e,(e=>this._api("GET",`get_attachments_for_case/${t}`,{query:e})))}getAttachmentsForPlan(t,e){return s("attachments",e,(e=>this._api("GET",`get_attachments_for_plan/${t}`,{query:e})))}getAttachmentsForPlanEntry(t,e){return this._api("GET",`get_attachments_for_plan_entry/${t}/${e}`)}getAttachmentsForRun(t,e){return s("attachments",e,(e=>this._api("GET",`get_attachments_for_run/${t}`,{query:e})))}getAttachmentsForTest(t){return this._api("GET",`get_attachments_for_test/${t}`)}getAttachment(t){return this._api("GET",`get_attachment/${t}`)}deleteAttachment(t){return this._api("POST",`delete_attachment/${t}`)}getCase(t){return this._api("GET",`get_case/${t}`)}getCases(t,e){return s("cases",e,(e=>this._api("GET",`get_cases/${t}`,{query:e})))}getHistoryForCase(t,e){return s("history",e,(e=>this._api("GET",`get_history_for_case/${t}`,{query:e})))}addCase(t,e){return this._api("POST",`add_case/${t}`,{json:e})}copyCasesToSection(t,e){return this._api("POST",`copy_cases_to_section/${t}`,{json:e})}updateCase(t,e){return this._api("POST",`update_case/${t}`,{json:e})}updateCases(t,e){return this._api("POST",`update_cases/${t}`,{json:e})}moveCasesToSection(t,e){return this._api("POST",`move_cases_to_section/${t}`,{json:e})}deleteCase(t){return this._api("POST",`delete_case/${t}`)}deleteCases(t,e){return this._api("POST",`delete_cases/${t}`,{json:e})}getCaseFields(){return this._api("GET","get_case_fields")}addCaseField(t){return this._api("POST","add_case_field",{json:t})}getCaseTypes(){return this._api("GET","get_case_types")}getConfigs(t){return this._api("GET",`get_configs/${t}`)}addConfigGroup(t,e){return this._api("POST",`add_config_group/${t}`,{json:e})}addConfig(t,e){return this._api("POST",`add_config/${t}`,{json:e})}updateConfigGroup(t,e){return this._api("POST",`update_config_group/${t}`,{json:e})}updateConfig(t,e){return this._api("POST",`update_config/${t}`,{json:e})}deleteConfigGroup(t){return this._api("POST",`delete_config_group/${t}`)}deleteConfig(t){return this._api("POST",`delete_config/${t}`)}getMilestone(t){return this._api("GET",`get_milestone/${t}`)}getMilestones(t,e){return s("milestones",e,(e=>this._api("GET",`get_milestones/${t}`,{query:e})))}addMilestone(t,e){return this._api("POST",`add_milestone/${t}`,{json:e})}updateMilestone(t,e){return this._api("POST",`update_milestone/${t}`,{json:e})}deleteMilestone(t){return this._api("POST",`delete_milestone/${t}`)}getPlan(t){return this._api("GET",`get_plan/${t}`)}getPlans(t,e){return s("plans",e,(e=>this._api("GET",`get_plans/${t}`,{query:e})))}addPlan(t,e){return this._api("POST",`add_plan/${t}`,{json:e})}addPlanEntry(t,e){return this._api("POST",`add_plan_entry/${t}`,{json:e})}addRunToPlanEntry(t,e,s){return this._api("POST",`add_run_to_plan_entry/${t}/${e}`,{json:s})}updatePlan(t,e){return this._api("POST",`update_plan/${t}`,{json:e})}updatePlanEntry(t,e,s){return this._api("POST",`update_plan_entry/${t}/${e}`,{json:s})}updateRunInPlanEntry(t,e){return this._api("POST",`update_run_in_plan_entry/${t}`,{json:e})}closePlan(t){return this._api("POST",`close_plan/${t}`)}deletePlan(t){return this._api("POST",`delete_plan/${t}`)}deletePlanEntry(t,e){return this._api("POST",`delete_plan_entry/${t}/${e}`)}deleteRunFromPlanEntry(t){return this._api("POST",`delete_run_from_plan_entry/${t}`)}getPriorities(){return this._api("GET","get_priorities")}getProject(t){return this._api("GET",`get_project/${t}`)}getProjects(t){return s("projects",t,(t=>this._api("GET","get_projects",{query:t})))}addProject(t){return this._api("POST","add_project",{json:t})}updateProject(t,e){return this._api("POST",`update_project/${t}`,{json:e})}deleteProject(t){return this._api("POST",`delete_project/${t}`)}getReports(t){return this._api("GET",`get_reports/${t}`)}runReport(t){return this._api("POST",`run_report/${t}`)}getResults(t,e){return s("results",e,(e=>this._api("GET",`get_results/${t}`,{query:e})))}getResultsForCase(t,e,r){return s("results",r,(s=>this._api("GET",`get_results_for_case/${t}/${e}`,{query:s})))}getResultsForRun(t,e){return s("results",e,(e=>this._api("GET",`get_results_for_run/${t}`,{query:e})))}addResult(t,e){return this._api("POST",`add_result/${t}`,{json:e})}addResultForCase(t,e,s){return this._api("POST",`add_result_for_case/${t}/${e}`,{json:s})}addResults(t,e){return this._api("POST",`add_results/${t}`,{json:e})}addResultsForCases(t,e){return this._api("POST",`add_results_for_cases/${t}`,{json:e})}getResultFields(){return this._api("GET","get_result_fields")}getRun(t){return this._api("GET",`get_run/${t}`)}getRuns(t,e){return s("runs",e,(e=>this._api("GET",`get_runs/${t}`,{query:e})))}addRun(t,e){return this._api("POST",`add_run/${t}`,{json:e})}updateRun(t,e){return this._api("POST",`update_run/${t}`,{json:e})}closeRun(t){return this._api("POST",`close_run/${t}`)}deleteRun(t){return this._api("POST",`delete_run/${t}`)}getSection(t){return this._api("GET",`get_section/${t}`)}getSections(t,e){return s("sections",e,(e=>this._api("GET",`get_sections/${t}`,{query:e})))}addSection(t,e){return this._api("POST",`add_section/${t}`,{json:e})}moveSection(t,e){return this._api("POST",`move_section/${t}`,{json:e})}updateSection(t,e){return this._api("POST",`update_section/${t}`,{json:e})}deleteSection(t){return this._api("POST",`delete_section/${t}`)}getSharedStep(t){return this._api("GET",`get_shared_step/${t}`)}getSharedSteps(t,e){return s("shared_steps",e,(e=>this._api("GET",`get_shared_steps/${t}`,{query:e})))}getSharedStepHistory(t,e){return s("step_history",e,(e=>this._api("GET",`get_shared_step_history/${t}`,{query:e})))}addSharedStep(t,e){return this._api("POST",`add_shared_step/${t}`,{json:e})}updateSharedStep(t,e){return this._api("POST",`update_shared_step/${t}`,{json:e})}deleteSharedStep(t,e){return this._api("POST",`delete_shared_step/${t}`,{json:e})}getStatuses(){return this._api("GET","get_statuses")}getCaseStatuses(t){return s("case_statuses",t,(t=>this._api("GET","get_case_statuses",{query:t})))}getSuite(t){return this._api("GET",`get_suite/${t}`)}getSuites(t){return this._api("GET",`get_suites/${t}`)}addSuite(t,e){return this._api("POST",`add_suite/${t}`,{json:e})}updateSuite(t,e){return this._api("POST",`update_suite/${t}`,{json:e})}deleteSuite(t){return this._api("POST",`delete_suite/${t}`)}getTemplates(t){return this._api("GET",`get_templates/${t}`)}getTest(t){return this._api("GET",`get_test/${t}`)}getTests(t,e){return s("tests",e,(e=>this._api("GET",`get_tests/${t}`,{query:e})))}getUser(t){return this._api("GET",`get_user/${t}`)}getCurrentUser(){return this._api("GET","get_current_user")}getUserByEmail(t){return this._api("GET","get_user_by_email",{query:{email:t}})}getUsers(t){return this._api("GET","get_users",{query:t})}async _api(t,s,{query:n,json:i,form:_}={}){var u;const o={},p=this.baseURL+s+function(t){if(!t)return"";let e="";for(const[s,r]of Object.entries(t)){let t=r;"boolean"==typeof r?t=+r:Array.isArray(r)&&(t=r.join(",")),e+=`&${s}=${encodeURIComponent(t)}`}return e}(n);var d;let h;if(this.username&&this.password&&(o.Authorization=`Basic ${d=`${this.username}:${this.password}`,"undefined"!=typeof btoa?btoa(d):Buffer.from(d).toString("base64")}`),_||(o["Content-Type"]="application/json"),i)h=JSON.stringify(i);else if(_){h=new FormData;for(const[t,e]of Object.entries(_))e.name&&e.value?r(h,t,e.value,e.name):r(h,t,e)}for(;;){const s=await fetch(p,{method:t,body:h,headers:o});if(429===s.status){const t=1e3*parseInt(s.headers.get("Retry-After")||"1");await a(t);continue}if(409===s.status){await a(1e4);continue}const r=(null===(u=s.headers.get("Content-Type"))||void 0===u?void 0:u.includes("json"))?await s.json().catch((()=>({}))):await s.blob();if(s.ok)return r;throw new e.Exception(r.error||"No additional error message received")}}}async function s(t,e,r){if(e&&(e.hasOwnProperty("limit")||e.hasOwnProperty("offset"))){const s=await r(e);return Array.isArray(s)?s:s[t]||[]}let a=0,n=0;const i=[],_=new Set;for(;;){n=250*a++;let u=await s(t,{...e,limit:250,offset:n},r);if(u=u.filter((t=>!_.has(t.id)&&_.add(t.id))),i.push(...u),250!=u.length)break}return i}function r(t,e,s,r){if(r&&"undefined"!=typeof Blob){const a=s instanceof Blob?s:new Blob([s]);t.append(e,a,r)}else t.append(e,s,r)}function a(t){return new Promise((e=>setTimeout(e,t)))}return e.Exception=t,e})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).TestRail=e()}(this,(function(){"use strict";class t extends Error{constructor(t){super(t),this.name="TestRailException"}}class e{constructor(t){this.username=(null==t?void 0:t.username)||(null==t?void 0:t.user),this.password=null==t?void 0:t.password,this.baseURL=((null==t?void 0:t.host)||"")+"/index.php?/api/v2/"}addAttachmentToCase(t,e){return this._api("POST",`add_attachment_to_case/${t}`,{form:{attachment:e}})}addAttachmentToPlan(t,e){return this._api("POST",`add_attachment_to_plan/${t}`,{form:{attachment:e}})}addAttachmentToPlanEntry(t,e,s){return this._api("POST",`add_attachment_to_plan_entry/${t}/${e}`,{form:{attachment:s}})}addAttachmentToResult(t,e){return this._api("POST",`add_attachment_to_result/${t}`,{form:{attachment:e}})}addAttachmentToRun(t,e){return this._api("POST",`add_attachment_to_run/${t}`,{form:{attachment:e}})}getAttachmentsForCase(t,e){return s("attachments",e,(e=>this._api("GET",`get_attachments_for_case/${t}`,{query:e})))}getAttachmentsForPlan(t,e){return s("attachments",e,(e=>this._api("GET",`get_attachments_for_plan/${t}`,{query:e})))}getAttachmentsForPlanEntry(t,e){return this._api("GET",`get_attachments_for_plan_entry/${t}/${e}`)}getAttachmentsForRun(t,e){return s("attachments",e,(e=>this._api("GET",`get_attachments_for_run/${t}`,{query:e})))}getAttachmentsForTest(t){return this._api("GET",`get_attachments_for_test/${t}`)}getAttachment(t){return this._api("GET",`get_attachment/${t}`)}deleteAttachment(t){return this._api("POST",`delete_attachment/${t}`)}getCase(t){return this._api("GET",`get_case/${t}`)}getCases(t,e){return s("cases",e,(e=>this._api("GET",`get_cases/${t}`,{query:e})))}getHistoryForCase(t,e){return s("history",e,(e=>this._api("GET",`get_history_for_case/${t}`,{query:e})))}addCase(t,e){return this._api("POST",`add_case/${t}`,{json:e})}copyCasesToSection(t,e){return this._api("POST",`copy_cases_to_section/${t}`,{json:e})}updateCase(t,e){return this._api("POST",`update_case/${t}`,{json:e})}updateCases(t,e){return this._api("POST",`update_cases/${t}`,{json:e})}moveCasesToSection(t,e){return this._api("POST",`move_cases_to_section/${t}`,{json:e})}deleteCase(t){return this._api("POST",`delete_case/${t}`)}deleteCases(t,e){return this._api("POST",`delete_cases/${t}`,{json:e})}getCaseFields(){return this._api("GET","get_case_fields")}addCaseField(t){return this._api("POST","add_case_field",{json:t})}getCaseTypes(){return this._api("GET","get_case_types")}getConfigs(t){return this._api("GET",`get_configs/${t}`)}addConfigGroup(t,e){return this._api("POST",`add_config_group/${t}`,{json:e})}addConfig(t,e){return this._api("POST",`add_config/${t}`,{json:e})}updateConfigGroup(t,e){return this._api("POST",`update_config_group/${t}`,{json:e})}updateConfig(t,e){return this._api("POST",`update_config/${t}`,{json:e})}deleteConfigGroup(t){return this._api("POST",`delete_config_group/${t}`)}deleteConfig(t){return this._api("POST",`delete_config/${t}`)}getGroup(t){return this._api("GET",`get_group/${t}`)}getGroups(t){return s("groups",t,(t=>this._api("GET","get_groups",{query:t})))}addGroup(t){return this._api("POST","add_group",{json:t})}updateGroup(t,e){return this._api("POST",`update_group/${t}`,{json:e})}deleteGroup(t){return this._api("POST",`delete_group/${t}`)}getMilestone(t){return this._api("GET",`get_milestone/${t}`)}getMilestones(t,e){return s("milestones",e,(e=>this._api("GET",`get_milestones/${t}`,{query:e})))}addMilestone(t,e){return this._api("POST",`add_milestone/${t}`,{json:e})}updateMilestone(t,e){return this._api("POST",`update_milestone/${t}`,{json:e})}deleteMilestone(t){return this._api("POST",`delete_milestone/${t}`)}getPlan(t){return this._api("GET",`get_plan/${t}`)}getPlans(t,e){return s("plans",e,(e=>this._api("GET",`get_plans/${t}`,{query:e})))}addPlan(t,e){return this._api("POST",`add_plan/${t}`,{json:e})}addPlanEntry(t,e){return this._api("POST",`add_plan_entry/${t}`,{json:e})}addRunToPlanEntry(t,e,s){return this._api("POST",`add_run_to_plan_entry/${t}/${e}`,{json:s})}updatePlan(t,e){return this._api("POST",`update_plan/${t}`,{json:e})}updatePlanEntry(t,e,s){return this._api("POST",`update_plan_entry/${t}/${e}`,{json:s})}updateRunInPlanEntry(t,e){return this._api("POST",`update_run_in_plan_entry/${t}`,{json:e})}closePlan(t){return this._api("POST",`close_plan/${t}`)}deletePlan(t){return this._api("POST",`delete_plan/${t}`)}deletePlanEntry(t,e){return this._api("POST",`delete_plan_entry/${t}/${e}`)}deleteRunFromPlanEntry(t){return this._api("POST",`delete_run_from_plan_entry/${t}`)}getPriorities(){return this._api("GET","get_priorities")}getProject(t){return this._api("GET",`get_project/${t}`)}getProjects(t){return s("projects",t,(t=>this._api("GET","get_projects",{query:t})))}addProject(t){return this._api("POST","add_project",{json:t})}updateProject(t,e){return this._api("POST",`update_project/${t}`,{json:e})}deleteProject(t){return this._api("POST",`delete_project/${t}`)}getReports(t){return this._api("GET",`get_reports/${t}`)}runReport(t){return this._api("POST",`run_report/${t}`)}getResults(t,e){return s("results",e,(e=>this._api("GET",`get_results/${t}`,{query:e})))}getResultsForCase(t,e,r){return s("results",r,(s=>this._api("GET",`get_results_for_case/${t}/${e}`,{query:s})))}getResultsForRun(t,e){return s("results",e,(e=>this._api("GET",`get_results_for_run/${t}`,{query:e})))}addResult(t,e){return this._api("POST",`add_result/${t}`,{json:e})}addResultForCase(t,e,s){return this._api("POST",`add_result_for_case/${t}/${e}`,{json:s})}addResults(t,e){return this._api("POST",`add_results/${t}`,{json:e})}addResultsForCases(t,e){return this._api("POST",`add_results_for_cases/${t}`,{json:e})}getResultFields(){return this._api("GET","get_result_fields")}getRoles(t){return s("roles",t,(t=>this._api("GET","get_roles",{query:t})))}getRun(t){return this._api("GET",`get_run/${t}`)}getRuns(t,e){return s("runs",e,(e=>this._api("GET",`get_runs/${t}`,{query:e})))}addRun(t,e){return this._api("POST",`add_run/${t}`,{json:e})}updateRun(t,e){return this._api("POST",`update_run/${t}`,{json:e})}closeRun(t){return this._api("POST",`close_run/${t}`)}deleteRun(t){return this._api("POST",`delete_run/${t}`)}getSection(t){return this._api("GET",`get_section/${t}`)}getSections(t,e){return s("sections",e,(e=>this._api("GET",`get_sections/${t}`,{query:e})))}addSection(t,e){return this._api("POST",`add_section/${t}`,{json:e})}moveSection(t,e){return this._api("POST",`move_section/${t}`,{json:e})}updateSection(t,e){return this._api("POST",`update_section/${t}`,{json:e})}deleteSection(t){return this._api("POST",`delete_section/${t}`)}getSharedStep(t){return this._api("GET",`get_shared_step/${t}`)}getSharedSteps(t,e){return s("shared_steps",e,(e=>this._api("GET",`get_shared_steps/${t}`,{query:e})))}getSharedStepHistory(t,e){return s("step_history",e,(e=>this._api("GET",`get_shared_step_history/${t}`,{query:e})))}addSharedStep(t,e){return this._api("POST",`add_shared_step/${t}`,{json:e})}updateSharedStep(t,e){return this._api("POST",`update_shared_step/${t}`,{json:e})}deleteSharedStep(t,e){return this._api("POST",`delete_shared_step/${t}`,{json:e})}getStatuses(){return this._api("GET","get_statuses")}getCaseStatuses(t){return s("case_statuses",t,(t=>this._api("GET","get_case_statuses",{query:t})))}getSuite(t){return this._api("GET",`get_suite/${t}`)}getSuites(t){return this._api("GET",`get_suites/${t}`)}addSuite(t,e){return this._api("POST",`add_suite/${t}`,{json:e})}updateSuite(t,e){return this._api("POST",`update_suite/${t}`,{json:e})}deleteSuite(t){return this._api("POST",`delete_suite/${t}`)}getTemplates(t){return this._api("GET",`get_templates/${t}`)}getTest(t){return this._api("GET",`get_test/${t}`)}getTests(t,e){return s("tests",e,(e=>this._api("GET",`get_tests/${t}`,{query:e})))}getUser(t){return this._api("GET",`get_user/${t}`)}getCurrentUser(){return this._api("GET","get_current_user")}getUserByEmail(t){return this._api("GET","get_user_by_email",{query:{email:t}})}getUsers(t){return this._api("GET","get_users",{query:t})}addUser(t){return this._api("POST","add_user",{json:t})}updateUser(t,e){return this._api("POST",`update_user/${t}`,{json:e})}async _api(t,s,{query:n,json:i,form:u}={}){var _;const o={},p=this.baseURL+s+function(t){if(!t)return"";let e="";for(const[s,r]of Object.entries(t)){let t=r;"boolean"==typeof r?t=+r:Array.isArray(r)&&(t=r.join(",")),e+=`&${s}=${encodeURIComponent(t)}`}return e}(n);var d;let h;if(this.username&&this.password&&(o.Authorization=`Basic ${d=`${this.username}:${this.password}`,"undefined"!=typeof btoa?btoa(d):Buffer.from(d).toString("base64")}`),u||(o["Content-Type"]="application/json"),i)h=JSON.stringify(i);else if(u){h=new FormData;for(const[t,e]of Object.entries(u))e.name&&e.value?r(h,t,e.value,e.name):r(h,t,e)}for(;;){const s=await fetch(p,{method:t,body:h,headers:o});if(429===s.status){const t=1e3*parseInt(s.headers.get("Retry-After")||"1");await a(t);continue}if(409===s.status){await a(1e4);continue}const r=(null===(_=s.headers.get("Content-Type"))||void 0===_?void 0:_.includes("json"))?await s.json().catch((()=>({}))):await s.blob();if(s.ok)return r;throw new e.Exception(r.error||"No additional error message received")}}}async function s(t,e,r){if(e&&(e.hasOwnProperty("limit")||e.hasOwnProperty("offset"))){const s=await r(e);return Array.isArray(s)?s:s[t]||[]}let a=0,n=0;const i=[],u=new Set;for(;;){n=250*a++;let _=await s(t,{...e,limit:250,offset:n},r);if(_=_.filter((t=>!u.has(t.id)&&u.add(t.id))),i.push(..._),250!=_.length)break}return i}function r(t,e,s,r){if(r&&"undefined"!=typeof Blob){const a=s instanceof Blob?s:new Blob([s]);t.append(e,a,r)}else t.append(e,s,r)}function a(t){return new Promise((e=>setTimeout(e,t)))}return e.Exception=t,e})); | ||
//# sourceMappingURL=TestRail.umd.js.map |
{ | ||
"name": "@dlenroc/testrail", | ||
"description": "TestRail API client with error handling and typing", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"author": "Corneliu Duplachi", | ||
@@ -37,23 +37,22 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@faker-js/faker": "^6.0.0-alpha.7", | ||
"@types/chai": "^4.3.0", | ||
"@types/chai-as-promised": "^7.1.4", | ||
"@types/chai-as-promised": "^7.1.5", | ||
"@types/deasync": "^0.1.2", | ||
"@types/faker": "^5.5.9", | ||
"@types/glob": "^7.2.0", | ||
"@types/mocha": "^9.0.0", | ||
"@types/mocha": "^9.1.0", | ||
"@types/node": "*", | ||
"chai": "^4.3.4", | ||
"chai": "^4.3.6", | ||
"chai-as-promised": "^7.1.1", | ||
"deasync": "^0.1.24", | ||
"faker": "^5.5.3", | ||
"glob": "^7.2.0", | ||
"intermock": "^0.2.5", | ||
"mocha": "^9.1.3", | ||
"nock": "^13.2.1", | ||
"rollup": "^2.63.0", | ||
"mocha": "^9.2.1", | ||
"nock": "^13.2.4", | ||
"rollup": "^2.69.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.31.1", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.5.4" | ||
"rollup-plugin-typescript2": "^0.31.2", | ||
"ts-node": "^10.6.0", | ||
"typescript": "^4.6.2" | ||
} | ||
} |
@@ -166,2 +166,24 @@ # @dlenroc/testrail · [![NPM Version](https://img.shields.io/npm/v/@dlenroc/testrail)](https://www.npmjs.com/package/@dlenroc/testrail) [![Supported Node.js version](https://img.shields.io/node/v/@dlenroc/testrail)](https://github.com/dlenroc/node-testrail-api/actions?query=workflow%3A"Node.js+CI") | ||
### Groups | ||
```typecript | ||
getGroup(groupId: number): Promise<Group> | ||
``` | ||
```typecript | ||
getGroups(filters?: Pagination): Promise<Group[]> | ||
``` | ||
```typecript | ||
addGroup(payload: AddGroup): Promise<Group> | ||
``` | ||
```typecript | ||
updateGroup(groupId: number, payload: AddGroup): Promise<Group> | ||
``` | ||
```typecript | ||
deleteGroup(groupId: number): Promise<void> | ||
``` | ||
### Milestones | ||
@@ -189,2 +211,8 @@ | ||
### Roles | ||
```typescript | ||
getRoles(filters?: Pagination): Promise<Role[]> | ||
``` | ||
### Plans | ||
@@ -457,1 +485,9 @@ | ||
``` | ||
```typescript | ||
addUser(payload: AddUser): Promise<User> | ||
``` | ||
```typescript | ||
updateUser(userId: number, payload: AddUser): Promise<User> | ||
``` |
@@ -6,2 +6,3 @@ export * from './AddAttachment'; | ||
export * from './AddConfigGroup'; | ||
export * from './AddGroup'; | ||
export * from './AddMilestone'; | ||
@@ -21,2 +22,3 @@ export * from './AddPlan'; | ||
export * from './AddSuite'; | ||
export * from './AddUser'; | ||
export * from './CaseFilters'; | ||
@@ -23,0 +25,0 @@ export * from './CopyCasesToSection'; |
@@ -17,2 +17,3 @@ export * from './Attachment'; | ||
export * from './FieldConfig'; | ||
export * from './Group'; | ||
export * from './Milestone'; | ||
@@ -30,2 +31,3 @@ export * from './Option'; | ||
export * from './ResultField'; | ||
export * from './Role'; | ||
export * from './Run'; | ||
@@ -32,0 +34,0 @@ export * from './Section'; |
export interface Project extends Record<string, unknown> { | ||
announcement?: string; | ||
completed_on?: number; | ||
default_role_id?: number; | ||
id: number; | ||
@@ -10,2 +11,14 @@ is_completed: boolean; | ||
url: string; | ||
groups: { | ||
id: number; | ||
role: string; | ||
role_id: number; | ||
}[]; | ||
users: { | ||
id: number; | ||
global_role_id: number; | ||
global_role: string; | ||
project_role_id: number; | ||
project_role: string; | ||
}[]; | ||
} |
@@ -1,9 +0,9 @@ | ||
import { SharedStep } from "./SharedStep"; | ||
import { SharedStep } from './SharedStep'; | ||
export interface SharedStepHistory extends Record<string, unknown> { | ||
custom_steps_separated: SharedStep['custom_steps_separated']; | ||
id: number; | ||
timestamp: number; | ||
title: string; | ||
user_id: number; | ||
custom_steps_separated: SharedStep['custom_steps_separated']; | ||
id: number; | ||
timestamp: number; | ||
title: string; | ||
user_id: number; | ||
} |
export interface User extends Record<string, unknown> { | ||
assigned_projects: number[]; | ||
email: string; | ||
email_notifications: boolean; | ||
id: number; | ||
is_active: boolean; | ||
is_admin: boolean; | ||
name: string; | ||
role: string; | ||
role_id: number; | ||
group_ids: number[]; | ||
mfa_required: boolean; | ||
sso_enabled: boolean; | ||
} |
@@ -169,2 +169,26 @@ import { Request, Response } from './payload'; | ||
// Groups | ||
getGroup(groupId: number): Promise<Response.Group> { | ||
return this._api('GET', `get_group/${groupId}`); | ||
} | ||
getGroups(filters?: Request.Pagination): Promise<Response.Group[]> { | ||
return pagination('groups', filters, (filters) => { | ||
return this._api('GET', 'get_groups', { query: filters }); | ||
}); | ||
} | ||
addGroup(payload: Request.AddGroup): Promise<Response.Group> { | ||
return this._api('POST', 'add_group', { json: payload }); | ||
} | ||
updateGroup(groupId: number, payload: Request.AddGroup): Promise<Response.Group> { | ||
return this._api('POST', `update_group/${groupId}`, { json: payload }); | ||
} | ||
deleteGroup(groupId: number): Promise<void> { | ||
return this._api('POST', `delete_group/${groupId}`); | ||
} | ||
// Milestones | ||
@@ -328,2 +352,10 @@ | ||
// Roles | ||
getRoles(filters?: Request.Pagination): Promise<Response.Role[]> { | ||
return pagination('roles', filters, (filters) => { | ||
return this._api('GET', 'get_roles', { query: filters }); | ||
}); | ||
} | ||
// Runs | ||
@@ -485,2 +517,10 @@ | ||
addUser(payload: Request.AddUser): Promise<Response.User> { | ||
return this._api('POST', 'add_user', { json: payload }); | ||
} | ||
updateUser(userId: number, payload: Request.AddUser): Promise<Response.User> { | ||
return this._api('POST', `update_user/${userId}`, { json: payload }); | ||
} | ||
// Internal | ||
@@ -487,0 +527,0 @@ |
@@ -1,6 +0,6 @@ | ||
export * from "./TestRail"; | ||
export * from './TestRail'; | ||
import TestRail from "./TestRail"; | ||
import TestRail from './TestRail'; | ||
// @ts-ignore | ||
export = TestRail; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
241710
19
108
1608
491