/// <summary>
        ///
        /// </summary>
        /// <param name="apiKey"></param>
        public GHRouter(string apiKey)
        {
            _apiKey = apiKey;

            _vrpApiInstance  = new VrpApi();
            _rtngApiInstance = new RoutingApi();
            _slnApiInstance  = new SolutionApi();
        }
        private void btnConnect_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtClientId.Text) || string.IsNullOrEmpty(txtClientSecret.Text))
                {
                    MessageBox.Show("Enter a client id & secret first.");
                    return;
                }

                // Connect to PureCloud
                AddLog("Connecting...");
                Configuration.Default.ApiClient.RestClient.BaseUrl = new Uri($"https://api.{cmbEnvironment.SelectedItem.ToString()}");
                var accessTokenInfo = Configuration.Default.ApiClient.PostToken(txtClientId.Text, txtClientSecret.Text);
                Configuration.Default.AccessToken = accessTokenInfo.AccessToken;
                loggedIn = true;
                AddLog("Connected!");
                AddLog($"Access Token: {accessTokenInfo.AccessToken}", true);

                // Get APIs
                AddLog("Initializing APIs...", true);
                tokensApi        = new TokensApi();
                routingApi       = new RoutingApi();
                analyticsApi     = new AnalyticsApi();
                conversationsApi = new ConversationsApi();
                AddLog("Finished initializing APIs...", true);

                // Update Controls
                btnConnect.Enabled    = false;
                btnDisconnect.Enabled = true;
                gbQueues.Enabled      = true;

                // Populate Queues
                GetQueues();
            }
            catch (Exception ex)
            {
                AddLog($"Error in btnConnect_Click: {ex.Message}");
                AddLog($"Detailled error: {ex}", true);
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnConnect.Enabled    = true;
                btnDisconnect.Enabled = false;
                gbQueues.Enabled      = false;
                loggedIn = false;
            }
        }
        public void getQueues()
        {
            try
            {
                /*
                 * var client = new RestClient("https://api.ininsca.com/api/v2/routing/queues");
                 * var request = new RestRequest(Method.GET);
                 * request.AddHeader("postman-token", "4fe9c331-3f04-c209-6269-537b27bbc5f0");
                 * request.AddHeader("cache-control", "no-cache");
                 * request.AddHeader("authorization", "Bearer 0PmmyDJOka3rSK6MPxyT7_7519dC-5Gs7J0mkDHoBhMi3atbI2Y_5RUJg-J3_bZwhiWQ7O3vmTvAKdeelbTw9Q");
                 * request.AddHeader("content-type", "application/json");
                 * IRestResponse response = client.Execute(request);
                 */



                Configuration.Default.AccessToken = "Bearer tGTVtwBo6hcm3m376LQKoIYsSi1RvaOavCdp-Ui5-dedf-l7JeLtXH2PkQXNBo5C8eAqh90ETmqAkNw0umVcSg";

                Configuration.Default.AddDefaultHeader("postman-token", "4fe9c331-3f04-c209-6269-537b27bbc5f0");
                Configuration.Default.AddDefaultHeader("content-type", "application/json");



                var api        = new RoutingApi();
                var pageSize   = 25;
                var pageNumber = 1;
                var sortBy     = "";
                var name       = "";
                var active     = true;

                QueueEntityListing result = api.GetQueues(pageSize, pageNumber, sortBy, name, active);

                log.Info("execute getQueues");
            }
            catch (Exception ex)
            {
                log.Error("error " + ex.Message);
            }
        }
Exemple #4
0
 public void Init()
 {
     instance = new RoutingApi();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lstLog"></param>
 public Planning(ListBox lstLog)
 {
     _lstLog    = lstLog;
     routingApi = new RoutingApi();
 }
        private void btnConnect_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtClientId.Text) || string.IsNullOrEmpty(txtClientSecret.Text))
                {
                    MessageBox.Show("Enter a client id & secret first.");
                    return;
                }

                // Connect to PureCloud
                AddLog("Connecting...");
                Configuration.Default.ApiClient.RestClient.BaseUrl = new Uri($"https://api.{cmbEnvironment.SelectedItem.ToString()}");
                var accessTokenInfo = Configuration.Default.ApiClient.PostToken(txtClientId.Text, txtClientSecret.Text);
                Configuration.Default.AccessToken = accessTokenInfo.AccessToken;
                loggedIn = true;
                AddLog($"Connected.");
                AddLog($"Access Token: {accessTokenInfo.AccessToken}", true);

                // Get APIs
                AddLog("Initializing APIs...", true);
                analyticsApi              = new AnalyticsApi();
                routingApi                = new RoutingApi();
                conversationsApi          = new ConversationsApi();
                tokensApi                 = new TokensApi();
                telephonyProvidersEdgeApi = new TelephonyProvidersEdgeApi();
                AddLog("Finished initializing APIs...", true);

                // Update Controls
                btnConnect.Enabled        = false;
                btnDisconnect.Enabled     = true;
                gbEdges.Enabled           = true;
                gbTroubleshooting.Enabled = true;
                gbAgents.Enabled          = true;
                gbTestGhostCall.Enabled   = true;
                gbCounters.Enabled        = true;

                // Populate Edges
                GetEdges();

                // Get Agents Stats
                AddLog("Starting timer for monitoring agent status", true);
                PullAgentsData();
                timer.Interval = 5000;
                timer.Tick    += (object timerSender, EventArgs eventArgs) => { PullAgentsData(); };
                timer.Start();
                AddLog("Timer started", true);
            }
            catch (Exception ex)
            {
                AddLog($"Error in btnConnect_Click: {ex.Message}");
                AddLog($"Detailled error: {ex}", true);
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnConnect.Enabled        = true;
                btnDisconnect.Enabled     = false;
                gbEdges.Enabled           = false;
                gbTroubleshooting.Enabled = false;
                gbAgents.Enabled          = false;
                gbTestGhostCall.Enabled   = false;
                gbCounters.Enabled        = false;
                loggedIn = false;
            }
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lstLog"></param>
 public Skill(ListBox lstLog)
 {
     _lstLog    = lstLog;
     routingApi = new RoutingApi();
 }
Exemple #8
0
        //private System.Windows.Forms.ListBox lstLog;

        public Queue(System.Windows.Forms.ListBox lstLog)
        {
            _lstLog    = lstLog;
            routingApi = new RoutingApi();
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lstLog"></param>
 public WrapupCodes_Qualif(ListBox lstLog)
 {
     _lstLog    = lstLog;
     routingApi = new RoutingApi();
 }