/// <summary> /// Get the specific issue by ID /// </summary> /// <param name="sync"></param> /// <param name="id"></param> /// <returns></returns> public static GitLabIssue getSpecificIssue(string externalProject, DataSync sync, int id) { string url = sync.apiUrl + "/projects/" + sync.connectionString + "%2F" + externalProject + "/issues/" + id; //perform the GET request Response response = httpGET(url, sync.externalPassword); GitLabIssue issue = JsonConvert.DeserializeObject <GitLabIssue>(response.body); return(issue); }
/// <summary> /// Get the comments on a specific GitLab issue /// </summary> /// <param name="issue"></param> /// <param name="connectionString"></param> /// <param name="externalLogin"></param> /// <param name="externalPassword"></param> /// <returns></returns> public static List <GitLabComment> GetGitLabComments(string externalProject, DataSync sync, GitLabIssue issue) { List <GitLabComment> comments = new List <GitLabComment>(); string url = sync.apiUrl + "/projects/" + sync.connectionString + "%2F" + externalProject + "/issues/" + issue.IId + "/notes"; //go through all of the comments pages while (url != null) { Response httpResponse = httpGET(url, sync.externalPassword); List <GitLabComment> newComments = JsonConvert.DeserializeObject <List <GitLabComment> >(httpResponse.body); comments.AddRange(newComments); url = nextUrl(httpResponse.headers); } return(comments); }
/// <summary> /// Set the milestone of the issue in GitLab /// </summary> /// <param name="sync"></param> /// <param name="issue"></param> /// <param name="milestone"></param> public static void setGitLabIssueMilestone(string externalProject, DataSync sync, GitLabIssue issue, GitLabMilestone milestone) { string url = sync.apiUrl + "/projects/" + sync.connectionString + "%2F" + externalProject + "/issues/" + issue.IId + "?milestone_id=" + milestone.globalId; httpPUT(url, sync.externalPassword); }
/// <summary> /// Sets the status of the issue in GitLab to either open or closed /// </summary> /// <param name="sync"></param> /// <param name="issue"></param> public static void setGitLabIssueStatus(string externalProject, DataSync sync, GitLabIssue issue, string status) { string state = status; if (status == "opened") { state = "reopen"; } if (status == "closed") { state = "close"; } string url = sync.apiUrl + "/projects/" + sync.connectionString + "%2F" + externalProject + "/issues/" + issue.IId + "?state_event=" + state; httpPUT(url, sync.externalPassword); }