Endpoints
GET @ /challenges
Fetches all challenges which are not deleted and released. Deleted challenges will have deleted set to true, and released challenges will have a date in released_at. Only users with ViewUpcomingWeeklyChallenge permission should be able to see unreleased challenges.
If the user can see deleted challenges, deleted should be added in the challenge response
Challenge Object should look something like this:
{
"id": "string",
"title": "string",
"description": "string",
"author_id": "string",
"language_ids": ["string"],
"released_at": "date/null",
"slug": "string"
}
if the user has any WeeklyChallenges permission, they should be able to see deleted challenges.
This endpoint needs pagination
POST @ /challenges
Creates a new Challenge. If the challenge is created successfully should return 201 Created with the challenge data.
Needs CreateWeeklyChallenge permission
Body
{
"title": "string",
"description": "string",
"example_in": ["string"],
"example_out": ["string"],
"language_ids": ["string"]
}
GET @ /challenges/{id/slug}
Fetch said challenge by id or slug.
Challenge object should something similar to this:
{
"id": "string",
"title": "string",
"description": "string",
"author_id": "string",
"author": {
"id": "string",
"name": "string",
"avatar": "string",
"discriminator": "string"
},
"example_in": ["string"],
"example_out": ["string"],
"languages": [
{
"id": "string",
"name": "string",
"download_url": "string"
}
],
"released_at": "date/null",
"slug": "string",
"submissions": "integer"
}
The checks done on GET @ /challenges should be done here too (deleted and unreleased)
PATCH @ /challenges/{id}
Updates said challenge. Should return 200 OK with the new challenge data.
Needs EditWeeklyChallenge permission
Body
{
"title": "string",
"description": "string",
"example_in": ["string"],
"example_out": ["string"],
"language_ids": ["string"]
}
All fields should be optional
PUT @ /challenges/{id}/release
Releases/Unreleases said challenge. Should return 204 No Content if executed successfully.
Needs EditWeeklyChallenge permission
DELETE @ /challenges/{id}
Update said challenge and set deleted to true. If executed successfully 204 No Content should be returned.
Needs DeleteWeeklyChallenge permission
Endpoints
GET @ /challengesFetches all challenges which are not deleted and released. Deleted challenges will have
deletedset to true, and released challenges will have a date inreleased_at. Only users withViewUpcomingWeeklyChallengepermission should be able to see unreleased challenges.Challenge Object should look something like this:
{ "id": "string", "title": "string", "description": "string", "author_id": "string", "language_ids": ["string"], "released_at": "date/null", "slug": "string" }if the user has any
WeeklyChallengespermission, they should be able to see deleted challenges.POST @ /challengesCreates a new Challenge. If the challenge is created successfully should return
201 Createdwith the challenge data.Body
{ "title": "string", "description": "string", "example_in": ["string"], "example_out": ["string"], "language_ids": ["string"] }GET @ /challenges/{id/slug}Fetch said challenge by id or slug.
Challenge object should something similar to this:
{ "id": "string", "title": "string", "description": "string", "author_id": "string", "author": { "id": "string", "name": "string", "avatar": "string", "discriminator": "string" }, "example_in": ["string"], "example_out": ["string"], "languages": [ { "id": "string", "name": "string", "download_url": "string" } ], "released_at": "date/null", "slug": "string", "submissions": "integer" }PATCH @ /challenges/{id}Updates said challenge. Should return
200 OKwith the new challenge data.Body
{ "title": "string", "description": "string", "example_in": ["string"], "example_out": ["string"], "language_ids": ["string"] }PUT @ /challenges/{id}/releaseReleases/Unreleases said challenge. Should return
204 No Contentif executed successfully.DELETE @ /challenges/{id}Update said challenge and set
deletedto true. If executed successfully204 No Contentshould be returned.