Ejemplo n.º 1
0
 /// <summary>
 /// Create Issue in GitHub repo
 /// </summary>
 public IRestResponse CreateIssue(string issueTitle)
 {
     try
     {
         StringBuilder endPoint = new StringBuilder("/repos/" + gitHubUser + "/" + repoName + "/issues");
         _restRequest = new RestRequest(endPoint.ToString(), Method.POST);
         _restRequest.Parameters.Clear();
         _restRequest.AddHeader("Accept", "application/json");
         _restRequest.AddHeader("Authorization", "token " + authToken);
         JObject body = jsonUtil.GetJSONObjectFromFile("createIssue");
         body["title"] = issueTitle;
         _restRequest.RequestFormat = DataFormat.Json;
         _restRequest.AddParameter("Application/Json", body, ParameterType.RequestBody);
         response = _restClient.Execute(_restRequest);
         if (response.StatusCode.ToString() == "Created")
         {
             return(response);
         }
     }
     catch (Exception e)
     {
         Log.Info(e.ToString());
     }
     return(null);
 }