Esempio n. 1
0
 /// <summary>
 /// Adds the specified DeviceManagementScriptGroupAssignment to the collection via POST.
 /// </summary>
 /// <param name="deviceManagementScriptGroupAssignment">The DeviceManagementScriptGroupAssignment to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created DeviceManagementScriptGroupAssignment.</returns>
 public System.Threading.Tasks.Task <DeviceManagementScriptGroupAssignment> AddAsync(DeviceManagementScriptGroupAssignment deviceManagementScriptGroupAssignment, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <DeviceManagementScriptGroupAssignment>(deviceManagementScriptGroupAssignment, cancellationToken));
 }
Esempio n. 2
0
 /// <summary>
 /// Adds the specified DeviceManagementScriptGroupAssignment to the collection via POST.
 /// </summary>
 /// <param name="deviceManagementScriptGroupAssignment">The DeviceManagementScriptGroupAssignment to add.</param>
 /// <returns>The created DeviceManagementScriptGroupAssignment.</returns>
 public System.Threading.Tasks.Task <DeviceManagementScriptGroupAssignment> AddAsync(DeviceManagementScriptGroupAssignment deviceManagementScriptGroupAssignment)
 {
     return(this.AddAsync(deviceManagementScriptGroupAssignment, CancellationToken.None));
 }
        /// <summary>
        /// Creates the specified DeviceManagementScriptGroupAssignment using POST.
        /// </summary>
        /// <param name="deviceManagementScriptGroupAssignmentToCreate">The DeviceManagementScriptGroupAssignment to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created DeviceManagementScriptGroupAssignment.</returns>
        public async System.Threading.Tasks.Task <DeviceManagementScriptGroupAssignment> CreateAsync(DeviceManagementScriptGroupAssignment deviceManagementScriptGroupAssignmentToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <DeviceManagementScriptGroupAssignment>(deviceManagementScriptGroupAssignmentToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
 /// <summary>
 /// Updates the specified DeviceManagementScriptGroupAssignment using PATCH.
 /// </summary>
 /// <param name="deviceManagementScriptGroupAssignmentToUpdate">The DeviceManagementScriptGroupAssignment to update.</param>
 /// <returns>The updated DeviceManagementScriptGroupAssignment.</returns>
 public System.Threading.Tasks.Task <DeviceManagementScriptGroupAssignment> UpdateAsync(DeviceManagementScriptGroupAssignment deviceManagementScriptGroupAssignmentToUpdate)
 {
     return(this.UpdateAsync(deviceManagementScriptGroupAssignmentToUpdate, CancellationToken.None));
 }