Esempio n. 1
0
        public async Task RunAsync(string userId, IZoomClient client, TextWriter log, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            await log.WriteLineAsync("\n***** CONTACTS *****\n").ConfigureAwait(false);

            // GET THE CONTACTS FOR THIS USER
            var paginatedInternalContacts = await client.Contacts.GetAllAsync(ContactType.Internal, 50, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"There are {paginatedInternalContacts.TotalRecords} internal contacts for user {userId}").ConfigureAwait(false);

            var paginatedExternalContacts = await client.Contacts.GetAllAsync(ContactType.External, 50, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"There are {paginatedExternalContacts.TotalRecords} external contacts for user {userId}").ConfigureAwait(false);

            var paginatedSearchedContacts = await client.Contacts.SearchAsync("zzz", true, 1, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Found {paginatedSearchedContacts.TotalRecords} contacts").ConfigureAwait(false);

            var contact = await client.Contacts.GetAsync(userId, true, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"{contact.EmailAddress} is {contact.PresenceStatus}").ConfigureAwait(false);
        }
Esempio n. 2
0
        public async Task RunAsync(string userId, IZoomClient client, TextWriter log, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            await log.WriteLineAsync("\n***** ACCOUNTS *****\n").ConfigureAwait(false);

            // GET ALL THE ACCOUNTS
            var paginatedAccounts = await client.Accounts.GetAllAsync(100, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"There are {paginatedAccounts.TotalRecords} sub accounts under the main account").ConfigureAwait(false);

            // GET SETTINGS
            if (paginatedAccounts.Records.Any())
            {
                var accountId = paginatedAccounts.Records.First().Id;

                var meetingAuthenticationSettings = await client.Accounts.GetMeetingAuthenticationSettingsAsync(accountId, cancellationToken).ConfigureAwait(false);

                await log.WriteLineAsync("Meeting authentication settings retrieved").ConfigureAwait(false);

                var recordingAuthenticationSettings = await client.Accounts.GetRecordingAuthenticationSettingsAsync(accountId, cancellationToken).ConfigureAwait(false);

                await log.WriteLineAsync("Recording authentication settings retrieved").ConfigureAwait(false);
            }
        }
 public void Setup()
 {
     _sut = new ZoomClient(new ZoomClientOptions
     {
         ZoomApiKey    = "",
         ZoomApiSecret = ""
     });
 }
Esempio n. 4
0
        public async Task RunAsync(string userId, IZoomClient client, TextWriter log, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            await log.WriteLineAsync("\n***** USERS *****\n").ConfigureAwait(false);

            // GET ALL THE USERS
            var paginatedUsers = await client.Users.GetAllAsync(UserStatus.Active, null, 100, 1, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"There are {paginatedUsers.Records.Length} users").ConfigureAwait(false);

            // CLEANUP PREVIOUS INTEGRATION TESTS THAT MIGHT HAVE BEEN INTERRUPTED BEFORE THEY HAD TIME TO CLEANUP AFTER THEMSELVES
            var cleanUpTasks = paginatedUsers.Records
                               .Where(m => m.FirstName == "ZoomNet" && m.LastName == "Integration Testing")
                               .Select(async oldUser =>
            {
                await client.Users.DeleteAsync(oldUser.Id, null, false, false, false, cancellationToken).ConfigureAwait(false);
                await log.WriteLineAsync($"User {oldUser.Id} deleted").ConfigureAwait(false);
                await Task.Delay(250, cancellationToken).ConfigureAwait(false);                            // Brief pause to ensure Zoom has time to catch up
            });
            await Task.WhenAll(cleanUpTasks).ConfigureAwait(false);

            // GET MY USER
            var myUser = await client.Users.GetCurrentAsync(cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"My user retrieved. My email address is {myUser.Email}").ConfigureAwait(false);

            // GET MY ASSISTANTS
            var myAssistants = await client.Users.GetAssistantsAsync(myUser.Id, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"My user has {myAssistants.Length} assistants").ConfigureAwait(false);

            // GET MY SCHEDULERS
            var mySchedulers = await client.Users.GetSchedulersAsync(myUser.Id, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"My user has {mySchedulers.Length} schedulers").ConfigureAwait(false);

            // GET MY SETTINGS
            var mySettings = await client.Users.GetSettingsAsync(myUser.Id, cancellationToken).ConfigureAwait(false);

            var myMeetingAuthSettings = await client.Users.GetMeetingAuthenticationSettingsAsync(myUser.Id, cancellationToken).ConfigureAwait(false);

            var myRecordingAuthSettings = await client.Users.GetRecordingAuthenticationSettingsAsync(myUser.Id, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync("My settings retrieved").ConfigureAwait(false);

            // GET MY PERMISSIONS
            var myPermissions = await client.Users.GetPermissionsAsync(myUser.Id, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"My permissions retrieved: I have been granted {myPermissions.Length} permissions").ConfigureAwait(false);
        }
Esempio n. 5
0
        public async Task RunAsync(string userId, IZoomClient client, TextWriter log, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            await log.WriteLineAsync("\n***** DASHBOARDS *****\n").ConfigureAwait(false);

            // GET ALL THE MEETINGS
            var pastMeetingsStats = await client.Dashboards.GetAllMeetingsAsync(DateTime.UtcNow.AddMonths(-1), DateTime.UtcNow, DashboardMeetingType.Past, 100, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"There are {pastMeetingsStats.TotalRecords} meetings in the last month").ConfigureAwait(false);
        }
Esempio n. 6
0
        public async Task RunAsync(string userId, IZoomClient client, TextWriter log, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            await log.WriteLineAsync("\n***** CLOUD RECORDINGS *****\n").ConfigureAwait(false);

            // GET ALL THE RECORDINGS FOR A GIVEN USER
            var paginatedRecordings = await client.CloudRecordings.GetRecordingsForUserAsync(userId, false, null, null, 100, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"User {userId} has {paginatedRecordings.TotalRecords} recordings stored in the cloud").ConfigureAwait(false);
        }
Esempio n. 7
0
        public async Task RunAsync(string userId, IZoomClient client, TextWriter log, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            await log.WriteLineAsync("\n***** ACCOUNT CHAT CHANNELS *****\n").ConfigureAwait(false);

            // GET THE CHANNELS FOR THIS USER
            var paginatedChannels = await client.Chat.GetAccountChannelsForUserAsync(userId, 100, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"There are {paginatedChannels.TotalRecords} account channels for user {userId}").ConfigureAwait(false);

            // CLEANUP PREVIOUS INTEGRATION TESTS THAT MIGHT HAVE BEEN INTERRUPTED BEFORE THEY HAD TIME TO CLEANUP AFTER THEMSELVES
            var cleanUpTasks = paginatedChannels.Records
                               .Where(m => m.Name.StartsWith("ZoomNet Integration Testing:"))
                               .Select(async oldChannel =>
            {
                await client.Chat.DeleteChannelAsync(oldChannel.Id, cancellationToken).ConfigureAwait(false);
                await log.WriteLineAsync($"Channel {oldChannel.Id} deleted").ConfigureAwait(false);
                await Task.Delay(250, cancellationToken).ConfigureAwait(false);                            // Brief pause to ensure Zoom has time to catch up
            });
            await Task.WhenAll(cleanUpTasks).ConfigureAwait(false);

            // CREATE A NEW CHANNEL
            var channel = await client.Chat.CreateAccountChannelAsync(userId, "ZoomNet Integration Testing: new channel", ChatChannelType.Public, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Account channel \"{channel.Name}\" created (Id={channel.Id}").ConfigureAwait(false);

            // UPDATE THE CHANNEL
            await client.Chat.UpdateAccountChannelAsync(userId, channel.Id, "ZoomNet Integration Testing: updated channel", cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Account channel \"{channel.Id}\" updated").ConfigureAwait(false);

            // RETRIEVE THE CHANNEL
            channel = await client.Chat.GetAccountChannelAsync(userId, channel.Id, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Account channel \"{channel.Id}\" retrieved").ConfigureAwait(false);

            // RETRIEVE THE CHANNEL MEMBERS
            var paginatedMembers = await client.Chat.GetAccountChannelMembersAsync(userId, channel.Id, 10, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Account channel \"{channel.Id}\" has {paginatedMembers.TotalRecords} members").ConfigureAwait(false);

            // SEND A MESSAGE TO THE CHANNEL
            var messageId = await client.Chat.SendMessageToChannelAsync(channel.Id, "This is a test from integration test", null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Message \"{messageId}\" sent").ConfigureAwait(false);

            // UPDATE THE MESSAGE
            await client.Chat.UpdateMessageToChannelAsync(messageId, channel.Id, "This is an updated message from integration testing", null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Message \"{messageId}\" updated").ConfigureAwait(false);

            // RETRIEVE LIST OF MESSAGES
            var paginatedMessages = await client.Chat.GetMessagesToChannelAsync(channel.Id, 100, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"There are {paginatedMessages.TotalRecords} messages in channel \"{channel.Id}\"").ConfigureAwait(false);

            // DELETE THE MESSAGE
            await client.Chat.DeleteMessageToChannelAsync(messageId, channel.Id, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Message \"{messageId}\" deleted").ConfigureAwait(false);

            // DELETE THE CHANNEL
            await client.Chat.DeleteAccountChannelAsync(userId, channel.Id, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Account channel \"{channel.Id}\" deleted").ConfigureAwait(false);
        }
Esempio n. 8
0
        public async Task RunAsync(string userId, IZoomClient client, TextWriter log, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            await log.WriteLineAsync("\n***** MEETINGS *****\n").ConfigureAwait(false);

            // GET ALL THE MEETINGS
            var paginatedScheduledMeetings = await client.Meetings.GetAllAsync(userId, MeetingListType.Scheduled, 100, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"There are {paginatedScheduledMeetings.TotalRecords} scheduled meetings").ConfigureAwait(false);

            var paginatedLiveMeetings = await client.Meetings.GetAllAsync(userId, MeetingListType.Live, 100, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"There are {paginatedLiveMeetings.TotalRecords} live meetings").ConfigureAwait(false);

            var paginatedUpcomingMeetings = await client.Meetings.GetAllAsync(userId, MeetingListType.Upcoming, 100, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"There are {paginatedUpcomingMeetings.TotalRecords} upcoming meetings").ConfigureAwait(false);

            // CLEANUP PREVIOUS INTEGRATION TESTS THAT MIGHT HAVE BEEN INTERRUPTED BEFORE THEY HAD TIME TO CLEANUP AFTER THEMSELVES
            var cleanUpTasks = paginatedScheduledMeetings.Records
                               .Union(paginatedLiveMeetings.Records)
                               .Where(m => m.Topic.StartsWith("ZoomNet Integration Testing:"))
                               .Select(async oldMeeting =>
            {
                await client.Meetings.DeleteAsync(oldMeeting.Id, null, false, false, cancellationToken).ConfigureAwait(false);
                await log.WriteLineAsync($"Meeting {oldMeeting.Id} deleted").ConfigureAwait(false);
                await Task.Delay(250, cancellationToken).ConfigureAwait(false);                            // Brief pause to ensure Zoom has time to catch up
            });
            await Task.WhenAll(cleanUpTasks).ConfigureAwait(false);

            var settings = new MeetingSettings()
            {
                Audio = AudioType.Telephony
            };
            var trackingFields = new Dictionary <string, string>()
            {
                { "field1", "value1" },
                { "field2", "value2" }
            };

            // Instant meeting
            var newInstantMeeting = await client.Meetings.CreateInstantMeetingAsync(userId, "ZoomNet Integration Testing: instant meeting", "The agenda", "p@ss!w0rd", settings, trackingFields, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Instant meeting {newInstantMeeting.Id} created").ConfigureAwait(false);

            await client.Meetings.EndAsync(newInstantMeeting.Id, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Instant meeting {newInstantMeeting.Id} ended").ConfigureAwait(false);

            var instantMeeting = (InstantMeeting)await client.Meetings.GetAsync(newInstantMeeting.Id, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Instant meeting {instantMeeting.Id} retrieved").ConfigureAwait(false);

            await client.Meetings.DeleteAsync(newInstantMeeting.Id, null, false, false, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Instant meeting {newInstantMeeting.Id} deleted").ConfigureAwait(false);

            // Scheduled meeting
            var start               = DateTime.UtcNow.AddMonths(1);
            var duration            = 30;
            var newScheduledMeeting = await client.Meetings.CreateScheduledMeetingAsync(userId, "ZoomNet Integration Testing: scheduled meeting", "The agenda", start, duration, "p@ss!w0rd", settings, trackingFields, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Scheduled meeting {newScheduledMeeting.Id} created").ConfigureAwait(false);

            var updatedSettings = new MeetingSettings()
            {
                Audio = AudioType.Voip
            };
            await client.Meetings.UpdateScheduledMeetingAsync(newScheduledMeeting.Id, topic : "ZoomNet Integration Testing: UPDATED scheduled meeting", settings : updatedSettings, cancellationToken : cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Scheduled meeting {newScheduledMeeting.Id} updated").ConfigureAwait(false);

            var scheduledMeeting = (ScheduledMeeting)await client.Meetings.GetAsync(newScheduledMeeting.Id, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Scheduled meeting {scheduledMeeting.Id} retrieved").ConfigureAwait(false);

            await client.Meetings.DeleteAsync(newScheduledMeeting.Id, null, false, false, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Scheduled meeting {newScheduledMeeting.Id} deleted").ConfigureAwait(false);

            // Recurring meeting
            var recurrenceInfo = new RecurrenceInfo()
            {
                EndTimes   = 2,
                WeeklyDays = new[] { DayOfWeek.Monday, DayOfWeek.Friday },
                Type       = RecurrenceType.Weekly
            };
            var newRecurringMeeting = await client.Meetings.CreateRecurringMeetingAsync(userId, "ZoomNet Integration Testing: recurring meeting", "The agenda", start, duration, recurrenceInfo, "p@ss!w0rd", settings, trackingFields, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Recurring meeting {newRecurringMeeting.Id} created").ConfigureAwait(false);

            await client.Meetings.UpdateRecurringMeetingAsync(newRecurringMeeting.Id, topic : "ZoomNet Integration Testing: UPDATED recurring meeting", cancellationToken : cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Recurring meeting {newRecurringMeeting.Id} updated").ConfigureAwait(false);

            var recurringMeeting = (RecurringMeeting)await client.Meetings.GetAsync(newRecurringMeeting.Id, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Recurring meeting {recurringMeeting.Id} retrieved").ConfigureAwait(false);

            var occurenceId = recurringMeeting.Occurrences[0].OccurrenceId;
            await client.Meetings.UpdateMeetingOccurrenceAsync(newRecurringMeeting.Id, occurenceId, duration : 99, cancellationToken : cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Recurring meeting {newRecurringMeeting.Id} occurence {occurenceId} updated").ConfigureAwait(false);

            await client.Meetings.DeleteAsync(newRecurringMeeting.Id, null, false, false, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Recurring meeting {newRecurringMeeting.Id} deleted").ConfigureAwait(false);
        }
Esempio n. 9
0
        public async Task RunAsync(string userId, IZoomClient client, TextWriter log, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            await log.WriteLineAsync("\n***** WEBINARS *****\n").ConfigureAwait(false);

            // GET ALL THE WEBINARS
            var paginatedWebinars = await client.Webinars.GetAllAsync(userId, 30, null, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"There are {paginatedWebinars.TotalRecords} webinars for user {userId}").ConfigureAwait(false);

            // CLEANUP PREVIOUS INTEGRATION TESTS THAT MIGHT HAVE BEEN INTERRUPTED BEFORE THEY HAD TIME TO CLEANUP AFTER THEMSELVES
            var cleanUpTasks = paginatedWebinars.Records
                               .Union(paginatedWebinars.Records)
                               .Where(m => m.Topic.StartsWith("ZoomNet Integration Testing:"))
                               .Select(async oldWebinar =>
            {
                await client.Webinars.DeleteAsync(oldWebinar.Id, null, false, cancellationToken).ConfigureAwait(false);
                await log.WriteLineAsync($"Webinar {oldWebinar.Id} deleted").ConfigureAwait(false);
                await Task.Delay(250, cancellationToken).ConfigureAwait(false);                            // Brief pause to ensure Zoom has time to catch up
            });
            await Task.WhenAll(cleanUpTasks).ConfigureAwait(false);

            var settings = new WebinarSettings()
            {
                ApprovalType = MeetingApprovalType.Manual
            };
            var trackingFields = new Dictionary <string, string>()
            {
                { "field1", "value1" },
                { "field2", "value2" }
            };

            // Scheduled webinar
            var start               = DateTime.UtcNow.AddMonths(1);
            var duration            = 30;
            var newScheduledWebinar = await client.Webinars.CreateScheduledWebinarAsync(userId, "ZoomNet Integration Testing: scheduled webinar", "The agenda", start, duration, "p@ss!w0rd", settings, trackingFields, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Scheduled webinar {newScheduledWebinar.Id} created").ConfigureAwait(false);

            await client.Webinars.DeleteAsync(newScheduledWebinar.Id, null, false, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Scheduled webinar {newScheduledWebinar.Id} deleted").ConfigureAwait(false);

            // Recurring webinar
            var recurrenceInfo = new RecurrenceInfo()
            {
                EndTimes   = 2,
                WeeklyDays = new[] { DayOfWeek.Monday, DayOfWeek.Friday },
                Type       = RecurrenceType.Weekly
            };
            var newRecurringWebinar = await client.Webinars.CreateRecurringWebinarAsync(userId, "ZoomNet Integration Testing: recurring webinar", "The agenda", start, duration, recurrenceInfo, "p@ss!w0rd", settings, trackingFields, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Recurring webinar {newRecurringWebinar.Id} created").ConfigureAwait(false);

            await client.Webinars.DeleteAsync(newRecurringWebinar.Id, null, false, cancellationToken).ConfigureAwait(false);

            await log.WriteLineAsync($"Recurring webinar {newRecurringWebinar.Id} deleted").ConfigureAwait(false);
        }