Skip to content

Commit

Permalink
new requests
Browse files Browse the repository at this point in the history
  • Loading branch information
cevro committed Oct 11, 2023
1 parent b45d42c commit 9ae36c5
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/Downloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ private function validate(string $schemaFile, array $arguments): void
} else {
$errors = '';
foreach ($validator->getErrors() as $error) {
var_dump($error);
$errors .= join(', ', $error);
}
throw new DownloaderException($errors);
Expand Down
20 changes: 20 additions & 0 deletions src/fksdb/auth/request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": [
"contestId",
"app"
],
"properties": {
"contestId": {
"type": "integer"
},
"app": {
"type": "string",
"enum": [
"wiki",
"pm"
]
}
}
}
54 changes: 54 additions & 0 deletions src/fksdb/auth/response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"loginId": {
"type": [
"integer",
"null"
]
},
"login": {
"type": [
"string",
"null"
]
},
"hash": {
"type": [
"string",
"null"
]
},
"email": {
"type": "string"
},
"roles": {
"type": "array",
"items": {
"type": "string",
"enum": [
"taskManager",
"dataManager",
"eventManager",
"inboxManager",
"boss",
"org",
"contestant",
"aesop",
"schoolManager",
"web",
"wiki",
"superuser",
"cartesian"
]
}
}
}
}
}
15 changes: 15 additions & 0 deletions src/fksdb/events/request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": [
"eventTypes"
],
"properties": {
"eventTypes": {
"type": "array",
"items": {
"type": "integer"
}
}
}
}
7 changes: 7 additions & 0 deletions src/fksdb/events/response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"items": {
"type": "object"
}
}
17 changes: 1 addition & 16 deletions tools/downloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,5 @@
'password' => FKSDB_PASS,
],
]);
var_dump($newDownloader->download('fksdb', 'GetOrganizers', ['contest_id' => 1, 'year' => 37]));

return $newDownloader;
/*
return function (Request $request, bool $soap = true) use ($new): ?string {
try {
if ($soap) {
header('Content-Type: text/xml');
return $downloader->download($request);
} else {
header('Content-Type: text/json');
return $downloader->downloadJSON($request);
}
} catch (Throwable $exception) {
var_dump($exception);
}
return null;
};*/

0 comments on commit 9ae36c5

Please sign in to comment.