Ejemplo n.º 1
0
        private static int ListParticipants(ListParticipantsOptions opts)
        {
            var zoomService  = new ZoomService(opts.ApiKey, opts.ApiSecret);
            var participants = zoomService.ListParticipants(opts.MeetingId).ConfigureAwait(false).GetAwaiter().GetResult();

            foreach (var participant in participants)
            {
                Console.WriteLine($"Id: {participant.UserId}; UserName: {participant.UserName}");
            }

            return(0);
        }
Ejemplo n.º 2
0
        public async Task <List <Session> > GetSessionsAsync(TimeSpan cacheAge)
        {
            using (logger.AutoTrace())
            {
                try
                {
                    await lockHandle.WaitAsync();

                    if (sessions == null)
                    {
                        sessions = await LoadConfiguredSession();
                    }

                    if (!IsCacheValid(cacheAge))
                    {
                        logger.Trace(() => "Invalid cache. Load participants from zoom");
                        foreach (var session in sessions)
                        {
                            var participants = await zoomService.ListParticipants(session.Id).ConfigureAwait(false);

                            session.Participants.Clear();
                            session.Participants.AddRange(participants.Select(p => new Participant
                            {
                                Id   = p.UserId,
                                Name = p.UserName
                            }));
                        }

                        lastCacheUpdate = DateTime.UtcNow;
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(() => "Unexpeted error", ex);
                    throw;
                }
                finally
                {
                    lockHandle.Release();
                }
                return(new List <Session>(sessions));
            }
        }