This repository has been archived by the owner on Nov 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Yggdrasil.Json.cs
150 lines (113 loc) · 3.73 KB
/
Yggdrasil.Json.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
using System.Collections.Generic;
using Newtonsoft.Json;
namespace ProtocolModern
{
public static partial class Yggdrasil
{
public enum ErrorType
{
ForbiddenOperationException,
IllegalArgumentException,
UnsupportedMediaType
}
#region Response
public struct AvailableProfiles
{
[JsonProperty("id")]
public string ID { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("legacy")]
public bool Legacy { get; set; }
}
public struct SelectedProfile
{
[JsonProperty("id")]
public string ID { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("legacy")]
public bool Legacy { get; set; }
}
public struct Response
{
[JsonProperty("accessToken")]
public string AccessToken { get; set; }
[JsonProperty("clientToken")]
public string ClientToken { get; set; }
[JsonProperty("selectedProfile")]
public SelectedProfile Profile { get; set; }
[JsonProperty("availableProfiles")]
public List<AvailableProfiles> AvailableProfiles { get; set; }
}
public struct Error
{
[JsonProperty("error")]
public ErrorType ErrorDescription { get; set; }
[JsonProperty("errorMessage")]
public string ErrorMessage { get; set; }
[JsonProperty("cause")]
public string Cause { get; set; }
}
public struct YggdrasilAnswer
{
public YggdrasilStatus Status;
public Response Response;
}
#endregion Response
#region Requests
private struct Agent
{
public static Agent Minecraft { get { return new Agent { Name = "Minecraft", Version = 1 }; } }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("version")]
public int Version { get; set; }
}
private struct JsonLogin
{
[JsonProperty("agent")]
public Agent Agent { get; set; }
[JsonProperty("username")]
public string Username { get; set; }
[JsonProperty("password")]
public string Password { get; set; }
}
private struct JsonRefreshSession
{
[JsonProperty("accessToken")]
public string AccessToken { get; set; }
[JsonProperty("clientToken")]
public string ClientToken { get; set; }
}
private struct JsonVerifySession
{
[JsonProperty("accessToken")]
public string AccessToken { get; set; }
}
private struct JsonLogout
{
[JsonProperty("username")]
public string Username { get; set; }
[JsonProperty("password")]
public string Password { get; set; }
}
private struct JsonInvalidate
{
[JsonProperty("accessToken")]
public string AccessToken { get; set; }
[JsonProperty("clientToken")]
public string ClientToken { get; set; }
}
private struct JsonClientAuth
{
[JsonProperty("accessToken")]
public string AccessToken { get; set; }
[JsonProperty("selectedProfile")]
public string SelectedProfile { get; set; }
[JsonProperty("serverId")]
public string ServerID { get; set; }
}
#endregion Requests
}
}