Beispiel #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());
            }
        }
Beispiel #2
0
 public V1(string URI, Net.OAuth.Client client, Net.OAuth.Client.Token token)
 {
     this.URI    = URI;
     this.client = client;
     this.token  = token;
 }
Beispiel #3
0
 public V1(string URI, Net.OAuth.Client client, Net.OAuth.Client.Token token)
 {
     this.URI = URI;
     this.client = client;
     this.token = token;
 }