From 01a29de0c52bd7f8281b895c8fb9dde3d8e3008f Mon Sep 17 00:00:00 2001 From: C-xC-c <58750933+C-xC-c@users.noreply.github.com> Date: Sun, 12 Jan 2020 13:08:16 +0000 Subject: [PATCH] Update get.org --- Docs/api/get.org | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/Docs/api/get.org b/Docs/api/get.org index 0f68700..35d6e7b 100644 --- a/Docs/api/get.org +++ b/Docs/api/get.org @@ -1,19 +1,32 @@ * /api/get +** Recieved Data +All versions of the script send a comma seperated list of post +numbers, =post_nrs= and a board =board=. Modern versions of bantflags +also send a version number, =version=, which decides how the returned +data will be formatted. -** Database Query +Data looks like this: +#+BEGIN_SRC http + POST https://flags.plum.moe/api/get + Content-Type: application/x-www-form-urlencoded + + post_nrs=12345,12346,14444&board=bant&version=1 +#+END_SRC +** Sent Data +*** GetPosts Returns an =IEnumerable>= of post numbers and -their flags where the post numbers are contained in the input. - -** Compatibility -*** V1 +their flags where the post numbers are contained in +=post_nrs=. =board= limits the query to only the board we're currently +on. +*** GetPosts_V1 Minimum script version: 0 Flags are converted from an =IEnumerable>= to a =List>= by joining the values in the -=DataRow= by "||". These are then split by the same seperator and -converted into an array on the script's end. +=DataRow= by "||", which are then split and converted into an array by +the script. -We're doing needless conversions at both ends which slows the whole +We're doing a needless conversion at both ends which slows the whole process down, but it's how extraflags is set up and we need to support it. @@ -31,13 +44,13 @@ Data looks like this: ] #+END_SRC -*** V2 +*** getPosts_V2 Minimum script version: 2 Flags are converted from an =IEnumerable>= to -a =Dictionary>= which are parsed by the -userscript without any conversion. This format is the same as returned -from the database query, sans extra information contained in a +a =Dictionary>= which can then be parsed by +the script without any conversion. This format is the same as returned +from the database query, sans the extra information returned by a =DataRow= Data looks like this: