/// <summary>
 /// Adds the specified DeviceManagementTroubleshootingEvent to the collection via POST.
 /// </summary>
 /// <param name="deviceManagementTroubleshootingEvent">The DeviceManagementTroubleshootingEvent to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created DeviceManagementTroubleshootingEvent.</returns>
 public System.Threading.Tasks.Task <DeviceManagementTroubleshootingEvent> AddAsync(DeviceManagementTroubleshootingEvent deviceManagementTroubleshootingEvent, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <DeviceManagementTroubleshootingEvent>(deviceManagementTroubleshootingEvent, cancellationToken));
 }
 /// <summary>
 /// Adds the specified DeviceManagementTroubleshootingEvent to the collection via POST.
 /// </summary>
 /// <param name="deviceManagementTroubleshootingEvent">The DeviceManagementTroubleshootingEvent to add.</param>
 /// <returns>The created DeviceManagementTroubleshootingEvent.</returns>
 public System.Threading.Tasks.Task <DeviceManagementTroubleshootingEvent> AddAsync(DeviceManagementTroubleshootingEvent deviceManagementTroubleshootingEvent)
 {
     return(this.AddAsync(deviceManagementTroubleshootingEvent, CancellationToken.None));
 }
Пример #3
0
        /// <summary>
        /// Creates the specified DeviceManagementTroubleshootingEvent using POST.
        /// </summary>
        /// <param name="deviceManagementTroubleshootingEventToCreate">The DeviceManagementTroubleshootingEvent to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created DeviceManagementTroubleshootingEvent.</returns>
        public async System.Threading.Tasks.Task <DeviceManagementTroubleshootingEvent> CreateAsync(DeviceManagementTroubleshootingEvent deviceManagementTroubleshootingEventToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <DeviceManagementTroubleshootingEvent>(deviceManagementTroubleshootingEventToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Пример #6
0
 /// <summary>
 /// Updates the specified DeviceManagementTroubleshootingEvent using PATCH.
 /// </summary>
 /// <param name="deviceManagementTroubleshootingEventToUpdate">The DeviceManagementTroubleshootingEvent to update.</param>
 /// <returns>The updated DeviceManagementTroubleshootingEvent.</returns>
 public System.Threading.Tasks.Task <DeviceManagementTroubleshootingEvent> UpdateAsync(DeviceManagementTroubleshootingEvent deviceManagementTroubleshootingEventToUpdate)
 {
     return(this.UpdateAsync(deviceManagementTroubleshootingEventToUpdate, CancellationToken.None));
 }