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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Beispiel #3
0
 /// <summary>
 /// Updates the specified MobileThreatDefenseConnector using PATCH.
 /// </summary>
 /// <param name="mobileThreatDefenseConnectorToUpdate">The MobileThreatDefenseConnector to update.</param>
 /// <returns>The updated MobileThreatDefenseConnector.</returns>
 public System.Threading.Tasks.Task <MobileThreatDefenseConnector> UpdateAsync(MobileThreatDefenseConnector mobileThreatDefenseConnectorToUpdate)
 {
     return(this.UpdateAsync(mobileThreatDefenseConnectorToUpdate, CancellationToken.None));
 }
 /// <summary>
 /// Adds the specified MobileThreatDefenseConnector to the collection via POST.
 /// </summary>
 /// <param name="mobileThreatDefenseConnector">The MobileThreatDefenseConnector to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created MobileThreatDefenseConnector.</returns>
 public System.Threading.Tasks.Task <MobileThreatDefenseConnector> AddAsync(MobileThreatDefenseConnector mobileThreatDefenseConnector, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <MobileThreatDefenseConnector>(mobileThreatDefenseConnector, cancellationToken));
 }
 /// <summary>
 /// Adds the specified MobileThreatDefenseConnector to the collection via POST.
 /// </summary>
 /// <param name="mobileThreatDefenseConnector">The MobileThreatDefenseConnector to add.</param>
 /// <returns>The created MobileThreatDefenseConnector.</returns>
 public System.Threading.Tasks.Task <MobileThreatDefenseConnector> AddAsync(MobileThreatDefenseConnector mobileThreatDefenseConnector)
 {
     return(this.AddAsync(mobileThreatDefenseConnector, CancellationToken.None));
 }
Beispiel #6
0
        /// <summary>
        /// Creates the specified MobileThreatDefenseConnector using POST.
        /// </summary>
        /// <param name="mobileThreatDefenseConnectorToCreate">The MobileThreatDefenseConnector to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created MobileThreatDefenseConnector.</returns>
        public async System.Threading.Tasks.Task <MobileThreatDefenseConnector> CreateAsync(MobileThreatDefenseConnector mobileThreatDefenseConnectorToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <MobileThreatDefenseConnector>(mobileThreatDefenseConnectorToCreate, cancellationToken).ConfigureAwait(false);

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