# get_latest_topic
# Function
Function Name | Description | Level |
---|---|---|
get_latest_topic | Returns a list of latest topics ordered by date. This is the replacement function of get_new_topic in API Level 3. This function will be invoked instead of get_new_topic if get_config returns "get_latest_topic=1" | 4 |
Input Parameters:
Name | Type | Required? | Description | Level |
---|---|---|---|---|
start_num | Int | yes | For pagination. If start_num = 0 & last_num = 9, it returns first 10 posts from the topic, sorted by date (last-in-first-out). If both are not presented, return first 20 posts. if start_num = 0 and last_num = 0, return the first post only, and so on (e.g. 1,1; 2,2). If start_num smaller than last_num returns null. If last_num - start_num > 50, returns only first 50 posts starting from start_num | |
last_num | Int | yes |
Output Parameters:
Name | Type | Required? | Description | Level |
---|---|---|---|---|
result | Boolean | yes | return true if the action is executed successfully. | 3 |
result_text | byte[] | para_description | 3 | |
total_topic_num | Int | yes | total number of latest topics | 4 |
search_id | String | return the search id so the app can send the same id back to the server for pagination support | ||
topics | Array of Hash table | an array contains a list of topics in request range | 4 | |
forum_id | String | yes | 4 | |
forum_name | byte[] | yes | 4 | |
topic_id | String | yes | 4 | |
topic_title | byte[] | yes | Remove all BBCode in title | 4 |
prefix | byte[] | 4 | ||
post_author_name | byte[] | yes | 4 | |
post_author_id | String | yes | 4 | |
is_subscribed | Boolean | return true if this thread has been subscribed by this user. | 4 | |
can_subscribe | Boolean | yes | returns false if the subscription feature is turned off | 4 |
is_closed | Boolean | return true if this thread has been closed. | 4 | |
icon_url | String | Return the last reply author avatar URL | 4 | |
participated_uids | Array of String | Return a list of uids of the users who participated in this topic. It does not need to return all the uids of whoever participated, instead returns not more than 10, preferrably ordered by the "importance" - it can be determined by the number of posts the user contributed to this topic etc. Plugin should check HTTP Header "Mobiquoid". If it is ="11", return this key, otherwise do not return it. | 4 | |
post_time | Date | yes | dateTime.iso8601 format. If this topic has no reply, use the topic creation time. | 4 |
timestamp | String | yes | Timestamp of topic last reply | |
reply_number | Int | yes | total number of reply in this topic. If this is no reply in this return, return 0. | 4 |
new_post | Boolean | yes | return true if this topic contains new post since user last login | 4 |
view_number | Int | yes | total number of view in this topic | 4 |
short_content | byte[] | Characters display rules (should follow this sequence): 1) Remove all BBCode except [ur], [img]. 2) Convert "[url http://...]http://…..[/url]" to "[url]". 3) Convert "[img]http://…..[/img]" to "[img]". 4) Remove "Last edited by..." tag at the end. 5) Remove all non-displayable characters (e.g. \n, \t, etc). 6) Remove all whitespace, /n and /r at the beginning and ending of the content. 7) return only first 200 characters | 4 |
# Example
Request:
<?xml version="1.0"?>
<methodCall>
<methodName>get_latest_topic</methodName>
<params>
<param><value><i4>0</i4></value></param>
<param><value><i4>9</i4></value></param>
</params>
</methodCall>
Response:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>result</name>
<value><boolean>1</boolean></value>
</member>
<member>
<name>total_topic_num</name>
<value><int>12</int></value>
</member>
<member>
<name>topics</name>
<value>
<array>
<data>
<value>
<struct>
<member>
<name>forum_id</name>
<value><string>1</string></value>
</member>
<member>
<name>forum_name</name>
<value><base64>5p2C6LCI</base64></value>
</member>
<member>
<name>topic_id</name>
<value><string>667</string></value>
</member>
<member>
<name>topic_title</name>
<value><base64>5pyJ5rKh5pyJ5Lq66LaFYeaWsOS4lueVjOeahOmCo+W8oOWbvu+8n+ayoeacieWtl+eahA==</base64></value>
</member>
<member>
<name>reply_number</name>
<value><int>4</int></value>
</member>
<member>
<name>view_number</name>
<value><int>97</int></value>
</member>
<member>
<name>short_content</name>
<value><base64>W3F1b3RlXSDluIXllYo=</base64></value>
</member>
<member>
<name>post_author_id</name>
<value><string>7</string></value>
</member>
<member>
<name>post_author_name</name>
<value><base64>ZGFva3Vu</base64></value>
</member>
<member>
<name>post_author_user_type</name>
<value><string>normal</string></value>
</member>
<member>
<name>new_post</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>post_time</name>
<value><dateTime.iso8601>20200607T16:27:43+00:00</dateTime.iso8601></value>
</member>
<member>
<name>timestamp</name>
<value><string>1591518463</string></value>
</member>
<member>
<name>icon_url</name>
<value><string></string></value>
</member>
<member>
<name>can_subscribe</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>is_subscribed</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>is_closed</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>is_sticky</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>can_delete</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>can_close</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>can_stick</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>can_move</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>can_rename</name>
<value><boolean>0</boolean></value>
</member>
</struct>
</value>
</data>
</array>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>