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