public void SendInvoicesToMaventa(IEnumerable<InvoiceViewModel>invoices) { ApiKeys apiKeys = new ApiKeys(); apiKeys.user_api_key = "x"; //User API key apiKeys.company_uuid = "y"; //UUID of current company //Create invoice foreach(var invoice in invoices) { MaventaAPI.InvoiceParamsInC invoiceOut = new MaventaAPI.InvoiceParamsInC(); //invoiceOut.invoice_nr = "1001"; //invoiceOut.reference_nr = "10016"; invoiceOut.date = invoice.InvoiceDate; invoiceOut.date_due = invoice.InvoiceDueDate; invoiceOut.sum = invoice.InvoiceSum; invoiceOut.sum_tax = invoice.InvoiceSum_tax; invoiceOut.currency = invoice.ClientCurrency; //invoiceOut.lang = "FI"; //Customer information MaventaAPI.CustomerParamsInC customerOut = new CustomerParamsInC(); customerOut.name = invoice.ClientName; //customerOut.bid = "FI1234567"; //customerOut.ovt = "0037111111"; //customerOut.email = "*****@*****.**"; //customerOut.country = "FI"; customerOut.address1 = invoice.ClientAddress; invoiceOut.customer = customerOut; //Invoice items List<ItemsInC> itemList = new List<ItemsInC>(); foreach(var item in invoice.Items) { ItemsInC itemOut = new ItemsInC(); itemOut.item_code = item.Code; itemOut.subject = item.Subject; itemOut.amount = item.Amount; itemOut.price = item.UnitPrice; itemOut.tax = item.Tax; itemOut.sum = item.Sum; itemOut.sum_tax = item.Sum_tax; itemList.Add(itemOut); } invoiceOut.items = itemList.ToArray(); //Send invoice InvoiceStatus invoiceResponse = new InvoiceStatus(); MaventaApiPortClient port = new MaventaApiPortClient(); invoiceResponse = port.invoice_create(apiKeys, invoiceOut); } }
private List <AnimetricsRecognizeResponse> RecognizeSourceFaces() { List <AnimetricsRecognizeResponse> result = new List <AnimetricsRecognizeResponse>(); foreach (var entry in DetectedSourceFaces) { var retryPolicy = Policy.HandleResult <AnimetricsRecognizeResponse>(r => r.images == null).Retry(3, (exception, retryCount) => { ApiKeys.NextKey(); }); AnimetricsRecognizeResponse response = retryPolicy.Execute(() => RecognizeFace(entry)); if (response != null) { result.Add(response); Console.WriteLine("Face recognized in source image {0}.", entry.Key); } } return(result); }
public void Update_with_scopes() { // Arrange var keyId = "xxxxxxxx"; var name = "My API Key"; var scopes = new[] { "mail.send", "alerts.create", "alerts.read" }; var mockHttp = new MockHttpMessageHandler(); mockHttp.Expect(HttpMethod.Put, Utils.GetSendGridApiUri(ENDPOINT, keyId)).Respond("application/json", SINGLE_API_KEY_JSON); var client = Utils.GetFluentClient(mockHttp); var apiKeys = new ApiKeys(client); // Act var result = apiKeys.UpdateAsync(keyId, name, scopes, CancellationToken.None).Result; // Assert mockHttp.VerifyNoOutstandingExpectation(); mockHttp.VerifyNoOutstandingRequest(); result.ShouldNotBeNull(); }
public void GetAll() { // Arrange var mockRepository = new MockRepository(MockBehavior.Strict); var mockClient = mockRepository.Create <IClient>(); mockClient .Setup(c => c.GetAsync(ENDPOINT, It.IsAny <CancellationToken>())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MULTIPLE_API_KEY_JSON) }) .Verifiable(); var apiKeys = new ApiKeys(mockClient.Object, ENDPOINT); // Act var result = apiKeys.GetAllAsync(CancellationToken.None).Result; // Assert result.ShouldNotBeNull(); result.Length.ShouldBe(2); }
private List <LambdaTrainAlbumResponse> TrainAlbum(string albumId) { List <LambdaTrainAlbumResponse> result = new List <LambdaTrainAlbumResponse>(); foreach (var entry in DataSet.TargetImages) { MemoryStream imageStream = new MemoryStream(); DataSet.GetImage(entry.Key).Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] data = imageStream.ToArray(); // For some reason LambdaLabs is really picky about what characters they allow in an entry id string entryId = entry.Key.Split('/')[1].Split('.')[0].Replace("_", ""); HttpResponse <string> response = Unirest.post(BaseUrl + "album_train") .header("X-Mashape-Key", ApiKeys.GetCurrentKey()) .header("accept", "application/json") .field("album", AlbumName) .field("albumkey", albumId) .field("entryid", entryId) .field("files", data) .asString(); LambdaTrainAlbumResponse responseObject = JsonConvert.DeserializeObject <LambdaTrainAlbumResponse>(response.Body); if (responseObject.entryid != null) { Console.WriteLine("Face detected in image {0}.", entry.Key); result.Add(responseObject); } else { Console.WriteLine("No face detected in image {0}.", entry.Key); } } return(result); }
public DSN(Uri reportingUrl, string projectId, ApiKeys keys) { this.reportingUrl = reportingUrl; this.projectId = projectId; this.keys = keys; }
public void AddApiKey(ApiKeySql apiKey) { ApiKeys.Add(apiKey); }
public ApiKeySql GetApiKey(string name) { return(ApiKeys.SingleOrDefault(a => a.Id == name)); }
public GetSingleEpisodeHandler(IOptions <ApiKeys> apiKeys, IOptions <ServicePath> servicePath, SonarrClient sonarrClient) { _apiKeys = apiKeys.Value; _servicePath = servicePath.Value; _sonarrClient = sonarrClient; }
public SafeBrowsingApi(ApiKeys apiKeys, IHttpClientFactory httpFactory) { http = httpFactory.CreateClient(); url += apiKeys.SafeBrowsingApi; }
public async Task RemoveApiKeyAsync(ExtendedUser user, ExtendedApiKey apiKey) { ApiKeys.Remove(apiKey); user.ApiKeys.Remove(apiKey); }
public PixabayClient(ApiKeys apiKey) { Client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", apiKey.Pixabay); }
public GetSeriesCastHandler(IOptions <ApiKeys> apiKeys, IOptions <ServicePath> servicePath, TVMazeClient tvMazeClient) { _apiKeys = apiKeys.Value; _servicePath = servicePath.Value; _tvMazeClient = tvMazeClient; }
public async Task <ExtendedApiKey> FindKeyByIdAsync(int id) { return(ApiKeys.FirstOrDefault(s => s.Id == id)); }
private Client(string apiKey, string username, string password, string baseUri, string apiVersion, HttpClient httpClient) { _mustDisposeHttpClient = httpClient == null; _httpClient = httpClient; #if DEBUG Version = "DEBUG"; #else var assemblyVersion = typeof(Client).GetTypeInfo().Assembly.GetName().Version; Version = $"{assemblyVersion.Major}.{assemblyVersion.Minor}.{assemblyVersion.Build}"; #endif _fluentClient = new FluentClient(new Uri($"{baseUri.TrimEnd('/')}/{apiVersion.TrimStart('/')}"), httpClient) .SetUserAgent($"StrongGrid/{Version} (+https://github.com/Jericho/StrongGrid)") .SetRequestCoordinator(new SendGridRetryStrategy()); _fluentClient.Filters.Remove <DefaultErrorFilter>(); _fluentClient.Filters.Add(new DiagnosticHandler()); _fluentClient.Filters.Add(new SendGridErrorHandler()); if (!string.IsNullOrEmpty(apiKey)) { _fluentClient.SetBearerAuthentication(apiKey); } if (!string.IsNullOrEmpty(username)) { _fluentClient.SetBasicAuthentication(username, password); } AccessManagement = new AccessManagement(_fluentClient); Alerts = new Alerts(_fluentClient); ApiKeys = new ApiKeys(_fluentClient); Batches = new Batches(_fluentClient); Blocks = new Blocks(_fluentClient); Bounces = new Bounces(_fluentClient); Campaigns = new Campaigns(_fluentClient); Categories = new Categories(_fluentClient); Contacts = new Contacts(_fluentClient); CustomFields = new CustomFields(_fluentClient); EmailActivities = new EmailActivities(_fluentClient); GlobalSuppressions = new GlobalSuppressions(_fluentClient); InvalidEmails = new InvalidEmails(_fluentClient); IpAddresses = new IpAddresses(_fluentClient); IpPools = new IpPools(_fluentClient); Lists = new Lists(_fluentClient); Mail = new Mail(_fluentClient); Segments = new Segments(_fluentClient); SenderIdentities = new SenderIdentities(_fluentClient); Settings = new Settings(_fluentClient); SpamReports = new SpamReports(_fluentClient); Statistics = new Statistics(_fluentClient); Subusers = new Subusers(_fluentClient); Suppressions = new Suppressions(_fluentClient); Teammates = new Teammates(_fluentClient); Templates = new Templates(_fluentClient); UnsubscribeGroups = new UnsubscribeGroups(_fluentClient); User = new User(_fluentClient); WebhookSettings = new WebhookSettings(_fluentClient); WebhookStats = new WebhookStats(_fluentClient); SenderAuthentication = new SenderAuthentication(_fluentClient); }
public async Task <IResponseContent> ApiKeyLoginAsync(ApiKeys key) { return(await this.ApiKeyLoginAsync(key.ApiKey, key.AppId, key.TenantId != null?key.TenantId.ToString() : string.Empty)); }
public async Task <ActionResult> Create([Bind(Include = "HikerId,FirstName,LastName,StreetAddress,City,State,Latitude,Longitude,ApplicationId")] Hiker hiker, ApiKeys apiKeys) { if (ModelState.IsValid) { string newuserid = User.Identity.GetUserId(); hiker.ApplicationId = newuserid; await GetHikerLatLong(apiKeys, hiker); db.Hikers.Add(hiker); db.SaveChanges(); return(RedirectToAction("Details", "Hikers", new { id = hiker.HikerId })); } return(View(hiker)); }
public TVMazeClient(HttpClient httpClient, IOptions <ApiKeys> apiKeys) { Client = httpClient; _apiKeys = apiKeys.Value; }
public GetCombinedMediaHandler(IHttpHelper http, IOptions <ServicePath> path, IOptions <ApiKeys> keys) { _http = http; _keys = keys.Value; _path = path.Value; }
public async Task <byte[]> CompressAsync() { var resImg = SourceImageBytes; long lastCompressedSize = 0; // // Check if api keys have enough compress remain count while (ApiKeys.Any()) { ApiKeys[0].CompressCount = await CompressRemainCountAsync(ApiKeys[0].Key); if (ApiKeys[0].CompressRemainCount <= 1) { ApiKeys.RemoveAt(0); } else { break; } } for (var repeatCount = 1; repeatCount <= RepeatCompressionNumber; repeatCount++) { using (var client = new WebClient()) { if (!ApiKeys.Any()) { break; } var auth = Convert.ToBase64String(Encoding.UTF8.GetBytes($"api:{ApiKeys[0].Key}")); client.Headers.Add(HttpRequestHeader.Authorization, $"Basic {auth}"); do { await client.UploadDataTaskAsync(ApiUrl, resImg); // Compression was successful, retrieve output from Location header. resImg = await client.DownloadDataTaskAsync(client.ResponseHeaders["Location"]); ApiKeys[0].CompressCount = int.Parse(client.ResponseHeaders["Compression-Count"]); // call progress event to new compress level OnProgressChanged(repeatCount, resImg, ApiKeys[0].CompressCount); await ApiKeys[0].SaveCompressRemainCountAsync(); if (ApiKeys[0].CompressRemainCount <= 1) { ApiKeys.RemoveAt(0); } if (lastCompressedSize == resImg.LongLength) { goto EndOfCompress; } lastCompressedSize = resImg.LongLength; } while (++repeatCount <= RepeatCompressionNumber && ApiKeys.Any()); } } EndOfCompress: return(resImg); }
public int CompressRemainCount() { return(ApiKeys.Sum(x => x.CompressRemainCount)); }
public TwitchController(IOptions <ApiKeys> apikeys) { _apikeys = apikeys.Value; }
public ItemController(IItemRepository itemRepository, IOptions <ApiKeys> apiKeys) { ItemRepository = itemRepository; _apiKeys = apiKeys.Value; }
/// <summary> /// A client has connected to the websocket server. /// </summary> /// <param name="conn">The client to process.</param> private void OnOpen(IWebSocketConnection conn) { if (QEDector.IsAttacking(IPAddress.Parse((ReadOnlySpan <char>)conn.ConnectionInfo.ClientIpAddress))) { lock (AttackerAddresses) { if (!AttackerAddresses.Contains(conn.ConnectionInfo.ClientIpAddress)) { Push( $"Under denial of service attack from: {conn.ConnectionInfo.ClientIpAddress}! The address has been booted from accessing the Web API server, for 5 minutes. Please take action!", "-HIGHEST PRIORITY/CRITICAL-", Structures.MessageFlag.ConsoleLogMessage); AttackerAddresses.Add(conn.ConnectionInfo.ClientIpAddress); } } return; } conn.OnMessage = message => { //we will handle AUTH and commands here. try { BlackTeaConnection connection; if (!ContainsWith(conn)) { var cryptoResult = QEData.TryDecrypt(message); if (cryptoResult != null) { connection = new BlackTeaConnection(conn, cryptoResult.Password); } else { var reject = new Structures.BaseMessage { Name = "reject", Date = GetTime(), Type = Structures.MessageFlag.LoginApiRejected }; conn.Send(JsonSerializer.Serialize(reject)); Master.LogManager.LogDashboard(IPAddress.Parse(conn.ConnectionInfo.ClientIpAddress), "[CRITICAL WARN] Failed log-in attempt."); conn.Close(); //we log the issue. Logger.LogWarning($"Failed log-in attempt : {conn.ConnectionInfo.ClientIpAddress}."); return; } } else { connection = GetWith(conn); } var json = QEData.Decrypt(message, connection.Key); if (json == null) { return; } var msg = JsonSerializer.Deserialize <Structures.BaseMessage>(json); if (msg != null) { if (msg.Type.Equals(Structures.MessageFlag.LoginApiRequest)) { //the client has entered an invalid key. lock (ApiKeys) if (!ApiKeys.Contains(msg.Text)) { msg.Name = "reject"; msg.Date = GetTime(); msg.Type = Structures.MessageFlag.LoginApiRejected; conn.Send(JsonSerializer.Serialize(msg)); Master.LogManager.LogDashboard(IPAddress.Parse(conn.ConnectionInfo.ClientIpAddress), "[CRITICAL WARN] Failed log-in attempt."); conn.Close(); //we log the issue. Logger.LogWarning($"Failed log-in attempt : {conn.ConnectionInfo.ClientIpAddress} - key : {msg.Text}"); return; } lock (Clients) { Clients.Add(connection); Logger.LogWarning($"ImpostorHQ : New web admin client : {conn.ConnectionInfo.ClientIpAddress}"); msg.Text = "You have successfully connected to ImpostorHQ!"; msg.Type = Structures.MessageFlag.LoginApiAccepted; msg.Name = "welcome"; msg.Date = GetTime(); conn.Send(JsonSerializer.Serialize(msg)); conn.OnClose += () => { //we handle the client disconnecting. RemoveWith(conn); }; } } else if (msg.Type.Equals(Structures.MessageFlag.ConsoleCommand)) { if (!ContainsWith(conn)) { //we are being attacked. //the client is sending commands without being logged in. conn.Close(); RemoveWith(conn); Logger.LogWarning($"Break-in attempt from : {conn.ConnectionInfo.ClientIpAddress}"); return; } MessageReceived(msg, conn); } else { //invalid API call. //probably not a client. conn.Close(); } } } catch (Exception ex) { //not JSON. Console.WriteLine($"Fatal error occured : {ex}"); return; } }; }
public AsteroidController() { _api = new ApiKeys(); client = new HttpClient(); }
public SteamController(IOptions <ApiKeys> apiKeys, ILogger <SteamController> logger) { _apiKeys = apiKeys.Value; _logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="BaseClient" /> class. /// </summary> /// <param name="apiKey">Your api key.</param> /// <param name="username">Your username. Ignored if the api key is specified.</param> /// <param name="password">Your password. Ignored if the api key is specified.</param> /// <param name="httpClient">Allows you to inject your own HttpClient. This is useful, for example, to setup the HtppClient with a proxy.</param> /// <param name="disposeClient">Indicates if the http client should be dispose when this instance of BaseClient is disposed.</param> /// <param name="options">Options for the SendGrid client.</param> /// <param name="logger">Logger.</param> public BaseClient(Parameter <string> apiKey, Parameter <string> username, Parameter <string> password, HttpClient httpClient, bool disposeClient, StrongGridClientOptions options, ILogger logger = null) { _mustDisposeHttpClient = disposeClient; _httpClient = httpClient; _options = options ?? GetDefaultOptions(); _logger = logger ?? NullLogger.Instance; _fluentClient = new FluentClient(new Uri(SENDGRID_V3_BASE_URI), httpClient) .SetUserAgent($"StrongGrid/{Version} (+https://github.com/Jericho/StrongGrid)") .SetRequestCoordinator(new SendGridRetryStrategy()); _fluentClient.Filters.Remove <DefaultErrorFilter>(); // Order is important: DiagnosticHandler must be first. // Also, the list of filters must be kept in sync with the filters in Utils.GetFluentClient in the unit testing project. _fluentClient.Filters.Add(new DiagnosticHandler(_options.LogLevelSuccessfulCalls, _options.LogLevelFailedCalls, _logger)); _fluentClient.Filters.Add(new SendGridErrorHandler()); if (apiKey.HasValue) { if (string.IsNullOrEmpty(apiKey)) { throw new ArgumentNullException(apiKey); } else { _fluentClient.SetBearerAuthentication(apiKey); } } else if (username.HasValue) { if (string.IsNullOrEmpty(username)) { throw new ArgumentNullException(username); } else { _fluentClient.SetBasicAuthentication(username, password); } } else { throw new ArgumentException("You must provide either an API key or a username and a password."); } AccessManagement = new AccessManagement(FluentClient); Alerts = new Alerts(FluentClient); ApiKeys = new ApiKeys(FluentClient); Batches = new Batches(FluentClient); Blocks = new Blocks(FluentClient); Bounces = new Bounces(FluentClient); Designs = new Designs(FluentClient); EmailActivities = new EmailActivities(FluentClient); EmailValidation = new EmailValidation(FluentClient); GlobalSuppressions = new GlobalSuppressions(FluentClient); InvalidEmails = new InvalidEmails(FluentClient); IpAddresses = new IpAddresses(FluentClient); IpPools = new IpPools(FluentClient); Mail = new Mail(FluentClient); Settings = new Settings(FluentClient); SpamReports = new SpamReports(FluentClient); Statistics = new Statistics(FluentClient); Subusers = new Subusers(FluentClient); Suppressions = new Suppressions(FluentClient); Teammates = new Teammates(FluentClient); Templates = new Templates(FluentClient); UnsubscribeGroups = new UnsubscribeGroups(FluentClient); User = new User(FluentClient); WebhookSettings = new WebhookSettings(FluentClient); WebhookStats = new WebhookStats(FluentClient); SenderAuthentication = new SenderAuthentication(FluentClient); }
public async Task <ExtendedApiKey> FindKeyByPublicKeyAsync(string publicKey) { return(ApiKeys.FirstOrDefault(s => s.PublicKey == publicKey)); }
public static SentryMessage message( string loggerName, ApiKeys keys, ErrorReporter.AppInfo appInfo, ErrorReporter.ErrorData data, ExtraData addExtraData ) { var timestamp = DateTime.UtcNow; // The list of frames should be ordered by the oldest call first. // ReSharper disable once ConvertClosureToMethodGroup - MCS bug var stacktraceFrames = data.backtrace.Select(a => backtraceElemToJson(a)).Reverse().ToList(); // Tags are properties that can be filtered/grouped by. var tags = new Dictionary <string, object> { // max tag name length = 32 { "ProductName", tag(appInfo.productName) }, { "BundleIdentifier", tag(appInfo.bundleIdentifier) }, { "App:LoadedLevelNames", tag( Enumerable2.fromImperative(SceneManager.sceneCount, SceneManager.GetSceneAt). Select(_ => $"{_.name}({_.buildIndex})").OrderBy(_ => _).mkString(", ") ) }, { "App:LevelCount", tag(SceneManager.sceneCountInBuildSettings) }, { "App:Platform", tag(Application.platform) }, { "App:UnityVersion", tag(Application.unityVersion) }, { "App:Version", tag(Application.version) }, { "App:BundleIdentifier", tag(Application.bundleIdentifier) }, { "App:InstallMode", tag(Application.installMode) }, { "App:SandboxType", tag(Application.sandboxType) }, { "App:ProductName", tag(Application.productName) }, { "App:CompanyName", tag(Application.companyName) }, { "App:CloudProjectId", tag(Application.cloudProjectId) }, { "App:WebSecurityEnabled", tag(Application.webSecurityEnabled) }, { "App:WebSecurityHostUrl", tag(Application.webSecurityHostUrl) }, { "App:TargetFrameRate", tag(Application.targetFrameRate) }, { "App:SystemLanguage", tag(Application.systemLanguage) }, { "App:BackgroundLoadingPriority", tag(Application.backgroundLoadingPriority) }, { "App:InternetReachability", tag(Application.internetReachability) }, { "App:GenuineCheckAvailable", tag(Application.genuineCheckAvailable) }, { "App:Genuine", tag(Application.genuineCheckAvailable && Application.genuine) }, { "SI:OperatingSystem", tag(SystemInfo.operatingSystem) }, { "SI:ProcessorType", tag(SystemInfo.processorType) }, { "SI:ProcessorCount", tag(SystemInfo.processorCount) }, { "SI:SystemMemorySize", tag(SystemInfo.systemMemorySize) }, { "SI:GraphicsMemorySize", tag(SystemInfo.graphicsMemorySize) }, { "SI:GraphicsDeviceName", tag(SystemInfo.graphicsDeviceName) }, { "SI:GraphicsDeviceVendor", tag(SystemInfo.graphicsDeviceVendor) }, { "SI:GraphicsDeviceID", tag(SystemInfo.graphicsDeviceID) }, { "SI:GraphicsDeviceVendorID", tag(SystemInfo.graphicsDeviceVendorID) }, { "SI:GraphicsDeviceType", tag(SystemInfo.graphicsDeviceType) }, { "SI:GraphicsDeviceVersion", tag(SystemInfo.graphicsDeviceVersion) }, { "SI:GraphicsShaderLevel", tag(SystemInfo.graphicsShaderLevel) }, { "SI:GraphicsMultiThreaded", tag(SystemInfo.graphicsMultiThreaded) }, { "SI:SupportsShadows", tag(SystemInfo.supportsShadows) }, { "SI:SupportsRenderTextures", tag(SystemInfo.supportsRenderTextures) }, { "SI:SupportsRenderToCubemap", tag(SystemInfo.supportsRenderToCubemap) }, { "SI:SupportsImageEffects", tag(SystemInfo.supportsImageEffects) }, { "SI:Supports3DTextures", tag(SystemInfo.supports3DTextures) }, { "SI:SupportsComputeShaders", tag(SystemInfo.supportsComputeShaders) }, { "SI:SupportsInstancing", tag(SystemInfo.supportsInstancing) }, { "SI:SupportsSparseTextures", tag(SystemInfo.supportsSparseTextures) }, { "SI:SupportedRenderTargetCount", tag(SystemInfo.supportedRenderTargetCount) }, { "SI:SupportsStencil", tag(SystemInfo.supportsStencil) }, { "SI:NPOTsupport", tag(SystemInfo.npotSupport) }, { "SI:DeviceName", tag(SystemInfo.deviceName) }, { "SI:DeviceModel", tag(SystemInfo.deviceModel) }, { "SI:SupportsAccelerometer", tag(SystemInfo.supportsAccelerometer) }, { "SI:SupportsGyroscope", tag(SystemInfo.supportsGyroscope) }, { "SI:SupportsLocationService", tag(SystemInfo.supportsLocationService) }, { "SI:SupportsVibration", tag(SystemInfo.supportsVibration) }, { "SI:DeviceType", tag(SystemInfo.deviceType) }, { "SI:MaxTextureSize", tag(SystemInfo.maxTextureSize) }, }; addExtraData.addTags((name, value) => tags[name] = tag(value)); // Extra contextual data is limited to 4096 characters. var extras = new Dictionary <string, object> { { "App:StreamedBytes", Application.streamedBytes }, }; addExtraData.addExtras((name, value) => extras[name] = value); var json = new Dictionary <string, object> { { "event_id", Guid.NewGuid().ToString("N") }, // max length - 1000 chars { "message", data.message.trimTo(1000) }, { "timestamp", timestamp.ToString("yyyy-MM-ddTHH:mm:ss") }, { "level", logTypeToSentryLevel(data.errorType) }, { "logger", loggerName }, { "platform", Application.platform.ToString() }, { "release", appInfo.bundleVersion }, { "tags", tags }, { "extra", extras }, { "stacktrace", new Dictionary <string, object> { { "frames", stacktraceFrames } } } }; if (!data.backtrace.isEmpty()) { json.Add("culprit", data.backtrace[0].method); } var serialized = Formats.MiniJSON.Json.Serialize(json); return(new SentryMessage(keys, timestamp, serialized)); }
public SearchMovieByNameHandler(IOptions <ApiKeys> apikeys, IOptions <ServicePath> path) { _apikeys = apikeys.Value; _path = path.Value; }
public SentryMessage(ApiKeys keys, DateTime timestamp, string json) { this.keys = keys; this.timestamp = timestamp; this.json = json; }