This repository was archived by the owner on Oct 31, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +97
-2
lines changed Expand file tree Collapse file tree 3 files changed +97
-2
lines changed Original file line number Diff line number Diff line change 1+ using System . Threading ;
2+ using System . Threading . Tasks ;
3+
4+ using Fortnite_API . Objects ;
5+
6+ using RestSharp ;
7+
8+ namespace Fortnite_API . Endpoints
9+ {
10+ public class AesEndpoint
11+ {
12+ private readonly IRestClient _client ;
13+
14+ internal AesEndpoint ( IRestClient client )
15+ {
16+ _client = client ;
17+ }
18+
19+ public async Task < ApiResponse < AesData > > GetAsync ( CancellationToken token = default )
20+ {
21+ var request = new RestRequest ( "aes" , Method . GET ) ;
22+ var response = await _client . ExecuteTaskAsync < ApiResponse < AesData > > ( request , token ) . ConfigureAwait ( false ) ;
23+ return response . Data ;
24+ }
25+
26+ public ApiResponse < AesData > Get ( )
27+ {
28+ return GetAsync ( ) . GetAwaiter ( ) . GetResult ( ) ;
29+ }
30+ }
31+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ public class FortniteApi
1414 public ShopEndpoints Shop { get ; }
1515 public NewsEndpoints News { get ; }
1616 public CreatorcodeEndpoints CreatorCode { get ; }
17+ public AesEndpoint Aes { get ; }
1718
1819 public FortniteApi ( string apiKey )
1920 {
@@ -27,10 +28,9 @@ public FortniteApi(string apiKey)
2728 throw new ArgumentOutOfRangeException ( nameof ( apiKey ) ) ;
2829 }
2930
30- var currentVersion = Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version ;
3131 var _client = new RestClient ( "https://fortnite-api.com/" )
3232 {
33- UserAgent = $ "Fortnite-API.NET/{ currentVersion . ToString ( 3 ) } ",
33+ UserAgent = $ "Fortnite-API.NET/{ Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version . ToString ( 3 ) } ",
3434 Timeout = 10 * 1000 ,
3535 DefaultParameters =
3636 {
@@ -42,6 +42,7 @@ public FortniteApi(string apiKey)
4242 Shop = new ShopEndpoints ( _client ) ;
4343 News = new NewsEndpoints ( _client ) ;
4444 CreatorCode = new CreatorcodeEndpoints ( _client ) ;
45+ Aes = new AesEndpoint ( _client ) ;
4546 }
4647 }
4748}
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ using J = Newtonsoft . Json . JsonPropertyAttribute ;
4+
5+ namespace Fortnite_API . Objects
6+ {
7+ public class AesData : IEquatable < AesData >
8+ {
9+ [ J ( "aes" ) ] public string Aes { get ; private set ; }
10+ [ J ( "build" ) ] public string Build { get ; private set ; }
11+ [ J ( "lastUpdate" ) ] public DateTime LastUpdate { get ; private set ; }
12+
13+ public bool Equals ( AesData other )
14+ {
15+ if ( ReferenceEquals ( null , other ) )
16+ {
17+ return false ;
18+ }
19+
20+ if ( ReferenceEquals ( this , other ) )
21+ {
22+ return true ;
23+ }
24+
25+ return Aes == other . Aes && Build == other . Build && LastUpdate . Equals ( other . LastUpdate ) ;
26+ }
27+
28+ public override bool Equals ( object obj )
29+ {
30+ if ( ReferenceEquals ( null , obj ) )
31+ {
32+ return false ;
33+ }
34+
35+ if ( ReferenceEquals ( this , obj ) )
36+ {
37+ return true ;
38+ }
39+
40+ if ( obj . GetType ( ) != typeof ( AesData ) )
41+ {
42+ return false ;
43+ }
44+
45+ return Equals ( ( AesData ) obj ) ;
46+ }
47+
48+ public override int GetHashCode ( )
49+ {
50+ return HashCode . Combine ( Aes , Build , LastUpdate ) ;
51+ }
52+
53+ public static bool operator == ( AesData left , AesData right )
54+ {
55+ return Equals ( left , right ) ;
56+ }
57+
58+ public static bool operator != ( AesData left , AesData right )
59+ {
60+ return ! Equals ( left , right ) ;
61+ }
62+ }
63+ }
You can’t perform that action at this time.
0 commit comments