summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2017-03-03 11:37:57 +0100
committerYorhel <git@yorhel.nl>2017-03-03 11:37:57 +0100
commit8629c32832cc0f8f91fbcf6f12ece9c4210f7e1c (patch)
tree049f62b0f30cb00018a7735e1825c3b3c1f0494c
parentcb1af38ef7cfc49932ed5e3176505f4e2f3e639c (diff)
API: Add traits filter to get character
-rw-r--r--data/docs/1119
-rw-r--r--lib/Multi/API.pm4
2 files changed, 23 insertions, 0 deletions
diff --git a/data/docs/11 b/data/docs/11
index 48f1e2f1..56246d05 100644
--- a/data/docs/11
+++ b/data/docs/11
@@ -571,6 +571,7 @@ however still required.<br />
need.<br />
This filter may used cached data, it may take up to 24 hours
before a VN will have its tag updated with respect to this filter.<br />
+ VNs that are linked to childs of the given tag are also included.<br />
Be warned that this filter ignores spoiler settings, fetch the tags
associated with the returned VN to verify the spoiler level.
</td>
@@ -1126,6 +1127,23 @@ however still required.<br />
may also include characters that are normally hidden by spoiler settings.
</td>
</tr>
+ <tr>
+ <td>traits</td>
+ <td>int<br />array of ints</td>
+ <td>= !=</td>
+ <td>
+ Find chars by traits. When providing an array of ints, the '=' filter will return
+ chars that are linked to any (not all) of the given traits, the '!=' filter will
+ return chars that are not linked to any of the given traits. You can combine
+ multiple trait filters with 'and' and 'or' to get the exact behavior you
+ need.<br />
+ This filter may used cached data, it may take up to 24 hours
+ before a char entry will have its traits updated with respect to this filter.<br />
+ Chars that are linked to childs of the given trait are also included.<br />
+ Be warned that this filter ignores spoiler settings, fetch the traits
+ associated with the returned char to verify the spoiler level.
+ </td>
+ </tr>
</table>
@@ -1512,6 +1530,7 @@ however still required.<br />
<b>2.27</b>
<ul>
<li>Add "username" filter to "get user"</li>
+ <li>Add "traits" filter to "get character"</li>
</ul>
<b>2.25</b>
<ul>
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index 4d856aad..807e72f8 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -827,6 +827,10 @@ my %GET_CHARACTER = (
[ 'int' => 'c.id IN(SELECT cv.id FROM chars_vns cv WHERE cv.vid = :value:)', {'=',1}, range => [1,1e6] ],
[ inta => 'c.id IN(SELECT cv.id FROM chars_vns cv WHERE cv.vid IN(:value:))', {'=',1}, range => [1,1e6], join => ',' ],
],
+ traits => [
+ [ int => 'c.id :op:(SELECT tc.cid FROM traits_chars tc WHERE tc.tid = :value:)', {'=' => 'IN', '!=' => 'NOT IN'}, range => [1,1e6] ],
+ [ inta => 'c.id :op:(SELECT tc.cid FROM traits_chars tc WHERE tc.tid IN(:value:))', {'=' => 'IN', '!=' => 'NOT IN'}, join => ',', range => [1,1e6] ],
+ ],
},
);