Skip to content

Commit

Permalink
update readme and doc comments for each endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
joshraphael committed Aug 16, 2024
1 parent ad2875c commit 05dddfd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,19 @@ you can now use the client to call any of the available endpoints, for example:
profile, err := client.GetUserProfile("jamiras")
```

Check out the [examples](examples/) directory for how to call each endpoint, as well as our GoDocs (TBD)
Check out the [examples](examples/) directory for how to call each endpoint, as well as our GoDocs (TBD)

## API
Click the function names to open their complete docs on the docs site.

<h3>User</h3>

* [`GetUserProfile()`](https://api-docs.retroachievements.org/v1/get-user-profile.html) - Get a user's basic profile information.
* [`GetUserRecentAchievements()`](https://api-docs.retroachievements.org/v1/get-user-recent-achievements.html) - Get a list of achievements recently earned by the user.
* [`GetAchievementsEarnedBetween()`](https://api-docs.retroachievements.org/v1/get-achievements-earned-between.html) - Get a list of achievements earned by a user between two dates.
* [`GetAchievementsEarnedOnDay()`](https://api-docs.retroachievements.org/v1/get-achievements-earned-on-day.html) - Get a list of achievements earned by a user on a given date.

<h3>Game</h3>

* [`GetGame()`](https://api-docs.retroachievements.org/v1/get-game.html) - Get basic metadata about a game.
* [`GetGameExtended()`](https://api-docs.retroachievements.org/v1/get-game-extended.html) - Get extended metadata about a game.
4 changes: 2 additions & 2 deletions game.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/joshraphael/go-retroachievements/models"
)

// GetGame gets info of a game
// GetGame get basic metadata about a game.
func (c *Client) GetGame(id int) (*models.GameInfo, error) {
resp, err := c.do(
raHttp.Method(http.MethodGet),
Expand All @@ -26,7 +26,7 @@ func (c *Client) GetGame(id int) (*models.GameInfo, error) {
return game, nil
}

// GetGameExtended gets extended info of a game
// GetGameExtended get extended metadata about a game.
func (c *Client) GetGameExtended(id int) (*models.ExtentedGameInfo, error) {
resp, err := c.do(
raHttp.Method(http.MethodGet),
Expand Down
8 changes: 4 additions & 4 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/joshraphael/go-retroachievements/models"
)

// GetUserProfile gets the profile of a given username
// GetUserProfile get a user's basic profile information.
func (c *Client) GetUserProfile(username string) (*models.Profile, error) {
resp, err := c.do(
raHttp.Method(http.MethodGet),
Expand All @@ -27,7 +27,7 @@ func (c *Client) GetUserProfile(username string) (*models.Profile, error) {
return profile, nil
}

// GetUserRecentAchievements gets all achievements within the last specified amount of minutes for a given username
// GetUserRecentAchievements get a list of achievements recently earned by the user.
func (c *Client) GetUserRecentAchievements(username string, lookbackMinutes int) ([]models.UnlockedAchievement, error) {
resp, err := c.do(
raHttp.Method(http.MethodGet),
Expand All @@ -46,7 +46,7 @@ func (c *Client) GetUserRecentAchievements(username string, lookbackMinutes int)
return achievements, nil
}

// GetAchievementsEarnedBetween gets all achievements earned within a time frame for a given username
// GetAchievementsEarnedBetween get a list of achievements earned by a user between two dates.
func (c *Client) GetAchievementsEarnedBetween(username string, from time.Time, to time.Time) ([]models.UnlockedAchievement, error) {
resp, err := c.do(
raHttp.Method(http.MethodGet),
Expand All @@ -66,7 +66,7 @@ func (c *Client) GetAchievementsEarnedBetween(username string, from time.Time, t
return achievements, nil
}

// GetAchievementsEarnedOnDay gets all achievements earned on a specific day for a given username
// GetAchievementsEarnedOnDay get a list of achievements earned by a user on a given date.
func (c *Client) GetAchievementsEarnedOnDay(username string, date time.Time) ([]models.UnlockedAchievement, error) {
resp, err := c.do(
raHttp.Method(http.MethodGet),
Expand Down

0 comments on commit 05dddfd

Please sign in to comment.