Renamed RequestToken to Login
This commit is contained in:
parent
66da5a3ae4
commit
302f4976a9
3 changed files with 4 additions and 4 deletions
|
@ -20,7 +20,7 @@ import (
|
|||
)
|
||||
|
||||
// RequestToken asks the Discord server for an authentication token
|
||||
func RequestToken(session *Session, email string, password string) (token string, err error) {
|
||||
func Login(session *Session, email string, password string) (token string, err error) {
|
||||
|
||||
var urlStr string = fmt.Sprintf("%s/%s", discordApi, "auth/login")
|
||||
req, err := http.NewRequest("POST", urlStr, bytes.NewBuffer([]byte(fmt.Sprintf(`{"email":"%s", "password":"%s"}`, email, password))))
|
||||
|
|
|
@ -34,7 +34,7 @@ func New(email string, password string) (d *Discord, err error) {
|
|||
|
||||
session := Session{}
|
||||
|
||||
session.Token, err = session.RequestToken(email, password)
|
||||
session.Token, err = session.Login(email, password)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ type Session struct {
|
|||
* The below functions are "shortcut" methods for functions in client.go
|
||||
* Reference the client.go file for more documentation.
|
||||
*/
|
||||
func (session *Session) RequestToken(email string, password string) (token string, err error) {
|
||||
token, err = RequestToken(session, email, password)
|
||||
func (session *Session) Login(email string, password string) (token string, err error) {
|
||||
token, err = Login(session, email, password)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue