Ejemplo n.º 1
0
        /// <summary>
        /// List the users who have requested this user's permission to follow.
        /// Required scope: relationships.
        /// </summary>
        /// <returns>JSON result string.</returns>
        public async Task <string> GetRequestedByAsync()
        {
            using (HttpClient httpClient = new HttpClient())
            {
                var response = await httpClient.GetAsync(RelationshipEndpointUrlsFactory.CreateRequestedByUrl(this.accessToken));

                string responseContent = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                {
                    return(responseContent);
                }
                else
                {
                    throw new InstagramAPIException(responseContent);
                }
            }
        }
        /// <summary>
        /// List the users who have requested this user's permission to follow.
        /// Required scope: relationships.
        /// </summary>
        /// <returns>JSON result string.</returns>
        public async Task <string> GetRequestedByAsync(string accessToken)
        {
            using (HttpClient httpClient = new HttpClient())
            {
                Uri uri = RelationshipEndpointUrlsFactory.CreateRequestedByUrl(accessToken);
                if (this.EnforceSignedRequests)
                {
                    uri = uri.AddParameter("sig", Utilities.GenerateSig(InstagramAPIEndpoints.RequestedByEndpoint, this.ClientSecret, uri.Query));
                }
                var response = await httpClient.GetAsync(uri);

                string responseContent = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                {
                    return(responseContent);
                }
                else
                {
                    throw new InstagramAPIException(responseContent);
                }
            }
        }