# Subscription

Subscription

This section provides necessary functions related to thread and forum subscription.

# get_subscribed_forum

Function:

Function Name Description Level
get_subscribed_forum return a list of subscribed forums. 3

Input Parameters:

Name Type Required? Description Level

Output Parameters:

Name Type Required? Description Level
total_forums_num Int yes returns total number of subscribed forums 3
forums Array of Hash table yes returns an array of subscribed forums 3
forum_id String yes 3
forum_name byte[] yes 3
icon_url String an image URL to be displayed at the left hand side of the forum in the app.
is_protected Boolean return true if this forum is a protected forum. Please refer to "get_forum" for details description. 3
new_post Boolean return true if there is new posts in this forum. 3

# subscribe_forum

Function:

Function Name Description Level
subscribe_forum add a forum into the user forum subscription list. 3

Input Parameters:

Name Type Required? Description Level
forum_id String yes forum id of the forum to be subscribed. 3

Output Parameters:

Name Type Required? Description Level
result Boolean yes return true if the action is performed successfully. 3
result_text byte[] 3

# unsubscribe_forum

Function:

Function Name Description Level
unsubscribe_forum remove a forum into the user forum subscription list. 3

Input Parameters:

Name Type Required? Description Level
forum_id String yes forum id of the forum to be unsubscribed. In api level 4 or get_config return flag 'mass_subscribe' as true: if forum id is 'ALL', unsubscribe all forums get_config return flag 'direct_unsubscribe' as true: if forum id is 's_{id}', it means it's subscribe id, not a forum id 3,4

Output Parameters:

Name Type Required? Description Level
result Boolean return true if the action is performed successfully. 3
result_text byte[] 3

# get_subscribed_topic

Function:

Function Name Description Level
get_subscribed_topic return a list of subscribed topics. 3, 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 4
last_num Int yes 4

Output Parameters:

Name Type Required? Description Level
total_topic_num Int yes returns total number of subscribed topics 3
topics Array of Hash table yes returns an array of subscribed topics 3
forum_id String yes 3
forum_name byte[] yes 3
topic_id String yes 3
topic_title byte[] yes Remove all BBCode in title 3
post_author_name byte[] yes 3
is_closed Boolean return true if this thread has been closed. 3
icon_url String Return topic author avatar URL 3
post_time Date yes dateTime.iso8601 format. If this topic has no reply, use the topic creation time. 3
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. 3
new_post Boolean yes return true if this topic contains new post since user last login 3
view_number Int yes total number of view in this topic 3
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 begining and ending of the content. 7) return only first 200 characters 3

# subscribe_topic

Function:

Function Name Description Level
subscribe_topic add a topic into the user forum subscription list. 3

Input Parameters:

Name Type Required? Description Level
topic_id String yes topic id of the forum to be subscribed. 3

Output Parameters:

Name Type Required? Description Level
result Boolean yes return true if the action is performed successfully. 3
result_text byte[] 3

# unsubscribe_topic

Function:

Function Name Description Level
unsubscribe_topic remove a topic from the user topic subscription list. 3

Input Parameters:

Name Type Required? Description Level
topic_id String yes topic id of the topic to be unsubscribed. In api level 4 or get_config return flag 'mass_subscribe' as true: if topic id is 'ALL', unsubscribe all topics get_config return flag 'direct_unsubscribe' as true: if topic id is 's_{id}', it means it's subscribe id, not a topic id 3,4

Output Parameters:

Name Type Required? Description Level
result Boolean yes return true if the action is performed successfully. 3
result_text byte[] 3