@@ -25,9 +25,38 @@ export const findProgressByIds = async (ids: number[], userId: number): Promise<
2525}
2626
2727
28+ /**
29+ * Find puzzle informations and player's completion from a "pretty ID" which is a string, found in the URL of the puzzle.
30+ *
31+ * ## Requires to log in before.
32+ *
33+ * @param {string } puzzlePrettyId - Puzzle's "pretty ID", found in its URL.
34+ * @param {number } userId - User ID you want to retrieve the completion
35+ */
36+
37+ export const findProgressByPrettyId = async ( puzzlePrettyId : string , userId : number ) : Promise < IPuzzlePrettyProgress > => {
38+
39+ const cookies : string = getCookies ( )
40+
41+ const response = await axios ( {
42+ url : urls . puzzle + "findProgressByPrettyId" ,
43+ method : "post" ,
44+ headers : {
45+ "content-type" : "application/json;charset=UTF-8" ,
46+ "cookie" : cookies
47+ } ,
48+ data : [ puzzlePrettyId , userId ]
49+ } )
50+
51+ return response [ "data" ]
52+ }
53+
54+
2855/**
2956 * Find every minimal puzzle progress from a user. You can also use this to get every puzzles of CodinGame
3057 *
58+ * ## Requires to log in before.
59+ *
3160 * @param {number } userId - User ID you want to retrieve the completion
3261 *
3362 */
@@ -91,6 +120,67 @@ type topics = {
91120 children : topics [ ] | [ ]
92121}
93122
123+ export interface IPuzzlePrettyProgress {
124+ id : number
125+ level : string
126+ rank : number
127+ thumbnailBinaryId : number
128+ previewBinaryId : number
129+ coverBinaryId : number
130+ logoBinaryId : number
131+ title : string
132+ titlemap : {
133+ "1" : string ,
134+ "2" : string
135+ }
136+ description : string
137+ statement : string
138+ validatorScore : number
139+ achievementCount : number
140+ doneAchievementCount : number
141+ linkedAchievements : linkedAchievement [ ]
142+ forumLink : string
143+ solvedCount : number
144+ attemptCount : number
145+ xpPoints : number
146+ feedback : feedbackPuzzle
147+ topics : topics [ ]
148+ creationTime : number
149+ type : string
150+ prettyId : string
151+ detailsPageUrl : string
152+ replayIds : number [ ]
153+ contentDetails : puzzleDetails
154+ communityCreation : boolean
155+ }
156+
157+ type linkedAchievement = {
158+ id : string
159+ puzzleId : number
160+ title : string
161+ description : string
162+ points : number
163+ progress : number
164+ progressMax : number
165+ completionTime : number
166+ imageBinaryId : number
167+ level : string
168+ weight : number
169+ }
170+
171+ type puzzleDetails = {
172+ description : string
173+ learnDescription : string
174+ story : string
175+ externalResources : externalResource [ ]
176+ }
177+
178+ type externalResource = {
179+ publicId : string
180+ url : string
181+ name : string
182+ }
183+
94184export interface IPuzzleMinimalProgress {
95185 id : number
96186 level : string
0 commit comments