Пример #1
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="driveToInitialize">The <see cref="Drive"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(Drive driveToInitialize)
        {
            if (driveToInitialize != null && driveToInitialize.AdditionalData != null)
            {
                if (driveToInitialize.Items != null && driveToInitialize.Items.CurrentPage != null)
                {
                    driveToInitialize.Items.AdditionalData = driveToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        driveToInitialize.Items.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                if (driveToInitialize.Special != null && driveToInitialize.Special.CurrentPage != null)
                {
                    driveToInitialize.Special.AdditionalData = driveToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        driveToInitialize.Special.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
Пример #2
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));
 }
Пример #3
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));
 }
Пример #4
0
 /// <summary>
 /// Creates the specified Drive using POST.
 /// </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>
 /// Creates the specified Drive using PUT.
 /// </summary>
 /// <param name="driveToCreate">The Drive to create.</param>
 /// <returns>The created Drive.</returns>
 public Task <Drive> CreateAsync(Drive driveToCreate)
 {
     return(this.CreateAsync(driveToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Updates the specified Drive using PATCH.
 /// </summary>
 /// <param name="driveToUpdate">The Drive to update.</param>
 /// <returns>The updated Drive.</returns>
 public System.Threading.Tasks.Task<Drive> UpdateAsync(Drive driveToUpdate)
 {
     return this.UpdateAsync(driveToUpdate, CancellationToken.None);
 }