-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add GetUser & Me REST mappings
- Loading branch information
Karitham
committed
Jan 4, 2022
1 parent
6bcddeb
commit f9e70f6
Showing
4 changed files
with
27 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package corde | ||
|
||
import ( | ||
"github.com/Karitham/corde/internal/rest" | ||
) | ||
|
||
// Me returns the current user | ||
func (m *Mux) Me() (User, error) { | ||
var user User | ||
_, err := rest.DoJson(m.Client, rest.Req("/users/@me").Get(m.authorize), &user) | ||
return user, err | ||
} | ||
|
||
// GetUser returns a user by id | ||
func (m *Mux) GetUser(id Snowflake) (User, error) { | ||
var user User | ||
_, err := rest.DoJson(m.Client, rest.Req("/users/", id).Get(m.authorize), &user) | ||
return user, err | ||
} |