Esempio n. 1
0
        /// <summary>
        /// Updates the specified ManagedMobileApp using PATCH.
        /// </summary>
        /// <param name="managedMobileAppToUpdate">The ManagedMobileApp 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 ManagedMobileApp.</returns>
        public async System.Threading.Tasks.Task <ManagedMobileApp> UpdateAsync(ManagedMobileApp managedMobileAppToUpdate, CancellationToken cancellationToken)
        {
            if (managedMobileAppToUpdate.AdditionalData != null)
            {
                if (managedMobileAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    managedMobileAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, managedMobileAppToUpdate.GetType().Name)
                    });
                }
            }
            if (managedMobileAppToUpdate.AdditionalData != null)
            {
                if (managedMobileAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    managedMobileAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, managedMobileAppToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <ManagedMobileApp>(managedMobileAppToUpdate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Esempio n. 3
0
 /// <summary>
 /// Adds the specified ManagedMobileApp to the collection via POST.
 /// </summary>
 /// <param name="managedMobileApp">The ManagedMobileApp to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created ManagedMobileApp.</returns>
 public System.Threading.Tasks.Task <ManagedMobileApp> AddAsync(ManagedMobileApp managedMobileApp, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <ManagedMobileApp>(managedMobileApp, cancellationToken));
 }
Esempio n. 4
0
 /// <summary>
 /// Adds the specified ManagedMobileApp to the collection via POST.
 /// </summary>
 /// <param name="managedMobileApp">The ManagedMobileApp to add.</param>
 /// <returns>The created ManagedMobileApp.</returns>
 public System.Threading.Tasks.Task <ManagedMobileApp> AddAsync(ManagedMobileApp managedMobileApp)
 {
     return(this.AddAsync(managedMobileApp, CancellationToken.None));
 }
 /// <summary>
 /// Creates the specified ManagedMobileApp using POST.
 /// </summary>
 /// <param name="managedMobileAppToCreate">The ManagedMobileApp to create.</param>
 /// <returns>The created ManagedMobileApp.</returns>
 public System.Threading.Tasks.Task <ManagedMobileApp> CreateAsync(ManagedMobileApp managedMobileAppToCreate)
 {
     return(this.CreateAsync(managedMobileAppToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="managedMobileAppToInitialize">The <see cref="ManagedMobileApp"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(ManagedMobileApp managedMobileAppToInitialize)
 {
 }