Ejemplo n.º 1
0
 /// <summary>
 /// Adds the specified MobileContainedApp to the collection via POST.
 /// </summary>
 /// <param name="mobileContainedApp">The MobileContainedApp to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created MobileContainedApp.</returns>
 public System.Threading.Tasks.Task <MobileContainedApp> AddAsync(MobileContainedApp mobileContainedApp, CancellationToken cancellationToken)
 {
     this.ContentType             = "application/json";
     this.Method                  = "POST";
     mobileContainedApp.ODataType = string.Concat("#", StringHelper.ConvertTypeToLowerCamelCase(mobileContainedApp.GetType().FullName));
     return(this.SendAsync <MobileContainedApp>(mobileContainedApp, cancellationToken));
 }
        /// <summary>
        /// Updates the specified MobileContainedApp using PATCH.
        /// </summary>
        /// <param name="mobileContainedAppToUpdate">The MobileContainedApp 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 MobileContainedApp.</returns>
        public async System.Threading.Tasks.Task <MobileContainedApp> UpdateAsync(MobileContainedApp mobileContainedAppToUpdate, CancellationToken cancellationToken)
        {
            if (mobileContainedAppToUpdate.AdditionalData != null)
            {
                if (mobileContainedAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    mobileContainedAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, mobileContainedAppToUpdate.GetType().Name)
                    });
                }
            }
            if (mobileContainedAppToUpdate.AdditionalData != null)
            {
                if (mobileContainedAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    mobileContainedAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, mobileContainedAppToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <MobileContainedApp>(mobileContainedAppToUpdate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds the specified MobileContainedApp to the collection via POST.
 /// </summary>
 /// <param name="mobileContainedApp">The MobileContainedApp to add.</param>
 /// <returns>The created MobileContainedApp.</returns>
 public System.Threading.Tasks.Task <MobileContainedApp> AddAsync(MobileContainedApp mobileContainedApp)
 {
     return(this.AddAsync(mobileContainedApp, CancellationToken.None));
 }
 /// <summary>
 /// Creates the specified MobileContainedApp using POST.
 /// </summary>
 /// <param name="mobileContainedAppToCreate">The MobileContainedApp to create.</param>
 /// <returns>The created MobileContainedApp.</returns>
 public System.Threading.Tasks.Task <MobileContainedApp> CreateAsync(MobileContainedApp mobileContainedAppToCreate)
 {
     return(this.CreateAsync(mobileContainedAppToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="mobileContainedAppToInitialize">The <see cref="MobileContainedApp"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(MobileContainedApp mobileContainedAppToInitialize)
 {
 }