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