/// <summary>
 /// Creates the specified Drive using PUT.
 /// </summary>
 /// <param name="drive">The Drive to create.</param>
 /// <returns>The created Drive.</returns>
 public async Task<Drive> CreateAsync(Drive drive)
 {
     this.ContentType = "application/json";
     this.Method = "PUT";
     var entity = await this.SendAsync<Drive>(drive);
     this.InitializeCollectionProperties(entity);
     return entity;
 }
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="drive">The <see cref="Drive"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(Drive drive)
        {
        
            if (drive != null && drive.AdditionalData != null)
            {
        
                if (drive.Items != null && drive.Items.CurrentPage != null)
                {
                    drive.Items.AdditionalData = drive.AdditionalData;

                    object nextPageLink;
                    drive.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        drive.Items.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
        
                if (drive.Shared != null && drive.Shared.CurrentPage != null)
                {
                    drive.Shared.AdditionalData = drive.AdditionalData;

                    object nextPageLink;
                    drive.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        drive.Shared.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
        
                if (drive.Special != null && drive.Special.CurrentPage != null)
                {
                    drive.Special.AdditionalData = drive.AdditionalData;

                    object nextPageLink;
                    drive.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        drive.Special.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
        
            }

        
        }
Пример #3
0
 /// <summary>
 /// Adds the specified Drive to the collection via POST.
 /// </summary>
 /// <param name="drive">The Drive to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created Drive.</returns>
 public System.Threading.Tasks.Task <Drive> AddAsync(Drive drive, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <Drive>(drive, cancellationToken));
 }
Пример #4
0
 /// <summary>
 /// Creates the specified Drive using PUT.
 /// </summary>
 /// <param name="driveToCreate">The Drive to create.</param>
 /// <returns>The created Drive.</returns>
 public System.Threading.Tasks.Task <Drive> CreateAsync(Drive driveToCreate)
 {
     return(this.CreateAsync(driveToCreate, CancellationToken.None));
 }
Пример #5
0
 /// <summary>
 /// Adds the specified Drive to the collection via POST.
 /// </summary>
 /// <param name="drive">The Drive to add.</param>
 /// <returns>The created Drive.</returns>
 public System.Threading.Tasks.Task <Drive> AddAsync(Drive drive)
 {
     return(this.AddAsync(drive, CancellationToken.None));
 }