/// <summary>
        /// Updates the specified SkillProficiency using PATCH.
        /// </summary>
        /// <param name="skillProficiencyToUpdate">The SkillProficiency 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 SkillProficiency.</returns>
        public async System.Threading.Tasks.Task <SkillProficiency> UpdateAsync(SkillProficiency skillProficiencyToUpdate, CancellationToken cancellationToken)
        {
            if (skillProficiencyToUpdate.AdditionalData != null)
            {
                if (skillProficiencyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    skillProficiencyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, skillProficiencyToUpdate.GetType().Name)
                    });
                }
            }
            if (skillProficiencyToUpdate.AdditionalData != null)
            {
                if (skillProficiencyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    skillProficiencyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, skillProficiencyToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <SkillProficiency>(skillProficiencyToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
        /// <summary>
        /// Creates the specified SkillProficiency using POST.
        /// </summary>
        /// <param name="skillProficiencyToCreate">The SkillProficiency to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created SkillProficiency.</returns>
        public async System.Threading.Tasks.Task <SkillProficiency> CreateAsync(SkillProficiency skillProficiencyToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <SkillProficiency>(skillProficiencyToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
예제 #3
0
 /// <summary>
 /// Adds the specified SkillProficiency to the collection via POST.
 /// </summary>
 /// <param name="skillProficiency">The SkillProficiency to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created SkillProficiency.</returns>
 public System.Threading.Tasks.Task <SkillProficiency> AddAsync(SkillProficiency skillProficiency, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <SkillProficiency>(skillProficiency, cancellationToken));
 }
예제 #4
0
 /// <summary>
 /// Adds the specified SkillProficiency to the collection via POST.
 /// </summary>
 /// <param name="skillProficiency">The SkillProficiency to add.</param>
 /// <returns>The created SkillProficiency.</returns>
 public System.Threading.Tasks.Task <SkillProficiency> AddAsync(SkillProficiency skillProficiency)
 {
     return(this.AddAsync(skillProficiency, CancellationToken.None));
 }
 /// <summary>
 /// Creates the specified SkillProficiency using POST.
 /// </summary>
 /// <param name="skillProficiencyToCreate">The SkillProficiency to create.</param>
 /// <returns>The created SkillProficiency.</returns>
 public System.Threading.Tasks.Task <SkillProficiency> CreateAsync(SkillProficiency skillProficiencyToCreate)
 {
     return(this.CreateAsync(skillProficiencyToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="skillProficiencyToInitialize">The <see cref="SkillProficiency"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(SkillProficiency skillProficiencyToInitialize)
 {
 }