/// <summary> /// Updates the specified MobileApp using PATCH. /// </summary> /// <param name="mobileAppToUpdate">The MobileApp 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 MobileApp.</returns> public async System.Threading.Tasks.Task <MobileApp> UpdateAsync(MobileApp mobileAppToUpdate, CancellationToken cancellationToken) { if (mobileAppToUpdate.AdditionalData != null) { if (mobileAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || mobileAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, mobileAppToUpdate.GetType().Name) }); } } if (mobileAppToUpdate.AdditionalData != null) { if (mobileAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || mobileAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, mobileAppToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <MobileApp>(mobileAppToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Adds the specified MobileApp to the collection via POST. /// </summary> /// <param name="mobileApp">The MobileApp to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created MobileApp.</returns> public System.Threading.Tasks.Task <MobileApp> AddAsync(MobileApp mobileApp, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; mobileApp.ODataType = string.Concat("#", StringHelper.ConvertTypeToLowerCamelCase(mobileApp.GetType().FullName)); return(this.SendAsync <MobileApp>(mobileApp, cancellationToken)); }