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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Adds the specified ManagedAppStatus to the collection via POST.
 /// </summary>
 /// <param name="managedAppStatus">The ManagedAppStatus to add.</param>
 /// <returns>The created ManagedAppStatus.</returns>
 public System.Threading.Tasks.Task <ManagedAppStatus> AddAsync(ManagedAppStatus managedAppStatus)
 {
     return(this.AddAsync(managedAppStatus, CancellationToken.None));
 }
Пример #5
0
 /// <summary>
 /// Creates the specified ManagedAppStatus using POST.
 /// </summary>
 /// <param name="managedAppStatusToCreate">The ManagedAppStatus to create.</param>
 /// <returns>The created ManagedAppStatus.</returns>
 public System.Threading.Tasks.Task <ManagedAppStatus> CreateAsync(ManagedAppStatus managedAppStatusToCreate)
 {
     return(this.CreateAsync(managedAppStatusToCreate, CancellationToken.None));
 }
Пример #6
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="managedAppStatusToInitialize">The <see cref="ManagedAppStatus"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(ManagedAppStatus managedAppStatusToInitialize)
 {
 }