Skip to content

Commit

Permalink
Add more leaderboard endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Kruhlmann committed Apr 8, 2024
1 parent e8e6571 commit 21ae382
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/models/response/community/avatar_stat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ let to_json r =
;;

let from_json json =
let open Yojson.Basic.Util in
{ result = Yojson.Basic.Util.(json |> member "result" |> Stub.Response.from_json)
; avatar_stats_for_profile =
Yojson.Basic.Util.(json |> member "avatarStatsForProfile" |> to_list |> List.map Stub.Avatar_stat.from_json)
json |> member "avatarStatsForProfile" |> to_list |> List.map Stub.Avatar_stat.from_json
}
;;
2 changes: 1 addition & 1 deletion tests/res/GetAvatarStatForProfile.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"result":{"code":0, "message":"SUCCESS"},"avatarStatsForProfile":[{"profile_id":196240,"avatarstat_id":1,"value":2289,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":2,"value":2883,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":3,"value":109,"lastupdated":1701878160},{"profile_id":196240,"avatarstat_id":4,"value":126,"lastupdated":1703620557},{"profile_id":196240,"avatarstat_id":5,"value":83,"lastupdated":1705958489},{"profile_id":196240,"avatarstat_id":6,"value":89,"lastupdated":1710870531},{"profile_id":196240,"avatarstat_id":7,"value":72,"lastupdated":1703094913},{"profile_id":196240,"avatarstat_id":8,"value":93,"lastupdated":1697553305},{"profile_id":196240,"avatarstat_id":9,"value":51,"lastupdated":1707758737},{"profile_id":196240,"avatarstat_id":10,"value":84,"lastupdated":1707835328},{"profile_id":196240,"avatarstat_id":11,"value":101,"lastupdated":1705775048},{"profile_id":196240,"avatarstat_id":12,"value":60,"lastupdated":1707765916},{"profile_id":196240,"avatarstat_id":13,"value":92,"lastupdated":1710450575},{"profile_id":196240,"avatarstat_id":14,"value":118,"lastupdated":1709849955},{"profile_id":196240,"avatarstat_id":15,"value":64,"lastupdated":1707762327},{"profile_id":196240,"avatarstat_id":16,"value":75,"lastupdated":1706560874},{"profile_id":196240,"avatarstat_id":17,"value":78,"lastupdated":1709660727},{"profile_id":196240,"avatarstat_id":18,"value":97,"lastupdated":1712325945},{"profile_id":196240,"avatarstat_id":19,"value":129,"lastupdated":1711125571},{"profile_id":196240,"avatarstat_id":20,"value":80,"lastupdated":1706036817},{"profile_id":196240,"avatarstat_id":21,"value":65,"lastupdated":1697042353},{"profile_id":196240,"avatarstat_id":22,"value":72,"lastupdated":1706628114},{"profile_id":196240,"avatarstat_id":23,"value":59,"lastupdated":1705504077},{"profile_id":196240,"avatarstat_id":24,"value":100,"lastupdated":1712331792},{"profile_id":196240,"avatarstat_id":25,"value":60,"lastupdated":1703180470},{"profile_id":196240,"avatarstat_id":26,"value":79,"lastupdated":1705852544},{"profile_id":196240,"avatarstat_id":27,"value":72,"lastupdated":1706453046},{"profile_id":196240,"avatarstat_id":28,"value":72,"lastupdated":1703014911},{"profile_id":196240,"avatarstat_id":29,"value":83,"lastupdated":1706715589},{"profile_id":196240,"avatarstat_id":30,"value":145,"lastupdated":1709842959},{"profile_id":196240,"avatarstat_id":31,"value":79,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":32,"value":58,"lastupdated":1707306850},{"profile_id":196240,"avatarstat_id":33,"value":67,"lastupdated":1710604928},{"profile_id":196240,"avatarstat_id":34,"value":59,"lastupdated":1710253584},{"profile_id":196240,"avatarstat_id":35,"value":131,"lastupdated":1712329291},{"profile_id":196240,"avatarstat_id":36,"value":110,"lastupdated":1695056009},{"profile_id":196240,"avatarstat_id":37,"value":98,"lastupdated":1707315946},{"profile_id":196240,"avatarstat_id":38,"value":1567,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":39,"value":71867,"lastupdated":1644600017},{"profile_id":196240,"avatarstat_id":40,"value":63196,"lastupdated":1590445116},{"profile_id":196240,"avatarstat_id":41,"value":54056,"lastupdated":1601508247},{"profile_id":196240,"avatarstat_id":42,"value":7716,"lastupdated":1710450575},{"profile_id":196240,"avatarstat_id":43,"value":1950,"lastupdated":1705775048},{"profile_id":196240,"avatarstat_id":44,"value":711061,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":45,"value":603439,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":46,"value":5433,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":47,"value":40818,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":48,"value":29202,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":49,"value":22,"lastupdated":1642699546},{"profile_id":196240,"avatarstat_id":50,"value":8474,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":51,"value":192,"lastupdated":1707759959},{"profile_id":196240,"avatarstat_id":52,"value":1520,"lastupdated":1710868039},{"profile_id":196240,"avatarstat_id":53,"value":8393,"lastupdated":1712333878},{"profile_id":196240,"avatarstat_id":54,"value":21666,"lastupdated":1710872113},{"profile_id":196240,"avatarstat_id":55,"value":272,"lastupdated":1710447248},{"profile_id":196240,"avatarstat_id":56,"value":8206,"lastupdated":1712334674},{"profile_id":196240,"avatarstat_id":57,"value":2748,"lastupdated":1712333878},{"profile_id":196240,"avatarstat_id":59,"value":725,"lastupdated":1712488505},{"profile_id":196240,"avatarstat_id":60,"value":3704,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":61,"value":3492,"lastupdated":1712488505},{"profile_id":196240,"avatarstat_id":63,"value":325,"lastupdated":1705780915},{"profile_id":196240,"avatarstat_id":64,"value":28,"lastupdated":1579635385},{"profile_id":196240,"avatarstat_id":65,"value":11,"lastupdated":1705514456},{"profile_id":196240,"avatarstat_id":69,"value":230,"lastupdated":1710450575},{"profile_id":196240,"avatarstat_id":70,"value":260,"lastupdated":1710450575},{"profile_id":196240,"avatarstat_id":71,"value":129,"lastupdated":1709668668},{"profile_id":196240,"avatarstat_id":72,"value":205,"lastupdated":1710450575},{"profile_id":196240,"avatarstat_id":73,"value":120,"lastupdated":1709842959},{"profile_id":196240,"avatarstat_id":74,"value":128,"lastupdated":1711125571},{"profile_id":196240,"avatarstat_id":75,"value":113,"lastupdated":1706562655},{"profile_id":196240,"avatarstat_id":76,"value":186,"lastupdated":1710608257},{"profile_id":196240,"avatarstat_id":77,"value":155,"lastupdated":1711122168},{"profile_id":196240,"avatarstat_id":78,"value":105,"lastupdated":1707832845},{"profile_id":196240,"avatarstat_id":79,"value":146,"lastupdated":1710608257},{"profile_id":196240,"avatarstat_id":80,"value":229,"lastupdated":1710604928},{"profile_id":196240,"avatarstat_id":81,"value":143,"lastupdated":1710450575},{"profile_id":196240,"avatarstat_id":82,"value":114,"lastupdated":1710870532},{"profile_id":196240,"avatarstat_id":83,"value":148,"lastupdated":1711122168},{"profile_id":196240,"avatarstat_id":84,"value":153,"lastupdated":1707315946},{"profile_id":196240,"avatarstat_id":85,"value":154,"lastupdated":1706810586},{"profile_id":196240,"avatarstat_id":86,"value":101,"lastupdated":1710608257},{"profile_id":196240,"avatarstat_id":87,"value":123,"lastupdated":1712325945},{"profile_id":196240,"avatarstat_id":88,"value":132,"lastupdated":1709849955},{"profile_id":196240,"avatarstat_id":89,"value":129,"lastupdated":1709668668},{"profile_id":196240,"avatarstat_id":90,"value":117,"lastupdated":1709668668},{"profile_id":196240,"avatarstat_id":91,"value":145,"lastupdated":1710450575},{"profile_id":196240,"avatarstat_id":92,"value":104,"lastupdated":1707832845},{"profile_id":196240,"avatarstat_id":93,"value":154,"lastupdated":1712331792},{"profile_id":196240,"avatarstat_id":94,"value":115,"lastupdated":1710604928},{"profile_id":196240,"avatarstat_id":95,"value":111,"lastupdated":1710535006},{"profile_id":196240,"avatarstat_id":96,"value":174,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":97,"value":90,"lastupdated":1706628114},{"profile_id":196240,"avatarstat_id":98,"value":106,"lastupdated":1709664885},{"profile_id":196240,"avatarstat_id":99,"value":104,"lastupdated":1707765917},{"profile_id":196240,"avatarstat_id":100,"value":120,"lastupdated":1707319249},{"profile_id":196240,"avatarstat_id":101,"value":159,"lastupdated":1710248801},{"profile_id":196240,"avatarstat_id":102,"value":162,"lastupdated":1710608257},{"profile_id":196240,"avatarstat_id":103,"value":161,"lastupdated":1707762327},{"profile_id":196240,"avatarstat_id":104,"value":1202,"lastupdated":1637176716},{"profile_id":196240,"avatarstat_id":105,"value":2715,"lastupdated":1590445123},{"profile_id":196240,"avatarstat_id":106,"value":2362,"lastupdated":1586542566},{"profile_id":196240,"avatarstat_id":107,"value":83,"lastupdated":1574360632},{"profile_id":196240,"avatarstat_id":108,"value":682,"lastupdated":1710450575},{"profile_id":196240,"avatarstat_id":109,"value":190,"lastupdated":1579445688},{"profile_id":196240,"avatarstat_id":111,"value":10124,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":142,"value":4711,"lastupdated":1712488495},{"profile_id":196240,"avatarstat_id":143,"value":628,"lastupdated":1712488495},{"profile_id":196240,"avatarstat_id":144,"value":215,"lastupdated":1710438239},{"profile_id":196240,"avatarstat_id":153,"value":6153,"lastupdated":1712333698},{"profile_id":196240,"avatarstat_id":154,"value":336,"lastupdated":1706717426},{"profile_id":196240,"avatarstat_id":155,"value":237652,"lastupdated":1712322753},{"profile_id":196240,"avatarstat_id":156,"value":4250,"lastupdated":1712323809},{"profile_id":196240,"avatarstat_id":157,"value":137,"lastupdated":1697556347},{"profile_id":196240,"avatarstat_id":158,"value":268306,"lastupdated":1705946791},{"profile_id":196240,"avatarstat_id":159,"value":15209,"lastupdated":1705608235},{"profile_id":196240,"avatarstat_id":160,"value":512,"lastupdated":1625324434},{"profile_id":196240,"avatarstat_id":163,"value":7,"lastupdated":1621498349},{"profile_id":196240,"avatarstat_id":165,"value":205,"lastupdated":1712488505},{"profile_id":196240,"avatarstat_id":166,"value":2957,"lastupdated":1712488505},{"profile_id":196240,"avatarstat_id":167,"value":88,"lastupdated":1712488505},{"profile_id":196240,"avatarstat_id":168,"value":3369,"lastupdated":1625397812},{"profile_id":196240,"avatarstat_id":169,"value":639,"lastupdated":1625320810},{"profile_id":196240,"avatarstat_id":170,"value":10,"lastupdated":1619796153},{"profile_id":196240,"avatarstat_id":171,"value":1399,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":172,"value":179514,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":173,"value":3707,"lastupdated":1712337465},{"profile_id":196240,"avatarstat_id":174,"value":49,"lastupdated":1707487976},{"profile_id":196240,"avatarstat_id":175,"value":37,"lastupdated":1710867199},{"profile_id":196240,"avatarstat_id":176,"value":53,"lastupdated":1710253584},{"profile_id":196240,"avatarstat_id":177,"value":75,"lastupdated":1707765917},{"profile_id":196240,"avatarstat_id":184,"value":33,"lastupdated":1710248801},{"profile_id":196240,"avatarstat_id":185,"value":36,"lastupdated":1697046367},{"profile_id":196240,"avatarstat_id":186,"value":30,"lastupdated":1709842960},{"profile_id":196240,"avatarstat_id":187,"value":48,"lastupdated":1702926667},{"profile_id":196240,"avatarstat_id":194,"value":113526,"lastupdated":1710248785},{"profile_id":196240,"avatarstat_id":195,"value":28,"lastupdated":1710608257},{"profile_id":196240,"avatarstat_id":196,"value":36,"lastupdated":1696505856},{"profile_id":196240,"avatarstat_id":197,"value":26,"lastupdated":1705615095},{"profile_id":196240,"avatarstat_id":198,"value":22,"lastupdated":1710604928},{"profile_id":196240,"avatarstat_id":199,"value":36,"lastupdated":1707496556},{"profile_id":196240,"avatarstat_id":200,"value":24,"lastupdated":1707494284},{"profile_id":196240,"avatarstat_id":202,"value":4,"lastupdated":1711122168},{"profile_id":196240,"avatarstat_id":203,"value":5,"lastupdated":1706628114},{"profile_id":196240,"avatarstat_id":204,"value":5,"lastupdated":1694182600},{"profile_id":196240,"avatarstat_id":205,"value":3,"lastupdated":1684417238},{"profile_id":196240,"avatarstat_id":206,"value":2,"lastupdated":1684418625},{"profile_id":196240,"avatarstat_id":207,"value":3,"lastupdated":1684321191},{"profile_id":196240,"avatarstat_id":209,"value":6,"lastupdated":1686752894},{"profile_id":196240,"avatarstat_id":210,"value":1,"lastupdated":1684260140},{"profile_id":196240,"avatarstat_id":211,"value":2,"lastupdated":1684268089},{"profile_id":196240,"avatarstat_id":212,"value":2,"lastupdated":1684326951},{"profile_id":196240,"avatarstat_id":213,"value":2,"lastupdated":1684269726},{"profile_id":196240,"avatarstat_id":215,"value":3,"lastupdated":1684418625},{"profile_id":196240,"avatarstat_id":216,"value":2,"lastupdated":1684325986},{"profile_id":196240,"avatarstat_id":217,"value":3,"lastupdated":1684326951},{"profile_id":196240,"avatarstat_id":218,"value":2,"lastupdated":1684270691},{"profile_id":196240,"avatarstat_id":221,"value":3,"lastupdated":1684269726},{"profile_id":196240,"avatarstat_id":222,"value":1,"lastupdated":1684268089},{"profile_id":196240,"avatarstat_id":223,"value":2,"lastupdated":1684418625},{"profile_id":196240,"avatarstat_id":224,"value":1,"lastupdated":1684269726},{"profile_id":196240,"avatarstat_id":225,"value":5,"lastupdated":1684418625},{"profile_id":196240,"avatarstat_id":226,"value":1,"lastupdated":1684263141},{"profile_id":196240,"avatarstat_id":227,"value":4,"lastupdated":1686752894},{"profile_id":196240,"avatarstat_id":228,"value":1,"lastupdated":1684273893},{"profile_id":196240,"avatarstat_id":229,"value":3,"lastupdated":1684417238},{"profile_id":196240,"avatarstat_id":230,"value":2,"lastupdated":1684325025},{"profile_id":196240,"avatarstat_id":232,"value":2,"lastupdated":1684321191},{"profile_id":196240,"avatarstat_id":233,"value":12,"lastupdated":1684321191},{"profile_id":196240,"avatarstat_id":234,"value":3,"lastupdated":1686752894},{"profile_id":196240,"avatarstat_id":235,"value":6,"lastupdated":1686752894},{"profile_id":196240,"avatarstat_id":236,"value":1,"lastupdated":1684257903},{"profile_id":196240,"avatarstat_id":237,"value":2,"lastupdated":1684417238},{"profile_id":196240,"avatarstat_id":238,"value":11,"lastupdated":1684327061},{"profile_id":196240,"avatarstat_id":240,"value":1,"lastupdated":1686567332},{"profile_id":196240,"avatarstat_id":1001,"value":37035,"lastupdated":1595964196},{"profile_id":196240,"avatarstat_id":1002,"value":37035,"lastupdated":1595964196},{"profile_id":196240,"avatarstat_id":1003,"value":60636,"lastupdated":1601427762},{"profile_id":196240,"avatarstat_id":1004,"value":13311,"lastupdated":1601558744},{"profile_id":196240,"avatarstat_id":1005,"value":20,"lastupdated":1703006480},{"profile_id":196240,"avatarstat_id":1006,"value":20,"lastupdated":1703006480},{"profile_id":196240,"avatarstat_id":1007,"value":79,"lastupdated":1703006480},{"profile_id":196240,"avatarstat_id":2060,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2061,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2067,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2068,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2069,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2070,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2071,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2072,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2073,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2074,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2075,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2076,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2077,"value":13,"lastupdated":1633525772},{"profile_id":196240,"avatarstat_id":2078,"value":13,"lastupdated":1633533992},{"profile_id":196240,"avatarstat_id":2079,"value":13,"lastupdated":1633535824},{"profile_id":196240,"avatarstat_id":2080,"value":13,"lastupdated":1635011490},{"profile_id":196240,"avatarstat_id":2081,"value":13,"lastupdated":1635013888},{"profile_id":196240,"avatarstat_id":2082,"value":13,"lastupdated":1635016045},{"profile_id":196240,"avatarstat_id":2083,"value":13,"lastupdated":1635019436},{"profile_id":196240,"avatarstat_id":2202,"value":13,"lastupdated":1642689852},{"profile_id":196240,"avatarstat_id":2203,"value":13,"lastupdated":1642693452},{"profile_id":196240,"avatarstat_id":2204,"value":13,"lastupdated":1642694869},{"profile_id":196240,"avatarstat_id":2205,"value":13,"lastupdated":1642696112},{"profile_id":196240,"avatarstat_id":2206,"value":13,"lastupdated":1642698041},{"profile_id":196240,"avatarstat_id":2207,"value":13,"lastupdated":1642699547},{"profile_id":196240,"avatarstat_id":2235,"value":13,"lastupdated":1659964477},{"profile_id":196240,"avatarstat_id":2236,"value":13,"lastupdated":1659968663},{"profile_id":196240,"avatarstat_id":2237,"value":13,"lastupdated":1662133529},{"profile_id":196240,"avatarstat_id":2238,"value":13,"lastupdated":1662917253},{"profile_id":196240,"avatarstat_id":2239,"value":13,"lastupdated":1663434463},{"profile_id":196240,"avatarstat_id":2240,"value":13,"lastupdated":1672849092},{"profile_id":196240,"avatarstat_id":2241,"value":13,"lastupdated":1672851438},{"profile_id":196240,"avatarstat_id":2242,"value":13,"lastupdated":1672855953},{"profile_id":196240,"avatarstat_id":2243,"value":13,"lastupdated":1673366508},{"profile_id":196240,"avatarstat_id":2244,"value":13,"lastupdated":1673369202},{"profile_id":196240,"avatarstat_id":2245,"value":13,"lastupdated":1657565991},{"profile_id":196240,"avatarstat_id":2246,"value":13,"lastupdated":1657568908},{"profile_id":196240,"avatarstat_id":2247,"value":13,"lastupdated":1657570526},{"profile_id":196240,"avatarstat_id":2248,"value":13,"lastupdated":1657572368},{"profile_id":196240,"avatarstat_id":2249,"value":13,"lastupdated":1657574769},{"profile_id":196240,"avatarstat_id":2251,"value":13,"lastupdated":1684318124},{"profile_id":196240,"avatarstat_id":2252,"value":13,"lastupdated":1684321191},{"profile_id":196240,"avatarstat_id":2253,"value":13,"lastupdated":1686567327},{"profile_id":196240,"avatarstat_id":2254,"value":13,"lastupdated":1686752894}]}
{"result":{"code":0, "message":"SUCCESS"},"avatarStatsForProfile":[{"profile_id":196240,"avatarstat_id":1,"value":2289,"lastupdated":1712337465}]}
2 changes: 1 addition & 1 deletion tests/test_cases/api.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ let test_get_leaderboards () =
;;

let test_get_avatar_stat () =
let requester = Mock.Json_file.create_requester "GetAvailableLeaderboards.json" in
let requester = Mock.Json_file.create_requester "GetAvatarStatForProfile.json" in
let client = Client.create "aoe-api.worldsedgelink.com" Data.Game.Age2 in
let endpoint = Api.Community.Leaderboard.get_avatar ~profile_ids:[ 1 ] in
Client.get endpoint client ~requester
Expand Down

0 comments on commit 21ae382

Please sign in to comment.