Пример #1
0
        /// <summary>
        /// Get members of a group.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="api"></param>
        /// <returns></returns>
        private static List <User> GetGroupMembers(GroupsSearchResponse group, GroupsApi api)
        {
            // The list that will contain group members
            List <User> members = new List <User>();

            foreach (var grp in group.Results)
            {
                // API call to get members
                UserEntityListing result = api.GetGroupMembers(grp.Id, 25, null, "ASC", null);

                // Add the members to the list
                members = result.Entities;
            }

            return(members);
        }
Пример #2
0
        static void Main(string[] args)
        {
            // OAuth input
            Console.Write("Enter Client ID: ");
            string clientId = Console.ReadLine();

            Console.Write("Enter Client Secret: ");
            string clientSecret = Console.ReadLine();

            // Group name to get members from
            Console.Write("Enter Group Name: ");
            string groupName = Console.ReadLine();

            // Configure SDK Settings
            string accessToken = GetToken(clientId, clientSecret);

            PureCloudPlatform.Client.V2.Client.Configuration.Default.AccessToken = accessToken;

            // Instantiate APIs
            GroupsApi groupsApi = new GroupsApi();

            // Get the group using the group name
            GroupsSearchResponse theGroup = GetGroup(groupName, groupsApi);

            // Get members of the group
            List <User> users = GetGroupMembers(theGroup, groupsApi);

            // Build the notification handler
            NotificationHandler handler = new NotificationHandler();

            // Subscribe the notifiaciton handler to the presence of group members
            SubscribeToUserGroupPresence(users, handler);

            // Display to confirm websocket client is listening
            Console.WriteLine("Websocket connected, awaiting messages...");

            if (Debugger.IsAttached)
            {
                Console.ReadKey();
            }
        }
Пример #3
0
 public void Init()
 {
     instance = new GroupsSearchResponse();
 }