示例#1
0
        public async Task <bool> AddGroupMember(string groupId, User user)
        {
            var newGroupMember = new NewGroupMember {
                Id = user.Id, Email = user.Email
            };
            NewGroupMembers newGroupMembers = new NewGroupMembers
            {
                Members = new List <NewGroupMember> {
                    newGroupMember
                }
            };

            RestRequest restRequest = await BuildRequestAuthorization($"groups/{groupId}/members", Method.POST);

            restRequest.AddJsonBody((object)newGroupMembers);
            IRestResponse <AddGroupMemberResponse> restResponse = await(await GetWebClient()).ExecuteTaskAsync <AddGroupMemberResponse>((IRestRequest)restRequest);

            if (restResponse.ResponseStatus == ResponseStatus.Completed && restResponse.StatusCode == HttpStatusCode.Created)
            {
                return(true);
            }

            throw new ZoomApiException
                  {
                      Content           = restResponse.Content,
                      ErrorMessage      = restResponse.ErrorMessage,
                      StatusDescription = restResponse.StatusDescription
                  };
        }
示例#2
0
        public IHttpActionResult AddGroupMember(Guid groupId, NewGroupMember newGroupMember)
        {
            if (groupId == Guid.Empty)
            {
                throw new ArgumentException("groupId must be defined.");
            }
            if (newGroupMember == null)
            {
                throw new ArgumentNullException("newGroupMember");
            }
            if (newGroupMember.UserId == Guid.Empty)
            {
                throw new ArgumentException("User id must be defined.");
            }

            var          groupMember  = identityManagementService.AddGroupMember(groupId, newGroupMember.UserId);
            UserListItem userListItem = mapperFactory.CreateUserListItemMapper().Map(groupMember);

            return(Ok(userListItem));
        }