From d872f28ca4841a842fdf2573d40d49105add8672 Mon Sep 17 00:00:00 2001
From: Yorhel
Date: Mon, 14 Aug 2017 18:22:25 +0200
Subject: API: Some additions to the "get *list" commands
---
data/docs/11 | 65 +++++++++++++++++++++++++++++++++++++++++++++++---------
lib/Multi/API.pm | 22 +++++++++++++------
2 files changed, 71 insertions(+), 16 deletions(-)
diff --git a/data/docs/11 b/data/docs/11
index e9678e88..f5cf904a 100644
--- a/data/docs/11
+++ b/data/docs/11
@@ -1435,20 +1435,27 @@ Returned members:
Description |
+ uid |
+ basic |
+ integer |
+ no |
+ User ID |
+
+
vn |
basic |
integer |
no |
Visual Novel ID |
-
+
vote |
basic |
integer |
no |
In the range of 10 (lowest) to 100 (highest). These are displayed on the site as a fractional number between 1 and 10. |
-
+
added |
basic |
integer |
@@ -1470,7 +1477,13 @@ Returned members:
uid |
integer |
= |
- This filter must be present. The special value '0' is recognized as the currently logged in user. |
+ The special value '0' is recognized as the currently logged in user. |
+
+
+ vid |
+ integer array of integers |
+ = != > < >= <= = != |
+ Visual novel ID. |
@@ -1493,27 +1506,34 @@ Returned members:
Description |
+ uid |
+ basic |
+ integer |
+ no |
+ User ID |
+
+
vn |
basic |
integer |
no |
Visual Novel ID |
-
+
status |
basic |
integer |
no |
0=Unknown, 1=playing, 2=finished, 3=stalled, 4=dropped. |
-
+
added |
basic |
integer |
no |
Unix timestamp of when this item has been added. |
-
+
notes |
basic |
string |
@@ -1535,7 +1555,13 @@ Returned members:
uid |
integer |
= |
- This filter must be present. The special value '0' is recognized as the currently logged in user. |
+ The special value '0' is recognized as the currently logged in user. |
+
+
+ vid |
+ integer array of integers |
+ = != > < >= <= = != |
+ Visual novel ID. |
The notes mentioned under 'get votelist' also apply here.
@@ -1551,20 +1577,27 @@ Returned members:
Description |
+ uid |
+ basic |
+ integer |
+ no |
+ User ID |
+
+
vn |
basic |
integer |
no |
Visual Novel ID |
-
+
priority |
basic |
integer |
no |
0=high, 1=medium, 2=low, 3=blacklist. |
-
+
added |
basic |
integer |
@@ -1586,7 +1619,13 @@ Returned members:
uid |
integer |
= |
- This filter must be present. The special value '0' is recognized as the currently logged in user. |
+ The special value '0' is recognized as the currently logged in user. |
+
+
+ vid |
+ integer array of integers |
+ = != > < >= <= = != |
+ Visual novel ID. |
The notes mentioned under 'get votelist' also apply here.
@@ -1755,6 +1794,12 @@ Returned members:
Check out the announcements board for more information about updates.
+2017-08-14
+
+ - Add 'uid' field to "get votelist/vnlist/wishlist" commands
+ - Add 'vn' filter to the same commands
+ - The 'uid' filter for these commands is now optional, making it possible to find all list entries for a particular VN
+
2017-06-21
- Add "resolution", "voiced", "animation" members to "get release" command
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index 9ad2a33a..c9b2540d 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -1008,12 +1008,20 @@ my %GET_USER = (
# the uid filter for votelist/vnlist/wishlist
my $UID_FILTER = [ 'int' => 'uid :op: :value:', {qw|= =|}, range => [0,1e6], process => \&subst_user_id ];
+# Similarly, a filter for 'vid'
+my $VN_FILTER = [
+ [ 'int' => 'vid :op: :value:', {qw|= = != <> > > < < <= <= >= >=|}, range => [1,1e6] ],
+ [ inta => 'vid :op:(:value:)', {'=' => 'IN', '!=' => 'NOT IN'}, range => [1,1e6], join => ',' ],
+];
+
+
my %GET_VOTELIST = (
islist => 1,
sql => "SELECT %s FROM votes v WHERE (%s) AND NOT EXISTS(SELECT 1 FROM users_prefs WHERE uid = v.uid AND key = 'hide_list') %s",
sqluser => q{SELECT %1$s FROM votes v WHERE (%2$s) AND (uid = %4$d OR NOT EXISTS(SELECT 1 FROM users_prefs WHERE uid = v.uid AND key = 'hide_list')) %3$s},
- select => "vid as vn, vote, extract('epoch' from date) AS added",
+ select => "uid, vid as vn, vote, extract('epoch' from date) AS added",
proc => sub {
+ $_[0]{uid}*=1;
$_[0]{vn}*=1;
$_[0]{vote}*=1;
$_[0]{added} = int $_[0]{added};
@@ -1021,15 +1029,16 @@ my %GET_VOTELIST = (
sortdef => 'vn',
sorts => { vn => 'vid %s' },
flags => { basic => {} },
- filters => { uid => [ $UID_FILTER ] }
+ filters => { uid => [ $UID_FILTER ], vn => $VN_FILTER }
);
my %GET_VNLIST = (
islist => 1,
sql => "SELECT %s FROM vnlists v WHERE (%s) AND NOT EXISTS(SELECT 1 FROM users_prefs WHERE uid = v.uid AND key = 'hide_list') %s",
sqluser => q{SELECT %1$s FROM vnlists v WHERE (%2$s) AND (uid = %4$d OR NOT EXISTS(SELECT 1 FROM users_prefs WHERE uid = v.uid AND key = 'hide_list')) %3$s},
- select => "vid as vn, status, extract('epoch' from added) AS added, notes",
+ select => "uid, vid as vn, status, extract('epoch' from added) AS added, notes",
proc => sub {
+ $_[0]{uid}*=1;
$_[0]{vn}*=1;
$_[0]{status}*=1;
$_[0]{added} = int $_[0]{added};
@@ -1038,15 +1047,16 @@ my %GET_VNLIST = (
sortdef => 'vn',
sorts => { vn => 'vid %s' },
flags => { basic => {} },
- filters => { uid => [ $UID_FILTER ] }
+ filters => { uid => [ $UID_FILTER ], vn => $VN_FILTER }
);
my %GET_WISHLIST = (
islist => 1,
sql => "SELECT %s FROM wlists w WHERE (%s) AND NOT EXISTS(SELECT 1 FROM users_prefs WHERE uid = w.uid AND key = 'hide_list') %s",
sqluser => q{SELECT %1$s FROM wlists w WHERE (%2$s) AND (uid = %4$d OR NOT EXISTS(SELECT 1 FROM users_prefs WHERE uid = w.uid AND key = 'hide_list')) %3$s},
- select => "vid AS vn, wstat AS priority, extract('epoch' from added) AS added",
+ select => "uid, vid AS vn, wstat AS priority, extract('epoch' from added) AS added",
proc => sub {
+ $_[0]{uid}*=1;
$_[0]{vn}*=1;
$_[0]{priority}*=1;
$_[0]{added} = int $_[0]{added};
@@ -1054,7 +1064,7 @@ my %GET_WISHLIST = (
sortdef => 'vn',
sorts => { vn => 'vid %s' },
flags => { basic => {} },
- filters => { uid => [ $UID_FILTER ] }
+ filters => { uid => [ $UID_FILTER ], vn => $VN_FILTER }
);
--
cgit v1.2.3