Skip to content

Commit

Permalink
use inner response types 1/1
Browse files Browse the repository at this point in the history
  • Loading branch information
natural committed Nov 26, 2023
1 parent 7e05c0a commit 28ce5b6
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 52 deletions.
10 changes: 3 additions & 7 deletions example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {
client, _ := vements.NewClient(API_KEY, []string{"production"}, vements.NewConfig())
id := rand.Intn(1000)

participantCreateResponse, _ := client.Participant.Create(
participant, _ := client.Participant.Create(
vements.ParticipantCreateRequest{
ProjectId: PROJECT_ID,
Display: fmt.Sprintf("Example Player %v", id),
Expand All @@ -28,9 +28,7 @@ func main() {
},
)

participant := participantCreateResponse.InsertParticipantOne

fmt.Printf("Participant Created: %+v\n", participantCreateResponse)
fmt.Printf("Participant Created: %+v\n", participant)

for i := 0; i < 5; i++ {
_, _ = client.Scoreboard.Record(
Expand All @@ -43,9 +41,7 @@ func main() {
)
}

scoresResponse, _ := client.Scoreboard.Scores(SCOREBOARD_ID, time.Now().Add(time.Hour*-24), time.Now())
scores := scoresResponse.ScoreboardScores

scores, _ := client.Scoreboard.Scores(SCOREBOARD_ID, time.Now().Add(time.Hour*-24), time.Now())
for _, score := range scores {
fmt.Printf("Rank: %v Player: %v Total: %v\n", score.Rank, score.Participant.Display, score.Total)
}
Expand Down
Loading

0 comments on commit 28ce5b6

Please sign in to comment.