Exemple #1
0
        private HttpRequestMessage AddAuth(HttpRequestMessage request)
        {
            if (OAuthResponse == null)
            {
                request.AddParameter("client_id", InstagramConfig.ClientId);
            }
            else
            {
                request.AddParameter("access_token", OAuthResponse.Access_Token);
            }

            return request;
        }
Exemple #2
0
        public Task<OAuthResponse> RequestToken(string code)
        {
            HttpClient client = new HttpClient { BaseAddress = new Uri(_config.OAuthURI) };
            var request = new HttpRequestMessage(HttpMethod.Post, "access_token");

            request.AddParameter("client_id", _config.ClientId);
            request.AddParameter("client_secret", _config.ClientSecret);
            request.AddParameter("grant_type", "authorization_code");
            request.AddParameter("redirect_uri", _config.RedirectURI);
            request.AddParameter("code", code);

            return client.ExecuteAsync<OAuthResponse>(request);
        }
        public Task<SubscriptionsResponse> Create(Object type, Aspect aspect)
        {
            // create a new guid that uniquely identifies this subscription request
            var verifyToken = Guid.NewGuid().ToString();
            var request = new HttpRequestMessage {Method = HttpMethod.Post};

            request.AddParameter("client_id", config.ClientId);
            request.AddParameter("client_secret", config.ClientSecret);
            request.AddParameter("object", type.ToString().ToLower());
            request.AddParameter("aspect", aspect.ToString().ToLower());
            request.AddParameter("verify_token", verifyToken);
            request.AddParameter("callback_url", config.CallbackUri);

            return client.ExecuteAsync<SubscriptionsResponse>(request);
        }
Exemple #4
0
        private HttpRequestMessage CreateSubscriptionBase()
        {
            // create a new guid that uniquely identifies this subscription request
            var verifyToken = Guid.NewGuid().ToString(); // might need to record this somewhere??
            var request = new HttpRequestMessage { Method = HttpMethod.Post };
            request.RequestUri = new Uri("https://api.instagram.com/v1/subscriptions/");

            request.AddParameter("verify_token", verifyToken);
            request.AddParameter("client_id", config.ClientId);
            request.AddParameter("client_secret", config.ClientSecret);

            return request;
        }
Exemple #5
0
        public Task<SubscriptionResponse> DeleteSubscription(string id)
        {
            var request = new HttpRequestMessage { Method = HttpMethod.Delete };
            request.RequestUri = new Uri("https://api.instagram.com/v1/subscriptions/");

            request.AddParameter("id", id);
            if (id.ToCharArray().All(Char.IsDigit))
                request.AddParameter("object", "geography");
            else
                request.AddParameter("object", "tag");
            request.AddParameter("client_id", config.ClientId);
            request.AddParameter("client_secret", config.ClientSecret);
            

            return client.ExecuteAsync<SubscriptionResponse>(request);

        }
Exemple #6
0
        public Task<SubscriptionResponse> DeleteAllSubscriptions()
        {
            var request = new HttpRequestMessage { Method = HttpMethod.Delete };
            request.RequestUri = new Uri("https://api.instagram.com/v1/subscriptions/");

            request.AddParameter("client_id", config.ClientId);
            request.AddParameter("client_secret", config.ClientSecret);
            request.AddParameter("object", "all");

            return client.ExecuteAsync<SubscriptionResponse>(request);

        }
Exemple #7
-1
        internal override HttpRequestMessage AddAuth(HttpRequestMessage request)
        {
            request.AddParameter("client_id", InstagramConfig.ClientId);
            request.AddParameter("client_secret", InstagramConfig.ClientSecret);

            return request;
        }
Exemple #8
-1
        public Task<SubscriptionsResponse> List()
        {
            var request = new HttpRequestMessage { Method = HttpMethod.Get };
            request.RequestUri = new Uri(config.RealTimeApi);

            request.AddParameter("client_id", config.ClientId);
            request.AddParameter("client_secret", config.ClientSecret);

            return client.ExecuteAsync<SubscriptionsResponse>(request);
        }