-
Notifications
You must be signed in to change notification settings - Fork 0
/
event.go
27 lines (24 loc) · 819 Bytes
/
event.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package retroachievements
import (
"fmt"
"net/http"
raHttp "github.com/joshraphael/go-retroachievements/http"
"github.com/joshraphael/go-retroachievements/models"
)
// GetAchievementOfTheWeek gets comprehensive metadata about the current Achievement of the Week.
func (c *Client) GetAchievementOfTheWeek(params models.GetAchievementOfTheWeekParameters) (*models.GetAchievementOfTheWeek, error) {
r, err := c.do(
raHttp.Method(http.MethodGet),
raHttp.UserAgent(c.UserAgent),
raHttp.Path("/API/API_GetAchievementOfTheWeek.php"),
raHttp.APIToken(c.Secret),
)
if err != nil {
return nil, fmt.Errorf("calling endpoint: %w", err)
}
resp, err := raHttp.ResponseObject[models.GetAchievementOfTheWeek](r)
if err != nil {
return nil, fmt.Errorf("parsing response object: %w", err)
}
return resp, nil
}