Esempio n. 1
0
        public List <ImgurAlbumData> GetAlbums()
        {
            if (CheckAuthorization())
            {
                NameValueCollection headers = new NameValueCollection();
                headers.Add("Authorization", "Bearer " + AuthInfo.Token.access_token);
                string response = SendRequest(HttpMethod.GET, "https://api.imgur.com/3/account/me/albums", null, ResponseType.Text, headers, null);

                if (!string.IsNullOrEmpty(response))
                {
                    ImgurAlbums albums = JsonConvert.DeserializeObject <ImgurAlbums>(response);

                    if (albums != null)
                    {
                        if (albums.success)
                        {
                            return(albums.data);
                        }

                        Errors.Add("Imgur albums failed. Status code: " + albums.status);
                    }
                }
            }

            return(null);
        }
Esempio n. 2
0
        public List <ImgurAlbumData> GetAlbums()
        {
            if (CheckAuthorization())
            {
                string response = SendRequest(HttpMethod.GET, "https://api.imgur.com/3/account/me/albums", headers: GetAuthHeaders());

                if (!string.IsNullOrEmpty(response))
                {
                    ImgurAlbums albums = JsonConvert.DeserializeObject <ImgurAlbums>(response);

                    if (albums != null)
                    {
                        if (albums.success)
                        {
                            return(albums.data);
                        }

                        Errors.Add("Imgur albums failed. Status code: " + albums.status);
                    }
                }
            }

            return(null);
        }