/// <summary> /// Get a list of users who have liked this media. /// Required scope: likes /// </summary> /// <returns>JSON result string.</returns> public async Task <string> GetMediaLikesAsync(string mediaId) { using (HttpClient httpClient = new HttpClient()) { var response = await httpClient.GetAsync(LikeEndpointsUrlsFactory.CreateGETLikeUrl(mediaId, this.accessToken)); string responseContent = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { return(responseContent); } else { throw new InstagramAPIException(responseContent); } } }
/// <summary> /// Get a list of users who have liked this media. /// Required scope: likes /// </summary> /// <param name="accessToken" type="string"> /// <para> /// A valid access token. /// </para> /// </param> /// <returns>JSON result string.</returns> public async Task<string> GetMediaLikesAsync(string mediaId, string accessToken) { using (HttpClient httpClient = new HttpClient()) { Uri uri = LikeEndpointsUrlsFactory.CreateGETLikeUrl(mediaId, accessToken); if (this.EnforceSignedRequests) { uri = uri.AddParameter("sig", Utilities.GenerateSig(string.Format(InstagramAPIEndpoints.LikesEndpoint, mediaId), 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); } } }