-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
77 lines (63 loc) · 2.06 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// See https://aka.ms/new-console-template for more information
using System;
using FingerprintPro.ServerSdk.Api;
using FingerprintPro.ServerSdk.Client;
using FingerprintPro.ServerSdk.Model;
var example = new FingerprintExample();
example.GetVisitsExample();
example.GetEventExample();
// Uncomment following line to test update event method
// example.UpdateEventExample()
// Uncomment following line to test delete visitor data
// example.DeleteVisitorDataExample()
internal class FingerprintExample
{
private readonly Configuration _configuration = new(Environment.GetEnvironmentVariable("API_KEY")!);
private readonly string _visitorId = Environment.GetEnvironmentVariable("VISITOR_ID")!;
private readonly string _requestId = Environment.GetEnvironmentVariable("REQUEST_ID")!;
private readonly FingerprintApi _api;
public FingerprintExample()
{
// Change region if needed
var region = Environment.GetEnvironmentVariable("REGION")!;
_configuration.Region = region switch
{
"eu" => Region.Eu,
"ap" => Region.Asia,
_ => _configuration.Region
};
_api = new FingerprintApi(_configuration);
}
public void GetVisitsExample()
{
var visits = _api.GetVisits(_visitorId);
Console.WriteLine("GetVisits() result:");
Console.WriteLine(visits);
}
public void GetEventExample()
{
var events = _api.GetEvent(_requestId);
Console.WriteLine("GetEvent() result:");
Console.WriteLine(events);
}
public void UpdateEventExample()
{
var tag = new Tag
{
["sdk"] = "dotnet"
};
var body = new EventsUpdateRequest()
{
Suspect = false,
Tag = tag,
LinkedId = "<linked_id>"
};
_api.UpdateEvent(body, _requestId);
Console.WriteLine("Event updated");
}
public void DeleteVisitorDataExample()
{
_api.DeleteVisitorData(_visitorId);
Console.WriteLine("Scheduled visitor data removal");
}
}