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

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

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