-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnalyticsElements.cs
82 lines (72 loc) · 2.24 KB
/
AnalyticsElements.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
78
79
80
81
82
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace ComputerAnalytics
{
[BsonIgnoreExtraElements]
public class AnalyticsReferrerId
{
public string uri { get; set; } = "";
}
[BsonIgnoreExtraElements]
public class AnalyticsAggregationQueryResult<T>
{
public T _id { get; set; } = default(T);
public long totalClicks { get; set; } = 0;
public long totalUniqueIPs { get; set; } = 0;
public long minDuration { get; set; } = long.MaxValue;
public long maxDuration { get; set; } = 0;
public double avgDuration { get; set; } = 0.0;
public long totalDuration { get; set; } = 0;
public DateTime closeTime { get; set; } = DateTime.MinValue;
public List<string> ips = new List<string>();
}
[BsonIgnoreExtraElements]
public class AnalyticsAggregationNewUsersResult : AnalyticsAggregationQueryResult<AnalyticsTimeId>
{
public long newIPs { get; set; } = 0;
public long returningIPs { get; set; } = 0;
}
[BsonIgnoreExtraElements]
public class AnalyticsTimeId
{
public string time { get; set; } = "";
public long unix { get; set; } = 0;
}
[BsonIgnoreExtraElements]
public class AnalyticsScreenId
{
public long screenWidth { get; set; } = 0;
public long screenHeight { get; set; } = 0;
}
[BsonIgnoreExtraElements]
public class AnalyticsEndpointId
{
public string endpoint { get; set; } = "";
public string fullUri { get; set; } = "";
public string host { get; set; } = "";
}
[BsonIgnoreExtraElements]
public class AnalyticsCountryId
{
public string countryCode { get; set; } = "";
}
public class AnalyticsResponse
{
public string type { get; set; } = "success";
public string msg { get; set; } = "";
public AnalyticsResponse(string type, string msg = "")
{
this.type = type;
this.msg = msg;
}
public override string ToString()
{
return JsonSerializer.Serialize(this);
}
}
}