public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "conversations/aggregates")] HttpRequest req , [Genesys] IGenesysAccessToken token , ILogger log) { try { ApiClient apiClient = new ApiClient($"https://api.{token.Environment}"); var configuration = new Configuration(apiClient); configuration.AccessToken = token.Value; var analyticsApi = new AnalyticsApi(configuration); var dtUtc = DateTime.Now.ToUniversalTime(); var dtFrom = dtUtc.AddDays(-7); var dtTo = dtUtc; var response = await analyticsApi.PostAnalyticsConversationsAggregatesQueryAsync(new ConversationAggregationQuery { Interval = $"{dtFrom:O}/{dtTo:O}", }); return(new OkObjectResult(new { Items = response?.Results })); } catch (ApiException ex) { log.LogError(ex, "Purecloud error"); return(new BadRequestResult()); } }
public static void AnalyticsWakeApp(string mode, string id = null, string type = null, string subtype = null) { if (Application.isEditor) { return; } var userId = UserInfoManager.isLogin() ? UserInfoManager.initUserInfo().userId : null; var device = deviceId() + (SystemInfo.deviceModel ?? ""); var data = new List <Dictionary <string, string> >(); if (id.isNotEmpty()) { data.Add(new Dictionary <string, string> { { "key", "id" }, { "dataType", "string" }, { "value", id } }); } if (type.isNotEmpty()) { data.Add(new Dictionary <string, string> { { "key", "type" }, { "dataType", "string" }, { "value", type } }); } if (subtype.isNotEmpty()) { data.Add(new Dictionary <string, string> { { "key", "subtype" }, { "dataType", "string" }, { "value", subtype } }); } AnalyticsApi.AnalyticsApp(userId, device, mode, DateTime.UtcNow, data); }
public override void Start() { base.Start(); // Log each page view AnalyticsApi.LogPageView(); }
public LicensesApi(IBitmovinApiClientFactory apiClientFactory) { _apiClient = apiClientFactory.CreateClient <ILicensesApiClient>(); Analytics = new AnalyticsApi(apiClientFactory); Domains = new DomainsApi(apiClientFactory); ThirdPartyLicensing = new ThirdPartyLicensingApi(apiClientFactory); }
public List <AnalyticsConversation> GetConversationData(Interval interval) { Log.Debug($"GetConversationData(), {nameof(interval)}:{interval}"); var result = new List <AnalyticsConversation>(); try { var pageSize = 100; var pageNumber = 1; var api = new AnalyticsApi(); var body = new ConversationQuery { Interval = interval.ToString(), Paging = new PagingSpec(pageSize, pageNumber) }; Log.Info($"Getting conversations for interval: {body.Interval}"); var pageResult = api.PostAnalyticsConversationsDetailsQuery(body); while (pageResult?.Conversations != null) { result.AddRange(pageResult.Conversations); body.Paging.PageNumber++; pageResult = api.PostAnalyticsConversationsDetailsQuery(body); } Log.Info($"Conversations for interval retrived: {result.Count}"); } catch (Exception ex) { Log.Error("GetConversationData()", ex); } return(result); }
public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "conversations/aggregates")] HttpRequest req, ILogger log) { try { var configuration = new Configuration(apiClient); var purecloudClientId = System.Environment.GetEnvironmentVariable("ClientId"); var purecloudClientSecret = System.Environment.GetEnvironmentVariable("ClientSecret"); var authTokenInfo = apiClient.PostToken(purecloudClientId, purecloudClientSecret); configuration.AccessToken = authTokenInfo.AccessToken; var analyticsApi = new AnalyticsApi(configuration); var dtUtc = DateTime.Now.ToUniversalTime(); var dtFrom = dtUtc.AddDays(-7); var dtTo = dtUtc; var response = await analyticsApi.PostAnalyticsConversationsAggregatesQueryAsync(new ConversationAggregationQuery { Interval = $"{dtFrom:O}/{dtTo:O}", }); return(new OkObjectResult(new { Items = response?.Results })); } catch (ApiException ex) { log.LogError(ex, "Purecloud error"); return(new BadRequestResult()); } }
protected override void OnAppearing() { base.OnAppearing(); AnalyticsApi.LogPageView(); AnalyticsApi.LogEvent(Title + " Page Loaded"); }
/// <summary> /// Constructor for the Application object. /// </summary> public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard Silverlight initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Show graphics profiling information while debugging. if (System.Diagnostics.Debugger.IsAttached) { // Display the current frame rate counters. Application.Current.Host.Settings.EnableFrameRateCounter = true; // Show the areas of the app that are being redrawn in each frame. //Application.Current.Host.Settings.EnableRedrawRegions = true; // Enable non-production analysis visualization mode, // which shows areas of a page that are handed off to GPU with a colored overlay. //Application.Current.Host.Settings.EnableCacheVisualization = true; // Disable the application idle detection by setting the UserIdleDetectionMode property of the // application's PhoneApplicationService object to Disabled. // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run // and consume battery power when the user is not using the phone. PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } sharedCode = new SharedCode("VVBG8GG7Y99CKDMRFJ6X"); PhoneApplicationService.Current.Launching += (sender, args) => AnalyticsApi.StartSession(); PhoneApplicationService.Current.Activated += (sender, args) => AnalyticsApi.StartSession(); }
public Interactions(ListBox lstLog) { _lstLog = lstLog; conversationsApi = new ConversationsApi(); conversationQuery = new ConversationQuery(); api = new AnalyticsApi(); }
public SharedCode(string key) { AnalyticsApi.ApiKey = key; AnalyticsApi.SetAppVersion("wp7"); AnalyticsApi.SetUserId(Guid.NewGuid().ToString()); isWorking = false; }
public Setup(Context applicationContext) : base(applicationContext) { // set up the Android Application Api Key AnalyticsApi.ApiKey = "36TWHT3RMTBTF2G46KGH"; // Starting and ending the sessions specifically for Android is found in the BaseView AnalyticsApi.Init(applicationContext); }
public Setup(MvxApplicationDelegate applicationDelegate, IMvxTouchViewPresenter presenter) : base(applicationDelegate, presenter) { // set up the iOS Application Api Key AnalyticsApi.ApiKey = "PQSZJRK4B5BW8Q7YQQXF"; // Starting and ending the sessions specifically for iOS AnalyticsApi.StartSession(); }
public BitmovinApi(IBitmovinApiClientFactory apiClientFactory) { Account = new AccountApi(apiClientFactory); Analytics = new AnalyticsApi(apiClientFactory); Encoding = new EncodingApi(apiClientFactory); General = new GeneralApi(apiClientFactory); Notifications = new NotificationsApi(apiClientFactory); Player = new PlayerApi(apiClientFactory); }
// Code to execute if a navigation fails private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) { AnalyticsApi.LogError(e.Exception); if (System.Diagnostics.Debugger.IsAttached) { // A navigation has failed; break into the debugger System.Diagnostics.Debugger.Break(); } }
public Setup(PhoneApplicationFrame rootFrame) : base(rootFrame) { // set up the Windows Phone Application Api Key AnalyticsApi.ApiKey = "VVBG8GG7Y99CKDMRFJ6X"; // Start the sessions specifically for Windows Phone PhoneApplicationService.Current.Launching += (sender, args) => AnalyticsApi.StartSession(); PhoneApplicationService.Current.Activated += (sender, args) => AnalyticsApi.StartSession(); }
// Code to execute on Unhandled Exceptions private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { AnalyticsApi.LogError(e.ExceptionObject); if (System.Diagnostics.Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger System.Diagnostics.Debugger.Break(); } }
public async Task DoLoadsOfWork(string taskName) { using (AnalyticsApi.LogTimedEvent(taskName)) { IsWorking = true; await Task.Factory.Delay(3000); IsWorking = false; } }
public static void AnalyticsLogin(string type, string userId) { if (Application.isEditor) { return; } var device = deviceId() + (SystemInfo.deviceModel ?? ""); var data = new List <Dictionary <string, string> > { new Dictionary <string, string> { { "key", "type" }, { "dataType", "string" }, { "value", type } } }; AnalyticsApi.AnalyticsApp(userId, device, "UserLogin", DateTime.UtcNow, data); }
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 static void AnalyticsClickEgg(int index) { if (Application.isEditor) { return; } var userId = UserInfoManager.isLogin() ? UserInfoManager.initUserInfo().userId : null; var device = deviceId() + (SystemInfo.deviceModel ?? ""); var data = new List <Dictionary <string, string> > { new Dictionary <string, string> { { "key", "index" }, { "dataType", "int" }, { "value", index.ToString() } } }; AnalyticsApi.AnalyticsApp(userId, device, "ClickEgg", DateTime.UtcNow, data); }
public static void AnalyticsOpenApp() { if (Application.isEditor) { return; } var type = "OpenApp"; var userId = UserInfoManager.isLogin() ? UserInfoManager.initUserInfo().userId : null; var device = deviceId() + (SystemInfo.deviceModel ?? ""); var data = new List <Dictionary <string, string> > { new Dictionary <string, string> { { "key", "enableNotification" }, { "dataType", "bool" }, { "value", enableNotification().ToString() } } }; AnalyticsApi.AnalyticsApp(userId, device, type, DateTime.UtcNow, data); }
public static void AnalyticsQRScan(QRState state, bool success = true) { if (Application.isEditor) { return; } var userId = UserInfoManager.isLogin() ? UserInfoManager.initUserInfo().userId : null; var device = deviceId() + (SystemInfo.deviceModel ?? ""); var data = new List <Dictionary <string, string> > { new Dictionary <string, string> { { "key", "state" }, { "dataType", "string" }, { "value", state.ToString() } }, new Dictionary <string, string> { { "key", "success" }, { "dataType", "bool" }, { "value", success.ToString() } } }; AnalyticsApi.AnalyticsApp(userId, device, "QRScan", DateTime.UtcNow, data); }
public bool profanityDetection(string text) { // Configure API key authorization: Apikey Configuration.Default.AddApiKey("Apikey", "128ffe67-a3e7-4ec4-b723-980fa639eaeb"); var apiInstance = new AnalyticsApi(); // Detect language of text var input = new ProfanityAnalysisRequest(text); try { ProfanityAnalysisResponse result = apiInstance.AnalyticsProfanity(input); //if the score is over 0.6 that means it s profanity other wise is not if it s less than 0.6 the return result is false return(result.ProfanityScoreResult > 0.6); } catch (Exception e) { } //false no profanity detected return(false); }
private void SetUpAnalytics() { AnalyticsApi.SetAppVersion("2.0.0.0"); AnalyticsApi.SetSessionContinueTimeout(30); }
private static async Task Main(string[] args) { StartAnalytics(); AnalyticsApi.UserAgent = EditorName = GetEditorNameByArgs(args); AnalyticsApi.TrackEvent("SessionStart", "Session Start", extraValues: new { sc = "start" }); AnalyticsApi.TrackEvent("ServerStart", "Started LSP Server", extraValues: new { sc = "start" }); if (args.Any(a => a.ToLower().Equals("-d"))) { while (!Debugger.IsAttached) { await Task.Delay(100); } } ILanguageServer server = null; server = await LanguageServer.From(options => { options .WithInput(Console.OpenStandardInput()) .WithOutput(Console.OpenStandardOutput()) .ConfigureLogging(c => c.AddLanguageProtocolLogging()) .WithHandler <TextDocumentHandler>() .WithHandler <TextHoverHandler>(); options.OnRequest <object, int>("insight/inspectionsCount", _ => Task.FromResult(WorkspaceManager.Instance.InspectionsManager.CodeInspections.Count)); var debouncedParseRange = Debouncer.Debounce <SkriptFile>(file => file.NotifyVisibleNodesRangeChanged(), TimeSpan.FromMilliseconds(500)); options.OnNotification <ViewportChangedParams>("insight/viewportRangeChanged", e => { var file = WorkspaceManager.CurrentWorkspace.WorkspaceManager.GetOrCreateByUri(e.Uri.ToUri()); if (file == null) { return; } file.VisibleRanges = e.Ranges; debouncedParseRange.Run(file); }); options.OnNotification("insight/notifySupportsExtendedCapabilities", async() => { if (WorkspaceManager.CurrentHost == null) { return; } var sendRequest = WorkspaceManager.CurrentHost.SendRawRequest <ExtendedHostCapabilities>( "insight/queryExtendedCapabilities"); if (sendRequest != null) { WorkspaceManager.CurrentHost.ExtendedCapabilities = await sendRequest; } }); }); WorkspaceManager.CurrentHost = new LspSkriptInsightHost(server); WorkspaceManager.CurrentHost.LogInfo("SkriptInsight loaded successfully."); #pragma warning disable 4014 Task.Run(() => StartDiscordRichPresence(WorkspaceManager.CurrentWorkspace)); #pragma warning restore 4014 await server.WaitForExit; DiscordRpcClient?.Dispose(); AnalyticsApi.CancellationToken.Cancel(); AnalyticsApi.TrackEvent("ServerStop", "Stopped LSP Server"); AnalyticsApi.TrackEvent("SessionStop", "Session Stop", extraValues: new { sc = "stop" }); }
protected override void OnStop() { base.OnStop(); AnalyticsApi.EndSession(this); }
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; } }
protected override void OnStart() { base.OnStart(); AnalyticsApi.StartSession(this); }
public void Init() { instance = new AnalyticsApi(); }
public async Task <CloudmersiveNLPResponse> CloudmersiveNLPResponseAsync(string type, string url) { string CloudmersiveApiKey = _config["CloudmersiveApiKey"]; string scrapeResult = await ScrapeNewsSiteByUrlAsync(url); // Configure API key authorization: Apikey Configuration.Default.AddApiKey("Apikey", CloudmersiveApiKey); // Get an API key at, https://account.cloudmersive.com/ var apiInstance = new AnalyticsApi(); if (type == "sentimentality") { var input = new SentimentAnalysisRequest(scrapeResult); // SentimentAnalysisRequest | Input sentiment analysis request try { // Perform Sentiment Analysis and Classification on Text SentimentAnalysisResponse cloudmersiveResult = apiInstance.AnalyticsSentiment(input); CloudmersiveNLPResponse cloudmersiveNLPResponse = new CloudmersiveNLPResponse { Successful = cloudmersiveResult.Successful, SentimentClassificationResult = cloudmersiveResult.SentimentClassificationResult, SentimentScoreResult = cloudmersiveResult.SentimentScoreResult, SentenceCount = cloudmersiveResult.SentenceCount, }; return(cloudmersiveNLPResponse); } catch (Exception e) { return(null); } } else if (type == "subjectivity") { var input = new SubjectivityAnalysisRequest(scrapeResult); // SentimentAnalysisRequest | Input sentiment analysis request try { // Perform Subjectivity Analysis and Classification on Text SubjectivityAnalysisResponse cloudmersiveResult = apiInstance.AnalyticsSubjectivity(input); CloudmersiveNLPResponse cloudmersiveNLPResponse = new CloudmersiveNLPResponse { Successful = cloudmersiveResult.Successful, SubjectivityScoreResult = cloudmersiveResult.SubjectivityScoreResult, SentenceCount = cloudmersiveResult.SentenceCount, }; return(cloudmersiveNLPResponse); } catch (Exception e) { return(null); } } else { return(null); } }