├── .github
├── FUNDING.yml
└── dependabot.yml
├── .gitignore
├── LICENSE
├── README.md
├── logo.png
└── src
├── Fortnite-API.Test
├── Fortnite-API.Test.csproj
└── Program.cs
├── Fortnite-API.sln
└── Fortnite-API
├── Endpoints
├── EndpointBase.cs
├── V1
│ ├── AesV1Endpoints.cs
│ ├── CosmeticsV1Endpoints.cs
│ ├── CreatorcodeV1Endpoints.cs
│ ├── MapV1Endpoint.cs
│ ├── NewsV1Endpoints.cs
│ ├── PlaylistsV1Endpoint.cs
│ ├── ShopV1Endpoints.cs
│ ├── StatsV1Endpoints.cs
│ └── V1Endpoints.cs
└── V2
│ ├── AesV2Endpoints.cs
│ ├── CosmeticsV2Endpoints.cs
│ ├── CreatorCodeV2Endpoints.cs
│ ├── NewsV2Endpoints.cs
│ ├── ShopV2Endpoints.cs
│ ├── StatsV2Endpoints.cs
│ └── V2Endpoints.cs
├── Extensions.cs
├── Fortnite-API.csproj
├── FortniteApiClient.cs
├── JsonNetSerializer.cs
├── Objects
├── AccountData.cs
├── ApiResponse.cs
├── GameLanguage.cs
├── MatchMethod.cs
├── V1
│ ├── AesV1.cs
│ ├── BrCosmeticV1.cs
│ ├── BrCosmeticV1Images.cs
│ ├── BrCosmeticV1Rarity.cs
│ ├── BrCosmeticV1SearchProperties.cs
│ ├── BrCosmeticV1Type.cs
│ ├── BrCosmeticV1Variant.cs
│ ├── BrCosmeticV1VariantOption.cs
│ ├── BrShopV1.cs
│ ├── BrShopV1Entry.cs
│ ├── BrStatsV2V1.cs
│ ├── BrStatsV2V1AccountType.cs
│ ├── BrStatsV2V1BattlePass.cs
│ ├── BrStatsV2V1DuoStats.cs
│ ├── BrStatsV2V1ImagePlatform.cs
│ ├── BrStatsV2V1LtmStats.cs
│ ├── BrStatsV2V1OverallStats.cs
│ ├── BrStatsV2V1RequestProperties.cs
│ ├── BrStatsV2V1SoloStats.cs
│ ├── BrStatsV2V1SquadStats.cs
│ ├── BrStatsV2V1Stats.cs
│ ├── BrStatsV2V1StatsPlatform.cs
│ ├── BrStatsV2V1TimeWindow.cs
│ ├── CombinedNewsV1.cs
│ ├── CreatorCodeV1.cs
│ ├── ImageV1Data.cs
│ ├── MapV1.cs
│ ├── MapV1Images.cs
│ ├── MapV1POI.cs
│ ├── MapV1POILocation.cs
│ ├── NewsV1.cs
│ ├── NewsV1Message.cs
│ ├── NewsV1Motd.cs
│ ├── PlaylistV1.cs
│ └── PlaylistV1Images.cs
└── V2
│ ├── AesV2.cs
│ ├── AesV2DynamicKey.cs
│ ├── AesV2KeyFormat.cs
│ ├── BrCosmeticV2.cs
│ ├── BrCosmeticV2Images.cs
│ ├── BrCosmeticV2Introduction.cs
│ ├── BrCosmeticV2Rarity.cs
│ ├── BrCosmeticV2SearchProperties.cs
│ ├── BrCosmeticV2Series.cs
│ ├── BrCosmeticV2Set.cs
│ ├── BrCosmeticV2Type.cs
│ ├── BrCosmeticV2Variant.cs
│ ├── BrCosmeticV2VariantOption.cs
│ ├── BrMaterialInstanceV2.cs
│ ├── BrMaterialInstanceV2Color.cs
│ ├── BrNewCosmeticsV2.cs
│ ├── BrNewDisplayAssetV2.cs
│ ├── BrShopV2.cs
│ ├── BrShopV2Combined.cs
│ ├── BrShopV2StoreFront.cs
│ ├── BrShopV2StoreFrontEntry.cs
│ ├── BrShopV2StoreFrontEntryBanner.cs
│ ├── BrShopV2StoreFrontEntryBundle.cs
│ ├── BrShopV2StoreFrontEntrySection.cs
│ ├── CreatorCodeV2.cs
│ ├── NewsV2.cs
│ ├── NewsV2Combined.cs
│ ├── NewsV2Message.cs
│ └── NewsV2Motd.cs
├── Optional.cs
└── Utilities.cs
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | custom: ["https://buymeacoffee.com/FortniteAPI", "https://fortnite-api.com/paypal"]
2 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "nuget" # See documentation for possible values
9 | directory: "/" # Location of package manifests
10 | schedule:
11 | interval: "daily"
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Ll]og/
33 | [Ll]ogs/
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # ASP.NET Scaffolding
66 | ScaffoldingReadMe.txt
67 |
68 | # StyleCop
69 | StyleCopReport.xml
70 |
71 | # Files built by Visual Studio
72 | *_i.c
73 | *_p.c
74 | *_h.h
75 | *.ilk
76 | *.meta
77 | *.obj
78 | *.iobj
79 | *.pch
80 | *.pdb
81 | *.ipdb
82 | *.pgc
83 | *.pgd
84 | *.rsp
85 | *.sbr
86 | *.tlb
87 | *.tli
88 | *.tlh
89 | *.tmp
90 | *.tmp_proj
91 | *_wpftmp.csproj
92 | *.log
93 | *.vspscc
94 | *.vssscc
95 | .builds
96 | *.pidb
97 | *.svclog
98 | *.scc
99 |
100 | # Chutzpah Test files
101 | _Chutzpah*
102 |
103 | # Visual C++ cache files
104 | ipch/
105 | *.aps
106 | *.ncb
107 | *.opendb
108 | *.opensdf
109 | *.sdf
110 | *.cachefile
111 | *.VC.db
112 | *.VC.VC.opendb
113 |
114 | # Visual Studio profiler
115 | *.psess
116 | *.vsp
117 | *.vspx
118 | *.sap
119 |
120 | # Visual Studio Trace Files
121 | *.e2e
122 |
123 | # TFS 2012 Local Workspace
124 | $tf/
125 |
126 | # Guidance Automation Toolkit
127 | *.gpState
128 |
129 | # ReSharper is a .NET coding add-in
130 | _ReSharper*/
131 | *.[Rr]e[Ss]harper
132 | *.DotSettings.user
133 |
134 | # TeamCity is a build add-in
135 | _TeamCity*
136 |
137 | # DotCover is a Code Coverage Tool
138 | *.dotCover
139 |
140 | # AxoCover is a Code Coverage Tool
141 | .axoCover/*
142 | !.axoCover/settings.json
143 |
144 | # Coverlet is a free, cross platform Code Coverage Tool
145 | coverage*.json
146 | coverage*.xml
147 | coverage*.info
148 |
149 | # Visual Studio code coverage results
150 | *.coverage
151 | *.coveragexml
152 |
153 | # NCrunch
154 | _NCrunch_*
155 | .*crunch*.local.xml
156 | nCrunchTemp_*
157 |
158 | # MightyMoose
159 | *.mm.*
160 | AutoTest.Net/
161 |
162 | # Web workbench (sass)
163 | .sass-cache/
164 |
165 | # Installshield output folder
166 | [Ee]xpress/
167 |
168 | # DocProject is a documentation generator add-in
169 | DocProject/buildhelp/
170 | DocProject/Help/*.HxT
171 | DocProject/Help/*.HxC
172 | DocProject/Help/*.hhc
173 | DocProject/Help/*.hhk
174 | DocProject/Help/*.hhp
175 | DocProject/Help/Html2
176 | DocProject/Help/html
177 |
178 | # Click-Once directory
179 | publish/
180 |
181 | # Publish Web Output
182 | *.[Pp]ublish.xml
183 | *.azurePubxml
184 | # Note: Comment the next line if you want to checkin your web deploy settings,
185 | # but database connection strings (with potential passwords) will be unencrypted
186 | *.pubxml
187 | *.publishproj
188 |
189 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
190 | # checkin your Azure Web App publish settings, but sensitive information contained
191 | # in these scripts will be unencrypted
192 | PublishScripts/
193 |
194 | # NuGet Packages
195 | *.nupkg
196 | # NuGet Symbol Packages
197 | *.snupkg
198 | # The packages folder can be ignored because of Package Restore
199 | **/[Pp]ackages/*
200 | # except build/, which is used as an MSBuild target.
201 | !**/[Pp]ackages/build/
202 | # Uncomment if necessary however generally it will be regenerated when needed
203 | #!**/[Pp]ackages/repositories.config
204 | # NuGet v3's project.json files produces more ignorable files
205 | *.nuget.props
206 | *.nuget.targets
207 |
208 | # Microsoft Azure Build Output
209 | csx/
210 | *.build.csdef
211 |
212 | # Microsoft Azure Emulator
213 | ecf/
214 | rcf/
215 |
216 | # Windows Store app package directories and files
217 | AppPackages/
218 | BundleArtifacts/
219 | Package.StoreAssociation.xml
220 | _pkginfo.txt
221 | *.appx
222 | *.appxbundle
223 | *.appxupload
224 |
225 | # Visual Studio cache files
226 | # files ending in .cache can be ignored
227 | *.[Cc]ache
228 | # but keep track of directories ending in .cache
229 | !?*.[Cc]ache/
230 |
231 | # Others
232 | ClientBin/
233 | ~$*
234 | *~
235 | *.dbmdl
236 | *.dbproj.schemaview
237 | *.jfm
238 | *.pfx
239 | *.publishsettings
240 | orleans.codegen.cs
241 |
242 | # Including strong name files can present a security risk
243 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
244 | #*.snk
245 |
246 | # Since there are multiple workflows, uncomment next line to ignore bower_components
247 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
248 | #bower_components/
249 |
250 | # RIA/Silverlight projects
251 | Generated_Code/
252 |
253 | # Backup & report files from converting an old project file
254 | # to a newer Visual Studio version. Backup files are not needed,
255 | # because we have git ;-)
256 | _UpgradeReport_Files/
257 | Backup*/
258 | UpgradeLog*.XML
259 | UpgradeLog*.htm
260 | ServiceFabricBackup/
261 | *.rptproj.bak
262 |
263 | # SQL Server files
264 | *.mdf
265 | *.ldf
266 | *.ndf
267 |
268 | # Business Intelligence projects
269 | *.rdl.data
270 | *.bim.layout
271 | *.bim_*.settings
272 | *.rptproj.rsuser
273 | *- [Bb]ackup.rdl
274 | *- [Bb]ackup ([0-9]).rdl
275 | *- [Bb]ackup ([0-9][0-9]).rdl
276 |
277 | # Microsoft Fakes
278 | FakesAssemblies/
279 |
280 | # GhostDoc plugin setting file
281 | *.GhostDoc.xml
282 |
283 | # Node.js Tools for Visual Studio
284 | .ntvs_analysis.dat
285 | node_modules/
286 |
287 | # Visual Studio 6 build log
288 | *.plg
289 |
290 | # Visual Studio 6 workspace options file
291 | *.opt
292 |
293 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
294 | *.vbw
295 |
296 | # Visual Studio LightSwitch build output
297 | **/*.HTMLClient/GeneratedArtifacts
298 | **/*.DesktopClient/GeneratedArtifacts
299 | **/*.DesktopClient/ModelManifest.xml
300 | **/*.Server/GeneratedArtifacts
301 | **/*.Server/ModelManifest.xml
302 | _Pvt_Extensions
303 |
304 | # Paket dependency manager
305 | .paket/paket.exe
306 | paket-files/
307 |
308 | # FAKE - F# Make
309 | .fake/
310 |
311 | # CodeRush personal settings
312 | .cr/personal
313 |
314 | # Python Tools for Visual Studio (PTVS)
315 | __pycache__/
316 | *.pyc
317 |
318 | # Cake - Uncomment if you are using it
319 | # tools/**
320 | # !tools/packages.config
321 |
322 | # Tabs Studio
323 | *.tss
324 |
325 | # Telerik's JustMock configuration file
326 | *.jmconfig
327 |
328 | # BizTalk build output
329 | *.btp.cs
330 | *.btm.cs
331 | *.odx.cs
332 | *.xsd.cs
333 |
334 | # OpenCover UI analysis results
335 | OpenCover/
336 |
337 | # Azure Stream Analytics local run output
338 | ASALocalRun/
339 |
340 | # MSBuild Binary and Structured Log
341 | *.binlog
342 |
343 | # NVidia Nsight GPU debugger configuration file
344 | *.nvuser
345 |
346 | # MFractors (Xamarin productivity tool) working folder
347 | .mfractor/
348 |
349 | # Local History for Visual Studio
350 | .localhistory/
351 |
352 | # BeatPulse healthcheck temp database
353 | healthchecksdb
354 |
355 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
356 | MigrationBackup/
357 |
358 | # Ionide (cross platform F# VS Code tools) working folder
359 | .ionide/
360 |
361 | # Fody - auto-generated XML schema
362 | FodyWeavers.xsd
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019-2021 Fortnite-API.com
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # C# wrapper for [Fortnite-API.com](https://fortnite-api.com)
4 |
5 | [](https://github.com/Fortnite-API/csharp-wrapper/releases/latest) [](https://www.nuget.org/packages/Fortnite-API-Wrapper) [](https://www.nuget.org/packages/Fortnite-API-Wrapper) [](https://github.com/Fortnite-API/csharp-wrapper/issues) [](https://github.com/Fortnite-API/csharp-wrapper/blob/master/LICENSE) [](https://fortnite-api.com/paypal) [](https://fortnite-api.com/discord)
6 |
7 |
8 |
9 | This library offers a complete wrapper around the endpoints of [fortnite-api.com](https://fortnite-api.com).
10 |
11 | ## NuGet
12 |
13 | Install-Package Fortnite-API-Wrapper
14 |
15 | ## Documentation
16 |
17 | Here is a quick overview of the API so you can get started very quickly.
18 |
19 | If you need an in-use example then please take a look at the [program.cs](https://github.com/Fortnite-API/csharp-wrapper/blob/master/src/Fortnite-API.Test/Program.cs) in my test folder where i use some of the endpoints.
20 |
21 | - General usage
22 |
23 | ```cs
24 | using Fortnite_API;
25 |
26 | var apiClient = new FortniteApiClient();
27 | ```
28 |
29 | - FortniteApiClient class
30 |
31 | ```cs
32 | var apiClient = new FortniteApiClient();
33 |
34 | // accesses the stats endpoint (https://fortnite-api.com/v1/stats)
35 | apiClient.V1.Stats...
36 |
37 | // accesses the playlists endpoint (https://fortnite-api.com/v1/playlists)
38 | apiClient.V1.Playlists...
39 |
40 | // accesses the map endpoint (https://fortnite-api.com/v1/map)
41 | apiClient.V1.Map...
42 |
43 | // accesses the shop endpoint (https://fortnite-api.com/v2/shop)
44 | apiClient.V2.Shop...
45 |
46 | // accesses the cosmetics endpoint (https://fortnite-api.com/v2/cosmetics)
47 | apiClient.V2.Cosmetics...
48 |
49 | // accesses the news endpoint (https://fortnite-api.com/v2/news)
50 | apiClient.V2.News...
51 |
52 | // accesses the creatorcode endpoint (https://fortnite-api.com/v2/creatorcode)
53 | apiClient.V2.CreatorCode...
54 |
55 | // accesses the aes endpoint (https://fortnite-api.com/v2/aes)
56 | apiClient.V2.Aes...
57 | ```
58 |
59 | ### Contribute
60 |
61 | If you can provide any help, may it only be spell checking please contribute!
62 |
63 | We are open for any contribution.
64 |
65 | ## License
66 |
67 | - Fortnite-API (MIT) [License](https://github.com/Fortnite-API/csharp-wrapper/blob/master/LICENSE "MIT License")
68 | - RestSharp (Apache 2.0) [License](https://github.com/restsharp/RestSharp/blob/master/LICENSE.txt)
69 | - Newtonsoft.Json (MIT) [License](https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md)
70 |
71 | API developed by [Fortnite-API.com](https://dash.fortnite-api.com/about)
72 |
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fortnite-API/csharp-wrapper/f802607299f4688121e7c82f94e785220ebbf1b9/logo.png
--------------------------------------------------------------------------------
/src/Fortnite-API.Test/Fortnite-API.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0
6 | Fortnite_API.Test
7 |
8 |
9 |
10 | x64
11 |
12 |
13 |
14 | x64
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/Fortnite-API.Test/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Threading.Tasks;
3 |
4 | using Fortnite_API;
5 |
6 | namespace Fortnite_api.Test
7 | {
8 | internal class Program
9 | {
10 | private static async Task Main()
11 | {
12 | var apiKey = string.Empty; // optional as of now. check https://dash.fortnite-api.com to be sure
13 | var api = new FortniteApiClient(apiKey);
14 |
15 | var metaTagsCosmetics = await api.V2.Cosmetics.SearchAllBrAsync(x => x.HasMetaTags = true);
16 | //var pak1002Cosmetics = await api.V2.Cosmetics.SearchAllBrAsync(x => x.DynamicPakId = "1002");
17 | //var s16Cosmetics = await api.V2.Cosmetics.SearchAllBrAsync(x => x.BackendIntroduction = 16);
18 | //var newCosmetics = await api.V2.Cosmetics.GetBrNewAsync();
19 | //var map = await api.V1.Map.GetAsync();
20 |
21 | //var cosmeticsV2 = await api.V2.Cosmetics.GetBrAsync();
22 | //var renegadeSearch = await api.V2.Cosmetics.SearchBrAsync(x =>
23 | //{
24 | // x.Name = "enegade raid";
25 | // x.MatchMethod = MatchMethod.Contains;
26 | // x.BackendType = "AthenaCharacter";
27 | //});
28 |
29 | //var aesV2 = await api.V2.Aes.GetAsync();
30 | //var aesV2Base64 = await api.V2.Aes.GetAsync(AesV2KeyFormat.Base64);
31 |
32 | //var newsV2 = await api.V2.News.GetAsync();
33 | //var newsV2German = await api.V2.News.GetAsync(GameLanguage.DE);
34 | //var newsV2Br = await api.V2.News.GetBrAsync();
35 |
36 | //var creatorCodeV2tfue = await api.V2.CreatorCode.GetAsync("tfue239042039480");
37 | //var creatorCodeV2allStw = await api.V2.CreatorCode.SearchAllAsync("stw");
38 |
39 | //var shopV2 = await api.V2.Shop.GetBrAsync();
40 | //var shopV2German = await api.V2.Shop.GetBrAsync(GameLanguage.DE);
41 | var shopV2Combined = await api.V2.Shop.GetBrCombinedAsync();
42 |
43 | //var statsV2V1 = await api.V1.Stats.GetBrV2Async(x =>
44 | //{
45 | // //x.AccountId = "4735ce9132924caf8a5b17789b40f79c";
46 | // x.Name = "ninja";
47 | // x.ImagePlatform = BrStatsV2V1ImagePlatform.All;
48 | //});
49 |
50 | Debugger.Break();
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/src/Fortnite-API.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29503.13
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fortnite-API", "Fortnite-API\Fortnite-API.csproj", "{591626D0-DB4F-45D8-AC97-E970FCB715B6}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fortnite-API.Test", "Fortnite-API.Test\Fortnite-API.Test.csproj", "{90D24488-44F9-4402-A3BF-D8B3F2040C1B}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {591626D0-DB4F-45D8-AC97-E970FCB715B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {591626D0-DB4F-45D8-AC97-E970FCB715B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {591626D0-DB4F-45D8-AC97-E970FCB715B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {591626D0-DB4F-45D8-AC97-E970FCB715B6}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {90D24488-44F9-4402-A3BF-D8B3F2040C1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {90D24488-44F9-4402-A3BF-D8B3F2040C1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {90D24488-44F9-4402-A3BF-D8B3F2040C1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {90D24488-44F9-4402-A3BF-D8B3F2040C1B}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {337EBEE7-A75D-466C-99ED-A4482BC8A9C9}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/EndpointBase.cs:
--------------------------------------------------------------------------------
1 | using RestSharp;
2 |
3 | namespace Fortnite_API.Endpoints
4 | {
5 | public abstract class EndpointBase
6 | {
7 | internal readonly IRestClient _client;
8 |
9 | internal EndpointBase(IRestClient client)
10 | {
11 | _client = client;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V1/AesV1Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | using Fortnite_API.Objects;
5 | using Fortnite_API.Objects.V1;
6 |
7 | using RestSharp;
8 |
9 | namespace Fortnite_API.Endpoints.V1
10 | {
11 | public class AesV1Endpoints : EndpointBase
12 | {
13 | internal AesV1Endpoints(IRestClient client) : base(client) { }
14 |
15 | public async Task> GetAsync(CancellationToken token = default)
16 | {
17 | var request = new RestRequest("v1/aes", Method.GET);
18 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
19 | return response.Data;
20 | }
21 |
22 | public ApiResponse Get()
23 | {
24 | return GetAsync().GetAwaiter().GetResult();
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V1/CosmeticsV1Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | using Fortnite_API.Objects;
7 | using Fortnite_API.Objects.V1;
8 |
9 | using RestSharp;
10 |
11 | namespace Fortnite_API.Endpoints.V1
12 | {
13 | public class CosmeticsV1Endpoints : EndpointBase
14 | {
15 | internal CosmeticsV1Endpoints(IRestClient client) : base(client) { }
16 |
17 | public async Task>> GetBrAsync(GameLanguage? language = null, CancellationToken token = default)
18 | {
19 | var request = new RestRequest("v1/cosmetics/br", Method.GET);
20 |
21 | if (language.HasValue)
22 | {
23 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
24 | }
25 |
26 | var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false);
27 | return response.Data;
28 | }
29 |
30 | public ApiResponse> GetBr(GameLanguage? language = null)
31 | {
32 | return GetBrAsync(language).GetAwaiter().GetResult();
33 | }
34 |
35 | public async Task> GetBrAsync(string cosmeticId, GameLanguage? language = null, CancellationToken token = default)
36 | {
37 | if (cosmeticId == null)
38 | {
39 | throw new ArgumentNullException(nameof(cosmeticId));
40 | }
41 |
42 | if (cosmeticId.Length == 0)
43 | {
44 | throw new ArgumentOutOfRangeException(nameof(cosmeticId));
45 | }
46 |
47 | var request = new RestRequest($"v1/cosmetics/br/{cosmeticId}", Method.GET);
48 |
49 | if (language.HasValue)
50 | {
51 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
52 | }
53 |
54 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
55 | return response.Data;
56 | }
57 |
58 | public ApiResponse GetBr(string cosmeticId, GameLanguage? language = null)
59 | {
60 | return GetBrAsync(cosmeticId, language).GetAwaiter().GetResult();
61 | }
62 |
63 | public async Task>> SearchBrIdsAsync(IEnumerable cosmeticIds, GameLanguage? language = null, CancellationToken token = default)
64 | {
65 | if (cosmeticIds == null)
66 | {
67 | throw new ArgumentNullException(nameof(cosmeticIds));
68 | }
69 |
70 | var request = new RestRequest("v1/cosmetics/br/search/ids", Method.GET);
71 | var isArrayEmpty = true;
72 |
73 | foreach (var cosmeticId in cosmeticIds)
74 | {
75 | isArrayEmpty = false;
76 | request.AddQueryParameter("id", cosmeticId);
77 | }
78 |
79 | if (isArrayEmpty)
80 | {
81 | throw new ArgumentOutOfRangeException(nameof(cosmeticIds));
82 | }
83 |
84 | if (language.HasValue)
85 | {
86 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
87 | }
88 |
89 | var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false);
90 | return response.Data;
91 | }
92 |
93 | public ApiResponse> SearchBrIds(IEnumerable cosmeticIds, GameLanguage? language = null)
94 | {
95 | return SearchBrIdsAsync(cosmeticIds, language).GetAwaiter().GetResult();
96 | }
97 |
98 | public async Task> SearchBrAsync(Action func, CancellationToken token = default)
99 | {
100 | if (func == null)
101 | {
102 | throw new ArgumentNullException(nameof(func));
103 | }
104 |
105 | var request = new RestRequest("v1/cosmetics/br/search", Method.GET).ApplySearchParameters(func);
106 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
107 | return response.Data;
108 | }
109 |
110 | public ApiResponse SearchBr(Action func)
111 | {
112 | return SearchBrAsync(func).GetAwaiter().GetResult();
113 | }
114 |
115 | public async Task>> SearchAllBrAsync(Action func, CancellationToken token = default)
116 | {
117 | if (func == null)
118 | {
119 | throw new ArgumentNullException(nameof(func));
120 | }
121 |
122 | var request = new RestRequest("v1/cosmetics/br/search/all", Method.GET).ApplySearchParameters(func);
123 | var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false);
124 | return response.Data;
125 | }
126 |
127 | public ApiResponse> SearchAll(Action func)
128 | {
129 | return SearchAllBrAsync(func).GetAwaiter().GetResult();
130 | }
131 | }
132 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V1/CreatorcodeV1Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | using Fortnite_API.Objects;
7 | using Fortnite_API.Objects.V1;
8 |
9 | using RestSharp;
10 |
11 | namespace Fortnite_API.Endpoints.V1
12 | {
13 | public class CreatorcodeV1Endpoints : EndpointBase
14 | {
15 | internal CreatorcodeV1Endpoints(IRestClient client) : base(client) { }
16 |
17 | public async Task> GetAsync(string slug, CancellationToken token = default)
18 | {
19 | if (slug == null)
20 | {
21 | throw new ArgumentNullException(nameof(slug));
22 | }
23 |
24 | if (slug.Length == 0)
25 | {
26 | throw new ArgumentOutOfRangeException(nameof(slug));
27 | }
28 |
29 | var request = new RestRequest("v1/creatorcode", Method.GET).AddQueryParameter("slug", slug);
30 |
31 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
32 | return response.Data;
33 | }
34 |
35 | public ApiResponse Get(string slug)
36 | {
37 | return GetAsync(slug).GetAwaiter().GetResult();
38 | }
39 |
40 | public async Task> SearchAsync(string slug, CancellationToken token = default)
41 | {
42 | if (slug == null)
43 | {
44 | throw new ArgumentNullException(nameof(slug));
45 | }
46 |
47 | if (slug.Length == 0)
48 | {
49 | throw new ArgumentOutOfRangeException(nameof(slug));
50 | }
51 |
52 | var request = new RestRequest("v1/creatorcode/search", Method.GET).AddQueryParameter("slug", slug);
53 |
54 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
55 | return response.Data;
56 | }
57 |
58 | public ApiResponse Search(string slug)
59 | {
60 | return SearchAsync(slug).GetAwaiter().GetResult();
61 | }
62 |
63 | public async Task>> SearchAllAsync(string slug, CancellationToken token = default)
64 | {
65 | if (slug == null)
66 | {
67 | throw new ArgumentNullException(nameof(slug));
68 | }
69 |
70 | if (slug.Length == 0)
71 | {
72 | throw new ArgumentOutOfRangeException(nameof(slug));
73 | }
74 |
75 | var request = new RestRequest("v1/creatorcode/search/all", Method.GET).AddQueryParameter("slug", slug);
76 |
77 | var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false);
78 | return response.Data;
79 | }
80 |
81 | public ApiResponse> SearchAll(string slug)
82 | {
83 | return SearchAllAsync(slug).GetAwaiter().GetResult();
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V1/MapV1Endpoint.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | using Fortnite_API.Objects;
5 | using Fortnite_API.Objects.V1;
6 |
7 | using RestSharp;
8 |
9 | namespace Fortnite_API.Endpoints.V1
10 | {
11 | public class MapV1Endpoint : EndpointBase
12 | {
13 | internal MapV1Endpoint(IRestClient client) : base(client) { }
14 |
15 | public async Task> GetAsync(GameLanguage? language = null, CancellationToken token = default)
16 | {
17 | var request = new RestRequest("v1/map", Method.GET);
18 |
19 | if (language.HasValue)
20 | {
21 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
22 | }
23 |
24 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
25 | return response.Data;
26 | }
27 |
28 | public ApiResponse Get(GameLanguage? language = null)
29 | {
30 | return GetAsync(language).GetAwaiter().GetResult();
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V1/NewsV1Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | using Fortnite_API.Objects;
5 | using Fortnite_API.Objects.V1;
6 |
7 | using RestSharp;
8 |
9 | namespace Fortnite_API.Endpoints.V1
10 | {
11 | public class NewsV1Endpoints : EndpointBase
12 | {
13 | internal NewsV1Endpoints(IRestClient client) : base(client) { }
14 |
15 | public async Task> GetAsync(GameLanguage? language = null, CancellationToken token = default)
16 | {
17 | var request = new RestRequest("v1/news", Method.GET);
18 |
19 | if (language.HasValue)
20 | {
21 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
22 | }
23 |
24 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
25 | return response.Data;
26 | }
27 |
28 | public ApiResponse Get(GameLanguage? language = null)
29 | {
30 | return GetAsync(language).GetAwaiter().GetResult();
31 | }
32 |
33 | private async Task> GetNewsAsync(IRestRequest request, GameLanguage? language, CancellationToken token)
34 | {
35 | if (language.HasValue)
36 | {
37 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
38 | }
39 |
40 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
41 | return response.Data;
42 | }
43 |
44 | public Task> GetBrAsync(GameLanguage? language = null, CancellationToken token = default)
45 | {
46 | var request = new RestRequest("v1/news/br", Method.GET);
47 | return GetNewsAsync(request, language, token);
48 | }
49 |
50 | public ApiResponse GetBr(GameLanguage? language = null)
51 | {
52 | return GetBrAsync(language).GetAwaiter().GetResult();
53 | }
54 |
55 | public Task> GetStwAsync(GameLanguage? language = null, CancellationToken token = default)
56 | {
57 | var request = new RestRequest("v1/news/stw", Method.GET);
58 | return GetNewsAsync(request, language, token);
59 | }
60 |
61 | public ApiResponse GetStw(GameLanguage? language = null)
62 | {
63 | return GetStwAsync(language).GetAwaiter().GetResult();
64 | }
65 |
66 | public Task> GetCreativeAsync(GameLanguage? language = null, CancellationToken token = default)
67 | {
68 | var request = new RestRequest("v1/news/creative", Method.GET);
69 | return GetNewsAsync(request, language, token);
70 | }
71 |
72 | public ApiResponse GetCreative(GameLanguage? language = null)
73 | {
74 | return GetCreativeAsync(language).GetAwaiter().GetResult();
75 | }
76 | }
77 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V1/PlaylistsV1Endpoint.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 |
5 | using Fortnite_API.Objects;
6 | using Fortnite_API.Objects.V1;
7 |
8 | using RestSharp;
9 |
10 | namespace Fortnite_API.Endpoints.V1
11 | {
12 | public class PlaylistsV1Endpoint : EndpointBase
13 | {
14 | internal PlaylistsV1Endpoint(IRestClient client) : base(client) { }
15 |
16 | public async Task>> GetAsync(GameLanguage? language = null, CancellationToken token = default)
17 | {
18 | var request = new RestRequest("v1/playlists", Method.GET);
19 |
20 | if (language.HasValue)
21 | {
22 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
23 | }
24 |
25 | var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false);
26 | return response.Data;
27 | }
28 |
29 | public ApiResponse> Get(GameLanguage? language = null)
30 | {
31 | return GetAsync(language).GetAwaiter().GetResult();
32 | }
33 |
34 | public async Task> GetAsync(string playlistId, GameLanguage? language = null, CancellationToken token = default)
35 | {
36 | var request = new RestRequest($"v1/playlists/{playlistId}", Method.GET);
37 |
38 | if (language.HasValue)
39 | {
40 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
41 | }
42 |
43 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
44 | return response.Data;
45 | }
46 |
47 | public ApiResponse Get(string playlistId, GameLanguage? language = null)
48 | {
49 | return GetAsync(playlistId, language).GetAwaiter().GetResult();
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V1/ShopV1Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | using Fortnite_API.Objects;
5 | using Fortnite_API.Objects.V1;
6 |
7 | using RestSharp;
8 |
9 | namespace Fortnite_API.Endpoints.V1
10 | {
11 | public class ShopV1Endpoints : EndpointBase
12 | {
13 | internal ShopV1Endpoints(IRestClient client) : base(client) { }
14 |
15 | public async Task> GetBrAsync(GameLanguage? language = null, CancellationToken token = default)
16 | {
17 | var request = new RestRequest("v1/shop/br", Method.GET);
18 |
19 | if (language.HasValue)
20 | {
21 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
22 | }
23 |
24 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
25 | return response.Data;
26 | }
27 |
28 | public ApiResponse GetBr(GameLanguage? language = null)
29 | {
30 | return GetBrAsync(language).GetAwaiter().GetResult();
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V1/StatsV1Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 |
5 | using Fortnite_API.Objects;
6 | using Fortnite_API.Objects.V1;
7 |
8 | using RestSharp;
9 |
10 | namespace Fortnite_API.Endpoints.V1
11 | {
12 | public class StatsV1Endpoints : EndpointBase
13 | {
14 | internal StatsV1Endpoints(IRestClient client) : base(client) { }
15 |
16 | [Obsolete("BR V1 stats are no longer available since Epic Games shut down the endpoint.", true)]
17 | public Task GetBrV1Async()
18 | {
19 | return Task.Delay(1); // net452 doesnt have Task.CompletedTask
20 | }
21 |
22 | [Obsolete("BR V1 stats are no longer available since Epic Games shut down the endpoint.", true)]
23 | public void GetBrV1() { }
24 |
25 | public async Task> GetBrV2Async(Action func, CancellationToken token = default)
26 | {
27 | var props = new BrStatsV2V1RequestProperties();
28 | func(props);
29 |
30 | RestRequest request;
31 |
32 | if (props.AccountId.HasValue)
33 | {
34 | request = new RestRequest($"v1/stats/br/v2/{props.AccountId.Value}", Method.GET);
35 | }
36 | else if (props.Name.HasValue)
37 | {
38 | request = new RestRequest("v1/stats/br/v2", Method.GET);
39 | request.AddQueryParameter("name", props.Name.Value);
40 |
41 | if (props.AccountType.HasValue)
42 | {
43 | request.AddQueryParameter("accountType", props.AccountType.Value.GetString());
44 | }
45 | }
46 | else
47 | {
48 | throw new ArgumentException("missing accountId or name");
49 | }
50 |
51 | if (props.TimeWindow.HasValue)
52 | {
53 | request.AddQueryParameter("timeWindow", props.TimeWindow.Value.GetString());
54 | }
55 |
56 | if (props.ImagePlatform.HasValue)
57 | {
58 | request.AddQueryParameter("image", props.ImagePlatform.Value.GetString());
59 | }
60 |
61 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
62 | return response.Data;
63 | }
64 |
65 | public ApiResponse GetBrV2Id(Action func)
66 | {
67 | return GetBrV2Async(func).GetAwaiter().GetResult();
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V1/V1Endpoints.cs:
--------------------------------------------------------------------------------
1 | using RestSharp;
2 |
3 | namespace Fortnite_API.Endpoints.V1
4 | {
5 | public class V1Endpoints
6 | {
7 | public CosmeticsV1Endpoints Cosmetics { get; }
8 | public ShopV1Endpoints Shop { get; }
9 | public NewsV1Endpoints News { get; }
10 | public CreatorcodeV1Endpoints CreatorCode { get; }
11 | public AesV1Endpoints Aes { get; }
12 | public StatsV1Endpoints Stats { get; }
13 | public PlaylistsV1Endpoint Playlists { get; }
14 | public MapV1Endpoint Map { get; }
15 |
16 | internal V1Endpoints(IRestClient client)
17 | {
18 | Cosmetics = new CosmeticsV1Endpoints(client);
19 | Shop = new ShopV1Endpoints(client);
20 | News = new NewsV1Endpoints(client);
21 | CreatorCode = new CreatorcodeV1Endpoints(client);
22 | Aes = new AesV1Endpoints(client);
23 | Stats = new StatsV1Endpoints(client);
24 | Playlists = new PlaylistsV1Endpoint(client);
25 | Map = new MapV1Endpoint(client);
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V2/AesV2Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | using Fortnite_API.Objects;
5 | using Fortnite_API.Objects.V2;
6 |
7 | using RestSharp;
8 |
9 | namespace Fortnite_API.Endpoints.V2
10 | {
11 | public class AesV2Endpoints : EndpointBase
12 | {
13 | internal AesV2Endpoints(IRestClient client) : base(client) { }
14 |
15 | public async Task> GetAsync(AesV2KeyFormat? keyFormat = null, CancellationToken token = default)
16 | {
17 | var request = new RestRequest("v2/aes", Method.GET);
18 |
19 | if (keyFormat.HasValue)
20 | {
21 | request.AddQueryParameter("keyFormat", keyFormat.Value.GetString());
22 | }
23 |
24 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
25 | return response.Data;
26 | }
27 |
28 | public ApiResponse Get(AesV2KeyFormat? keyFormat = null)
29 | {
30 | return GetAsync(keyFormat).GetAwaiter().GetResult();
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V2/CosmeticsV2Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading;
5 | using System.Threading.Tasks;
6 |
7 | using Fortnite_API.Objects;
8 | using Fortnite_API.Objects.V2;
9 |
10 | using Newtonsoft.Json;
11 |
12 | using RestSharp;
13 |
14 | namespace Fortnite_API.Endpoints.V2
15 | {
16 | public class CosmeticsV2Endpoints : EndpointBase
17 | {
18 | internal CosmeticsV2Endpoints(IRestClient client) : base(client) { }
19 |
20 | public async Task>> GetBrAsync(GameLanguage? language = null, CancellationToken token = default)
21 | {
22 | var request = new RestRequest("v2/cosmetics/br", Method.GET);
23 |
24 | if (language.HasValue)
25 | {
26 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
27 | }
28 |
29 | var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false);
30 | return response.Data;
31 | }
32 |
33 | public ApiResponse> GetBr(GameLanguage? language = null)
34 | {
35 | return GetBrAsync(language).GetAwaiter().GetResult();
36 | }
37 |
38 | public async Task> GetBrAsync(string cosmeticId, GameLanguage? language = null, CancellationToken token = default)
39 | {
40 | if (cosmeticId == null)
41 | {
42 | throw new ArgumentNullException(nameof(cosmeticId));
43 | }
44 |
45 | if (cosmeticId.Length == 0)
46 | {
47 | throw new ArgumentOutOfRangeException(nameof(cosmeticId), cosmeticId, null);
48 | }
49 |
50 | var request = new RestRequest($"v2/cosmetics/br/{cosmeticId}", Method.GET);
51 |
52 | if (language.HasValue)
53 | {
54 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
55 | }
56 |
57 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
58 | return response.Data;
59 | }
60 |
61 | public ApiResponse GetBr(string cosmeticId, GameLanguage? language = null)
62 | {
63 | return GetBrAsync(cosmeticId, language).GetAwaiter().GetResult();
64 | }
65 |
66 | public async Task> GetBrNewAsync(GameLanguage? language = null, CancellationToken token = default)
67 | {
68 | var request = new RestRequest("v2/cosmetics/br/new", Method.GET);
69 |
70 | if (language.HasValue)
71 | {
72 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
73 | }
74 |
75 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
76 | return response.Data;
77 | }
78 |
79 | public ApiResponse GetBrNew(GameLanguage? language = null)
80 | {
81 | return GetBrNewAsync(language).GetAwaiter().GetResult();
82 | }
83 |
84 | public async Task>> SearchBrIdsAsync(IEnumerable cosmeticIds, GameLanguage? language = null, CancellationToken token = default)
85 | {
86 | if (cosmeticIds == null || !cosmeticIds.Any())
87 | {
88 | throw new ArgumentNullException(nameof(cosmeticIds), "the array must not be empty");
89 | }
90 |
91 | var request = new RestRequest("v2/cosmetics/br/search/ids", Method.POST);
92 | request.AddParameter("application/json", JsonConvert.SerializeObject(cosmeticIds), ParameterType.RequestBody);
93 |
94 | if (language.HasValue)
95 | {
96 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
97 | }
98 |
99 | var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false);
100 | return response.Data;
101 | }
102 |
103 | public ApiResponse> SearchBrIds(IEnumerable cosmeticIds, GameLanguage? language = null)
104 | {
105 | return SearchBrIdsAsync(cosmeticIds, language).GetAwaiter().GetResult();
106 | }
107 |
108 | public async Task> SearchBrAsync(Action func, CancellationToken token = default)
109 | {
110 | if (func == null)
111 | {
112 | throw new ArgumentNullException(nameof(func));
113 | }
114 |
115 | var request = new RestRequest("v2/cosmetics/br/search", Method.GET).ApplySearchParameters(func);
116 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
117 | return response.Data;
118 | }
119 |
120 | public ApiResponse SearchBr(Action func)
121 | {
122 | return SearchBrAsync(func).GetAwaiter().GetResult();
123 | }
124 |
125 | public async Task>> SearchAllBrAsync(Action func, CancellationToken token = default)
126 | {
127 | if (func == null)
128 | {
129 | throw new ArgumentNullException(nameof(func));
130 | }
131 |
132 | var request = new RestRequest("v2/cosmetics/br/search/all", Method.GET).ApplySearchParameters(func);
133 | var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false);
134 | return response.Data;
135 | }
136 |
137 | public ApiResponse> SearchAll(Action func)
138 | {
139 | return SearchAllBrAsync(func).GetAwaiter().GetResult();
140 | }
141 | }
142 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V2/CreatorCodeV2Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | using Fortnite_API.Objects;
7 | using Fortnite_API.Objects.V2;
8 |
9 | using RestSharp;
10 |
11 | namespace Fortnite_API.Endpoints.V2
12 | {
13 | public class CreatorCodeV2Endpoints : EndpointBase
14 | {
15 | internal CreatorCodeV2Endpoints(IRestClient client) : base(client) { }
16 |
17 | public async Task> GetAsync(string name, CancellationToken token = default)
18 | {
19 | if (name == null)
20 | {
21 | throw new ArgumentNullException(nameof(name));
22 | }
23 |
24 | if (name.Length == 0)
25 | {
26 | throw new ArgumentOutOfRangeException(nameof(name));
27 | }
28 |
29 | var request = new RestRequest("v2/creatorcode", Method.GET).AddQueryParameter("name", name);
30 |
31 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
32 | return response.Data;
33 | }
34 |
35 | public ApiResponse Get(string name)
36 | {
37 | return GetAsync(name).GetAwaiter().GetResult();
38 | }
39 |
40 | public async Task> SearchAsync(string name, CancellationToken token = default)
41 | {
42 | if (name == null)
43 | {
44 | throw new ArgumentNullException(nameof(name));
45 | }
46 |
47 | if (name.Length == 0)
48 | {
49 | throw new ArgumentOutOfRangeException(nameof(name));
50 | }
51 |
52 | var request = new RestRequest("v2/creatorcode/search", Method.GET).AddQueryParameter("name", name);
53 |
54 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
55 | return response.Data;
56 | }
57 |
58 | public ApiResponse Search(string name)
59 | {
60 | return SearchAsync(name).GetAwaiter().GetResult();
61 | }
62 |
63 | public async Task>> SearchAllAsync(string name, CancellationToken token = default)
64 | {
65 | if (name == null)
66 | {
67 | throw new ArgumentNullException(nameof(name));
68 | }
69 |
70 | if (name.Length == 0)
71 | {
72 | throw new ArgumentOutOfRangeException(nameof(name));
73 | }
74 |
75 | var request = new RestRequest("v2/creatorcode/search/all", Method.GET).AddQueryParameter("name", name);
76 |
77 | var response = await _client.ExecuteAsync>>(request, token).ConfigureAwait(false);
78 | return response.Data;
79 | }
80 |
81 | public ApiResponse> SearchAll(string name)
82 | {
83 | return SearchAllAsync(name).GetAwaiter().GetResult();
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V2/NewsV2Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | using Fortnite_API.Objects;
5 | using Fortnite_API.Objects.V2;
6 |
7 | using RestSharp;
8 |
9 | namespace Fortnite_API.Endpoints.V2
10 | {
11 | public class NewsV2Endpoints : EndpointBase
12 | {
13 | internal NewsV2Endpoints(IRestClient client) : base(client) { }
14 |
15 | public async Task> GetAsync(GameLanguage? language = null, CancellationToken token = default)
16 | {
17 | var request = new RestRequest("v2/news", Method.GET);
18 |
19 | if (language.HasValue)
20 | {
21 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
22 | }
23 |
24 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
25 | return response.Data;
26 | }
27 |
28 | public ApiResponse Get(GameLanguage? language = null)
29 | {
30 | return GetAsync(language).GetAwaiter().GetResult();
31 | }
32 |
33 | private async Task> GetNewsAsync(IRestRequest request, GameLanguage? language, CancellationToken token)
34 | {
35 | if (language.HasValue)
36 | {
37 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
38 | }
39 |
40 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
41 | return response.Data;
42 | }
43 |
44 | public Task> GetBrAsync(GameLanguage? language = null, CancellationToken token = default)
45 | {
46 | var request = new RestRequest("v2/news/br", Method.GET);
47 | return GetNewsAsync(request, language, token);
48 | }
49 |
50 | public ApiResponse GetBr(GameLanguage? language = null)
51 | {
52 | return GetBrAsync(language).GetAwaiter().GetResult();
53 | }
54 |
55 | public Task> GetStwAsync(GameLanguage? language = null, CancellationToken token = default)
56 | {
57 | var request = new RestRequest("v2/news/stw", Method.GET);
58 | return GetNewsAsync(request, language, token);
59 | }
60 |
61 | public ApiResponse GetStw(GameLanguage? language = null)
62 | {
63 | return GetStwAsync(language).GetAwaiter().GetResult();
64 | }
65 |
66 | public Task> GetCreativeAsync(GameLanguage? language = null, CancellationToken token = default)
67 | {
68 | var request = new RestRequest("v2/news/creative", Method.GET);
69 | return GetNewsAsync(request, language, token);
70 | }
71 |
72 | public ApiResponse GetCreative(GameLanguage? language = null)
73 | {
74 | return GetCreativeAsync(language).GetAwaiter().GetResult();
75 | }
76 | }
77 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V2/ShopV2Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | using Fortnite_API.Objects;
5 | using Fortnite_API.Objects.V2;
6 |
7 | using RestSharp;
8 |
9 | namespace Fortnite_API.Endpoints.V2
10 | {
11 | public class ShopV2Endpoints : EndpointBase
12 | {
13 | internal ShopV2Endpoints(IRestClient client) : base(client) { }
14 |
15 | public async Task> GetBrAsync(GameLanguage? language = null, CancellationToken token = default)
16 | {
17 | var request = new RestRequest("v2/shop/br", Method.GET);
18 |
19 | if (language.HasValue)
20 | {
21 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
22 | }
23 |
24 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
25 | return response.Data;
26 | }
27 |
28 | public ApiResponse GetBr(GameLanguage? language = null)
29 | {
30 | return GetBrAsync(language).GetAwaiter().GetResult();
31 | }
32 |
33 | public async Task> GetBrCombinedAsync(GameLanguage? language = null, CancellationToken token = default)
34 | {
35 | var request = new RestRequest("v2/shop/br/combined", Method.GET);
36 |
37 | if (language.HasValue)
38 | {
39 | request.AddQueryParameter("language", language.Value.GetLanguageCode());
40 | }
41 |
42 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
43 | return response.Data;
44 | }
45 |
46 | public ApiResponse GetBrCombined(GameLanguage? language = null)
47 | {
48 | return GetBrCombinedAsync(language).GetAwaiter().GetResult();
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V2/StatsV2Endpoints.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 |
5 | using Fortnite_API.Objects;
6 | using Fortnite_API.Objects.V1;
7 |
8 | using RestSharp;
9 |
10 | namespace Fortnite_API.Endpoints.V2
11 | {
12 | public class StatsV2Endpoints : EndpointBase
13 | {
14 | internal StatsV2Endpoints(IRestClient client) : base(client) { }
15 |
16 | [Obsolete("BR V1 stats are no longer available since Epic Games shut down the endpoint.", true)]
17 | public Task GetBrV1Async()
18 | {
19 | return Task.Delay(1); // net452 doesnt have Task.CompletedTask
20 | }
21 |
22 | [Obsolete("BR V1 stats are no longer available since Epic Games shut down the endpoint.", true)]
23 | public void GetBrV1() { }
24 |
25 | public async Task> GetBrV2Async(Action func, CancellationToken token = default)
26 | {
27 | var props = new BrStatsV2V1RequestProperties();
28 | func(props);
29 |
30 | RestRequest request;
31 |
32 | if (props.AccountId.HasValue)
33 | {
34 | request = new RestRequest($"v2/stats/br/v2/{props.AccountId.Value}", Method.GET);
35 | }
36 | else if (props.Name.HasValue)
37 | {
38 | request = new RestRequest("v2/stats/br/v2", Method.GET);
39 | request.AddQueryParameter("name", props.Name.Value);
40 |
41 | if (props.AccountType.HasValue)
42 | {
43 | request.AddQueryParameter("accountType", props.AccountType.Value.GetString());
44 | }
45 | }
46 | else
47 | {
48 | throw new ArgumentException("missing accountId or name");
49 | }
50 |
51 | if (props.TimeWindow.HasValue)
52 | {
53 | request.AddQueryParameter("timeWindow", props.TimeWindow.Value.GetString());
54 | }
55 |
56 | if (props.ImagePlatform.HasValue)
57 | {
58 | request.AddQueryParameter("image", props.ImagePlatform.Value.GetString());
59 | }
60 |
61 | var response = await _client.ExecuteAsync>(request, token).ConfigureAwait(false);
62 | return response.Data;
63 | }
64 |
65 | public ApiResponse GetBrV2Id(Action func)
66 | {
67 | return GetBrV2Async(func).GetAwaiter().GetResult();
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Endpoints/V2/V2Endpoints.cs:
--------------------------------------------------------------------------------
1 | using RestSharp;
2 |
3 | namespace Fortnite_API.Endpoints.V2
4 | {
5 | public class V2Endpoints
6 | {
7 | public CosmeticsV2Endpoints Cosmetics { get; }
8 | public AesV2Endpoints Aes { get; }
9 | public NewsV2Endpoints News { get; }
10 | public CreatorCodeV2Endpoints CreatorCode { get; }
11 | public ShopV2Endpoints Shop { get; }
12 | public StatsV2Endpoints Stats { get; }
13 |
14 | internal V2Endpoints(IRestClient client)
15 | {
16 | Cosmetics = new CosmeticsV2Endpoints(client);
17 | Aes = new AesV2Endpoints(client);
18 | News = new NewsV2Endpoints(client);
19 | CreatorCode = new CreatorCodeV2Endpoints(client);
20 | Shop = new ShopV2Endpoints(client);
21 | Stats = new StatsV2Endpoints(client);
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Extensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.CompilerServices;
3 |
4 | using Fortnite_API.Objects;
5 | using Fortnite_API.Objects.V1;
6 | using Fortnite_API.Objects.V2;
7 |
8 | using RestSharp;
9 |
10 | namespace Fortnite_API
11 | {
12 | internal static class Extensions
13 | {
14 | public static string GetLanguageCode(this GameLanguage language)
15 | {
16 | switch (language)
17 | {
18 | case GameLanguage.EN:
19 | return "en";
20 | case GameLanguage.AR:
21 | return "ar";
22 | case GameLanguage.DE:
23 | return "de";
24 | case GameLanguage.ES_419:
25 | return "es-419";
26 | case GameLanguage.ES:
27 | return "es";
28 | case GameLanguage.FR:
29 | return "fr";
30 | case GameLanguage.IT:
31 | return "it";
32 | case GameLanguage.JA:
33 | return "ja";
34 | case GameLanguage.KO:
35 | return "ko";
36 | case GameLanguage.PL:
37 | return "pl";
38 | case GameLanguage.PT_BR:
39 | return "pt-BR";
40 | case GameLanguage.RU:
41 | return "ru";
42 | case GameLanguage.TR:
43 | return "tr";
44 | case GameLanguage.ZH_CN:
45 | return "zh-CN";
46 | case GameLanguage.ZH_HANT:
47 | return "zh-Hant";
48 | default:
49 | throw new ArgumentOutOfRangeException(nameof(language));
50 | }
51 | }
52 |
53 | public static string GetString(this AesV2KeyFormat keyFormat)
54 | {
55 | switch (keyFormat)
56 | {
57 | case AesV2KeyFormat.Hex:
58 | return "hex";
59 | case AesV2KeyFormat.Base64:
60 | return "base64";
61 | default:
62 | throw new ArgumentOutOfRangeException(nameof(keyFormat), keyFormat, null);
63 | }
64 | }
65 |
66 | public static string GetString(this BrStatsV2V1TimeWindow timeWindow)
67 | {
68 | switch (timeWindow)
69 | {
70 | case BrStatsV2V1TimeWindow.Lifetime:
71 | return "lifetime";
72 | case BrStatsV2V1TimeWindow.Season:
73 | return "season";
74 | default:
75 | throw new ArgumentOutOfRangeException(nameof(timeWindow), timeWindow, null);
76 | }
77 | }
78 |
79 | public static string GetString(this BrStatsV2V1AccountType accountType)
80 | {
81 | switch (accountType)
82 | {
83 | case BrStatsV2V1AccountType.Epic:
84 | return "epic";
85 | case BrStatsV2V1AccountType.PSN:
86 | return "psn";
87 | case BrStatsV2V1AccountType.XBL:
88 | return "xbl";
89 | default:
90 | throw new ArgumentOutOfRangeException(nameof(accountType), accountType, null);
91 | }
92 | }
93 |
94 | public static string GetString(this BrStatsV2V1ImagePlatform imagePlatform)
95 | {
96 | switch (imagePlatform)
97 | {
98 | case BrStatsV2V1ImagePlatform.None:
99 | return "none";
100 | case BrStatsV2V1ImagePlatform.All:
101 | return "all";
102 | case BrStatsV2V1ImagePlatform.KeyboardMouse:
103 | return "keyboardMouse";
104 | case BrStatsV2V1ImagePlatform.Gamepad:
105 | return "gamepad";
106 | case BrStatsV2V1ImagePlatform.Touch:
107 | return "touch";
108 | default:
109 | throw new ArgumentOutOfRangeException(nameof(imagePlatform), imagePlatform, null);
110 | }
111 | }
112 |
113 | public static string GetString(this MatchMethod matchMethod)
114 | {
115 | switch (matchMethod)
116 | {
117 | case MatchMethod.Full:
118 | return "full";
119 | case MatchMethod.Contains:
120 | return "contains";
121 | case MatchMethod.Starts:
122 | return "starts";
123 | case MatchMethod.Ends:
124 | return "ends";
125 | default:
126 | throw new ArgumentOutOfRangeException(nameof(matchMethod), matchMethod, null);
127 | }
128 | }
129 |
130 | public static string GetString(this BrCosmeticV1Type brCosmeticType)
131 | {
132 | switch (brCosmeticType)
133 | {
134 | case BrCosmeticV1Type.Banner:
135 | return "banner";
136 | case BrCosmeticV1Type.Backpack:
137 | return "backpack";
138 | case BrCosmeticV1Type.Contrail:
139 | return "contrail";
140 | case BrCosmeticV1Type.Outfit:
141 | return "outfit";
142 | case BrCosmeticV1Type.Emote:
143 | return "emote";
144 | case BrCosmeticV1Type.Emoji:
145 | return "emoji";
146 | case BrCosmeticV1Type.Glider:
147 | return "glider";
148 | case BrCosmeticV1Type.Wrap:
149 | return "wrap";
150 | case BrCosmeticV1Type.LoadingScreen:
151 | return "loadingscreen";
152 | case BrCosmeticV1Type.Music:
153 | return "music";
154 | case BrCosmeticV1Type.Pet:
155 | return "pet";
156 | case BrCosmeticV1Type.PetCarrier:
157 | return "petcarrier";
158 | case BrCosmeticV1Type.Pickaxe:
159 | return "pickaxe";
160 | case BrCosmeticV1Type.Spray:
161 | return "spray";
162 | case BrCosmeticV1Type.Toy:
163 | return "toy";
164 | case BrCosmeticV1Type.Shout:
165 | return "shout";
166 | default:
167 | throw new ArgumentOutOfRangeException(nameof(brCosmeticType), brCosmeticType, null);
168 | }
169 | }
170 |
171 | public static string GetString(this BrCosmeticV1Rarity brCosmeticRarity)
172 | {
173 | switch (brCosmeticRarity)
174 | {
175 | case BrCosmeticV1Rarity.Frozen:
176 | return "frozen";
177 | case BrCosmeticV1Rarity.Lava:
178 | return "lava";
179 | case BrCosmeticV1Rarity.Legendary:
180 | return "legendary";
181 | case BrCosmeticV1Rarity.Dark:
182 | return "dark";
183 | case BrCosmeticV1Rarity.StarWars:
184 | return "starwars";
185 | case BrCosmeticV1Rarity.Marvel:
186 | return "marvel";
187 | case BrCosmeticV1Rarity.DC:
188 | return "dc";
189 | case BrCosmeticV1Rarity.Icon:
190 | return "icon";
191 | case BrCosmeticV1Rarity.Shadow:
192 | return "shadow";
193 | case BrCosmeticV1Rarity.Epic:
194 | return "epic";
195 | case BrCosmeticV1Rarity.Rare:
196 | return "rare";
197 | case BrCosmeticV1Rarity.Uncommon:
198 | return "uncommon";
199 | case BrCosmeticV1Rarity.Common:
200 | return "common";
201 | case BrCosmeticV1Rarity.Slurp:
202 | return "slurp";
203 | default:
204 | throw new ArgumentOutOfRangeException(nameof(brCosmeticRarity), brCosmeticRarity, null);
205 | }
206 | }
207 |
208 | [MethodImpl(MethodImplOptions.AggressiveInlining)]
209 | public static string GetString(this bool boolean)
210 | {
211 | return boolean ? "true" : "false";
212 | }
213 |
214 | public static IRestRequest ApplySearchParameters(this IRestRequest request, Action func)
215 | {
216 | var searchProperties = new BrCosmeticV2SearchProperties();
217 | func(searchProperties);
218 |
219 | return searchProperties.AppendParameters(request);
220 | }
221 |
222 | public static IRestRequest ApplySearchParameters(this IRestRequest request, Action func)
223 | {
224 | var searchProperties = new BrCosmeticV1SearchProperties();
225 | func(searchProperties);
226 | var hasOneOrMoreParameters = false;
227 |
228 | if (searchProperties.Language.HasValue)
229 | {
230 | request.AddQueryParameter("language", searchProperties.Language.Value.GetLanguageCode());
231 | }
232 |
233 | if (searchProperties.SearchLanguage.HasValue)
234 | {
235 | request.AddQueryParameter("searchLanguage", searchProperties.SearchLanguage.Value.GetLanguageCode());
236 | }
237 |
238 | if (searchProperties.MatchMethod.HasValue)
239 | {
240 | request.AddQueryParameter("matchMethod", searchProperties.MatchMethod.Value.GetString());
241 | }
242 |
243 | if (searchProperties.Type.HasValue)
244 | {
245 | hasOneOrMoreParameters = true;
246 | request.AddQueryParameter("type", searchProperties.Type.Value.GetString());
247 | }
248 |
249 | if (searchProperties.BackendType.HasValue)
250 | {
251 | hasOneOrMoreParameters = true;
252 | request.AddQueryParameter("backendType", searchProperties.BackendType.Value);
253 | }
254 |
255 | if (searchProperties.Rarity.HasValue)
256 | {
257 | hasOneOrMoreParameters = true;
258 | request.AddQueryParameter("rarity", searchProperties.Rarity.Value.GetString());
259 | }
260 |
261 | if (searchProperties.DisplayRarity.HasValue)
262 | {
263 | hasOneOrMoreParameters = true;
264 | request.AddQueryParameter("displayRarity", searchProperties.DisplayRarity.Value);
265 | }
266 |
267 | if (searchProperties.BackendRarity.HasValue)
268 | {
269 | hasOneOrMoreParameters = true;
270 | request.AddQueryParameter("backendRarity", searchProperties.BackendRarity.Value);
271 | }
272 |
273 | if (searchProperties.Name.HasValue)
274 | {
275 | hasOneOrMoreParameters = true;
276 | request.AddQueryParameter("name", searchProperties.Name.Value);
277 | }
278 |
279 | if (searchProperties.ShortDescription.HasValue)
280 | {
281 | hasOneOrMoreParameters = true;
282 | request.AddQueryParameter("shortDescription", searchProperties.ShortDescription.Value);
283 | }
284 |
285 | if (searchProperties.Description.HasValue)
286 | {
287 | hasOneOrMoreParameters = true;
288 | request.AddQueryParameter("description", searchProperties.Description.Value);
289 | }
290 |
291 | if (searchProperties.Set.HasValue)
292 | {
293 | hasOneOrMoreParameters = true;
294 | request.AddQueryParameter("set", searchProperties.Set.Value);
295 | }
296 |
297 | if (searchProperties.SetText.HasValue)
298 | {
299 | hasOneOrMoreParameters = true;
300 | request.AddQueryParameter("setText", searchProperties.SetText.Value);
301 | }
302 |
303 | if (searchProperties.Series.HasValue)
304 | {
305 | hasOneOrMoreParameters = true;
306 | request.AddQueryParameter("series", searchProperties.Series.Value);
307 | }
308 |
309 | if (searchProperties.BackendSeries.HasValue)
310 | {
311 | hasOneOrMoreParameters = true;
312 | request.AddQueryParameter("backendSeries", searchProperties.BackendSeries.Value);
313 | }
314 |
315 | if (searchProperties.HasSmallIcon.HasValue)
316 | {
317 | hasOneOrMoreParameters = true;
318 | request.AddQueryParameter("hasSmallIcon", searchProperties.HasSmallIcon.Value.GetString());
319 | }
320 |
321 | if (searchProperties.HasIcon.HasValue)
322 | {
323 | hasOneOrMoreParameters = true;
324 | request.AddQueryParameter("hasIcon", searchProperties.HasIcon.Value.GetString());
325 | }
326 |
327 | if (searchProperties.HasFeaturedImage.HasValue)
328 | {
329 | hasOneOrMoreParameters = true;
330 | request.AddQueryParameter("hasFeaturedImage", searchProperties.HasFeaturedImage.Value.GetString());
331 | }
332 |
333 | if (searchProperties.HasBackgroundImage.HasValue)
334 | {
335 | hasOneOrMoreParameters = true;
336 | request.AddQueryParameter("hasBackgroundImage", searchProperties.HasBackgroundImage.Value.GetString());
337 | }
338 |
339 | if (searchProperties.HasCoverArt.HasValue)
340 | {
341 | hasOneOrMoreParameters = true;
342 | request.AddQueryParameter("hasCoverArt", searchProperties.HasCoverArt.Value.GetString());
343 | }
344 |
345 | if (searchProperties.HasDecal.HasValue)
346 | {
347 | hasOneOrMoreParameters = true;
348 | request.AddQueryParameter("hasDecal", searchProperties.HasDecal.Value.GetString());
349 | }
350 |
351 | if (searchProperties.HasVariants.HasValue)
352 | {
353 | hasOneOrMoreParameters = true;
354 | request.AddQueryParameter("hasVariants", searchProperties.HasVariants.Value.GetString());
355 | }
356 |
357 | if (searchProperties.HasGameplayTags.HasValue)
358 | {
359 | hasOneOrMoreParameters = true;
360 | request.AddQueryParameter("hasGameplayTags", searchProperties.HasGameplayTags.Value.GetString());
361 | }
362 |
363 | if (searchProperties.GameplayTag.HasValue)
364 | {
365 | hasOneOrMoreParameters = true;
366 | request.AddQueryParameter("gameplayTag", searchProperties.GameplayTag.Value);
367 | }
368 |
369 | if (!hasOneOrMoreParameters)
370 | {
371 | throw new ArgumentException("at least one search parameter is required");
372 | }
373 |
374 | return request;
375 | }
376 | }
377 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Fortnite-API.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.1;net452;net472;net48;netcoreapp3.1;net5.0;net6.0
5 | Fortnite_API
6 | C# wrapper for https://fortnite-api.com
7 | Fortnite-API-Wrapper
8 | Fortnite-API-Wrapper
9 | https://fortnite-api.com
10 | https://github.com/Fortnite-API/csharp-wrapper
11 | en
12 | fortnite, fortniteapi, fortnite-api, fortnite-api.com
13 | true
14 |
15 | Fortnite-API, NotOfficer
16 | LICENSE
17 | 2.3.2
18 | Fortnite-API
19 |
20 | git
21 | Copyright (c) 2019-2021 Fortnite-API.com
22 | 2.3.2.0
23 | 2.3.2.0
24 | logo.png
25 | true
26 |
27 |
28 |
29 | TRACE
30 | AnyCPU
31 | none
32 | false
33 |
34 |
35 |
36 | AnyCPU
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | True
48 |
49 |
50 |
51 | True
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/Fortnite-API/FortniteApiClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Fortnite_API.Endpoints.V1;
4 | using Fortnite_API.Endpoints.V2;
5 |
6 | using RestSharp;
7 |
8 | namespace Fortnite_API
9 | {
10 | public class FortniteApiClient
11 | {
12 | public V1Endpoints V1 { get; }
13 | public V2Endpoints V2 { get; }
14 |
15 | public FortniteApiClient(string apiKey = null)
16 | {
17 | var assemblyVersion = GetType().Assembly.GetName().Version;
18 | var versionString = assemblyVersion == null ? "unknown" : assemblyVersion.ToString(3);
19 |
20 | var client = new RestClient("https://fortnite-api.com/")
21 | {
22 | UserAgent = $"Fortnite-API.NET/{versionString}",
23 | Timeout = 10 * 1000
24 | }.UseSerializer();
25 |
26 | if (!string.IsNullOrWhiteSpace(apiKey))
27 | {
28 | client.AddDefaultHeader("x-api-key", apiKey);
29 | }
30 |
31 | V1 = new V1Endpoints(client);
32 | V2 = new V2Endpoints(client);
33 | }
34 | }
35 |
36 | [Obsolete("Please use 'Fortnite_API.FortniteApiClient' instead", true)]
37 | public class FortniteApi
38 | {
39 | public V1Endpoints V1 { get; }
40 | public V2Endpoints V2 { get; }
41 |
42 | public FortniteApi(string apiKey = null)
43 | {
44 | V1 = null;
45 | V2 = null;
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/JsonNetSerializer.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS0618
2 |
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | using RestSharp;
7 | using RestSharp.Serialization;
8 |
9 | namespace Fortnite_API
10 | {
11 | internal class JsonNetSerializer : IRestSerializer
12 | {
13 | private static readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings
14 | {
15 | ContractResolver = new DefaultContractResolver
16 | {
17 | NamingStrategy = new CamelCaseNamingStrategy(false, false)
18 | }
19 | };
20 |
21 | public string Serialize(object obj)
22 | {
23 | return JsonConvert.SerializeObject(obj, _serializerSettings);
24 | }
25 |
26 | public string Serialize(Parameter parameter)
27 | {
28 | return JsonConvert.SerializeObject(parameter.Value, _serializerSettings);
29 | }
30 |
31 | public T Deserialize(IRestResponse response)
32 | {
33 | return JsonConvert.DeserializeObject(response.Content, _serializerSettings);
34 | }
35 |
36 | public string[] SupportedContentTypes { get; } =
37 | {
38 | "application/json",
39 | "application/json; charset=utf-8"
40 | };
41 |
42 | public string ContentType { get; set; } = "application/json; charset=utf-8";
43 |
44 | public DataFormat DataFormat => DataFormat.Json;
45 | }
46 | }
47 |
48 | #pragma warning restore CS0618
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/AccountData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects
7 | {
8 | [DebuggerDisplay("{" + nameof(Name) + "}")]
9 | public class AccountData : IEquatable
10 | {
11 | [J] public string Id { get; set; }
12 | [J] public string Name { get; set; }
13 |
14 | public bool Equals(AccountData other)
15 | {
16 | if (ReferenceEquals(null, other))
17 | {
18 | return false;
19 | }
20 |
21 | if (ReferenceEquals(this, other))
22 | {
23 | return true;
24 | }
25 |
26 | return Id == other.Id && Name == other.Name;
27 | }
28 |
29 | public override bool Equals(object obj)
30 | {
31 | if (ReferenceEquals(null, obj))
32 | {
33 | return false;
34 | }
35 |
36 | if (ReferenceEquals(this, obj))
37 | {
38 | return true;
39 | }
40 |
41 | if (obj.GetType() != GetType())
42 | {
43 | return false;
44 | }
45 |
46 | return Equals((AccountData)obj);
47 | }
48 |
49 | public override int GetHashCode()
50 | {
51 | unchecked
52 | {
53 | return Id.GetHashCode() * 397 ^ Name.GetHashCode();
54 | }
55 | }
56 |
57 | public static bool operator ==(AccountData left, AccountData right)
58 | {
59 | return Equals(left, right);
60 | }
61 |
62 | public static bool operator !=(AccountData left, AccountData right)
63 | {
64 | return !Equals(left, right);
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/ApiResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 | using I = Newtonsoft.Json.JsonPropertyAttribute;
5 | using N = Newtonsoft.Json.NullValueHandling;
6 |
7 | namespace Fortnite_API.Objects
8 | {
9 | [DebuggerDisplay("{" + nameof(DebuggerDisplay) + "}")]
10 | public class ApiResponse
11 | {
12 | [J] public int Status { get; private set; }
13 | [J(NullValueHandling = N.Ignore)] public T Data { get; private set; }
14 | [J(NullValueHandling = N.Ignore)] public string Error { get; private set; }
15 |
16 | [I] public bool IsSuccess => Status == 200;
17 | [I] public bool HasError => Error != null;
18 |
19 | private object DebuggerDisplay => IsSuccess ? Data : (object)$"Error: {Status} | {Error}";
20 | }
21 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/GameLanguage.cs:
--------------------------------------------------------------------------------
1 | namespace Fortnite_API.Objects
2 | {
3 | public enum GameLanguage
4 | {
5 | EN,
6 | AR,
7 | DE,
8 | ES_419,
9 | ES,
10 | FR,
11 | IT,
12 | JA,
13 | KO,
14 | PL,
15 | PT_BR,
16 | RU,
17 | TR,
18 | ZH_CN,
19 | ZH_HANT
20 | }
21 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/MatchMethod.cs:
--------------------------------------------------------------------------------
1 | namespace Fortnite_API.Objects
2 | {
3 | public enum MatchMethod
4 | {
5 | Full,
6 | Contains,
7 | Starts,
8 | Ends
9 | }
10 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/AesV1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class AesV1 : IEquatable
8 | {
9 | [J] public string Aes { get; private set; }
10 | [J] public string Build { get; private set; }
11 | [J] public DateTime LastUpdate { get; private set; }
12 |
13 | public bool Equals(AesV1 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(AesV1))
41 | {
42 | return false;
43 | }
44 |
45 | return Equals((AesV1)obj);
46 | }
47 |
48 | public override int GetHashCode()
49 | {
50 | unchecked
51 | {
52 | var hashCode = Aes != null ? Aes.GetHashCode() : 0;
53 | hashCode = hashCode * 397 ^ (Build != null ? Build.GetHashCode() : 0);
54 | hashCode = hashCode * 397 ^ LastUpdate.GetHashCode();
55 | return hashCode;
56 | }
57 | }
58 |
59 | public static bool operator ==(AesV1 left, AesV1 right)
60 | {
61 | return Equals(left, right);
62 | }
63 |
64 | public static bool operator !=(AesV1 left, AesV1 right)
65 | {
66 | return !Equals(left, right);
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrCosmeticV1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using I = Newtonsoft.Json.JsonIgnoreAttribute;
5 | using J = Newtonsoft.Json.JsonPropertyAttribute;
6 |
7 | namespace Fortnite_API.Objects.V1
8 | {
9 | public class BrCosmeticV1 : IEquatable
10 | {
11 | [J] public string Id { get; private set; }
12 |
13 | private string _typeString;
14 |
15 | [J("type")]
16 | public string TypeString
17 | {
18 | get => _typeString;
19 | private set => Type = Utilities.GetBrCosmeticV1Type(_typeString = value);
20 | }
21 | [I] public BrCosmeticV1Type Type { get; private set; } = BrCosmeticV1Type.Unknown;
22 | [J] public string BackendType { get; private set; }
23 |
24 | private string _rarityString;
25 |
26 | [J("rarity")]
27 | public string RarityString
28 | {
29 | get => _rarityString;
30 | private set => Rarity = Utilities.GetBrCosmeticV1Rarity(_rarityString = value);
31 | }
32 | [I] public BrCosmeticV1Rarity Rarity { get; private set; } = BrCosmeticV1Rarity.Unknown;
33 | [J] public string DisplayRarity { get; private set; }
34 | [J] public string BackendRarity { get; private set; }
35 | [J] public string Name { get; private set; }
36 | [J] public string ShortDescription { get; private set; }
37 | [J] public string Description { get; private set; }
38 | [J] public string Set { get; private set; }
39 | [J] public string SetText { get; private set; }
40 | [J] public string Series { get; private set; }
41 | [J] public string BackendSeries { get; private set; }
42 | [J] public BrCosmeticV1Images Images { get; private set; }
43 | [J] public List Variants { get; private set; }
44 | [J] public List GameplayTags { get; private set; }
45 | [J] public string DisplayAssetPath { get; private set; }
46 | [J] public string Definition { get; private set; }
47 | [Obsolete("This property will always return null.")]
48 | public string RequiredItemId { get; } = null;
49 | [Obsolete("This property will always return null.")]
50 | public string BuiltInEmoteId { get; } = null;
51 | [J] public string Path { get; private set; }
52 | [Obsolete("This property will always return the same date as the 'Added' property.")]
53 | [J] public DateTime LastUpdate { get; private set; }
54 | [J] public DateTime Added { get; private set; }
55 |
56 | [I] public bool HasSet => Set != null;
57 | [I] public bool HasSetText => SetText != null;
58 | [I] public bool HasSeries => Series != null;
59 | [I] public bool HasDisplayAssetPath => DisplayAssetPath != null;
60 | [I] public bool HasDefinition => Definition != null;
61 | [Obsolete("This property will always return false.")]
62 | [I] public bool HasRequiredItemId { get; } = false;
63 | [Obsolete("This property will always return false.")]
64 | [I] public bool HasBuiltInEmoteId { get; } = false;
65 | [I] public bool HasVariants => Variants != null && Variants.Count != 0;
66 | [I] public bool HasGameplayTags => GameplayTags != null && GameplayTags.Count != 0;
67 |
68 | public bool HasGameplayTag(string gameplayTag)
69 | {
70 | if (gameplayTag == null)
71 | {
72 | throw new ArgumentNullException(nameof(gameplayTag));
73 | }
74 |
75 | if (gameplayTag.Length == 0)
76 | {
77 | throw new ArgumentOutOfRangeException(nameof(gameplayTag));
78 | }
79 |
80 | return HasGameplayTags && GameplayTags.Contains(gameplayTag);
81 | }
82 |
83 | public bool TryGetVariant(string variantType, out BrCosmeticV1Variant outVariant)
84 | {
85 | if (variantType == null)
86 | {
87 | throw new ArgumentNullException(nameof(variantType));
88 | }
89 |
90 | if (variantType.Length == 0)
91 | {
92 | throw new ArgumentOutOfRangeException(nameof(variantType));
93 | }
94 |
95 | if (HasVariants)
96 | {
97 | foreach (var variant in Variants)
98 | {
99 | if (!string.Equals(variant.Type, variantType, StringComparison.OrdinalIgnoreCase))
100 | {
101 | continue;
102 | }
103 |
104 | outVariant = variant;
105 | return true;
106 | }
107 | }
108 |
109 | outVariant = null;
110 | return false;
111 | }
112 |
113 | public bool TryGetVariantByChannel(string variantChannel, out BrCosmeticV1Variant outVariant)
114 | {
115 | if (variantChannel == null)
116 | {
117 | throw new ArgumentNullException(nameof(variantChannel));
118 | }
119 |
120 | if (variantChannel.Length == 0)
121 | {
122 | throw new ArgumentOutOfRangeException(nameof(variantChannel));
123 | }
124 |
125 | if (HasVariants)
126 | {
127 | foreach (var variant in Variants)
128 | {
129 | if (!string.Equals(variant.Channel, variantChannel, StringComparison.OrdinalIgnoreCase))
130 | {
131 | continue;
132 | }
133 |
134 | outVariant = variant;
135 | return true;
136 | }
137 | }
138 |
139 | outVariant = null;
140 | return false;
141 | }
142 |
143 | public bool Equals(BrCosmeticV1 other)
144 | {
145 | if (ReferenceEquals(null, other))
146 | {
147 | return false;
148 | }
149 |
150 | if (ReferenceEquals(this, other))
151 | {
152 | return true;
153 | }
154 |
155 | return Id == other.Id && Path == other.Path && Added.Equals(other.Added);
156 | }
157 |
158 | public override bool Equals(object obj)
159 | {
160 | if (ReferenceEquals(null, obj))
161 | {
162 | return false;
163 | }
164 |
165 | if (ReferenceEquals(this, obj))
166 | {
167 | return true;
168 | }
169 |
170 | if (obj.GetType() != typeof(BrCosmeticV1))
171 | {
172 | return false;
173 | }
174 |
175 | return Equals((BrCosmeticV1)obj);
176 | }
177 |
178 | public override int GetHashCode()
179 | {
180 | unchecked
181 | {
182 | var hashCode = Id != null ? Id.GetHashCode() : 0;
183 | hashCode = hashCode * 397 ^ (Path != null ? Path.GetHashCode() : 0);
184 | hashCode = hashCode * 397 ^ Added.GetHashCode();
185 | return hashCode;
186 | }
187 | }
188 |
189 | public static bool operator ==(BrCosmeticV1 left, BrCosmeticV1 right)
190 | {
191 | return Equals(left, right);
192 | }
193 |
194 | public static bool operator !=(BrCosmeticV1 left, BrCosmeticV1 right)
195 | {
196 | return !Equals(left, right);
197 | }
198 | }
199 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrCosmeticV1Images.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 | using I = Newtonsoft.Json.JsonIgnoreAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | public class BrCosmeticV1Images : IEquatable
9 | {
10 | [J] public ImageV1Data SmallIcon { get; private set; }
11 | [J] public ImageV1Data Icon { get; private set; }
12 | [J] public ImageV1Data Featured { get; private set; }
13 | [J] public ImageV1Data Background { get; private set; }
14 | [J] public ImageV1Data CoverArt { get; private set; }
15 | [J] public ImageV1Data Decal { get; private set; }
16 |
17 | [I] public bool HasSmallIcon => SmallIcon != null;
18 | [I] public bool HasIcon => Icon != null;
19 | [I] public bool HasFeatured => Featured != null;
20 | [I] public bool HasBackground => Background != null;
21 | [I] public bool HasCoverArt => CoverArt != null;
22 | [I] public bool HasDecal => Decal != null;
23 |
24 | public bool Equals(BrCosmeticV1Images other)
25 | {
26 | if (ReferenceEquals(null, other))
27 | {
28 | return false;
29 | }
30 |
31 | if (ReferenceEquals(this, other))
32 | {
33 | return true;
34 | }
35 |
36 | return Equals(SmallIcon, other.SmallIcon) && Equals(Icon, other.Icon) && Equals(Featured, other.Featured) && Equals(Background, other.Background) && Equals(CoverArt, other.CoverArt) && Equals(Decal, other.Decal);
37 | }
38 |
39 | public override bool Equals(object obj)
40 | {
41 | if (ReferenceEquals(null, obj))
42 | {
43 | return false;
44 | }
45 |
46 | if (ReferenceEquals(this, obj))
47 | {
48 | return true;
49 | }
50 |
51 | if (obj.GetType() != typeof(BrCosmeticV1Images))
52 | {
53 | return false;
54 | }
55 |
56 | return Equals((BrCosmeticV1Images)obj);
57 | }
58 |
59 | public override int GetHashCode()
60 | {
61 | unchecked
62 | {
63 | var hashCode = SmallIcon != null ? SmallIcon.GetHashCode() : 0;
64 | hashCode = hashCode * 397 ^ (Icon != null ? Icon.GetHashCode() : 0);
65 | hashCode = hashCode * 397 ^ (Featured != null ? Featured.GetHashCode() : 0);
66 | hashCode = hashCode * 397 ^ (Background != null ? Background.GetHashCode() : 0);
67 | hashCode = hashCode * 397 ^ (CoverArt != null ? CoverArt.GetHashCode() : 0);
68 | hashCode = hashCode * 397 ^ (Decal != null ? Decal.GetHashCode() : 0);
69 | return hashCode;
70 | }
71 | }
72 |
73 | public static bool operator ==(BrCosmeticV1Images left, BrCosmeticV1Images right)
74 | {
75 | return Equals(left, right);
76 | }
77 |
78 | public static bool operator !=(BrCosmeticV1Images left, BrCosmeticV1Images right)
79 | {
80 | return !Equals(left, right);
81 | }
82 | }
83 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrCosmeticV1Rarity.cs:
--------------------------------------------------------------------------------
1 | namespace Fortnite_API.Objects.V1
2 | {
3 | public enum BrCosmeticV1Rarity
4 | {
5 | Mythic,
6 | Frozen,
7 | Lava,
8 | Legendary,
9 | Slurp,
10 | Dark,
11 | StarWars,
12 | Marvel,
13 | DC,
14 | Icon,
15 | Shadow,
16 | Epic,
17 | Rare,
18 | Uncommon,
19 | Common,
20 | Unknown
21 | }
22 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrCosmeticV1SearchProperties.cs:
--------------------------------------------------------------------------------
1 | namespace Fortnite_API.Objects.V1
2 | {
3 | public class BrCosmeticV1SearchProperties
4 | {
5 | public Optional Language { get; set; }
6 | public Optional SearchLanguage { get; set; }
7 | public Optional MatchMethod { get; set; }
8 | public Optional Type { get; set; }
9 | public Optional BackendType { get; set; }
10 | public Optional Rarity { get; set; }
11 | public Optional DisplayRarity { get; set; }
12 | public Optional BackendRarity { get; set; }
13 | public Optional Name { get; set; }
14 | public Optional ShortDescription { get; set; }
15 | public Optional Description { get; set; }
16 | public Optional Set { get; set; }
17 | public Optional SetText { get; set; }
18 | public Optional Series { get; set; }
19 | public Optional BackendSeries { get; set; }
20 | public Optional HasSmallIcon { get; set; }
21 | public Optional HasIcon { get; set; }
22 | public Optional HasFeaturedImage { get; set; }
23 | public Optional HasBackgroundImage { get; set; }
24 | public Optional HasCoverArt { get; set; }
25 | public Optional HasDecal { get; set; }
26 | public Optional HasVariants { get; set; }
27 | public Optional HasGameplayTags { get; set; }
28 | public Optional GameplayTag { get; set; }
29 | }
30 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrCosmeticV1Type.cs:
--------------------------------------------------------------------------------
1 | namespace Fortnite_API.Objects.V1
2 | {
3 | public enum BrCosmeticV1Type
4 | {
5 | Banner,
6 | Backpack,
7 | Contrail,
8 | Outfit,
9 | Emote,
10 | Emoji,
11 | Glider,
12 | Wrap,
13 | LoadingScreen,
14 | Music,
15 | Pet,
16 | PetCarrier,
17 | Pickaxe,
18 | Shout,
19 | Spray,
20 | Toy,
21 | Unknown
22 | }
23 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrCosmeticV1Variant.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | public class BrCosmeticV1Variant : IEquatable
9 | {
10 | [J] public string Channel { get; private set; }
11 | [J] public string Type { get; private set; }
12 | [J] public List Options { get; private set; }
13 |
14 | public bool TryGetVariantOption(string optionName, out BrCosmeticV1VariantOption outOption)
15 | {
16 | if (optionName == null)
17 | {
18 | throw new ArgumentNullException(nameof(optionName));
19 | }
20 |
21 | if (optionName.Length == 0)
22 | {
23 | throw new ArgumentOutOfRangeException(nameof(optionName));
24 | }
25 |
26 | foreach (var option in Options)
27 | {
28 | if (!string.Equals(option.Name, optionName, StringComparison.OrdinalIgnoreCase))
29 | {
30 | continue;
31 | }
32 |
33 | outOption = option;
34 | return true;
35 | }
36 |
37 | outOption = null;
38 | return false;
39 | }
40 |
41 | public bool TryGetVariantOptionByTag(string optionTag, out BrCosmeticV1VariantOption outOption)
42 | {
43 | if (optionTag == null)
44 | {
45 | throw new ArgumentNullException(nameof(optionTag));
46 | }
47 |
48 | if (optionTag.Length == 0)
49 | {
50 | throw new ArgumentOutOfRangeException(nameof(optionTag));
51 | }
52 |
53 | foreach (var option in Options)
54 | {
55 | if (!string.Equals(option.Tag, optionTag, StringComparison.OrdinalIgnoreCase))
56 | {
57 | continue;
58 | }
59 |
60 | outOption = option;
61 | return true;
62 | }
63 |
64 | outOption = null;
65 | return false;
66 | }
67 |
68 | public bool Equals(BrCosmeticV1Variant other)
69 | {
70 | if (ReferenceEquals(null, other))
71 | {
72 | return false;
73 | }
74 |
75 | if (ReferenceEquals(this, other))
76 | {
77 | return true;
78 | }
79 |
80 | return Channel == other.Channel && Type == other.Type && Equals(Options, other.Options);
81 | }
82 |
83 | public override bool Equals(object obj)
84 | {
85 | if (ReferenceEquals(null, obj))
86 | {
87 | return false;
88 | }
89 |
90 | if (ReferenceEquals(this, obj))
91 | {
92 | return true;
93 | }
94 |
95 | if (obj.GetType() != typeof(BrCosmeticV1Variant))
96 | {
97 | return false;
98 | }
99 |
100 | return Equals((BrCosmeticV1Variant)obj);
101 | }
102 |
103 | public override int GetHashCode()
104 | {
105 | unchecked
106 | {
107 | var hashCode = Channel != null ? Channel.GetHashCode() : 0;
108 | hashCode = hashCode * 397 ^ (Type != null ? Type.GetHashCode() : 0);
109 | hashCode = hashCode * 397 ^ (Options != null ? Options.GetHashCode() : 0);
110 | return hashCode;
111 | }
112 | }
113 |
114 | public static bool operator ==(BrCosmeticV1Variant left, BrCosmeticV1Variant right)
115 | {
116 | return Equals(left, right);
117 | }
118 |
119 | public static bool operator !=(BrCosmeticV1Variant left, BrCosmeticV1Variant right)
120 | {
121 | return !Equals(left, right);
122 | }
123 | }
124 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrCosmeticV1VariantOption.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class BrCosmeticV1VariantOption : IEquatable
8 | {
9 | [J] public string Tag { get; private set; }
10 | [J] public string Name { get; private set; }
11 | [J] public ImageV1Data Image { get; private set; }
12 |
13 | public bool Equals(BrCosmeticV1VariantOption 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 Tag == other.Tag && Name == other.Name && Equals(Image, other.Image);
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(BrCosmeticV1VariantOption))
41 | {
42 | return false;
43 | }
44 |
45 | return Equals((BrCosmeticV1VariantOption)obj);
46 | }
47 |
48 | public override int GetHashCode()
49 | {
50 | unchecked
51 | {
52 | var hashCode = Tag != null ? Tag.GetHashCode() : 0;
53 | hashCode = hashCode * 397 ^ (Name != null ? Name.GetHashCode() : 0);
54 | hashCode = hashCode * 397 ^ (Image != null ? Image.GetHashCode() : 0);
55 | return hashCode;
56 | }
57 | }
58 |
59 | public static bool operator ==(BrCosmeticV1VariantOption left, BrCosmeticV1VariantOption right)
60 | {
61 | return Equals(left, right);
62 | }
63 |
64 | public static bool operator !=(BrCosmeticV1VariantOption left, BrCosmeticV1VariantOption right)
65 | {
66 | return !Equals(left, right);
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrShopV1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 | using I = Newtonsoft.Json.JsonIgnoreAttribute;
6 |
7 | namespace Fortnite_API.Objects.V1
8 | {
9 | public class BrShopV1 : IEquatable
10 | {
11 | [J] public string Hash { get; private set; }
12 | [J] public DateTime Date { get; private set; }
13 | [J] public List Featured { get; private set; }
14 | [J] public List Daily { get; private set; }
15 | [J] public List Votes { get; private set; }
16 | [J] public List VoteWinners { get; private set; }
17 |
18 | [I] public bool HasFeaturedEntries => Featured != null && Featured.Count > 0;
19 | [I] public bool HasDailyEntries => Daily != null && Daily.Count > 0;
20 | [I] public bool HasVoteEntries => Votes != null && Votes.Count > 0;
21 | [I] public bool HasVoteWinnerEntries => VoteWinners != null && VoteWinners.Count > 0;
22 |
23 | public bool Equals(BrShopV1 other)
24 | {
25 | if (ReferenceEquals(null, other))
26 | {
27 | return false;
28 | }
29 |
30 | if (ReferenceEquals(this, other))
31 | {
32 | return true;
33 | }
34 |
35 | return Hash == other.Hash && Date.Equals(other.Date);
36 | }
37 |
38 | public override bool Equals(object obj)
39 | {
40 | if (ReferenceEquals(null, obj))
41 | {
42 | return false;
43 | }
44 |
45 | if (ReferenceEquals(this, obj))
46 | {
47 | return true;
48 | }
49 |
50 | if (obj.GetType() != typeof(BrShopV1))
51 | {
52 | return false;
53 | }
54 |
55 | return Equals((BrShopV1)obj);
56 | }
57 |
58 | public override int GetHashCode()
59 | {
60 | unchecked
61 | {
62 | return (Hash != null ? Hash.GetHashCode() : 0) * 397 ^ Date.GetHashCode();
63 | }
64 | }
65 |
66 | public static bool operator ==(BrShopV1 left, BrShopV1 right)
67 | {
68 | return Equals(left, right);
69 | }
70 |
71 | public static bool operator !=(BrShopV1 left, BrShopV1 right)
72 | {
73 | return !Equals(left, right);
74 | }
75 | }
76 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrShopV1Entry.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class BrShopV1Entry
8 | {
9 | [J] public int RegularPrice { get; private set; }
10 | [J] public int FinalPrice { get; private set; }
11 | [J] public bool IsBundle { get; private set; }
12 | [J] public bool IsSpecial { get; private set; }
13 | [J] public bool Giftable { get; private set; }
14 | [J] public bool Refundable { get; private set; }
15 | [J] public int Panel { get; private set; }
16 | [J] public int SortPriority { get; private set; }
17 | [J] public string Banner { get; private set; }
18 | [J] public List Items { get; private set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | [DebuggerDisplay("{" + nameof(Account) + "}")]
9 | public class BrStatsV2V1 : IEquatable
10 | {
11 | [J] public AccountData Account { get; private set; }
12 | [J] public BrStatsV2V1BattlePass BattlePass { get; private set; }
13 | [J] public Uri Image { get; private set; }
14 | [J] public BrStatsV2V1Stats Stats { get; private set; }
15 |
16 | public bool Equals(BrStatsV2V1 other)
17 | {
18 | if (ReferenceEquals(null, other))
19 | {
20 | return false;
21 | }
22 |
23 | if (ReferenceEquals(this, other))
24 | {
25 | return true;
26 | }
27 |
28 | return Account.Equals(other.Account) && BattlePass.Equals(other.BattlePass) && Stats.Equals(other.Stats);
29 | }
30 |
31 | public override bool Equals(object obj)
32 | {
33 | if (ReferenceEquals(null, obj))
34 | {
35 | return false;
36 | }
37 |
38 | if (ReferenceEquals(this, obj))
39 | {
40 | return true;
41 | }
42 |
43 | if (obj.GetType() != this.GetType())
44 | {
45 | return false;
46 | }
47 |
48 | return Equals((BrStatsV2V1)obj);
49 | }
50 |
51 | public override int GetHashCode()
52 | {
53 | unchecked
54 | {
55 | var hashCode = Account.GetHashCode();
56 | hashCode = hashCode * 397 ^ BattlePass.GetHashCode();
57 | hashCode = hashCode * 397 ^ Stats.GetHashCode();
58 | return hashCode;
59 | }
60 | }
61 |
62 | public static bool operator ==(BrStatsV2V1 left, BrStatsV2V1 right)
63 | {
64 | return Equals(left, right);
65 | }
66 |
67 | public static bool operator !=(BrStatsV2V1 left, BrStatsV2V1 right)
68 | {
69 | return !Equals(left, right);
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1AccountType.cs:
--------------------------------------------------------------------------------
1 | namespace Fortnite_API.Objects.V1
2 | {
3 | public enum BrStatsV2V1AccountType
4 | {
5 | Epic,
6 | PSN,
7 | XBL
8 | }
9 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1BattlePass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | [DebuggerDisplay("{" + nameof(Level) + "}")]
9 | public class BrStatsV2V1BattlePass : IEquatable
10 | {
11 | [J] public int Level { get; private set; }
12 | [J] public int Progress { get; private set; }
13 |
14 | public bool Equals(BrStatsV2V1BattlePass other)
15 | {
16 | if (ReferenceEquals(null, other))
17 | {
18 | return false;
19 | }
20 |
21 | if (ReferenceEquals(this, other))
22 | {
23 | return true;
24 | }
25 |
26 | return Level == other.Level && Progress == other.Progress;
27 | }
28 |
29 | public override bool Equals(object obj)
30 | {
31 | if (ReferenceEquals(null, obj))
32 | {
33 | return false;
34 | }
35 |
36 | if (ReferenceEquals(this, obj))
37 | {
38 | return true;
39 | }
40 |
41 | if (obj.GetType() != GetType())
42 | {
43 | return false;
44 | }
45 |
46 | return Equals((BrStatsV2V1BattlePass)obj);
47 | }
48 |
49 | public override int GetHashCode()
50 | {
51 | unchecked
52 | {
53 | return Level * 397 ^ Progress;
54 | }
55 | }
56 |
57 | public static bool operator ==(BrStatsV2V1BattlePass left, BrStatsV2V1BattlePass right)
58 | {
59 | return Equals(left, right);
60 | }
61 |
62 | public static bool operator !=(BrStatsV2V1BattlePass left, BrStatsV2V1BattlePass right)
63 | {
64 | return !Equals(left, right);
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1DuoStats.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | [DebuggerDisplay("{" + nameof(Score) + "}")]
9 | public class BrStatsV2V1DuoStats : IEquatable
10 | {
11 | [J] public long Score { get; private set; }
12 | [J] public double ScorePerMin { get; private set; }
13 | [J] public double ScorePerMatch { get; private set; }
14 | [J] public long Wins { get; private set; }
15 | [J] public long Top5 { get; private set; }
16 | [J] public long Top12 { get; private set; }
17 | [J] public long Kills { get; private set; }
18 | [J] public double KillsPerMin { get; private set; }
19 | [J] public double KillsPerMatch { get; private set; }
20 | [J] public long Deaths { get; private set; }
21 | [J] public double Kd { get; private set; }
22 | [J] public long Matches { get; private set; }
23 | [J] public double WinRate { get; private set; }
24 | [J] public long MinutesPlayed { get; private set; }
25 | [J] public long PlayersOutlived { get; private set; }
26 | [J] public DateTime LastModified { get; private set; }
27 |
28 | public bool Equals(BrStatsV2V1DuoStats other)
29 | {
30 | if (ReferenceEquals(null, other))
31 | {
32 | return false;
33 | }
34 |
35 | if (ReferenceEquals(this, other))
36 | {
37 | return true;
38 | }
39 |
40 | return Score == other.Score && Wins == other.Wins && Kills == other.Kills && Matches == other.Matches && LastModified.Equals(other.LastModified);
41 | }
42 |
43 | public override bool Equals(object obj)
44 | {
45 | if (ReferenceEquals(null, obj))
46 | {
47 | return false;
48 | }
49 |
50 | if (ReferenceEquals(this, obj))
51 | {
52 | return true;
53 | }
54 |
55 | if (obj.GetType() != GetType())
56 | {
57 | return false;
58 | }
59 |
60 | return Equals((BrStatsV2V1DuoStats)obj);
61 | }
62 |
63 | public override int GetHashCode()
64 | {
65 | unchecked
66 | {
67 | var hashCode = Score.GetHashCode();
68 | hashCode = hashCode * 397 ^ Wins.GetHashCode();
69 | hashCode = hashCode * 397 ^ Kills.GetHashCode();
70 | hashCode = hashCode * 397 ^ Matches.GetHashCode();
71 | hashCode = hashCode * 397 ^ LastModified.GetHashCode();
72 | return hashCode;
73 | }
74 | }
75 |
76 | public static bool operator ==(BrStatsV2V1DuoStats left, BrStatsV2V1DuoStats right)
77 | {
78 | return Equals(left, right);
79 | }
80 |
81 | public static bool operator !=(BrStatsV2V1DuoStats left, BrStatsV2V1DuoStats right)
82 | {
83 | return !Equals(left, right);
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1ImagePlatform.cs:
--------------------------------------------------------------------------------
1 | namespace Fortnite_API.Objects.V1
2 | {
3 | public enum BrStatsV2V1ImagePlatform
4 | {
5 | None,
6 | All,
7 | KeyboardMouse,
8 | Gamepad,
9 | Touch
10 | }
11 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1LtmStats.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | [DebuggerDisplay("{" + nameof(Score) + "}")]
9 | public class BrStatsV2V1LtmStats : IEquatable
10 | {
11 | [J] public long Score { get; private set; }
12 | [J] public double ScorePerMin { get; private set; }
13 | [J] public double ScorePerMatch { get; private set; }
14 | [J] public long Wins { get; private set; }
15 | [J] public long Kills { get; private set; }
16 | [J] public double KillsPerMin { get; private set; }
17 | [J] public double KillsPerMatch { get; private set; }
18 | [J] public long Deaths { get; private set; }
19 | [J] public double Kd { get; private set; }
20 | [J] public long Matches { get; private set; }
21 | [J] public double WinRate { get; private set; }
22 | [J] public long MinutesPlayed { get; private set; }
23 | [J] public long PlayersOutlived { get; private set; }
24 | [J] public DateTime LastModified { get; private set; }
25 |
26 | public bool Equals(BrStatsV2V1LtmStats other)
27 | {
28 | if (ReferenceEquals(null, other))
29 | {
30 | return false;
31 | }
32 |
33 | if (ReferenceEquals(this, other))
34 | {
35 | return true;
36 | }
37 |
38 | return Score == other.Score && Wins == other.Wins && Kills == other.Kills && Matches == other.Matches && LastModified.Equals(other.LastModified);
39 | }
40 |
41 | public override bool Equals(object obj)
42 | {
43 | if (ReferenceEquals(null, obj))
44 | {
45 | return false;
46 | }
47 |
48 | if (ReferenceEquals(this, obj))
49 | {
50 | return true;
51 | }
52 |
53 | if (obj.GetType() != GetType())
54 | {
55 | return false;
56 | }
57 |
58 | return Equals((BrStatsV2V1LtmStats)obj);
59 | }
60 |
61 | public override int GetHashCode()
62 | {
63 | unchecked
64 | {
65 | var hashCode = Score.GetHashCode();
66 | hashCode = hashCode * 397 ^ Wins.GetHashCode();
67 | hashCode = hashCode * 397 ^ Kills.GetHashCode();
68 | hashCode = hashCode * 397 ^ Matches.GetHashCode();
69 | hashCode = hashCode * 397 ^ LastModified.GetHashCode();
70 | return hashCode;
71 | }
72 | }
73 |
74 | public static bool operator ==(BrStatsV2V1LtmStats left, BrStatsV2V1LtmStats right)
75 | {
76 | return Equals(left, right);
77 | }
78 |
79 | public static bool operator !=(BrStatsV2V1LtmStats left, BrStatsV2V1LtmStats right)
80 | {
81 | return !Equals(left, right);
82 | }
83 | }
84 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1OverallStats.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | [DebuggerDisplay("{" + nameof(Score) + "}")]
9 | public class BrStatsV2V1OverallStats : IEquatable
10 | {
11 | [J] public long Score { get; private set; }
12 | [J] public double ScorePerMin { get; private set; }
13 | [J] public double ScorePerMatch { get; private set; }
14 | [J] public long Wins { get; private set; }
15 | [J] public long Top3 { get; private set; }
16 | [J] public long Top5 { get; private set; }
17 | [J] public long Top6 { get; private set; }
18 | [J] public long Top10 { get; private set; }
19 | [J] public long Top12 { get; private set; }
20 | [J] public long Top25 { get; private set; }
21 | [J] public long Kills { get; private set; }
22 | [J] public double KillsPerMin { get; private set; }
23 | [J] public double KillsPerMatch { get; private set; }
24 | [J] public long Deaths { get; private set; }
25 | [J] public double Kd { get; private set; }
26 | [J] public long Matches { get; private set; }
27 | [J] public double WinRate { get; private set; }
28 | [J] public long MinutesPlayed { get; private set; }
29 | [J] public long PlayersOutlived { get; private set; }
30 | [J] public DateTime LastModified { get; private set; }
31 |
32 | public bool Equals(BrStatsV2V1OverallStats other)
33 | {
34 | if (ReferenceEquals(null, other))
35 | {
36 | return false;
37 | }
38 |
39 | if (ReferenceEquals(this, other))
40 | {
41 | return true;
42 | }
43 |
44 | return Score == other.Score && Wins == other.Wins && Kills == other.Kills && Matches == other.Matches && LastModified.Equals(other.LastModified);
45 | }
46 |
47 | public override bool Equals(object obj)
48 | {
49 | if (ReferenceEquals(null, obj))
50 | {
51 | return false;
52 | }
53 |
54 | if (ReferenceEquals(this, obj))
55 | {
56 | return true;
57 | }
58 |
59 | if (obj.GetType() != GetType())
60 | {
61 | return false;
62 | }
63 |
64 | return Equals((BrStatsV2V1OverallStats)obj);
65 | }
66 |
67 | public override int GetHashCode()
68 | {
69 | unchecked
70 | {
71 | var hashCode = Score.GetHashCode();
72 | hashCode = hashCode * 397 ^ Wins.GetHashCode();
73 | hashCode = hashCode * 397 ^ Kills.GetHashCode();
74 | hashCode = hashCode * 397 ^ Matches.GetHashCode();
75 | hashCode = hashCode * 397 ^ LastModified.GetHashCode();
76 | return hashCode;
77 | }
78 | }
79 |
80 | public static bool operator ==(BrStatsV2V1OverallStats left, BrStatsV2V1OverallStats right)
81 | {
82 | return Equals(left, right);
83 | }
84 |
85 | public static bool operator !=(BrStatsV2V1OverallStats left, BrStatsV2V1OverallStats right)
86 | {
87 | return !Equals(left, right);
88 | }
89 | }
90 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1RequestProperties.cs:
--------------------------------------------------------------------------------
1 | namespace Fortnite_API.Objects.V1
2 | {
3 | public class BrStatsV2V1RequestProperties
4 | {
5 | public Optional Name { get; set; }
6 | public Optional AccountType { get; set; }
7 | public Optional AccountId { get; set; }
8 | public Optional TimeWindow { get; set; }
9 | public Optional ImagePlatform { get; set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1SoloStats.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | [DebuggerDisplay("{" + nameof(Score) + "}")]
9 | public class BrStatsV2V1SoloStats : IEquatable
10 | {
11 | [J] public long Score { get; private set; }
12 | [J] public double ScorePerMin { get; private set; }
13 | [J] public double ScorePerMatch { get; private set; }
14 | [J] public long Wins { get; private set; }
15 | [J] public long Top10 { get; private set; }
16 | [J] public long Top25 { get; private set; }
17 | [J] public long Kills { get; private set; }
18 | [J] public double KillsPerMin { get; private set; }
19 | [J] public double KillsPerMatch { get; private set; }
20 | [J] public long Deaths { get; private set; }
21 | [J] public double Kd { get; private set; }
22 | [J] public long Matches { get; private set; }
23 | [J] public double WinRate { get; private set; }
24 | [J] public long MinutesPlayed { get; private set; }
25 | [J] public long PlayersOutlived { get; private set; }
26 | [J] public DateTime LastModified { get; private set; }
27 |
28 | public bool Equals(BrStatsV2V1SoloStats other)
29 | {
30 | if (ReferenceEquals(null, other))
31 | {
32 | return false;
33 | }
34 |
35 | if (ReferenceEquals(this, other))
36 | {
37 | return true;
38 | }
39 |
40 | return Score == other.Score && Wins == other.Wins && Kills == other.Kills && Matches == other.Matches && LastModified.Equals(other.LastModified);
41 | }
42 |
43 | public override bool Equals(object obj)
44 | {
45 | if (ReferenceEquals(null, obj))
46 | {
47 | return false;
48 | }
49 |
50 | if (ReferenceEquals(this, obj))
51 | {
52 | return true;
53 | }
54 |
55 | if (obj.GetType() != GetType())
56 | {
57 | return false;
58 | }
59 |
60 | return Equals((BrStatsV2V1SoloStats)obj);
61 | }
62 |
63 | public override int GetHashCode()
64 | {
65 | unchecked
66 | {
67 | var hashCode = Score.GetHashCode();
68 | hashCode = hashCode * 397 ^ Wins.GetHashCode();
69 | hashCode = hashCode * 397 ^ Kills.GetHashCode();
70 | hashCode = hashCode * 397 ^ Matches.GetHashCode();
71 | hashCode = hashCode * 397 ^ LastModified.GetHashCode();
72 | return hashCode;
73 | }
74 | }
75 |
76 | public static bool operator ==(BrStatsV2V1SoloStats left, BrStatsV2V1SoloStats right)
77 | {
78 | return Equals(left, right);
79 | }
80 |
81 | public static bool operator !=(BrStatsV2V1SoloStats left, BrStatsV2V1SoloStats right)
82 | {
83 | return !Equals(left, right);
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1SquadStats.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | [DebuggerDisplay("{" + nameof(Score) + "}")]
9 | public class BrStatsV2V1SquadStats : IEquatable
10 | {
11 | [J] public long Score { get; private set; }
12 | [J] public double ScorePerMin { get; private set; }
13 | [J] public double ScorePerMatch { get; private set; }
14 | [J] public long Wins { get; private set; }
15 | [J] public long Top3 { get; private set; }
16 | [J] public long Top6 { get; private set; }
17 | [J] public long Kills { get; private set; }
18 | [J] public double KillsPerMin { get; private set; }
19 | [J] public double KillsPerMatch { get; private set; }
20 | [J] public long Deaths { get; private set; }
21 | [J] public double Kd { get; private set; }
22 | [J] public long Matches { get; private set; }
23 | [J] public double WinRate { get; private set; }
24 | [J] public long MinutesPlayed { get; private set; }
25 | [J] public long PlayersOutlived { get; private set; }
26 | [J] public DateTime LastModified { get; private set; }
27 |
28 | public bool Equals(BrStatsV2V1SquadStats other)
29 | {
30 | if (ReferenceEquals(null, other))
31 | {
32 | return false;
33 | }
34 |
35 | if (ReferenceEquals(this, other))
36 | {
37 | return true;
38 | }
39 |
40 | return Score == other.Score && Wins == other.Wins && Kills == other.Kills && Matches == other.Matches && LastModified.Equals(other.LastModified);
41 | }
42 |
43 | public override bool Equals(object obj)
44 | {
45 | if (ReferenceEquals(null, obj))
46 | {
47 | return false;
48 | }
49 |
50 | if (ReferenceEquals(this, obj))
51 | {
52 | return true;
53 | }
54 |
55 | if (obj.GetType() != GetType())
56 | {
57 | return false;
58 | }
59 |
60 | return Equals((BrStatsV2V1SquadStats)obj);
61 | }
62 |
63 | public override int GetHashCode()
64 | {
65 | unchecked
66 | {
67 | var hashCode = Score.GetHashCode();
68 | hashCode = hashCode * 397 ^ Wins.GetHashCode();
69 | hashCode = hashCode * 397 ^ Kills.GetHashCode();
70 | hashCode = hashCode * 397 ^ Matches.GetHashCode();
71 | hashCode = hashCode * 397 ^ LastModified.GetHashCode();
72 | return hashCode;
73 | }
74 | }
75 |
76 | public static bool operator ==(BrStatsV2V1SquadStats left, BrStatsV2V1SquadStats right)
77 | {
78 | return Equals(left, right);
79 | }
80 |
81 | public static bool operator !=(BrStatsV2V1SquadStats left, BrStatsV2V1SquadStats right)
82 | {
83 | return !Equals(left, right);
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1Stats.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class BrStatsV2V1Stats : IEquatable
8 | {
9 | [J] public BrStatsV2V1StatsPlatform All { get; private set; }
10 | [J] public BrStatsV2V1StatsPlatform KeyboardMouse { get; private set; }
11 | [J] public BrStatsV2V1StatsPlatform Gamepad { get; private set; }
12 | [J] public BrStatsV2V1StatsPlatform Touch { get; private set; }
13 |
14 | public bool Equals(BrStatsV2V1Stats other)
15 | {
16 | if (ReferenceEquals(null, other))
17 | {
18 | return false;
19 | }
20 |
21 | if (ReferenceEquals(this, other))
22 | {
23 | return true;
24 | }
25 |
26 | return Equals(All, other.All) && Equals(KeyboardMouse, other.KeyboardMouse) && Equals(Gamepad, other.Gamepad) && Equals(Touch, other.Touch);
27 | }
28 |
29 | public override bool Equals(object obj)
30 | {
31 | if (ReferenceEquals(null, obj))
32 | {
33 | return false;
34 | }
35 |
36 | if (ReferenceEquals(this, obj))
37 | {
38 | return true;
39 | }
40 |
41 | if (obj.GetType() != GetType())
42 | {
43 | return false;
44 | }
45 |
46 | return Equals((BrStatsV2V1Stats)obj);
47 | }
48 |
49 | public override int GetHashCode()
50 | {
51 | unchecked
52 | {
53 | var hashCode = All.GetHashCode();
54 | hashCode = hashCode * 397 ^ (KeyboardMouse != null ? KeyboardMouse.GetHashCode() : 0);
55 | hashCode = hashCode * 397 ^ (Gamepad != null ? Gamepad.GetHashCode() : 0);
56 | hashCode = hashCode * 397 ^ (Touch != null ? Touch.GetHashCode() : 0);
57 | return hashCode;
58 | }
59 | }
60 |
61 | public static bool operator ==(BrStatsV2V1Stats left, BrStatsV2V1Stats right)
62 | {
63 | return Equals(left, right);
64 | }
65 |
66 | public static bool operator !=(BrStatsV2V1Stats left, BrStatsV2V1Stats right)
67 | {
68 | return !Equals(left, right);
69 | }
70 | }
71 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1StatsPlatform.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class BrStatsV2V1StatsPlatform : IEquatable
8 | {
9 | [J] public BrStatsV2V1OverallStats Overall { get; private set; }
10 | [J] public BrStatsV2V1SoloStats Solo { get; private set; }
11 | [J] public BrStatsV2V1DuoStats Duo { get; private set; }
12 | [J] public BrStatsV2V1SquadStats Trio { get; private set; }
13 | [J] public BrStatsV2V1SquadStats Squad { get; private set; }
14 | [J] public BrStatsV2V1LtmStats Ltm { get; private set; }
15 |
16 | public bool Equals(BrStatsV2V1StatsPlatform other)
17 | {
18 | if (ReferenceEquals(null, other))
19 | {
20 | return false;
21 | }
22 |
23 | if (ReferenceEquals(this, other))
24 | {
25 | return true;
26 | }
27 |
28 | return Equals(Overall, other.Overall) && Equals(Solo, other.Solo) && Equals(Duo, other.Duo) && Equals(Trio, other.Trio) && Equals(Squad, other.Squad) && Equals(Ltm, other.Ltm);
29 | }
30 |
31 | public override bool Equals(object obj)
32 | {
33 | if (ReferenceEquals(null, obj))
34 | {
35 | return false;
36 | }
37 |
38 | if (ReferenceEquals(this, obj))
39 | {
40 | return true;
41 | }
42 |
43 | if (obj.GetType() != GetType())
44 | {
45 | return false;
46 | }
47 |
48 | return Equals((BrStatsV2V1StatsPlatform)obj);
49 | }
50 |
51 | public override int GetHashCode()
52 | {
53 | unchecked
54 | {
55 | var hashCode = Overall.GetHashCode();
56 | hashCode = hashCode * 397 ^ (Solo != null ? Solo.GetHashCode() : 0);
57 | hashCode = hashCode * 397 ^ (Duo != null ? Duo.GetHashCode() : 0);
58 | hashCode = hashCode * 397 ^ (Trio != null ? Trio.GetHashCode() : 0);
59 | hashCode = hashCode * 397 ^ (Squad != null ? Squad.GetHashCode() : 0);
60 | hashCode = hashCode * 397 ^ (Ltm != null ? Ltm.GetHashCode() : 0);
61 | return hashCode;
62 | }
63 | }
64 |
65 | public static bool operator ==(BrStatsV2V1StatsPlatform left, BrStatsV2V1StatsPlatform right)
66 | {
67 | return Equals(left, right);
68 | }
69 |
70 | public static bool operator !=(BrStatsV2V1StatsPlatform left, BrStatsV2V1StatsPlatform right)
71 | {
72 | return !Equals(left, right);
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/BrStatsV2V1TimeWindow.cs:
--------------------------------------------------------------------------------
1 | namespace Fortnite_API.Objects.V1
2 | {
3 | public enum BrStatsV2V1TimeWindow
4 | {
5 | Lifetime,
6 | Season
7 | }
8 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/CombinedNewsV1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class CombinedNewsV1 : IEquatable
8 | {
9 | [J] public NewsV1 Br { get; private set; }
10 | [J] public NewsV1 Stw { get; private set; }
11 | [J] public NewsV1 Creative { get; private set; }
12 |
13 | public bool Equals(CombinedNewsV1 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 Equals(Br, other.Br) && Equals(Stw, other.Stw) && Equals(Creative, other.Creative);
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(CombinedNewsV1))
41 | {
42 | return false;
43 | }
44 |
45 | return Equals((CombinedNewsV1)obj);
46 | }
47 |
48 | public override int GetHashCode()
49 | {
50 | unchecked
51 | {
52 | var hashCode = Br != null ? Br.GetHashCode() : 0;
53 | hashCode = hashCode * 397 ^ (Stw != null ? Stw.GetHashCode() : 0);
54 | hashCode = hashCode * 397 ^ (Creative != null ? Creative.GetHashCode() : 0);
55 | return hashCode;
56 | }
57 | }
58 |
59 | public static bool operator ==(CombinedNewsV1 left, CombinedNewsV1 right)
60 | {
61 | return Equals(left, right);
62 | }
63 |
64 | public static bool operator !=(CombinedNewsV1 left, CombinedNewsV1 right)
65 | {
66 | return !Equals(left, right);
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/CreatorCodeV1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class CreatorCodeV1 : IEquatable
8 | {
9 | [J] public string Id { get; private set; }
10 | [J] public string Slug { get; private set; }
11 | [J] public string DisplayName { get; private set; }
12 | [J] public string Status { get; private set; }
13 | [J] public bool Verified { get; private set; }
14 |
15 | public bool Equals(CreatorCodeV1 other)
16 | {
17 | if (ReferenceEquals(null, other))
18 | {
19 | return false;
20 | }
21 |
22 | if (ReferenceEquals(this, other))
23 | {
24 | return true;
25 | }
26 |
27 | return Id == other.Id && Slug == other.Slug && DisplayName == other.DisplayName && Status == other.Status && Verified == other.Verified;
28 | }
29 |
30 | public override bool Equals(object obj)
31 | {
32 | if (ReferenceEquals(null, obj))
33 | {
34 | return false;
35 | }
36 |
37 | if (ReferenceEquals(this, obj))
38 | {
39 | return true;
40 | }
41 |
42 | if (obj.GetType() != typeof(CreatorCodeV1))
43 | {
44 | return false;
45 | }
46 |
47 | return Equals((CreatorCodeV1)obj);
48 | }
49 |
50 | public override int GetHashCode()
51 | {
52 | unchecked
53 | {
54 | var hashCode = Id != null ? Id.GetHashCode() : 0;
55 | hashCode = hashCode * 397 ^ (Slug != null ? Slug.GetHashCode() : 0);
56 | hashCode = hashCode * 397 ^ (DisplayName != null ? DisplayName.GetHashCode() : 0);
57 | hashCode = hashCode * 397 ^ (Status != null ? Status.GetHashCode() : 0);
58 | hashCode = hashCode * 397 ^ Verified.GetHashCode();
59 | return hashCode;
60 | }
61 | }
62 |
63 | public static bool operator ==(CreatorCodeV1 left, CreatorCodeV1 right)
64 | {
65 | return Equals(left, right);
66 | }
67 |
68 | public static bool operator !=(CreatorCodeV1 left, CreatorCodeV1 right)
69 | {
70 | return !Equals(left, right);
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/ImageV1Data.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using I = Newtonsoft.Json.JsonIgnoreAttribute;
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | public class ImageV1Data : IEquatable
9 | {
10 | [Obsolete("This property will always return null.")]
11 | [I] public string Hash { get; } = null;
12 | [J] public Uri Url { get; private set; }
13 |
14 | public bool Equals(ImageV1Data other)
15 | {
16 | if (ReferenceEquals(null, other))
17 | {
18 | return false;
19 | }
20 |
21 | if (ReferenceEquals(this, other))
22 | {
23 | return true;
24 | }
25 |
26 | return Url.Equals(other.Url);
27 | }
28 |
29 | public override bool Equals(object obj)
30 | {
31 | if (ReferenceEquals(null, obj))
32 | {
33 | return false;
34 | }
35 |
36 | if (ReferenceEquals(this, obj))
37 | {
38 | return true;
39 | }
40 |
41 | if (obj.GetType() != GetType())
42 | {
43 | return false;
44 | }
45 |
46 | return Equals((ImageV1Data)obj);
47 | }
48 |
49 | public override int GetHashCode()
50 | {
51 | return Url.GetHashCode();
52 | }
53 |
54 | public static bool operator ==(ImageV1Data left, ImageV1Data right)
55 | {
56 | return Equals(left, right);
57 | }
58 |
59 | public static bool operator !=(ImageV1Data left, ImageV1Data right)
60 | {
61 | return !Equals(left, right);
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/MapV1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | public class MapV1 : IEquatable
9 | {
10 | [J] public MapV1Images Images { get; private set; }
11 | [J] public List POIs { get; private set; }
12 |
13 | public bool Equals(MapV1 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 Images.Equals(other.Images) && POIs.Equals(other.POIs);
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(MapV1))
41 | {
42 | return false;
43 | }
44 |
45 | return Equals((MapV1)obj);
46 | }
47 |
48 | public override int GetHashCode()
49 | {
50 | unchecked
51 | {
52 | return Images.GetHashCode() * 397 ^ POIs.GetHashCode();
53 | }
54 | }
55 |
56 | public static bool operator ==(MapV1 left, MapV1 right)
57 | {
58 | return Equals(left, right);
59 | }
60 |
61 | public static bool operator !=(MapV1 left, MapV1 right)
62 | {
63 | return !Equals(left, right);
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/MapV1Images.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class MapV1Images : IEquatable
8 | {
9 | [J] public Uri Blank { get; private set; }
10 | [J] public Uri POIs { get; private set; }
11 |
12 | public bool Equals(MapV1Images other)
13 | {
14 | if (ReferenceEquals(null, other))
15 | {
16 | return false;
17 | }
18 |
19 | if (ReferenceEquals(this, other))
20 | {
21 | return true;
22 | }
23 |
24 | return Equals(Blank, other.Blank) && Equals(POIs, other.POIs);
25 | }
26 |
27 | public override bool Equals(object obj)
28 | {
29 | if (ReferenceEquals(null, obj))
30 | {
31 | return false;
32 | }
33 |
34 | if (ReferenceEquals(this, obj))
35 | {
36 | return true;
37 | }
38 |
39 | if (obj.GetType() != typeof(MapV1Images))
40 | {
41 | return false;
42 | }
43 |
44 | return Equals((MapV1Images)obj);
45 | }
46 |
47 | public override int GetHashCode()
48 | {
49 | unchecked
50 | {
51 | return (Blank != null ? Blank.GetHashCode() : 0) * 397 ^ (POIs != null ? POIs.GetHashCode() : 0);
52 | }
53 | }
54 |
55 | public static bool operator ==(MapV1Images left, MapV1Images right)
56 | {
57 | return Equals(left, right);
58 | }
59 |
60 | public static bool operator !=(MapV1Images left, MapV1Images right)
61 | {
62 | return !Equals(left, right);
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/MapV1POI.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class MapV1POI : IEquatable
8 | {
9 | [J] public string Id { get; private set; }
10 | [J] public string Name { get; private set; }
11 | [J] public MapV1POILocation Location { get; private set; }
12 |
13 | public bool Equals(MapV1POI 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 Id == other.Id && Name == other.Name && Equals(Location, other.Location);
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(MapV1POI))
41 | {
42 | return false;
43 | }
44 |
45 | return Equals((MapV1POI)obj);
46 | }
47 |
48 | public override int GetHashCode()
49 | {
50 | unchecked
51 | {
52 | var hashCode = Id.GetHashCode();
53 | hashCode = hashCode * 397 ^ (Name != null ? Name.GetHashCode() : 0);
54 | hashCode = hashCode * 397 ^ (Location != null ? Location.GetHashCode() : 0);
55 | return hashCode;
56 | }
57 | }
58 |
59 | public static bool operator ==(MapV1POI left, MapV1POI right)
60 | {
61 | return Equals(left, right);
62 | }
63 |
64 | public static bool operator !=(MapV1POI left, MapV1POI right)
65 | {
66 | return !Equals(left, right);
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/MapV1POILocation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class MapV1POILocation : IEquatable
8 | {
9 | [J] public float X { get; private set; }
10 | [J] public float Y { get; private set; }
11 | [J] public float Z { get; private set; }
12 |
13 | public bool Equals(MapV1POILocation 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 X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z);
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(MapV1POILocation))
41 | {
42 | return false;
43 | }
44 |
45 | return Equals((MapV1POILocation)obj);
46 | }
47 |
48 | public override int GetHashCode()
49 | {
50 | unchecked
51 | {
52 | var hashCode = X.GetHashCode();
53 | hashCode = hashCode * 397 ^ Y.GetHashCode();
54 | hashCode = hashCode * 397 ^ Z.GetHashCode();
55 | return hashCode;
56 | }
57 | }
58 |
59 | public static bool operator ==(MapV1POILocation left, MapV1POILocation right)
60 | {
61 | return Equals(left, right);
62 | }
63 |
64 | public static bool operator !=(MapV1POILocation left, MapV1POILocation right)
65 | {
66 | return !Equals(left, right);
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/NewsV1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | public class NewsV1 : IEquatable
9 | {
10 | [J] public string Language;
11 | [J] public string Title;
12 | [J] public DateTime LastModified;
13 | [J] public List Motds;
14 | [J] public List Messages;
15 |
16 | public bool Equals(NewsV1 other)
17 | {
18 | if (ReferenceEquals(null, other))
19 | {
20 | return false;
21 | }
22 |
23 | if (ReferenceEquals(this, other))
24 | {
25 | return true;
26 | }
27 |
28 | return Language == other.Language && Title == other.Title && LastModified.Equals(other.LastModified);
29 | }
30 |
31 | public override bool Equals(object obj)
32 | {
33 | if (ReferenceEquals(null, obj))
34 | {
35 | return false;
36 | }
37 |
38 | if (ReferenceEquals(this, obj))
39 | {
40 | return true;
41 | }
42 |
43 | if (obj.GetType() != typeof(NewsV1))
44 | {
45 | return false;
46 | }
47 |
48 | return Equals((NewsV1)obj);
49 | }
50 |
51 | public override int GetHashCode()
52 | {
53 | unchecked
54 | {
55 | var hashCode = Language != null ? Language.GetHashCode() : 0;
56 | hashCode = hashCode * 397 ^ (Title != null ? Title.GetHashCode() : 0);
57 | hashCode = hashCode * 397 ^ LastModified.GetHashCode();
58 | return hashCode;
59 | }
60 | }
61 |
62 | public static bool operator ==(NewsV1 left, NewsV1 right)
63 | {
64 | return Equals(left, right);
65 | }
66 |
67 | public static bool operator !=(NewsV1 left, NewsV1 right)
68 | {
69 | return !Equals(left, right);
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/NewsV1Message.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class NewsV1Message : IEquatable
8 | {
9 | [J] public Uri Image { get; private set; }
10 | [J] public bool Hidden { get; private set; }
11 | [J] public string MessageType { get; private set; }
12 | [J] public string Type { get; private set; }
13 | [J] public string Adspace { get; private set; }
14 | [J] public string Title { get; private set; }
15 | [J] public string Body { get; private set; }
16 | [J] public bool Spotlight { get; private set; }
17 |
18 | public bool Equals(NewsV1Message other)
19 | {
20 | if (ReferenceEquals(null, other))
21 | {
22 | return false;
23 | }
24 |
25 | if (ReferenceEquals(this, other))
26 | {
27 | return true;
28 | }
29 |
30 | return Equals(Image, other.Image) && Hidden == other.Hidden && MessageType == other.MessageType && Type == other.Type && Adspace == other.Adspace && Title == other.Title && Body == other.Body && Spotlight == other.Spotlight;
31 | }
32 |
33 | public override bool Equals(object obj)
34 | {
35 | if (ReferenceEquals(null, obj))
36 | {
37 | return false;
38 | }
39 |
40 | if (ReferenceEquals(this, obj))
41 | {
42 | return true;
43 | }
44 |
45 | if (obj.GetType() != typeof(NewsV1Message))
46 | {
47 | return false;
48 | }
49 |
50 | return Equals((NewsV1Message)obj);
51 | }
52 |
53 | public override int GetHashCode()
54 | {
55 | unchecked
56 | {
57 | var hashCode = Image != null ? Image.GetHashCode() : 0;
58 | hashCode = hashCode * 397 ^ Hidden.GetHashCode();
59 | hashCode = hashCode * 397 ^ (MessageType != null ? MessageType.GetHashCode() : 0);
60 | hashCode = hashCode * 397 ^ (Type != null ? Type.GetHashCode() : 0);
61 | hashCode = hashCode * 397 ^ (Adspace != null ? Adspace.GetHashCode() : 0);
62 | hashCode = hashCode * 397 ^ (Title != null ? Title.GetHashCode() : 0);
63 | hashCode = hashCode * 397 ^ (Body != null ? Body.GetHashCode() : 0);
64 | hashCode = hashCode * 397 ^ Spotlight.GetHashCode();
65 | return hashCode;
66 | }
67 | }
68 |
69 | public static bool operator ==(NewsV1Message left, NewsV1Message right)
70 | {
71 | return Equals(left, right);
72 | }
73 |
74 | public static bool operator !=(NewsV1Message left, NewsV1Message right)
75 | {
76 | return !Equals(left, right);
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/NewsV1Motd.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using J = Newtonsoft.Json.JsonPropertyAttribute;
4 |
5 | namespace Fortnite_API.Objects.V1
6 | {
7 | public class NewsV1Motd : IEquatable
8 | {
9 | [J] public string Id { get; private set; }
10 | [J] public string Title { get; private set; }
11 | [J] public string Body { get; private set; }
12 | [J] public Uri Image { get; private set; }
13 | [J] public Uri TileImage { get; private set; }
14 | [J] public bool Hidden { get; private set; }
15 | [J] public bool Spotlight { get; private set; }
16 | [J] public string Type { get; private set; }
17 | [J] public string EntryType { get; private set; }
18 |
19 | public bool Equals(NewsV1Motd other)
20 | {
21 | if (ReferenceEquals(null, other))
22 | {
23 | return false;
24 | }
25 |
26 | if (ReferenceEquals(this, other))
27 | {
28 | return true;
29 | }
30 |
31 | return Id == other.Id && Title == other.Title && Body == other.Body && Equals(Image, other.Image) && Equals(TileImage, other.TileImage) && Hidden == other.Hidden && Spotlight == other.Spotlight && Type == other.Type && EntryType == other.EntryType;
32 | }
33 |
34 | public override bool Equals(object obj)
35 | {
36 | if (ReferenceEquals(null, obj))
37 | {
38 | return false;
39 | }
40 |
41 | if (ReferenceEquals(this, obj))
42 | {
43 | return true;
44 | }
45 |
46 | if (obj.GetType() != typeof(NewsV1Motd))
47 | {
48 | return false;
49 | }
50 |
51 | return Equals((NewsV1Motd)obj);
52 | }
53 |
54 | public override int GetHashCode()
55 | {
56 | unchecked
57 | {
58 | var hashCode = Id != null ? Id.GetHashCode() : 0;
59 | hashCode = hashCode * 397 ^ (Title != null ? Title.GetHashCode() : 0);
60 | hashCode = hashCode * 397 ^ (Body != null ? Body.GetHashCode() : 0);
61 | hashCode = hashCode * 397 ^ (Image != null ? Image.GetHashCode() : 0);
62 | hashCode = hashCode * 397 ^ (TileImage != null ? TileImage.GetHashCode() : 0);
63 | hashCode = hashCode * 397 ^ Hidden.GetHashCode();
64 | hashCode = hashCode * 397 ^ Spotlight.GetHashCode();
65 | hashCode = hashCode * 397 ^ (Type != null ? Type.GetHashCode() : 0);
66 | hashCode = hashCode * 397 ^ (EntryType != null ? EntryType.GetHashCode() : 0);
67 | return hashCode;
68 | }
69 | }
70 |
71 | public static bool operator ==(NewsV1Motd left, NewsV1Motd right)
72 | {
73 | return Equals(left, right);
74 | }
75 |
76 | public static bool operator !=(NewsV1Motd left, NewsV1Motd right)
77 | {
78 | return !Equals(left, right);
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/PlaylistV1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 |
5 | using I = Newtonsoft.Json.JsonIgnoreAttribute;
6 | using J = Newtonsoft.Json.JsonPropertyAttribute;
7 |
8 | namespace Fortnite_API.Objects.V1
9 | {
10 | [DebuggerDisplay("{" + nameof(Id) + "}")]
11 | public class PlaylistV1 : IEquatable
12 | {
13 | [J] public string Id { get; private set; }
14 | [J] public string Name { get; private set; }
15 | [J] public string SubName { get; private set; }
16 | [J] public string Description { get; private set; }
17 | [J] public string GameType { get; private set; }
18 | [J] public string RatingType { get; private set; }
19 | [J] public int MinPlayers { get; private set; }
20 | [J] public int MaxPlayers { get; private set; }
21 | [J] public int MaxTeams { get; private set; }
22 | [J] public int MaxTeamSize { get; private set; }
23 | [J] public int MaxSquads { get; private set; }
24 | [J] public int MaxSquadSize { get; private set; }
25 | [J] public bool IsDefault { get; private set; }
26 | [J] public bool IsTournament { get; private set; }
27 | [J] public bool IsLimitedTimeMode { get; private set; }
28 | [J] public bool IsLargeTeamGame { get; private set; }
29 | [J] public bool AccumulateToProfileStats { get; private set; }
30 | [J] public PlaylistV1Images Images { get; private set; }
31 | [J] public List GameplayTags { get; private set; }
32 | [J] public string Path { get; private set; }
33 | [J] public DateTime Added { get; private set; }
34 |
35 | [I] public bool HasGameplayTags => GameplayTags != null && GameplayTags.Count != 0;
36 |
37 | public bool Equals(PlaylistV1 other)
38 | {
39 | if (ReferenceEquals(null, other))
40 | {
41 | return false;
42 | }
43 |
44 | if (ReferenceEquals(this, other))
45 | {
46 | return true;
47 | }
48 |
49 | return Id == other.Id && Path == other.Path && Added.Equals(other.Added);
50 | }
51 |
52 | public override bool Equals(object obj)
53 | {
54 | if (ReferenceEquals(null, obj))
55 | {
56 | return false;
57 | }
58 |
59 | if (ReferenceEquals(this, obj))
60 | {
61 | return true;
62 | }
63 |
64 | if (obj.GetType() != GetType())
65 | {
66 | return false;
67 | }
68 |
69 | return Equals((PlaylistV1)obj);
70 | }
71 |
72 | public override int GetHashCode()
73 | {
74 | unchecked
75 | {
76 | var hashCode = Id.GetHashCode();
77 | hashCode = hashCode * 397 ^ Path.GetHashCode();
78 | hashCode = hashCode * 397 ^ Added.GetHashCode();
79 | return hashCode;
80 | }
81 | }
82 |
83 | public static bool operator ==(PlaylistV1 left, PlaylistV1 right)
84 | {
85 | return Equals(left, right);
86 | }
87 |
88 | public static bool operator !=(PlaylistV1 left, PlaylistV1 right)
89 | {
90 | return !Equals(left, right);
91 | }
92 | }
93 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V1/PlaylistV1Images.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using I = Newtonsoft.Json.JsonIgnoreAttribute;
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V1
7 | {
8 | public class PlaylistV1Images : IEquatable
9 | {
10 | [J] public Uri Showcase { get; private set; }
11 | [J] public Uri MissionIcon { get; private set; }
12 |
13 | [I] public bool HasShowcase => Showcase != null;
14 | [I] public bool HasMissionIcon => MissionIcon != null;
15 |
16 | public bool Equals(PlaylistV1Images other)
17 | {
18 | if (ReferenceEquals(null, other))
19 | {
20 | return false;
21 | }
22 |
23 | if (ReferenceEquals(this, other))
24 | {
25 | return true;
26 | }
27 |
28 | return Equals(Showcase, other.Showcase) && Equals(MissionIcon, other.MissionIcon);
29 | }
30 |
31 | public override bool Equals(object obj)
32 | {
33 | if (ReferenceEquals(null, obj))
34 | {
35 | return false;
36 | }
37 |
38 | if (ReferenceEquals(this, obj))
39 | {
40 | return true;
41 | }
42 |
43 | if (obj.GetType() != GetType())
44 | {
45 | return false;
46 | }
47 |
48 | return Equals((PlaylistV1Images)obj);
49 | }
50 |
51 | public override int GetHashCode()
52 | {
53 | unchecked
54 | {
55 | return (Showcase != null ? Showcase.GetHashCode() : 0) * 397 ^ (MissionIcon != null ? MissionIcon.GetHashCode() : 0);
56 | }
57 | }
58 |
59 | public static bool operator ==(PlaylistV1Images left, PlaylistV1Images right)
60 | {
61 | return Equals(left, right);
62 | }
63 |
64 | public static bool operator !=(PlaylistV1Images left, PlaylistV1Images right)
65 | {
66 | return !Equals(left, right);
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/AesV2.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 |
5 | using J = Newtonsoft.Json.JsonPropertyAttribute;
6 |
7 | namespace Fortnite_API.Objects.V2
8 | {
9 | [DebuggerDisplay("{" + nameof(Build) + "}")]
10 | public class AesV2 : IEquatable
11 | {
12 | [J] public string Build { get; private set; }
13 | [J] public string MainKey { get; private set; }
14 | [J] public List DynamicKeys { get; private set; }
15 | [J] public DateTime Updated { get; private set; }
16 |
17 | public bool HasDynamicKeys => DynamicKeys != null;
18 |
19 | public bool Equals(AesV2 other)
20 | {
21 | if (ReferenceEquals(null, other))
22 | {
23 | return false;
24 | }
25 |
26 | if (ReferenceEquals(this, other))
27 | {
28 | return true;
29 | }
30 |
31 | return Build == other.Build && MainKey == other.MainKey && DynamicKeys.Equals(other.DynamicKeys) && Updated.Equals(other.Updated);
32 | }
33 |
34 | public override bool Equals(object obj)
35 | {
36 | if (ReferenceEquals(null, obj))
37 | {
38 | return false;
39 | }
40 |
41 | if (ReferenceEquals(this, obj))
42 | {
43 | return true;
44 | }
45 |
46 | if (obj.GetType() != GetType())
47 | {
48 | return false;
49 | }
50 |
51 | return Equals((AesV2)obj);
52 | }
53 |
54 | public override int GetHashCode()
55 | {
56 | unchecked
57 | {
58 | var hashCode = Build.GetHashCode();
59 | hashCode = hashCode * 397 ^ MainKey.GetHashCode();
60 | hashCode = hashCode * 397 ^ DynamicKeys.GetHashCode();
61 | hashCode = hashCode * 397 ^ Updated.GetHashCode();
62 | return hashCode;
63 | }
64 | }
65 |
66 | public static bool operator ==(AesV2 left, AesV2 right)
67 | {
68 | return Equals(left, right);
69 | }
70 |
71 | public static bool operator !=(AesV2 left, AesV2 right)
72 | {
73 | return !Equals(left, right);
74 | }
75 | }
76 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/AesV2DynamicKey.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V2
7 | {
8 | [DebuggerDisplay("{" + nameof(PakGuid) + "}")]
9 | public class AesV2DynamicKey : IEquatable
10 | {
11 | [J] public string PakFilename { get; private set; }
12 | [J] public string PakGuid { get; private set; }
13 | [J] public string Key { get; private set; }
14 |
15 | public bool Equals(AesV2DynamicKey other)
16 | {
17 | if (ReferenceEquals(null, other))
18 | {
19 | return false;
20 | }
21 |
22 | if (ReferenceEquals(this, other))
23 | {
24 | return true;
25 | }
26 |
27 | return PakGuid == other.PakGuid && Key == other.Key;
28 | }
29 |
30 | public override bool Equals(object obj)
31 | {
32 | if (ReferenceEquals(null, obj))
33 | {
34 | return false;
35 | }
36 |
37 | if (ReferenceEquals(this, obj))
38 | {
39 | return true;
40 | }
41 |
42 | if (obj.GetType() != GetType())
43 | {
44 | return false;
45 | }
46 |
47 | return Equals((AesV2DynamicKey)obj);
48 | }
49 |
50 | public override int GetHashCode()
51 | {
52 | unchecked
53 | {
54 | return PakGuid.GetHashCode() * 397 ^ Key.GetHashCode();
55 | }
56 | }
57 |
58 | public static bool operator ==(AesV2DynamicKey left, AesV2DynamicKey right)
59 | {
60 | return Equals(left, right);
61 | }
62 |
63 | public static bool operator !=(AesV2DynamicKey left, AesV2DynamicKey right)
64 | {
65 | return !Equals(left, right);
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/AesV2KeyFormat.cs:
--------------------------------------------------------------------------------
1 | namespace Fortnite_API.Objects.V2
2 | {
3 | public enum AesV2KeyFormat
4 | {
5 | Hex,
6 | Base64
7 | }
8 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrCosmeticV2.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 |
5 | using I = Newtonsoft.Json.JsonIgnoreAttribute;
6 | using J = Newtonsoft.Json.JsonPropertyAttribute;
7 |
8 | namespace Fortnite_API.Objects.V2
9 | {
10 | [DebuggerDisplay("{" + nameof(Id) + "}")]
11 | public class BrCosmeticV2 : IEquatable
12 | {
13 | private static readonly Uri _youtubeBaseUri = new Uri("https://youtu.be/", UriKind.Absolute);
14 |
15 | [J] public string Id { get; private set; }
16 | [J] public string Name { get; private set; }
17 | [J] public string Description { get; private set; }
18 | [J] public string ExclusiveDescription { get; private set; }
19 | [J] public string UnlockRequirements { get; private set; }
20 | [J] public string CustomExclusiveCallout { get; private set; }
21 | [J] public BrCosmeticV2Type Type { get; private set; }
22 | [J] public BrCosmeticV2Rarity Rarity { get; private set; }
23 | [J] public BrCosmeticV2Series Series { get; private set; }
24 | [J] public BrCosmeticV2Set Set { get; private set; }
25 | [J] public BrCosmeticV2Introduction Introduction { get; private set; }
26 | [J] public BrCosmeticV2Images Images { get; private set; }
27 | [J] public List Variants { get; private set; }
28 | [J] public List BuiltInEmoteIds { get; private set; }
29 | [J] public List GameplayTags { get; private set; }
30 | [J] public List MetaTags { get; private set; }
31 | private string _showcaseVideo;
32 | [J] public string ShowcaseVideo
33 | {
34 | get => _showcaseVideo;
35 | private set => ShowcaseVideoUri = _showcaseVideo == null ? null : new Uri(_youtubeBaseUri, _showcaseVideo = value);
36 | }
37 | [I] public Uri ShowcaseVideoUri { get; private set; }
38 | [J] public string DynamicPakId { get; private set; }
39 | [J] public string DisplayAssetPath { get; private set; }
40 | [J] public string DefinitionPath { get; private set; }
41 | [J] public string Path { get; private set; }
42 | [J] public DateTime Added { get; private set; }
43 | [J] public List ShopHistory { get; private set; }
44 |
45 | [I] public bool HasSeries => Series != null;
46 | [I] public bool HasSet => Set != null;
47 | [I] public bool HasIntroduction => Introduction != null;
48 | [I] public bool HasVariants => Variants != null && Variants.Count != 0;
49 | [I] public bool HasBuiltInEmoteIds => BuiltInEmoteIds != null && BuiltInEmoteIds.Count != 0;
50 | [I] public bool HasGameplayTags => GameplayTags != null && GameplayTags.Count != 0;
51 | [I] public bool HasMetaTags => MetaTags != null && MetaTags.Count != 0;
52 | [I] public bool HasShowcaseVideo => ShowcaseVideo != null;
53 | [I] public bool HasDynamicPakId => DynamicPakId != null;
54 | [I] public bool HasDisplayAssetPath => DisplayAssetPath != null;
55 | [I] public bool HasDefinitionPath => DefinitionPath != null;
56 | [I] public bool HasShopHistory => ShopHistory != null;
57 |
58 | public bool Equals(BrCosmeticV2 other)
59 | {
60 | if (ReferenceEquals(null, other))
61 | {
62 | return false;
63 | }
64 |
65 | if (ReferenceEquals(this, other))
66 | {
67 | return true;
68 | }
69 |
70 | return Id == other.Id;
71 | }
72 |
73 | public override bool Equals(object obj)
74 | {
75 | if (ReferenceEquals(null, obj))
76 | {
77 | return false;
78 | }
79 |
80 | if (ReferenceEquals(this, obj))
81 | {
82 | return true;
83 | }
84 |
85 | if (obj.GetType() != GetType())
86 | {
87 | return false;
88 | }
89 |
90 | return Equals((BrCosmeticV2)obj);
91 | }
92 |
93 | public override int GetHashCode()
94 | {
95 | return Id.GetHashCode();
96 | }
97 |
98 | public static bool operator ==(BrCosmeticV2 left, BrCosmeticV2 right)
99 | {
100 | return Equals(left, right);
101 | }
102 |
103 | public static bool operator !=(BrCosmeticV2 left, BrCosmeticV2 right)
104 | {
105 | return !Equals(left, right);
106 | }
107 | }
108 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrCosmeticV2Images.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using I = Newtonsoft.Json.JsonIgnoreAttribute;
5 | using J = Newtonsoft.Json.JsonPropertyAttribute;
6 |
7 | namespace Fortnite_API.Objects.V2
8 | {
9 | public class BrCosmeticV2Images : IEquatable
10 | {
11 | [J] public Uri SmallIcon { get; private set; }
12 | [J] public Uri Icon { get; private set; }
13 | [J] public Uri Featured { get; private set; }
14 | [J] public Dictionary Other { get; private set; }
15 |
16 | [I] public bool HasSmallIcon => SmallIcon != null;
17 | [I] public bool HasIcon => Icon != null;
18 | [I] public bool HasFeatured => Featured != null;
19 | [I] public bool HasOther => Other != null && Other.Count != 0;
20 |
21 | public Uri Get(bool useFeatured = true)
22 | {
23 | return useFeatured && HasFeatured ? Featured : Icon ?? SmallIcon;
24 | }
25 |
26 | public bool Equals(BrCosmeticV2Images other)
27 | {
28 | if (ReferenceEquals(null, other))
29 | {
30 | return false;
31 | }
32 |
33 | if (ReferenceEquals(this, other))
34 | {
35 | return true;
36 | }
37 |
38 | return SmallIcon == other.SmallIcon && Icon == other.Icon && Featured == other.Featured && Equals(Other, other.Other);
39 | }
40 |
41 | public override bool Equals(object obj)
42 | {
43 | if (ReferenceEquals(null, obj))
44 | {
45 | return false;
46 | }
47 |
48 | if (ReferenceEquals(this, obj))
49 | {
50 | return true;
51 | }
52 |
53 | if (obj.GetType() != GetType())
54 | {
55 | return false;
56 | }
57 |
58 | return Equals((BrCosmeticV2Images)obj);
59 | }
60 |
61 | public override int GetHashCode()
62 | {
63 | unchecked
64 | {
65 | var hashCode = SmallIcon != null ? SmallIcon.GetHashCode() : 0;
66 | hashCode = hashCode * 397 ^ (Icon != null ? Icon.GetHashCode() : 0);
67 | hashCode = hashCode * 397 ^ (Featured != null ? Featured.GetHashCode() : 0);
68 | hashCode = hashCode * 397 ^ (Other != null ? Other.GetHashCode() : 0);
69 | return hashCode;
70 | }
71 | }
72 |
73 | public static bool operator ==(BrCosmeticV2Images left, BrCosmeticV2Images right)
74 | {
75 | return Equals(left, right);
76 | }
77 |
78 | public static bool operator !=(BrCosmeticV2Images left, BrCosmeticV2Images right)
79 | {
80 | return !Equals(left, right);
81 | }
82 | }
83 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrCosmeticV2Introduction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V2
7 | {
8 | [DebuggerDisplay("{" + nameof(BackendValue) + "}")]
9 | public class BrCosmeticV2Introduction : IEquatable
10 | {
11 | [J] public string Chapter { get; private set; }
12 | [J] public string Season { get; private set; }
13 | [J] public string Text { get; private set; }
14 | [J] public int BackendValue { get; private set; }
15 |
16 | public bool Equals(BrCosmeticV2Introduction other)
17 | {
18 | if (ReferenceEquals(null, other))
19 | {
20 | return false;
21 | }
22 |
23 | if (ReferenceEquals(this, other))
24 | {
25 | return true;
26 | }
27 |
28 | return BackendValue == other.BackendValue;
29 | }
30 |
31 | public override bool Equals(object obj)
32 | {
33 | if (ReferenceEquals(null, obj))
34 | {
35 | return false;
36 | }
37 |
38 | if (ReferenceEquals(this, obj))
39 | {
40 | return true;
41 | }
42 |
43 | if (obj.GetType() != GetType())
44 | {
45 | return false;
46 | }
47 |
48 | return Equals((BrCosmeticV2Introduction)obj);
49 | }
50 |
51 | public override int GetHashCode()
52 | {
53 | return BackendValue;
54 | }
55 |
56 | public static bool operator ==(BrCosmeticV2Introduction left, BrCosmeticV2Introduction right)
57 | {
58 | return Equals(left, right);
59 | }
60 |
61 | public static bool operator !=(BrCosmeticV2Introduction left, BrCosmeticV2Introduction right)
62 | {
63 | return !Equals(left, right);
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrCosmeticV2Rarity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V2
7 | {
8 | [DebuggerDisplay("{" + nameof(BackendValue) + "}")]
9 | public class BrCosmeticV2Rarity : IEquatable
10 | {
11 | [J] public string Value { get; private set; }
12 | [J] public string DisplayValue { get; private set; }
13 | [J] public string BackendValue { get; private set; }
14 |
15 | public bool Equals(BrCosmeticV2Rarity other)
16 | {
17 | if (ReferenceEquals(null, other))
18 | {
19 | return false;
20 | }
21 |
22 | if (ReferenceEquals(this, other))
23 | {
24 | return true;
25 | }
26 |
27 | return BackendValue == other.BackendValue;
28 | }
29 |
30 | public override bool Equals(object obj)
31 | {
32 | if (ReferenceEquals(null, obj))
33 | {
34 | return false;
35 | }
36 |
37 | if (ReferenceEquals(this, obj))
38 | {
39 | return true;
40 | }
41 |
42 | if (obj.GetType() != GetType())
43 | {
44 | return false;
45 | }
46 |
47 | return Equals((BrCosmeticV2Rarity)obj);
48 | }
49 |
50 | public override int GetHashCode()
51 | {
52 | return BackendValue.GetHashCode();
53 | }
54 |
55 | public static bool operator ==(BrCosmeticV2Rarity left, BrCosmeticV2Rarity right)
56 | {
57 | return Equals(left, right);
58 | }
59 |
60 | public static bool operator !=(BrCosmeticV2Rarity left, BrCosmeticV2Rarity right)
61 | {
62 | return !Equals(left, right);
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrCosmeticV2SearchProperties.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using RestSharp;
4 |
5 | namespace Fortnite_API.Objects.V2
6 | {
7 | public class BrCosmeticV2SearchProperties
8 | {
9 | private static readonly DateTime _unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
10 |
11 | public Optional Language { get; set; }
12 | public Optional SearchLanguage { get; set; }
13 | public Optional MatchMethod { get; set; }
14 | public Optional Id { get; set; }
15 | public Optional Name { get; set; }
16 | public Optional Description { get; set; }
17 | public Optional Type { get; set; }
18 | public Optional DisplayType { get; set; }
19 | public Optional BackendType { get; set; }
20 | public Optional Rarity { get; set; }
21 | public Optional DisplayRarity { get; set; }
22 | public Optional BackendRarity { get; set; }
23 | public Optional HasSeries { get; set; }
24 | public Optional Series { get; set; }
25 | public Optional BackendSeries { get; set; }
26 | public Optional HasSet { get; set; }
27 | public Optional Set { get; set; }
28 | public Optional SetText { get; set; }
29 | public Optional BackendSet { get; set; }
30 | public Optional HasIntroduction { get; set; }
31 | public Optional BackendIntroduction { get; set; }
32 | public Optional IntroductionChapter { get; set; }
33 | public Optional IntroductionSeason { get; set; }
34 | public Optional HasFeaturedImage { get; set; }
35 | public Optional HasVariants { get; set; }
36 | public Optional HasGameplayTags { get; set; }
37 | public Optional GameplayTag { get; set; }
38 | public Optional HasMetaTags { get; set; }
39 | public Optional MetaTag { get; set; }
40 | public Optional DynamicPakId { get; set; }
41 | public Optional Added { get; set; }
42 | public Optional AddedSince { get; set; }
43 | public Optional UnseenFor { get; set; }
44 | public Optional LastAppearance { get; set; }
45 |
46 | internal IRestRequest AppendParameters(IRestRequest request)
47 | {
48 | if (Language.HasValue)
49 | {
50 | request.AddQueryParameter("language", Language.Value.GetLanguageCode());
51 | }
52 |
53 | if (SearchLanguage.HasValue)
54 | {
55 | request.AddQueryParameter("searchLanguage", SearchLanguage.Value.GetLanguageCode());
56 | }
57 |
58 | if (MatchMethod.HasValue)
59 | {
60 | request.AddQueryParameter("matchMethod", MatchMethod.Value.GetString());
61 | }
62 |
63 | var paramsCount = request.Parameters.Count;
64 |
65 | if (Id.HasValue)
66 | {
67 | request.AddQueryParameter("id", Id.Value);
68 | }
69 |
70 | if (Name.HasValue)
71 | {
72 | request.AddQueryParameter("name", Name.Value);
73 | }
74 |
75 | if (Description.HasValue)
76 | {
77 | request.AddQueryParameter("description", Description.Value);
78 | }
79 |
80 | if (Type.HasValue)
81 | {
82 | request.AddQueryParameter("type", Type.Value);
83 | }
84 |
85 | if (DisplayType.HasValue)
86 | {
87 | request.AddQueryParameter("displayType", DisplayType.Value);
88 | }
89 |
90 | if (BackendType.HasValue)
91 | {
92 | request.AddQueryParameter("backendType", BackendType.Value);
93 | }
94 |
95 | if (Rarity.HasValue)
96 | {
97 | request.AddQueryParameter("rarity", Rarity.Value);
98 | }
99 |
100 | if (DisplayRarity.HasValue)
101 | {
102 | request.AddQueryParameter("displayRarity", DisplayRarity.Value);
103 | }
104 |
105 | if (BackendRarity.HasValue)
106 | {
107 | request.AddQueryParameter("backendRarity", BackendRarity.Value);
108 | }
109 |
110 | if (HasSeries.HasValue)
111 | {
112 | request.AddQueryParameter("hasSeries", HasSeries.Value.GetString());
113 | }
114 |
115 | if (Series.HasValue)
116 | {
117 | request.AddQueryParameter("series", Series.Value);
118 | }
119 |
120 | if (BackendSeries.HasValue)
121 | {
122 | request.AddQueryParameter("backendSeries", BackendSeries.Value);
123 | }
124 |
125 | if (HasSet.HasValue)
126 | {
127 | request.AddQueryParameter("hasSet", HasSet.Value.GetString());
128 | }
129 |
130 | if (Set.HasValue)
131 | {
132 | request.AddQueryParameter("set", Set.Value);
133 | }
134 |
135 | if (SetText.HasValue)
136 | {
137 | request.AddQueryParameter("setText", SetText.Value);
138 | }
139 |
140 | if (BackendSet.HasValue)
141 | {
142 | request.AddQueryParameter("backendSet", BackendSet.Value);
143 | }
144 |
145 | if (HasIntroduction.HasValue)
146 | {
147 | request.AddQueryParameter("hasIntroduction", HasIntroduction.Value.GetString());
148 | }
149 |
150 | if (BackendIntroduction.HasValue)
151 | {
152 | request.AddQueryParameter("backendIntroduction", BackendIntroduction.Value.ToString());
153 | }
154 |
155 | if (IntroductionChapter.HasValue)
156 | {
157 | request.AddQueryParameter("introductionChapter", IntroductionChapter.Value);
158 | }
159 |
160 | if (IntroductionSeason.HasValue)
161 | {
162 | request.AddQueryParameter("introductionSeason", IntroductionSeason.Value);
163 | }
164 |
165 | if (HasFeaturedImage.HasValue)
166 | {
167 | request.AddQueryParameter("hasFeaturedImage", HasFeaturedImage.Value.GetString());
168 | }
169 |
170 | if (HasVariants.HasValue)
171 | {
172 | request.AddQueryParameter("hasVariants", HasVariants.Value.GetString());
173 | }
174 |
175 | if (HasGameplayTags.HasValue)
176 | {
177 | request.AddQueryParameter("hasGameplayTags", HasGameplayTags.Value.GetString());
178 | }
179 |
180 | if (GameplayTag.HasValue)
181 | {
182 | request.AddQueryParameter("gameplayTag", GameplayTag.Value);
183 | }
184 |
185 | if (HasMetaTags.HasValue)
186 | {
187 | request.AddQueryParameter("hasMetaTags", HasMetaTags.Value.GetString());
188 | }
189 |
190 | if (MetaTag.HasValue)
191 | {
192 | request.AddQueryParameter("metaTag", GameplayTag.Value);
193 | }
194 |
195 | if (DynamicPakId.HasValue)
196 | {
197 | request.AddQueryParameter("dynamicPakId", DynamicPakId.Value);
198 | }
199 |
200 | if (Added.HasValue)
201 | {
202 | if (Added.Value <= _unixEpoch)
203 | {
204 | throw new ArgumentOutOfRangeException(nameof(Added), Added.Value, null);
205 | }
206 |
207 | request.AddQueryParameter("added", (Added.Value - _unixEpoch).TotalSeconds.ToString("0"));
208 | }
209 |
210 | if (AddedSince.HasValue)
211 | {
212 | if (AddedSince.Value <= _unixEpoch)
213 | {
214 | throw new ArgumentOutOfRangeException(nameof(AddedSince), AddedSince.Value, null);
215 | }
216 |
217 | request.AddQueryParameter("addedSince", (AddedSince.Value - _unixEpoch).TotalSeconds.ToString("0"));
218 | }
219 |
220 | if (UnseenFor.HasValue)
221 | {
222 | request.AddQueryParameter("unseenFor", UnseenFor.Value.ToString());
223 | }
224 |
225 | if (LastAppearance.HasValue)
226 | {
227 | if (LastAppearance.Value <= _unixEpoch)
228 | {
229 | throw new ArgumentOutOfRangeException(nameof(LastAppearance), LastAppearance.Value, null);
230 | }
231 |
232 | request.AddQueryParameter("lastAppearance", (LastAppearance.Value - _unixEpoch).TotalSeconds.ToString("0"));
233 | }
234 |
235 | if (request.Parameters.Count - paramsCount == 0)
236 | {
237 | throw new ArgumentException("at least one search parameter is required");
238 | }
239 |
240 | return request;
241 | }
242 | }
243 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrCosmeticV2Series.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V2
7 | {
8 | [DebuggerDisplay("{" + nameof(BackendValue) + "}")]
9 | public class BrCosmeticV2Series : IEquatable
10 | {
11 | [J] public string Value { get; private set; }
12 | [J] public Uri Image { get; private set; }
13 | [J] public string BackendValue { get; private set; }
14 |
15 | public bool Equals(BrCosmeticV2Series other)
16 | {
17 | if (ReferenceEquals(null, other))
18 | {
19 | return false;
20 | }
21 |
22 | if (ReferenceEquals(this, other))
23 | {
24 | return true;
25 | }
26 |
27 | return BackendValue == other.BackendValue;
28 | }
29 |
30 | public override bool Equals(object obj)
31 | {
32 | if (ReferenceEquals(null, obj))
33 | {
34 | return false;
35 | }
36 |
37 | if (ReferenceEquals(this, obj))
38 | {
39 | return true;
40 | }
41 |
42 | if (obj.GetType() != GetType())
43 | {
44 | return false;
45 | }
46 |
47 | return Equals((BrCosmeticV2Series)obj);
48 | }
49 |
50 | public override int GetHashCode()
51 | {
52 | return BackendValue.GetHashCode();
53 | }
54 |
55 | public static bool operator ==(BrCosmeticV2Series left, BrCosmeticV2Series right)
56 | {
57 | return Equals(left, right);
58 | }
59 |
60 | public static bool operator !=(BrCosmeticV2Series left, BrCosmeticV2Series right)
61 | {
62 | return !Equals(left, right);
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrCosmeticV2Set.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V2
7 | {
8 | [DebuggerDisplay("{" + nameof(BackendValue) + "}")]
9 | public class BrCosmeticV2Set : IEquatable
10 | {
11 | [J] public string Value { get; private set; }
12 | [J] public string Text { get; private set; }
13 | [J] public string BackendValue { get; private set; }
14 |
15 | public bool Equals(BrCosmeticV2Set other)
16 | {
17 | if (ReferenceEquals(null, other))
18 | {
19 | return false;
20 | }
21 |
22 | if (ReferenceEquals(this, other))
23 | {
24 | return true;
25 | }
26 |
27 | return BackendValue == other.BackendValue;
28 | }
29 |
30 | public override bool Equals(object obj)
31 | {
32 | if (ReferenceEquals(null, obj))
33 | {
34 | return false;
35 | }
36 |
37 | if (ReferenceEquals(this, obj))
38 | {
39 | return true;
40 | }
41 |
42 | if (obj.GetType() != GetType())
43 | {
44 | return false;
45 | }
46 |
47 | return Equals((BrCosmeticV2Set)obj);
48 | }
49 |
50 | public override int GetHashCode()
51 | {
52 | return BackendValue.GetHashCode();
53 | }
54 |
55 | public static bool operator ==(BrCosmeticV2Set left, BrCosmeticV2Set right)
56 | {
57 | return Equals(left, right);
58 | }
59 |
60 | public static bool operator !=(BrCosmeticV2Set left, BrCosmeticV2Set right)
61 | {
62 | return !Equals(left, right);
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrCosmeticV2Type.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V2
7 | {
8 | [DebuggerDisplay("{" + nameof(BackendValue) + "}")]
9 | public class BrCosmeticV2Type : IEquatable
10 | {
11 | [J] public string Value { get; private set; }
12 | [J] public string DisplayValue { get; private set; }
13 | [J] public string BackendValue { get; private set; }
14 |
15 | public bool Equals(BrCosmeticV2Type other)
16 | {
17 | if (ReferenceEquals(null, other))
18 | {
19 | return false;
20 | }
21 |
22 | if (ReferenceEquals(this, other))
23 | {
24 | return true;
25 | }
26 |
27 | return BackendValue == other.BackendValue;
28 | }
29 |
30 | public override bool Equals(object obj)
31 | {
32 | if (ReferenceEquals(null, obj))
33 | {
34 | return false;
35 | }
36 |
37 | if (ReferenceEquals(this, obj))
38 | {
39 | return true;
40 | }
41 |
42 | if (obj.GetType() != GetType())
43 | {
44 | return false;
45 | }
46 |
47 | return Equals((BrCosmeticV2Type)obj);
48 | }
49 |
50 | public override int GetHashCode()
51 | {
52 | return BackendValue.GetHashCode();
53 | }
54 |
55 | public static bool operator ==(BrCosmeticV2Type left, BrCosmeticV2Type right)
56 | {
57 | return Equals(left, right);
58 | }
59 |
60 | public static bool operator !=(BrCosmeticV2Type left, BrCosmeticV2Type right)
61 | {
62 | return !Equals(left, right);
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrCosmeticV2Variant.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 |
5 | using J = Newtonsoft.Json.JsonPropertyAttribute;
6 |
7 | namespace Fortnite_API.Objects.V2
8 | {
9 | [DebuggerDisplay("{" + nameof(Channel) + "}")]
10 | public class BrCosmeticV2Variant : IEquatable
11 | {
12 | [J] public string Channel { get; private set; }
13 | [J] public string Type { get; private set; }
14 | [J] public List Options { get; private set; }
15 |
16 | public bool Equals(BrCosmeticV2Variant other)
17 | {
18 | if (ReferenceEquals(null, other))
19 | {
20 | return false;
21 | }
22 |
23 | if (ReferenceEquals(this, other))
24 | {
25 | return true;
26 | }
27 |
28 | return Channel == other.Channel && Options.Equals(other.Options);
29 | }
30 |
31 | public override bool Equals(object obj)
32 | {
33 | if (ReferenceEquals(null, obj))
34 | {
35 | return false;
36 | }
37 |
38 | if (ReferenceEquals(this, obj))
39 | {
40 | return true;
41 | }
42 |
43 | if (obj.GetType() != GetType())
44 | {
45 | return false;
46 | }
47 |
48 | return Equals((BrCosmeticV2Variant)obj);
49 | }
50 |
51 | public override int GetHashCode()
52 | {
53 | unchecked
54 | {
55 | return Channel.GetHashCode() * 397 ^ Options.GetHashCode();
56 | }
57 | }
58 |
59 | public static bool operator ==(BrCosmeticV2Variant left, BrCosmeticV2Variant right)
60 | {
61 | return Equals(left, right);
62 | }
63 |
64 | public static bool operator !=(BrCosmeticV2Variant left, BrCosmeticV2Variant right)
65 | {
66 | return !Equals(left, right);
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrCosmeticV2VariantOption.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | using J = Newtonsoft.Json.JsonPropertyAttribute;
5 |
6 | namespace Fortnite_API.Objects.V2
7 | {
8 | [DebuggerDisplay("{" + nameof(Tag) + "}")]
9 | public class BrCosmeticV2VariantOption : IEquatable
10 | {
11 | [J] public string Tag { get; private set; }
12 | [J] public string Name { get; private set; }
13 | [J] public string UnlockRequirements { get; private set; }
14 | [J] public Uri Image { get; private set; }
15 |
16 | public bool Equals(BrCosmeticV2VariantOption other)
17 | {
18 | if (ReferenceEquals(null, other))
19 | {
20 | return false;
21 | }
22 |
23 | if (ReferenceEquals(this, other))
24 | {
25 | return true;
26 | }
27 |
28 | return Tag == other.Tag;
29 | }
30 |
31 | public override bool Equals(object obj)
32 | {
33 | if (ReferenceEquals(null, obj))
34 | {
35 | return false;
36 | }
37 |
38 | if (ReferenceEquals(this, obj))
39 | {
40 | return true;
41 | }
42 |
43 | if (obj.GetType() != GetType())
44 | {
45 | return false;
46 | }
47 |
48 | return Equals((BrCosmeticV2VariantOption)obj);
49 | }
50 |
51 | public override int GetHashCode()
52 | {
53 | return Tag.GetHashCode();
54 | }
55 |
56 | public static bool operator ==(BrCosmeticV2VariantOption left, BrCosmeticV2VariantOption right)
57 | {
58 | return Equals(left, right);
59 | }
60 |
61 | public static bool operator !=(BrCosmeticV2VariantOption left, BrCosmeticV2VariantOption right)
62 | {
63 | return !Equals(left, right);
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrMaterialInstanceV2.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 |
5 | using I = Newtonsoft.Json.JsonIgnoreAttribute;
6 | using J = Newtonsoft.Json.JsonPropertyAttribute;
7 |
8 | namespace Fortnite_API.Objects.V2
9 | {
10 | [DebuggerDisplay("{" + nameof(Id) + "}")]
11 | public class BrMaterialInstanceV2 : IEquatable
12 | {
13 | [J] public string Id { get; private set; }
14 | [J] public Dictionary Images { get; private set; }
15 | [J] public Dictionary Colors { get; private set; }
16 | [J] public Dictionary Scalings { get; private set; }
17 | [J] public Dictionary Flags { get; private set; }
18 |
19 | [I] public bool HasImages => Images != null && Images.Count != 0;
20 | [I] public bool HasColors => Colors != null && Colors.Count != 0;
21 | [I] public bool HasScalings => Scalings != null && Scalings.Count != 0;
22 | [I] public bool HasFlags => Flags != null && Flags.Count != 0;
23 |
24 | public bool Equals(BrMaterialInstanceV2 other)
25 | {
26 | if (ReferenceEquals(null, other))
27 | {
28 | return false;
29 | }
30 |
31 | if (ReferenceEquals(this, other))
32 | {
33 | return true;
34 | }
35 |
36 | return Id == other.Id && Equals(Images, other.Images) && Equals(Colors, other.Colors) && Equals(Scalings, other.Scalings);
37 | }
38 |
39 | public override bool Equals(object obj)
40 | {
41 | if (ReferenceEquals(null, obj))
42 | {
43 | return false;
44 | }
45 |
46 | if (ReferenceEquals(this, obj))
47 | {
48 | return true;
49 | }
50 |
51 | if (obj.GetType() != GetType())
52 | {
53 | return false;
54 | }
55 |
56 | return Equals((BrMaterialInstanceV2)obj);
57 | }
58 |
59 | public override int GetHashCode()
60 | {
61 | unchecked
62 | {
63 | var hashCode = Id != null ? Id.GetHashCode() : 0;
64 | hashCode = hashCode * 397 ^ (Images != null ? Images.GetHashCode() : 0);
65 | hashCode = hashCode * 397 ^ (Colors != null ? Colors.GetHashCode() : 0);
66 | hashCode = hashCode * 397 ^ (Scalings != null ? Scalings.GetHashCode() : 0);
67 | return hashCode;
68 | }
69 | }
70 |
71 | public static bool operator ==(BrMaterialInstanceV2 left, BrMaterialInstanceV2 right)
72 | {
73 | return Equals(left, right);
74 | }
75 |
76 | public static bool operator !=(BrMaterialInstanceV2 left, BrMaterialInstanceV2 right)
77 | {
78 | return !Equals(left, right);
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrMaterialInstanceV2Color.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | using System;
4 | using System.Globalization;
5 | using System.Runtime.InteropServices;
6 |
7 | namespace Fortnite_API.Objects.V2
8 | {
9 | [StructLayout(LayoutKind.Sequential, Pack = 1, Size = 4)]
10 | [JsonConverter(typeof(BrMaterialInstanceV2ColorConverter))]
11 | public readonly struct BrMaterialInstanceV2Color
12 | {
13 | public byte R { get; }
14 | public byte G { get; }
15 | public byte B { get; }
16 | public byte A { get; }
17 |
18 | internal BrMaterialInstanceV2Color(byte r, byte g, byte b, byte a)
19 | {
20 | R = r;
21 | G = g;
22 | B = b;
23 | A = a;
24 | }
25 |
26 | public override string ToString()
27 | {
28 | return $"{R:x2}{G:x2}{B:x2}{A:x2}";
29 | }
30 | }
31 |
32 | internal class BrMaterialInstanceV2ColorConverter : JsonConverter
33 | {
34 | public override void WriteJson(JsonWriter writer, BrMaterialInstanceV2Color value, JsonSerializer serializer)
35 | {
36 | writer.WriteValue(value.ToString());
37 | }
38 |
39 | public override BrMaterialInstanceV2Color ReadJson(JsonReader reader, Type objectType, BrMaterialInstanceV2Color existingValue, bool hasExistingValue, JsonSerializer serializer)
40 | {
41 | if (reader.TokenType != JsonToken.String)
42 | {
43 | return existingValue;
44 | }
45 |
46 | var value = (string)reader.Value;
47 |
48 | if (string.IsNullOrEmpty(value))
49 | {
50 | return existingValue;
51 | }
52 |
53 | var r = byte.Parse(value.Substring(0, 2), NumberStyles.HexNumber);
54 | var g = byte.Parse(value.Substring(2, 2), NumberStyles.HexNumber);
55 | var b = byte.Parse(value.Substring(4, 2), NumberStyles.HexNumber);
56 | var a = byte.Parse(value.Substring(6, 2), NumberStyles.HexNumber);
57 | return new BrMaterialInstanceV2Color(r, g, b, a);
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/src/Fortnite-API/Objects/V2/BrNewCosmeticsV2.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 |
5 | using J = Newtonsoft.Json.JsonPropertyAttribute;
6 |
7 | namespace Fortnite_API.Objects.V2
8 | {
9 | [DebuggerDisplay("{" + nameof(Hash) + "}")]
10 | public class BrNewCosmeticsV2 : IEquatable