Exemple #1
0
        public GooglePhotosAlbum CreateAlbum(string albumName)
        {
            GooglePhotosNewAlbum newItemAlbum = new GooglePhotosNewAlbum
            {
                album = new GooglePhotosAlbum
                {
                    title = albumName
                }
            };

            string serializedNewItemAlbum         = JsonConvert.SerializeObject(newItemAlbum);
            string serializedNewItemAlbumResponse = SendRequest(HttpMethod.POST, "https://photoslibrary.googleapis.com/v1/albums", serializedNewItemAlbum, headers: GoogleAuth.GetAuthHeaders(), contentType: UploadHelpers.ContentTypeJSON);

            GooglePhotosAlbum newItemAlbumResponse = JsonConvert.DeserializeObject <GooglePhotosAlbum>(serializedNewItemAlbumResponse);

            return(newItemAlbumResponse);
        }
        public GooglePhotosAlbum CreateAlbum(string albumName)
        {
            GooglePhotosNewAlbum newItemAlbum = new GooglePhotosNewAlbum
            {
                album = new GooglePhotosAlbum
                {
                    title = albumName
                }
            };

            Dictionary <string, string> newItemAlbumArgs = new Dictionary <string, string>
            {
                { "fields", "id" }
            };

            string            serializedNewItemAlbum         = JsonConvert.SerializeObject(newItemAlbum);
            string            serializedNewItemAlbumResponse = SendRequest(HttpMethod.POST, "https://photoslibrary.googleapis.com/v1/albums", serializedNewItemAlbum, RequestHelpers.ContentTypeJSON, newItemAlbumArgs, GoogleAuth.GetAuthHeaders());
            GooglePhotosAlbum newItemAlbumResponse           = JsonConvert.DeserializeObject <GooglePhotosAlbum>(serializedNewItemAlbumResponse);

            return(newItemAlbumResponse);
        }