mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-07-25 06:20:56 +00:00
Compare commits
3 commits
f6530da149
...
a23250d396
Author | SHA1 | Date | |
---|---|---|---|
|
a23250d396 | ||
|
7824d15d26 | ||
|
84bf8d4dbf |
30
api/login.go
30
api/login.go
|
@ -1,6 +1,9 @@
|
|||
package api
|
||||
|
||||
import "github.com/diamondburned/arikawa/v3/utils/httputil"
|
||||
import (
|
||||
"github.com/diamondburned/arikawa/v3/discord"
|
||||
"github.com/diamondburned/arikawa/v3/utils/httputil"
|
||||
)
|
||||
|
||||
var (
|
||||
EndpointAuth = Endpoint + "auth/"
|
||||
|
@ -8,12 +11,25 @@ var (
|
|||
EndpointTOTP = EndpointAuth + "mfa/totp"
|
||||
)
|
||||
|
||||
type LoginResponse struct {
|
||||
MFA bool `json:"mfa"`
|
||||
SMS bool `json:"sms"`
|
||||
Ticket string `json:"ticket"`
|
||||
Token string `json:"token"`
|
||||
}
|
||||
type (
|
||||
LoginSettings struct {
|
||||
Locale discord.Language `json:"locale"`
|
||||
Theme string `json:"theme"`
|
||||
}
|
||||
|
||||
LoginResponse struct {
|
||||
UserID discord.UserID `json:"user_id"`
|
||||
Token string `json:"token"`
|
||||
UserSettings LoginSettings `json:"user_settings"`
|
||||
RequiredActions []string `json:"required_actions"`
|
||||
|
||||
Ticket string `json:"ticket"`
|
||||
MFA bool `json:"mfa"`
|
||||
TOTP bool `json:"totp"`
|
||||
SMS bool `json:"sms"`
|
||||
Backup bool `json:"backup"`
|
||||
}
|
||||
)
|
||||
|
||||
// login is the user's email or E.164-formatted phone number
|
||||
func (c *Client) Login(login, password string) (*LoginResponse, error) {
|
||||
|
|
|
@ -817,7 +817,6 @@ type (
|
|||
Locale string `json:"locale"`
|
||||
Theme string `json:"theme"`
|
||||
|
||||
GuildPositions []discord.GuildID `json:"guild_positions"`
|
||||
GuildFolders []GuildFolder `json:"guild_folders"`
|
||||
RestrictedGuilds []discord.GuildID `json:"restricted_guilds"`
|
||||
|
||||
|
@ -901,7 +900,7 @@ const (
|
|||
type GuildFolderID int64
|
||||
|
||||
func (g *GuildFolderID) UnmarshalJSON(b []byte) error {
|
||||
var body = string(b)
|
||||
body := string(b)
|
||||
if body == "null" {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue