예제 #1
0
        private static HttpWebResponse HttpGet(string URI, Net.OAuth.Client client, Net.OAuth.Client.Token token, uint tries)
        {
            HttpWebRequest request = null;

            try {
                request = (HttpWebRequest)WebRequest.Create(URI);

                request.Method      = "GET";
                request.ContentType = "application/x-www-form-urlencoded";
                request.Accept      = "application/json";

                Net.OAuth.Client.Sign(request, token);

                return((HttpWebResponse)request.GetResponse());
            } catch (WebException e) {
                if (e.Response == null)
                {
                    throw;
                }

                HttpStatusCode code = (e.Response as HttpWebResponse).StatusCode;

                if (code == HttpStatusCode.Unauthorized)
                {
                    throw new UnauthorizedException("Response is 401, Unauthorized.");
                }

                throw new ApiException("Response is unexpected, " + code.ToString());
            }
        }
예제 #2
0
 public V1(string URI, Net.OAuth.Client client, Net.OAuth.Client.Token token)
 {
     this.URI    = URI;
     this.client = client;
     this.token  = token;
 }
예제 #3
0
파일: V1.cs 프로젝트: Barnaff/Chromania
 public V1(string URI, Net.OAuth.Client client, Net.OAuth.Client.Token token)
 {
     this.URI = URI;
     this.client = client;
     this.token = token;
 }