Skip to content

Commit

Permalink
feat: use method constants for requests
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Gleich <[email protected]>
  • Loading branch information
gleich committed Jan 7, 2025
1 parent 7c13ac6 commit fb83f1a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/apis/applemusic/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func sendAppleMusicAPIRequest[T any](path string) (T, error) {
var zeroValue T
req, err := http.NewRequest(
"GET",
http.MethodGet,
fmt.Sprintf("https://api.music.apple.com/%s", strings.TrimLeft(path, "/")),
nil,
)
Expand Down
2 changes: 1 addition & 1 deletion internal/apis/steam/achievements.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func fetchGameAchievements(appID int32) (*float32, *[]achievement, error) {
"format": {"json"},
}
req, err := http.NewRequest(
"GET",
http.MethodGet,
"https://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2?"+params.Encode(),
nil,
)
Expand Down
2 changes: 1 addition & 1 deletion internal/apis/steam/games.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func fetchRecentlyPlayedGames() ([]game, error) {
"include_appinfo": {"true"},
"format": {"json"},
}
req, err := http.NewRequest("GET",
req, err := http.NewRequest(http.MethodGet,
"https://api.steampowered.com/IPlayerService/GetOwnedGames/v1?"+params.Encode(), nil,
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/apis/strava/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func sendStravaAPIRequest[T any](path string, tokens tokens) (T, error) {
var zeroValue T

req, err := http.NewRequest(
"GET",
http.MethodGet,
fmt.Sprintf("https://www.strava.com/%s", strings.TrimLeft(path, "/")),
nil,
)
Expand Down
6 changes: 5 additions & 1 deletion internal/apis/strava/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ func (t *tokens) refreshIfNeeded() {
"refresh_token": {t.Refresh},
"code": {secrets.SECRETS.StravaOAuthCode},
}
req, err := http.NewRequest("POST", "https://www.strava.com/oauth/token?"+params.Encode(), nil)
req, err := http.NewRequest(
http.MethodPost,
"https://www.strava.com/oauth/token?"+params.Encode(),
nil,
)
if err != nil {
lumber.Error(err, "creating request for new token failed")
return
Expand Down

0 comments on commit fb83f1a

Please sign in to comment.