summary refs log tree commit diff
path: root/extra/admin-api/Models/Spacebar.Models.Api/LoginRequest.cs
blob: 6971d55e2b79eebfb31a744df83ad1eb4048aff5 (plain) (blame)
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
using System.Text.Json.Serialization;

namespace Spacebar.Models.Api;

public class LoginRequest {
    [JsonPropertyName("login")]
    public required string Login { get; set; }
    
    [JsonPropertyName("password")]
    public required string Password { get; set; }
    
    /// <summary>
    /// Whether to un-delete a self-disabled or self-deleted account
    /// </summary>
    [JsonPropertyName("undelete")]
    public bool? Undelete { get; set; }
    
    /// <summary>
    /// One of gift, guild_template, guild_invite, dm_invite, friend_invite, role_subscription or role_subscription_setting
    /// </summary>
    [JsonPropertyName("login_source")]
    public string? LoginSource { get; set; }
    
    [JsonPropertyName("gift_code_sku_id")]
    public string? GiftCodeSkuId { get; set; }
}

/// <summary>
/// Note: nullable fields missing "if the login was not completed"
/// </summary>
public class LoginResponse {
    [JsonPropertyName("user_id"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
    public ulong UserId { get; set; }
    
    [JsonPropertyName("token")]
    public string? Token { get; set; }
    
    [JsonPropertyName("user_settings")]
    public LoginUserSettings? UserSettings { get; set; }
    
    /// <summary>
    /// Values: update_password
    /// </summary>
    [JsonPropertyName("required_actions")]
    public List<string>? RequiredActions { get; set; }
    
    /// <summary>
    /// MFA ticket
    /// </summary>
    [JsonPropertyName("ticket")]
    public string? Ticket { get; set; }
    
    [JsonPropertyName("login_instance_id")]
    public string? LoginInstanceId { get; set; }
    
    [JsonPropertyName("mfa")]
    public bool? Mfa { get; set; }
    
    [JsonPropertyName("totp")]
    public bool? Totp { get; set; }
    
    [JsonPropertyName("sms")]
    public bool? Sms { get; set; }
    
    [JsonPropertyName("backup")]
    public bool? Backup { get; set; }
    
    [JsonPropertyName("webauthn")]
    public string? Webauthn { get; set; }
    

    public class LoginUserSettings {
        [JsonPropertyName("locale")]
        public string Locale { get; set; }
        
        [JsonPropertyName("theme")]
        public string Theme { get; set; }
    }
}