/// <summary> /// Updates the specified DriveItemVersion using PATCH. /// </summary> /// <param name="driveItemVersionToUpdate">The DriveItemVersion to update.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <exception cref="ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception> /// <returns>The updated DriveItemVersion.</returns> public async System.Threading.Tasks.Task <DriveItemVersion> UpdateAsync(DriveItemVersion driveItemVersionToUpdate, CancellationToken cancellationToken) { if (driveItemVersionToUpdate.AdditionalData != null) { if (driveItemVersionToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || driveItemVersionToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, driveItemVersionToUpdate.GetType().Name) }); } } if (driveItemVersionToUpdate.AdditionalData != null) { if (driveItemVersionToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || driveItemVersionToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, driveItemVersionToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <DriveItemVersion>(driveItemVersionToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Creates the specified DriveItemVersion using POST. /// </summary> /// <param name="driveItemVersionToCreate">The DriveItemVersion to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created DriveItemVersion.</returns> public async System.Threading.Tasks.Task <DriveItemVersion> CreateAsync(DriveItemVersion driveItemVersionToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <DriveItemVersion>(driveItemVersionToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Adds the specified DriveItemVersion to the collection via POST. /// </summary> /// <param name="driveItemVersion">The DriveItemVersion to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created DriveItemVersion.</returns> public System.Threading.Tasks.Task <DriveItemVersion> AddAsync(DriveItemVersion driveItemVersion, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <DriveItemVersion>(driveItemVersion, cancellationToken)); }
/// <summary> /// Adds the specified DriveItemVersion to the collection via POST. /// </summary> /// <param name="driveItemVersion">The DriveItemVersion to add.</param> /// <returns>The created DriveItemVersion.</returns> public System.Threading.Tasks.Task <DriveItemVersion> AddAsync(DriveItemVersion driveItemVersion) { return(this.AddAsync(driveItemVersion, CancellationToken.None)); }
/// <summary> /// Creates the specified DriveItemVersion using POST. /// </summary> /// <param name="driveItemVersionToCreate">The DriveItemVersion to create.</param> /// <returns>The created DriveItemVersion.</returns> public System.Threading.Tasks.Task <DriveItemVersion> CreateAsync(DriveItemVersion driveItemVersionToCreate) { return(this.CreateAsync(driveItemVersionToCreate, CancellationToken.None)); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="driveItemVersionToInitialize">The <see cref="DriveItemVersion"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(DriveItemVersion driveItemVersionToInitialize) { }