public static OAuth2Token Get(Authentication.Crendentials credentials) { string format = "\"client_secret\": \"{0}\", \"scopes\": [ \"repo\" ], \"note\": \"{1}\""; string client_id = "a1178c3ffdfd1adea560"; string client_secret = "acf7e9e80eab5f238271ad8a2e0863025ad326ba"; string note = "TrakHound"; string note_url = "http://www.trakhound.com"; string data = string.Format(format, client_secret, note, note_url); data = "{" + data + "}"; var postData = new HTTP.PostContentData("parameters", data, "application/json"); var postDatas = new HTTP.PostContentData[1]; postDatas[0] = postData; var headers = new HTTP.HeaderData[1]; headers[0] = Authentication.GetBasicHeader(credentials); string response = HTTP.PUT(Authentication.AUTHENTICATION_URL + "/clients/" + client_id, postDatas, headers, "TrakHound"); return(Parse(response)); }
public static void Create(string repositoryUrl, Issue issue, Authentication.Crendentials credentials) { string format = "\"title\": \"{0}\", \"body\": \"{1}\""; string body = ComposeBody(issue); string data = string.Format(format, issue.Title, body); data = "{ " + data + " }"; var postData = new HTTP.PostContentData("parameters", data, "application/json"); var postDatas = new HTTP.PostContentData[1]; postDatas[0] = postData; var headers = new HTTP.HeaderData[1]; HTTP.POST(repositoryUrl, postDatas, headers, "TrakHound"); }
public static bool Create(string repositoryUrl, Issue issue, HTTP.HeaderData loginHeader) { string format = "\"title\": \"{0}\", \"body\": \"{1}\""; string body = ComposeBody(issue); string data = string.Format(format, issue.Title, body); data = "{ " + data + " }"; var postData = new HTTP.PostContentData("parameters", data, "application/json"); var postDatas = new HTTP.PostContentData[1]; postDatas[0] = postData; var headers = new HTTP.HeaderData[1]; headers[0] = loginHeader; return(!string.IsNullOrEmpty(HTTP.POST(repositoryUrl, postDatas, headers, "TrakHound"))); }