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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
コード例 #3
0
 /// <summary>
 /// Adds the specified AppRoleAssignment to the collection via POST.
 /// </summary>
 /// <param name="appRoleAssignment">The AppRoleAssignment to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created AppRoleAssignment.</returns>
 public System.Threading.Tasks.Task <AppRoleAssignment> AddAsync(AppRoleAssignment appRoleAssignment, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <AppRoleAssignment>(appRoleAssignment, cancellationToken));
 }
コード例 #4
0
 /// <summary>
 /// Adds the specified AppRoleAssignment to the collection via POST.
 /// </summary>
 /// <param name="appRoleAssignment">The AppRoleAssignment to add.</param>
 /// <returns>The created AppRoleAssignment.</returns>
 public System.Threading.Tasks.Task <AppRoleAssignment> AddAsync(AppRoleAssignment appRoleAssignment)
 {
     return(this.AddAsync(appRoleAssignment, CancellationToken.None));
 }
コード例 #5
0
 /// <summary>
 /// Creates the specified AppRoleAssignment using POST.
 /// </summary>
 /// <param name="appRoleAssignmentToCreate">The AppRoleAssignment to create.</param>
 /// <returns>The created AppRoleAssignment.</returns>
 public System.Threading.Tasks.Task <AppRoleAssignment> CreateAsync(AppRoleAssignment appRoleAssignmentToCreate)
 {
     return(this.CreateAsync(appRoleAssignmentToCreate, CancellationToken.None));
 }
コード例 #6
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="appRoleAssignmentToInitialize">The <see cref="AppRoleAssignment"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(AppRoleAssignment appRoleAssignmentToInitialize)
 {
 }
コード例 #7
0
 public async Task <AppRoleAssignment> AddApplicationRoleAssignment(Guid resourceId, [FromBody] Microsoft.Graph.AppRoleAssignment request)
 {
     request.ResourceId = resourceId;
     return(await _appsRepo.AssignAppRole(request));
 }