Skip to content

Commit a2b65d5

Browse files
committed
use enums for option tier/type
1 parent 30a3ae4 commit a2b65d5

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

Luraph.NET/Types.cs

+15-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66

77
namespace Luraph.APITypes
88
{
9+
[JsonConverter(typeof(JsonStringEnumConverter))]
10+
public enum LuraphOptionTier
11+
{
12+
CUSTOMER_ONLY, PREMIUM_ONLY, ADMIN_ONLY
13+
}
14+
15+
[JsonConverter(typeof(JsonStringEnumConverter))]
16+
public enum LuraphOptionType
17+
{
18+
CHECKBOX, DROPDOWN, TEXT
19+
}
20+
921
public readonly struct LuraphOption
1022
{
1123
[JsonPropertyName("name")]
@@ -15,10 +27,10 @@ public readonly struct LuraphOption
1527
public readonly string Description;
1628

1729
[JsonPropertyName("tier")]
18-
public readonly string Tier;
30+
public readonly LuraphOptionTier Tier;
1931

2032
[JsonPropertyName("type")]
21-
public readonly string Type;
33+
public readonly LuraphOptionType Type;
2234

2335
[JsonPropertyName("required")]
2436
public readonly bool Required;
@@ -30,7 +42,7 @@ public readonly struct LuraphOption
3042
public readonly Dictionary<string, object[]>? Dependencies;
3143

3244
[JsonConstructor]
33-
public LuraphOption(string name, string description, string tier, string type, string[] choices) => (Name, Description, Tier, Type, Choices) = (name, description, tier, type, choices);
45+
public LuraphOption(string name, string description, LuraphOptionTier tier, LuraphOptionType type, string[] choices) => (Name, Description, Tier, Type, Choices) = (name, description, tier, type, choices);
3446
}
3547

3648
public readonly struct LuraphNode

README.md

+24-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Returns: [*NodesResponse*](#struct-nodesresponse)
5858

5959
---
6060

61-
#### CreateNewJob(string node, string script, string fileName, Dictionary<string, object> options, bool useTokens = false, bool enforceSettings = false)
61+
#### CreateNewJob(string node, string script, string fileName, Dictionary&lt;string, object&gt; options, bool useTokens = false, bool enforceSettings = false)
6262

6363
Description: Queues a new obfuscation task.
6464

@@ -101,11 +101,11 @@ Returns: [*ObfuscateDownloadResponse*](#struct-obfuscatedownloadresponse)
101101
Fields:
102102
- string **Name** - The human readable name associated with an option.
103103
- string **Description** - The markdown formatted description for an option.
104-
- **Tier** - One of `CUSTOMER_ONLY`, `PREMIUM_ONLY`, `ADMIN_ONLY`.
105-
- **Type** - One of `CHECKBOX`, `DROPDOWN`, `TEXT`.
104+
- [*LuraphOptionTier*](#enum-luraphoptiontier) **Tier** - Required tier to access the option.
105+
- [*LuraphOptionType*](#enum-luraphoptiontype) **Type** - The type of input requested for the option.
106106
- bool **Required** - If creating a user interface to integrate with Luraph, settings that contain a value of `true` for this field should be explicitly set by the user, since they have a high chance of causing incorrect output when not set properly.
107107
- string[] **Choices** - An array of acceptable option values when `type == DROPDOWN`.
108-
- Dictionary<string, object[]>? **dependencies** - An array of required prerequisite values before this setting can be changed from the default value.
108+
- Dictionary&lt;string, object[]&gt;? **dependencies** - An array of required prerequisite values before this setting can be changed from the default value.
109109

110110
---
111111

@@ -163,6 +163,26 @@ Fields:
163163
- **Errors** - An array of [*LuraphError*](#struct-lurapherror).
164164
- **Message** - A human readable collection of error messages returned by a request.
165165

166+
---
167+
168+
### enum LuraphOptionTier
169+
170+
Values:
171+
- **CUSTOMER_ONLY** - All customers can access this option.
172+
- **PREMIUM_ONLY** - Only customers on a plan with premium features can access this option.
173+
- **ADMIN_ONLY** - Only administrators can access this option.
174+
175+
---
176+
177+
### enum LuraphOptionType
178+
179+
Values:
180+
- **CHECKBOX** - Expects a boolean value.
181+
- **DROPDOWN** - Expects a value contained in the option choices.
182+
- **TEXT** - Expects any textual imput.
183+
184+
---
185+
166186
## Useful Links
167187
- [Visit the Luraph Website](https://lura.ph/ "Luraph - Online Lua Obfuscation")
168188
- [Join the Luraph Discord](https://discord.lura.ph/ "Luraph Discord Server")

0 commit comments

Comments
 (0)