diff --git a/instruqt/challenge.go b/instruqt/challenge.go index b0668e5..4d60d98 100644 --- a/instruqt/challenge.go +++ b/instruqt/challenge.go @@ -42,6 +42,15 @@ type Challenge struct { } `json:"-"` } +// ChallengeNoTrack represents the data structure for an Instruqt challenge. +type ChallengeNoTrack struct { + Id string `json:"id"` // The unique identifier for the challenge. + Slug string `json:"slug"` // The slug for the challenge, which is a human-readable identifier. + Title string `json:"title"` // The title of the challenge. + Index int `json:"index"` // The index of the challenge in the track. + Status string `json:"status"` // The status of the challenge (e.g., "unlocked", "completed"). +} + // GetChallenge retrieves a challenge from Instruqt using its unique challenge ID. // // Parameters: diff --git a/instruqt/track.go b/instruqt/track.go index e95daab..934bb6f 100644 --- a/instruqt/track.go +++ b/instruqt/track.go @@ -91,11 +91,11 @@ type SandboxTrack struct { TotalCount int Nodes []Review } - Challenges []Challenge // A list of challenges associated with the sandbox track. - Status string // The current status of the sandbox track. - Started time.Time // The timestamp when the sandbox track was started. - Completed time.Time // The timestamp when the sandbox track was completed. - Participant struct { // Information about the participant of the sandbox track. + Challenges []ChallengeNoTrack // A list of challenges associated with the sandbox track. + Status string // The current status of the sandbox track. + Started time.Time // The timestamp when the sandbox track was started. + Completed time.Time // The timestamp when the sandbox track was completed. + Participant struct { // Information about the participant of the sandbox track. Id string } } @@ -117,11 +117,11 @@ type SandboxTrackNoReviews struct { TrackTags []struct { // A list of tags associated with the sandbox track. Value string } - Challenges []Challenge // A list of challenges associated with the sandbox track. - Status string // The current status of the sandbox track. - Started time.Time // The timestamp when the sandbox track was started. - Completed time.Time // The timestamp when the sandbox track was completed. - Participant struct { // Information about the participant of the sandbox track. + Challenges []ChallengeNoTrack // A list of challenges associated with the sandbox track. + Status string // The current status of the sandbox track. + Started time.Time // The timestamp when the sandbox track was started. + Completed time.Time // The timestamp when the sandbox track was completed. + Participant struct { // Information about the participant of the sandbox track. Id string } } @@ -216,7 +216,7 @@ func (c *Client) GetTrackBySlug(trackSlug string) (t Track, err error) { // Returns: // - Challenge: The first unlocked challenge found. // - error: Any error encountered while retrieving the challenge. -func (c *Client) GetTrackUnlockedChallenge(userId string, trackId string) (challenge Challenge, err error) { +func (c *Client) GetTrackUnlockedChallenge(userId string, trackId string) (challenge ChallengeNoTrack, err error) { track, err := c.GetUserTrackById(userId, trackId) if err != nil { return challenge, fmt.Errorf("[instruqt.GetTrackUnlockedChallenge] failed to get user track: %v", err)