Skip to content

Commit

Permalink
Paper API updates
Browse files Browse the repository at this point in the history
- Single-paper calls use /{p}/paper; multi-paper calls use /papers
- /papers?q= can be used to update *many* papers with a single JSON
  • Loading branch information
kohler committed Dec 8, 2024
1 parent 5122671 commit d5a3ab4
Show file tree
Hide file tree
Showing 10 changed files with 356 additions and 106 deletions.
14 changes: 9 additions & 5 deletions etc/apiexpansions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
},
{
"name": "paper", "post": true, "merge": true,
"tags": ["Submissions"], "order": 0,
"response_info": {"?paper": "paper", "?papers": "[paper]",
"?+change_list": "[string]", "?+change_lists": "[[string]]",
"?+valid": "[boolean]", "?dry_run": "boolean"
}
"tags": ["Submissions"], "order": 0
},
{
"name": "papers", "get": true, "merge": true,
"tags": ["Submissions"], "order": 1
},
{
"name": "papers", "post": true, "merge": true,
"tags": ["Submissions"], "order": 1
},
{
"name": "formatcheck", "get": true, "merge": true,
Expand Down
21 changes: 14 additions & 7 deletions etc/apifunctions.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,22 @@
"function": "Authorize_Page::oauthtoken_api"
},
{
"name": "paper", "get": true,
"function": "Paper_API::run",
"parameters": "?p ?forceShow ?q ?t ?qt ?scoresort ?sort ?reviewer",
"response": "?paper ?papers"
"name": "paper", "get": true, "post": true,
"function": "Paper_API::run_one",
"parameters": "?p ?+dry_run ?+disable_users ?+add_topics ?+notify ?forceShow",
"response": "?paper ?dry_run ?+change_list ?+valid"
},
{
"name": "paper", "post": true,
"function": "Paper_API::run",
"parameters": "?p ?dry_run ?disable_users ?add_topics ?notify"
"name": "papers", "get": true,
"function": "Paper_API::run_multi",
"parameters": "q ?t ?qt ?scoresort ?sort ?reviewer ?warn_missing ?forceShow",
"response": "?papers"
},
{
"name": "papers", "post": true,
"function": "Paper_API::run_multi",
"parameters": "?json ?dry_run ?disable_users ?add_topics ?notify ?forceShow ?q ?t ?qt ?sort ?scoresort ?reviewer",
"response": "?papers ?dry_run ?change_lists ?valid"
},
{
"name": "pc", "get": true,
Expand Down
14 changes: 9 additions & 5 deletions scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ function hoturl(page, options) {
x.t = "api";
x.v.push("fn=" + page.substring(4));
}
hoturl_clean(x, /^p=(\d+)$/, true);
hoturl_clean(x, /^p=(\d+|new)$/, true);
hoturl_clean(x, /^fn=(\w+)$/);
want_forceShow = true;
} else if (page === "settings") {
Expand All @@ -1561,13 +1561,17 @@ function hoturl(page, options) {
x.t = k + x.t.substring(i);
}

if (siteinfo.want_override_conflict && want_forceShow
&& !hoturl_find(xv, /^forceShow=/))
if (siteinfo.want_override_conflict
&& want_forceShow
&& !hoturl_find(xv, /^forceShow=/)) {
xv.push("forceShow=1");
if (siteinfo.defaults)
}
if (siteinfo.defaults) {
xv.push(serialize_object(siteinfo.defaults));
if (xv.length)
}
if (xv.length){
x.t += "?" + xv.join("&");
}
return siteinfo.site_relative + x.t + anchor;
}

Expand Down
Loading

0 comments on commit d5a3ab4

Please sign in to comment.