-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add GetAchievementsEarnedBetween endpoint
- Loading branch information
1 parent
af87a67
commit bf22083
Showing
5 changed files
with
201 additions
and
0 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
33 changes: 33 additions & 0 deletions
33
examples/getachievementsearnedbetween/getachievementsearnedbetween.go
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,33 @@ | ||
// Package getachievementsearnedbetween provides an example for a users achievements between two timestamps | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"time" | ||
|
||
"github.com/joshraphael/go-retroachievements/client" | ||
) | ||
|
||
/* | ||
Test script for getting user profile. Add RA_API_KEY to your env and use `go run getachievementsearnedbetween.go` | ||
*/ | ||
func main() { | ||
host := "https://retroachievements.org" | ||
secret := os.Getenv("RA_API_KEY") | ||
|
||
raClient := client.New(host, secret) | ||
|
||
now, err := time.Parse(time.DateTime, "2024-03-02 17:27:03") | ||
if err != nil { | ||
panic(err) | ||
} | ||
later := now.Add(10 * time.Minute) | ||
|
||
resp, err := raClient.GetAchievementsEarnedBetween("jamiras", now, later) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
fmt.Printf("%+v\n", resp) | ||
} |
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