nitai/projects
rblxtool / src / ui / RblxTool / Models / JsonContext.cs
159 lines · 4.4 KB Raw
1using System.Text.Json;
2using System.Text.Json.Serialization;
3
4namespace RblxTool.Models;
5
6[JsonSourceGenerationOptions(
7 GenerationMode = JsonSourceGenerationMode.Default,
8 PropertyNameCaseInsensitive = true,
9 DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
10[JsonSerializable(typeof(Envelope<List<AccountSummary>>))]
11[JsonSerializable(typeof(Envelope<AccountSummary>))]
12[JsonSerializable(typeof(Envelope<AccountOverview>))]
13[JsonSerializable(typeof(Envelope<EngineMetrics>))]
14[JsonSerializable(typeof(Envelope<SweepReport>))]
15[JsonSerializable(typeof(Envelope<HuntReport>))]
16[JsonSerializable(typeof(Envelope<JsonElement>))]
17[JsonSerializable(typeof(JobPoll))]
18[JsonSerializable(typeof(JobEvent))]
19[JsonSerializable(typeof(LoginResult))]
20[JsonSerializable(typeof(OauthUrlResult))]
21[JsonSerializable(typeof(SweepRequest))]
22[JsonSerializable(typeof(SnipeRequest))]
23[JsonSerializable(typeof(HuntRequest))]
24[JsonSerializable(typeof(OauthRequest))]
25public sealed partial class ToolJsonContext : JsonSerializerContext
26{
27}
28
29public sealed class SweepRequest
30{
31 [JsonPropertyName("maxPrice")]
32 public ulong MaxPrice { get; set; }
33
34 [JsonPropertyName("buy")]
35 public bool Buy { get; set; } = true;
36
37 [JsonPropertyName("dryRun")]
38 public bool DryRun { get; set; }
39
40 [JsonPropertyName("skipOwned")]
41 public bool SkipOwned { get; set; } = true;
42
43 [JsonPropertyName("pages")]
44 public int Pages { get; set; } = 64;
45
46 [JsonPropertyName("scanThreads")]
47 public int ScanThreads { get; set; } = 8;
48
49 [JsonPropertyName("detailThreads")]
50 public int DetailThreads { get; set; } = 6;
51
52 [JsonPropertyName("buyThreads")]
53 public int BuyThreads { get; set; } = 3;
54
55 [JsonPropertyName("limit")]
56 public int Limit { get; set; }
57
58 [JsonPropertyName("includeCollectibles")]
59 public bool IncludeCollectibles { get; set; } = true;
60
61 [JsonPropertyName("categories")]
62 public List<CategoryStream>? Categories { get; set; }
63}
64
65public sealed class CategoryStream
66{
67 [JsonPropertyName("category")]
68 public string Category { get; set; } = string.Empty;
69
70 [JsonPropertyName("subcategory")]
71 public string? Subcategory { get; set; }
72}
73
74public sealed class SnipeRequest
75{
76 [JsonPropertyName("targets")]
77 public List<SnipeTargetRequest> Targets { get; set; } = new();
78
79 [JsonPropertyName("intervalMs")]
80 public ulong IntervalMs { get; set; } = 750;
81
82 [JsonPropertyName("threads")]
83 public int Threads { get; set; } = 6;
84
85 [JsonPropertyName("buy")]
86 public bool Buy { get; set; } = true;
87
88 [JsonPropertyName("dryRun")]
89 public bool DryRun { get; set; }
90
91 [JsonPropertyName("limit")]
92 public int Limit { get; set; }
93
94 [JsonPropertyName("watchReleases")]
95 public bool WatchReleases { get; set; }
96
97 [JsonPropertyName("releaseMaxPrice")]
98 public ulong ReleaseMaxPrice { get; set; }
99
100 [JsonPropertyName("releaseIntervalMs")]
101 public ulong ReleaseIntervalMs { get; set; } = 2000;
102}
103
104public sealed class SnipeTargetRequest
105{
106 [JsonPropertyName("assetId")]
107 public ulong AssetId { get; set; }
108
109 [JsonPropertyName("collectibleItemId")]
110 public string? CollectibleItemId { get; set; }
111
112 [JsonPropertyName("maxPrice")]
113 public ulong MaxPrice { get; set; }
114
115 [JsonPropertyName("underRap")]
116 public double? UnderRap { get; set; }
117}
118
119public sealed class HuntRequest
120{
121 [JsonPropertyName("start")]
122 public ulong Start { get; set; } = 1;
123
124 [JsonPropertyName("end")]
125 public ulong End { get; set; } = 200000;
126
127 [JsonPropertyName("threads")]
128 public int Threads { get; set; } = 12;
129
130 [JsonPropertyName("minMembers")]
131 public ulong MinMembers { get; set; } = 1;
132
133 [JsonPropertyName("requirePublicEntry")]
134 public bool RequirePublicEntry { get; set; } = true;
135
136 [JsonPropertyName("enrich")]
137 public bool Enrich { get; set; } = true;
138
139 [JsonPropertyName("claim")]
140 public bool Claim { get; set; }
141
142 [JsonPropertyName("limit")]
143 public int Limit { get; set; }
144}
145
146public sealed class OauthRequest
147{
148 [JsonPropertyName("clientId")]
149 public string ClientId { get; set; } = string.Empty;
150
151 [JsonPropertyName("clientSecret")]
152 public string? ClientSecret { get; set; }
153
154 [JsonPropertyName("redirectUri")]
155 public string RedirectUri { get; set; } = "http://localhost:8790/callback";
156
157 [JsonPropertyName("scopes")]
158 public string Scopes { get; set; } = "openid profile";
159}