mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-07-26 23:40:57 +00:00
Compare commits
3 commits
c12cbbd100
...
4662d7efbe
Author | SHA1 | Date | |
---|---|---|---|
|
4662d7efbe | ||
|
7824d15d26 | ||
|
b20a4a4a58 |
28
api/login.go
28
api/login.go
|
@ -1,6 +1,9 @@
|
||||||
package api
|
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 (
|
var (
|
||||||
EndpointAuth = Endpoint + "auth/"
|
EndpointAuth = Endpoint + "auth/"
|
||||||
|
@ -8,13 +11,26 @@ var (
|
||||||
EndpointTOTP = EndpointAuth + "mfa/totp"
|
EndpointTOTP = EndpointAuth + "mfa/totp"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LoginResponse struct {
|
type (
|
||||||
MFA bool `json:"mfa"`
|
LoginSettings struct {
|
||||||
SMS bool `json:"sms"`
|
Locale discord.Language `json:"locale"`
|
||||||
Ticket string `json:"ticket"`
|
Theme string `json:"theme"`
|
||||||
Token string `json:"token"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// login is the user's email or E.164-formatted phone number
|
||||||
func (c *Client) Login(login, password string) (*LoginResponse, error) {
|
func (c *Client) Login(login, password string) (*LoginResponse, error) {
|
||||||
var param struct {
|
var param struct {
|
||||||
|
|
5
go.mod
5
go.mod
|
@ -1,12 +1,13 @@
|
||||||
module github.com/diamondburned/arikawa/v3
|
module github.com/diamondburned/arikawa/v3
|
||||||
|
|
||||||
go 1.23
|
go 1.23
|
||||||
|
toolchain go1.24.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gorilla/schema v1.4.1
|
github.com/gorilla/schema v1.4.1
|
||||||
github.com/gorilla/websocket v1.5.3
|
github.com/gorilla/websocket v1.5.3
|
||||||
golang.org/x/crypto v0.32.0
|
golang.org/x/crypto v0.35.0
|
||||||
golang.org/x/time v0.10.0
|
golang.org/x/time v0.10.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require golang.org/x/sys v0.29.0 // indirect
|
require golang.org/x/sys v0.30.0 // indirect
|
||||||
|
|
8
go.sum
8
go.sum
|
@ -2,9 +2,9 @@ github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E=
|
||||||
github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
|
github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
|
||||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
|
||||||
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
|
||||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4=
|
golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4=
|
||||||
golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||||
|
|
Loading…
Reference in a new issue