-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathIPLookupResult.cs
More file actions
104 lines (75 loc) · 3.07 KB
/
IPLookupResult.cs
File metadata and controls
104 lines (75 loc) · 3.07 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text.Json.Serialization;
using IPData.Helpers.Extensions;
namespace IPData.Models
{
public class IPLookupResult
{
[JsonPropertyName("ip")]
public string Ip { get; set; }
[JsonPropertyName("is_eu")]
public bool? IsEu { get; set; }
[JsonPropertyName("city")]
public string City { get; set; }
[JsonPropertyName("region")]
public string Region { get; set; }
[JsonPropertyName("region_code")]
public string RegionCode { get; set; }
[JsonPropertyName("country_name")]
public string CountryName { get; set; }
[JsonPropertyName("country_code")]
public string CountryCode { get; set; }
[JsonPropertyName("continent_name")]
public string ContinentName { get; set; }
[JsonPropertyName("continent_code")]
public string ContinentCode { get; set; }
[JsonPropertyName("latitude")]
public double? Latitude { get; set; }
[JsonPropertyName("longitude")]
public double? Longitude { get; set; }
[JsonPropertyName("asn")]
public AsnInfo Asn { get; set; }
[JsonPropertyName("organisation")]
public string Organisation { get; set; }
[JsonPropertyName("postal")]
public string Postal { get; set; }
[JsonPropertyName("calling_code")]
public string CallingCode { get; set; }
[JsonPropertyName("flag")]
public Uri Flag { get; set; }
[JsonPropertyName("emoji_flag")]
public string EmojiFlag { get; set; }
[JsonPropertyName("emoji_unicode")]
public string EmojiUnicode { get; set; }
[JsonPropertyName("languages")]
public List<Language> Languages { get; private set; } = new List<Language>();
[JsonPropertyName("currency")]
public Currency Currency { get; set; }
[JsonPropertyName("time_zone")]
public TimeZone TimeZone { get; set; }
[JsonPropertyName("threat")]
public Threat Threat { get; set; }
[JsonPropertyName("region_type")]
public string RegionType { get; set; }
[JsonPropertyName("carrier")]
public CarrierInfo Carrier { get; set; }
[JsonPropertyName("company")]
public CompanyInfo Company { get; set; }
[JsonPropertyName("status")]
public int? Status { get; set; }
[JsonPropertyName("count")]
public int Count { get; set; }
internal static string FieldName(Expression<Func<IPLookupResult, object>> expression)
{
var propName = expression.PropertyName();
var attribute = typeof(IPLookupResult)
.GetProperty(propName)
?.GetCustomAttributes(typeof(JsonPropertyNameAttribute), false)
.Single() as JsonPropertyNameAttribute;
return attribute?.Name ?? string.Empty;
}
}
}