Пример #1
0
        /// <inheritdoc/>
        public async Task <Team> CreateTeamAsync(string name)
        {
            var teamParams = new TeamParams {
                Name = name
            };

            return(await TeamsClient.PostResultAsync <Team, TeamParams>(WxTeamsConstants.TeamsUrl, teamParams));
        }
Пример #2
0
        /// <inheritdoc/>
        public async Task <Room> CreateRoomAsync(string title, string teamId = null)
        {
            var props = new RoomParams {
                Title = title, TeamId = teamId
            };

            return(await TeamsClient.PostResultAsync <Room, RoomParams>(WxTeamsConstants.RoomsUrl, props));
        }
Пример #3
0
        /// <inheritdoc/>
        public async Task <Message> SendMessageAsync(ISendableMessage sendMessage)
        {
            if (sendMessage.HasLocalFile())
            {
                return(await TeamsClient.PostMultiPartResultAsync <Message, ISendableMessage>(WxTeamsConstants.MessagesUrl, sendMessage));
            }

            return(await TeamsClient.PostResultAsync <Message, ISendableMessage>(WxTeamsConstants.MessagesUrl, sendMessage));
        }
Пример #4
0
        /// <inheritdoc/>
        public async Task <Webhook> CreateWebhookAsync(string name, string targetUrl, WebhookResource resource,
                                                       EventType eventType, string filter = "", string secret = "")
        {
            ValidateWebhookParameters(name, targetUrl);

            var webhookParams = new WebhookParams
            {
                Name      = name,
                TargetUrl = targetUrl,
                Resource  = resource,
                Event     = eventType,
                Filter    = filter,
                Secret    = secret
            };

            return(await TeamsClient.PostResultAsync <Webhook, WebhookParams>(WxTeamsConstants.WebhooksUrl, webhookParams));
        }
Пример #5
0
        /// <inheritdoc/>
        public async Task <RoomMembership> AddUserToRoomAsync(string roomId, string userIdOrEmail, bool IsModerator = false)
        {
            var props = new MembershipParams {
                RoomId = roomId, IsModerator = IsModerator
            };

            if (RegexUtilities.IsValidEmail(userIdOrEmail))
            {
                props.PersonEmail = userIdOrEmail;
            }
            else
            {
                props.PersonId = userIdOrEmail;
            }

            return(await TeamsClient.PostResultAsync <RoomMembership, MembershipParams>(WxTeamsConstants.MembershipsUrl, props));
        }
Пример #6
0
 /// <inheritdoc/>
 public async Task <Person> CreateUserAsync(ICreateablePerson personParams)
 => await TeamsClient.PostResultAsync <Person, ICreateablePerson>(WxTeamsConstants.PeopleUrl, personParams);