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