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

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }