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