package com.martin.ionichinabystudio.config; /** * @Description 网络请求的配置类 * @File HttpConfig.java * @Package com.martin.ionichinabystudio.config * @Date 2015年7月02日下午5:43:41 * @Author Donghongyu 1358506549@qq.com * @Version v1.0.0 */ public class HttpConfig { public static final int HTTP_OK = 1; public static final int HTTP_ERR = 1; // 请求的IP地址 public static final String HOST_IP = "http://ionichina.com/api/v1"; /** * get /topics 主题首页 * * 接收 get 参数 * * page Number 页数<br> * tab String 主题分类<br> * limit Number 每一页的主题数量<br> * mdrender String 当为 false 时,不渲染。默认为 true<br> * http://ionichina.com/api/v1/topics?tab=all&page=1&limit=1&mdrender=true */ public static final String API_GET_TOPICS = HOST_IP + "/topics"; /** * get /topic/:id 主题详情 * * 接收 get 参数 * * mdrender String 当为 false 时,不渲染。默认为 true * 示例:/api/v1/topic/5433d5e4e737cbe96dcef312 */ public static final String API_GET_TOPIC_DETAILS = HOST_IP + "/topic"; /** * post /topics 新建主题 * * 接收 post 参数 * * title String 标题<br> * tab String 目前有 ask share job <br> * content String 主体内容<br> * accesstoken String 用户的<br> * * 返回值示例 {success: true, topic_id: '5433d5e4e737cbe96dcef312'} */ public static final String API_POST_TOPIC_DETAILS = HOST_IP + "/topics"; /** * post /topic/collect 收藏主题 * * 接收 post 参数 * * accesstoken String 用户的<br> * accessToken topic_id String 被收藏的主题id <br> * * 返回值示例 {success: true} */ public static final String API_POST_TOPIC_COLLECT = HOST_IP + "/topic/collect"; /** * post /topic/de_collect 取消收藏 * * 接收 post 参数 * * accesstoken String 用户的<br> * accessToken topic_id String 被取消收藏的主题id <br> * * 返回值示例 {success: true} */ public static final String API_POST_TOPIC_DE_COLLECT = HOST_IP + "/topic/de_collect"; /** * post /topic/:topic_id/replies 新建评论 * * 接收 post 参数 * * accesstoken String 用户的 accessToken <br> * content String 评论的主体 <br> * reply_id String 如果这个评论是对另一个评论的回复,请务必带上此字段。这样前端就可以构建出评论线索图。 <br> * 返回值示例 {success: true, reply_id: '5433d5e4e737cbe96dcef312'} */ public static final String API_POST_TOPIC_ADD_REPLIES = HOST_IP + "/topic"; /** * post /reply/:reply_id/ups 为评论点赞 * * 接受 post 参数 * * accesstoken String 接口会自动判断用户是否已点赞,如果否,则点赞;如果是,则取消点赞。点赞的动作反应在返回数据的 action * 字段中,up or down。 * * 返回值示例 * * {"success": true, "action": "down"} */ public static final String API_POST_REPLY_ADD_UPS = HOST_IP + "/reply"; /** * get /user/:loginname 用户详情 * * 示例:/api/v1/user/DongHongfei */ public static final String API_GET_USER_DETAILS = HOST_IP + "/user"; /** * post /accesstoken 验证 accessToken 的正确性 * * 接收 post 参数 * * accesstoken String 用户的 accessToken 如果成功匹配上用户,返回成功信息。否则 403。 * * 返回值示例 * * {success: true, loginname: req.user.loginname} */ public static final String API_POST_CHACK_ACCESSTOKEN = HOST_IP + "/accesstoken"; /** * get /message/count 获取未读消息数 * * 接收 get 参数 * * accesstoken String 返回值示例 * * { data: 3 } */ public static final String API_GET_MESSAGE_UNREAD_COUNT = HOST_IP + "/message/count"; /** * get /messages 获取已读和未读消息 * * 接收 get 参数 * * accesstoken String 返回值示例 * * { data: { has_read_messages: [], hasnot_read_messages: [ { id: * "543fb7abae523bbc80412b26", type: "at", has_read: false, author: { * loginname: "DongHongfei", avatar_url: * "https://avatars.githubusercontent.com/u/5700428?v=3" }, topic: { id: * "542d6ecb9ecb3db94b2b3d0f", title: "adfadfadfasdf", last_reply_at: * "2014-10-18T07:47:22.563Z" }, reply: { id: "543fb7abae523bbc80412b24", * content: "[@DongHongfei](/user/DongHongfei) 哼哼哈嘿", ups: [ ], create_at: * "2014-10-16T12:18:51.566Z" } }, ... ] } } */ public static final String API_GET_MESSAGE_READ_ADN_UNREAD_DETAILS = HOST_IP + "/messages"; /** * post /message/mark_all 标记全部已读 * * 接收 post 参数 * * accesstoken String <br> * 返回值示例 * * { success: true, marked_msgs: [ { id: '544ce385aeaeb5931556c6f9' } ] } */ public static final String API_POST_MESSAGE_MARK_ALL = HOST_IP + "/message/mark_all"; }