/// <summary> /// Updates the specified DimensionValue using PATCH. /// </summary> /// <param name="dimensionValueToUpdate">The DimensionValue 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 DimensionValue.</returns> public async System.Threading.Tasks.Task <DimensionValue> UpdateAsync(DimensionValue dimensionValueToUpdate, CancellationToken cancellationToken) { if (dimensionValueToUpdate.AdditionalData != null) { if (dimensionValueToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || dimensionValueToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, dimensionValueToUpdate.GetType().Name) }); } } if (dimensionValueToUpdate.AdditionalData != null) { if (dimensionValueToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || dimensionValueToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, dimensionValueToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <DimensionValue>(dimensionValueToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Creates the specified DimensionValue using POST. /// </summary> /// <param name="dimensionValueToCreate">The DimensionValue to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created DimensionValue.</returns> public async System.Threading.Tasks.Task <DimensionValue> CreateAsync(DimensionValue dimensionValueToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <DimensionValue>(dimensionValueToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Creates the specified DimensionValue using POST. /// </summary> /// <param name="dimensionValueToCreate">The DimensionValue to create.</param> /// <returns>The created DimensionValue.</returns> public System.Threading.Tasks.Task <DimensionValue> CreateAsync(DimensionValue dimensionValueToCreate) { return(this.CreateAsync(dimensionValueToCreate, CancellationToken.None)); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="dimensionValueToInitialize">The <see cref="DimensionValue"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(DimensionValue dimensionValueToInitialize) { }
/// <summary> /// Adds the specified DimensionValue to the collection via POST. /// </summary> /// <param name="dimensionValue">The DimensionValue to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created DimensionValue.</returns> public System.Threading.Tasks.Task <DimensionValue> AddAsync(DimensionValue dimensionValue, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <DimensionValue>(dimensionValue, cancellationToken)); }
/// <summary> /// Adds the specified DimensionValue to the collection via POST. /// </summary> /// <param name="dimensionValue">The DimensionValue to add.</param> /// <returns>The created DimensionValue.</returns> public System.Threading.Tasks.Task <DimensionValue> AddAsync(DimensionValue dimensionValue) { return(this.AddAsync(dimensionValue, CancellationToken.None)); }