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

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

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