Skip to content

Fix tests and add authentication token login - #2

Merged
geekgonecrazy merged 4 commits into
RocketChat:masterfrom
miraclesu:fix-test
Jun 7, 2018
Merged

geekgonecrazy merged 4 commits into
RocketChat:masterfrom
miraclesu:fix-test

Conversation

@miraclesu

Copy link
Copy Markdown
Contributor

fixed #1

@CLAassistant

CLAassistant commented Jun 5, 2018 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@geekgonecrazy geekgonecrazy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing!

Comment thread realtime/users.go Outdated
// Auth a user. Using an authentication token to login.
//
// https://rocket.chat/docs/developer-guides/realtime-api/method-calls/login/#using-an-authentication-token
func (c *Client) Auth(token string) (*models.User, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we maybe use a method name here that is more specific? Auth is too generic to be just token login

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about TokenLogin? Or merge token access to Login like this logic

// Login a user.
// token shouldn't be nil, otherwise the password and the email are not allowed to be nil.
//
// https://rocket.chat/docs/developer-guides/realtime-api/method-calls/login/
func (c *Client) Login(credentials *models.UserCredentials) (*models.User, error) {
	if credentials.Token != "" {

	} else {

	}
}

Any other suggestions?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would work even better. Bit more familiar in terms of go libraries and their behaviors 😄

@miraclesu

miraclesu commented Jun 7, 2018 •

Copy link
Copy Markdown
Contributor Author

@geekgonecrazy plz review, thx.
And I make some breaking changes in this PR #3 , any suggestions?

@geekgonecrazy
geekgonecrazy merged commit ac0b9aa into RocketChat:master Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

realtime messages_test fail

3 participants