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

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Adds the specified AccessPackageResourceRequestObject to the collection via POST.
 /// </summary>
 /// <param name="accessPackageResourceRequest">The AccessPackageResourceRequestObject to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created AccessPackageResourceRequestObject.</returns>
 public System.Threading.Tasks.Task <AccessPackageResourceRequestObject> AddAsync(AccessPackageResourceRequestObject accessPackageResourceRequest, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <AccessPackageResourceRequestObject>(accessPackageResourceRequest, cancellationToken));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Adds the specified AccessPackageResourceRequestObject to the collection via POST.
 /// </summary>
 /// <param name="accessPackageResourceRequest">The AccessPackageResourceRequestObject to add.</param>
 /// <returns>The created AccessPackageResourceRequestObject.</returns>
 public System.Threading.Tasks.Task <AccessPackageResourceRequestObject> AddAsync(AccessPackageResourceRequestObject accessPackageResourceRequest)
 {
     return(this.AddAsync(accessPackageResourceRequest, CancellationToken.None));
 }