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