The ID or URL-encoded path of the project owned by the authenticated user
async
(params, auths) => {
}
var queryString = "";
var growQueryString = function(param_name,param_value,current_query_string){
var new_query_string = '';
if (current_query_string.indexOf('?') > -1){
new_query_string = current_query_string+"&"+param_name+"="+param_value;
} else {
new_query_string = "?"+param_name+"="+param_value;
}
return new_query_string;
};
var growQueryString2 = function(param_name,param_value,current_query_string){
var new_query_string = '';
if (current_query_string.indexOf('?') > -1){
new_query_string = current_query_string+"&&"+param_name+"="+param_value;
} else {
new_query_string = "?"+param_name+"="+param_value;
}
return new_query_string;
};
if(params.iids){
var iids = JSON.parse(params.iids)
for(var i=0; i<iids.length; i++){
queryString = growQueryString2("iids[]",iids[i],queryString);
}
}
if(params.state){
queryString = growQueryString("state",params.state,queryString);
}
if(params.labels){
queryString = growQueryString("labels",params.labels,queryString);
}
if(params.with_labels_details){
queryString = growQueryString("with_labels_details",params.with_labels_details,queryString);
}
if(params.milestone){
queryString = growQueryString("milestone",params.milestone,queryString);
}
if(params.scope){
queryString = growQueryString("scope",params.scope,queryString);
}
if(params.author_id){
queryString = growQueryString("author_id",params.author_id,queryString);
}
if(params.author_username){
queryString = growQueryString("author_username",params.author_username,queryString);
}
if(params.assignee_id){
queryString = growQueryString("assignee_id",params.assignee_id,queryString);
}
if(params.assignee_username){
try{
//Gitlab Community Edition uses a single element array
var assignee_username_array = JSON.parse(params.assignee_username);
queryString = growQueryString("assignee_username",assignee_username_array[0],queryString);
}catch(err){
//Gitlab Enterprise uses plain string
queryString = growQueryString("assignee_username",params.assignee_username,queryString);
}
}
if(params.my_reaction_emoji){
queryString = growQueryString("my_reaction_emoji",params.my_reaction_emoji,queryString);
}
if(params.weight ){
queryString = growQueryString("weight",params.weight,queryString);
}
if(params.order_by){
queryString = growQueryString("order_by",params.order_by,queryString);
}
if(params.sort){
queryString = growQueryString("sort",params.sort,queryString);
}
if(params.search){
queryString = growQueryString("search",params.search,queryString);
}
if(params.search_in){
queryString = growQueryString("in",params.search_in,queryString);
}
if(params.created_after){
queryString = growQueryString("created_after",params.created_after,queryString);
}
if(params.created_before){
queryString = growQueryString("created_before",params.created_before,queryString);
}
if(params.updated_after){
queryString = growQueryString("updated_after",params.updated_after,queryString);
}
if(params.updated_before){
queryString = growQueryString("updated_before",params.updated_before,queryString);
}
if(params.confidential){
queryString = growQueryString("confidential",params.confidential,queryString);
}
if(params.not){
queryString = growQueryString("not",params.not,queryString);
}
const request = require("request");
const request_promise = require("request-promise");
try{
this.resp = await request_promise({
uri: `https://gitlab.com/api/v4/projects/${params.id}/issues${queryString}`,
headers: {
Authorization: `Bearer ${auths.gitlab.oauth_access_token}`
}
});
}catch(err){
this.err = err;
}