示例#1
0
        /// <summary>
        /// Creates the specified UnifiedRoleEligibilityScheduleInstance using POST.
        /// </summary>
        /// <param name="unifiedRoleEligibilityScheduleInstanceToCreate">The UnifiedRoleEligibilityScheduleInstance to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created UnifiedRoleEligibilityScheduleInstance.</returns>
        public async System.Threading.Tasks.Task <UnifiedRoleEligibilityScheduleInstance> CreateAsync(UnifiedRoleEligibilityScheduleInstance unifiedRoleEligibilityScheduleInstanceToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <UnifiedRoleEligibilityScheduleInstance>(unifiedRoleEligibilityScheduleInstanceToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
示例#2
0
 /// <summary>
 /// Creates the specified UnifiedRoleEligibilityScheduleInstance using POST.
 /// </summary>
 /// <param name="unifiedRoleEligibilityScheduleInstanceToCreate">The UnifiedRoleEligibilityScheduleInstance to create.</param>
 /// <returns>The created UnifiedRoleEligibilityScheduleInstance.</returns>
 public System.Threading.Tasks.Task <UnifiedRoleEligibilityScheduleInstance> CreateAsync(UnifiedRoleEligibilityScheduleInstance unifiedRoleEligibilityScheduleInstanceToCreate)
 {
     return(this.CreateAsync(unifiedRoleEligibilityScheduleInstanceToCreate, CancellationToken.None));
 }
示例#3
0
        /// <summary>
        /// Updates the specified UnifiedRoleEligibilityScheduleInstance using PATCH.
        /// </summary>
        /// <param name="unifiedRoleEligibilityScheduleInstanceToUpdate">The UnifiedRoleEligibilityScheduleInstance 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 UnifiedRoleEligibilityScheduleInstance.</returns>
        public async System.Threading.Tasks.Task <UnifiedRoleEligibilityScheduleInstance> UpdateAsync(UnifiedRoleEligibilityScheduleInstance unifiedRoleEligibilityScheduleInstanceToUpdate, CancellationToken cancellationToken)
        {
            if (unifiedRoleEligibilityScheduleInstanceToUpdate.AdditionalData != null)
            {
                if (unifiedRoleEligibilityScheduleInstanceToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    unifiedRoleEligibilityScheduleInstanceToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, unifiedRoleEligibilityScheduleInstanceToUpdate.GetType().Name)
                    });
                }
            }
            if (unifiedRoleEligibilityScheduleInstanceToUpdate.AdditionalData != null)
            {
                if (unifiedRoleEligibilityScheduleInstanceToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    unifiedRoleEligibilityScheduleInstanceToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, unifiedRoleEligibilityScheduleInstanceToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <UnifiedRoleEligibilityScheduleInstance>(unifiedRoleEligibilityScheduleInstanceToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
示例#4
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="unifiedRoleEligibilityScheduleInstanceToInitialize">The <see cref="UnifiedRoleEligibilityScheduleInstance"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(UnifiedRoleEligibilityScheduleInstance unifiedRoleEligibilityScheduleInstanceToInitialize)
 {
 }
示例#5
0
 /// <summary>
 /// Adds the specified UnifiedRoleEligibilityScheduleInstance to the collection via POST.
 /// </summary>
 /// <param name="unifiedRoleEligibilityScheduleInstance">The UnifiedRoleEligibilityScheduleInstance to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created UnifiedRoleEligibilityScheduleInstance.</returns>
 public System.Threading.Tasks.Task <UnifiedRoleEligibilityScheduleInstance> AddAsync(UnifiedRoleEligibilityScheduleInstance unifiedRoleEligibilityScheduleInstance, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <UnifiedRoleEligibilityScheduleInstance>(unifiedRoleEligibilityScheduleInstance, cancellationToken));
 }