From 4eb47a7326de9950822a3482f9418ee344158612 Mon Sep 17 00:00:00 2001
From: Yorhel
Date: Sun, 4 Dec 2016 07:58:33 +0100
Subject: API: Add username filter to "get user" + d11 updates
---
data/docs/11 | 80 ++++++++++++++------------------------------------------
lib/Multi/API.pm | 5 ++++
2 files changed, 24 insertions(+), 61 deletions(-)
diff --git a/data/docs/11 b/data/docs/11
index 44adab5c..d0b0cf29 100644
--- a/data/docs/11
+++ b/data/docs/11
@@ -12,6 +12,14 @@
+Usage terms
+
+ This service is free for non-commercial use. The API is provided on a
+ best-effort basis, no guarantees are made about the stability or applicability
+ of this service.
+
+
+
Design goals
-
@@ -70,63 +78,6 @@ server resources and prevent abuse of this service.
- Port (TLS)
- 19535
For improved security, make sure to verify that the certificate is valid for 'api.vndb.org' and is signed by a trusted root (in particular, by Let's Encrypt).
-
-Disclaimer
-These notes should be obvious, but I'll point it out anyway.
-
- -
- This service is still experimental and is provided for free. No guarantees
- are given about the stability and uptime of this service. It may disappear
- at any time, and access to it can be restricted without prior notice.
-
- -
- Changes to this API can be made without prior notice. Backwards compatibility
- is provided when feasable, but non-compatible changes may be made at some
- point. It is the responsibility of the application developers to keep their
- applications up-to-date.
-
- -
- This service does not grant anyone the right to copy or republish the
- information fetched using the API. VNDB does not have a clear copyright
- statement, and in general we're not very strict about other people copying
- our information, but this API is not intended to be used for fetching and
- publishing more than half of our database. When in doubt, ask.
-
- -
- Lastly, this API is not complete. If you have any specific features you'd
- like to see, don't hesitate to ask.
-
-
-
-
-Implementation tips
-Like the disclaimer, these notes should be obvious, but it can't hurt to state them anyway.
-
- -
- Cache as much as you can, the data on VNDB doesn't change very often. Even if
- you only refresh the cached information once every month, you can be sure
- that most of the data hasn't changed within that time.
-
- -
- Program defensively. Even when the documentation says that a string will be
- returned, it may very well happen that this is later changed into an array.
- Make sure your application doesn't completely crash in such an event. Also keep
- in mind that for every command you send, the server can reply with an error, or
- can immediately close the connection (but this should be rare).
-
- -
- Regularly check this page to see if anything has changed to the API, and
- update your client when necessary. A change log can be found on the bottom of
- this page. It is recommended to subscribe to the announcements Atom feed.
-
- -
- Use a JSON library for both encoding and decoding JSON data. While the format
- is relatively easy to use, you're much more likely to introduce bugs when you're
- writing your own parser.
-
-
-
:SUB:Request/response syntax
@@ -1216,12 +1167,15 @@ however still required.
id |
integer array of integers |
= |
- 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. |
+
+
+ username |
+ string array of strings |
+ = != ~ = |
+ |
-
- Note: Internally, the user with id '0' is reserved for the "deleted" user.
-
:SUBSUB:get votelist
@@ -1554,6 +1508,10 @@ however still required.
This section lists the changes made in each version of the VNDB code.
Check out the announcements board for more information about updates.
+2.27
+
+ - Add "username" filter to "get user"
+
2.25
- Add "tags" filter to "get vn"
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index e43f42f3..566b8ada 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -848,6 +848,11 @@ my %GET_USER = (
[ 'int' => 'u.id :op: :value:', {qw|= =|}, range => [0,1e6], process => \&subst_user_id ],
[ inta => 'u.id IN(:value:)', {'=',1}, range => [0,1e6], join => ',', process => \&subst_user_id ],
],
+ username => [
+ [ str => 'u.username :op: :value:', {qw|= = != <>|} ],
+ [ str => 'u.username ILIKE :value:', {'~',1}, process => \'like' ],
+ [ stra => 'u.username IN(:value:)', {'=',1}, join => ',' ],
+ ],
},
);
--
cgit v1.2.3