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