Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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");
        }