Renamed RequestToken to Login

This commit is contained in:
Bruce Marriner 2015-11-03 08:51:21 -06:00
parent 66da5a3ae4
commit 302f4976a9
3 changed files with 4 additions and 4 deletions

View file

@ -20,7 +20,7 @@ import (
) )
// RequestToken asks the Discord server for an authentication token // 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") 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)))) req, err := http.NewRequest("POST", urlStr, bytes.NewBuffer([]byte(fmt.Sprintf(`{"email":"%s", "password":"%s"}`, email, password))))

View file

@ -34,7 +34,7 @@ func New(email string, password string) (d *Discord, err error) {
session := Session{} session := Session{}
session.Token, err = session.RequestToken(email, password) session.Token, err = session.Login(email, password)
if err != nil { if err != nil {
return return
} }

View file

@ -17,8 +17,8 @@ type Session struct {
* The below functions are "shortcut" methods for functions in client.go * The below functions are "shortcut" methods for functions in client.go
* Reference the client.go file for more documentation. * Reference the client.go file for more documentation.
*/ */
func (session *Session) RequestToken(email string, password string) (token string, err error) { func (session *Session) Login(email string, password string) (token string, err error) {
token, err = RequestToken(session, email, password) token, err = Login(session, email, password)
return return
} }