Skip to content

Latest commit

 

History

History
242 lines (215 loc) · 16.2 KB

wiki.md

File metadata and controls

242 lines (215 loc) · 16.2 KB

Weigo

Weigo是Go语言版本的SinaWeibo的SDK.以下是api接口功能说明

###未完成的功能有

提醒
收藏
帐号
搜索
短链
标签
推荐
话题

###微博

接口名方法参数对应API
获取最新的公共微博GET_statuses_public_timelinemap[string]interface{}, *Statusesstatuses/public_timeline
获取用户发布的微博GET_statuses_user_timelinemap[string]interface{}, *Statusesstatuses/user_timeline
获取当前登录用户
及其所关注用户的最新微博
GET_statuses_friends_timelinemap[string]interface{}, *Statusesstatuses/friends_timeline
获取当前登录用户
及其所关注用户的最新微博
GET_statuses_home_timelinemap[string]interface{}, *Statusesstatuses/home_timeline
返回一条原创微博的最新转发微博GET_statuses_repost_timelinemap[string]interface{}, *Repostsstatusesstatuses/repost_timeline
批量获取指定的一批用户的微博列表GET_statuses_timeline_batchmap[string]interface{}, *Statusesstatuses/timeline_batch
获取用户发布的微博的IDGET_statuses_user_timeline_idsmap[string]interface{}, *TimelineIDsstatuses/repost_timeline/ids
获取一条原创微博的最新转发微博的IDGET_statuses_repost_timeline_idsmap[string]interface{}, *TimelineIDsstatuses/repost_timeline/ids
获取当前登录用户及其所关注用户的最新微博的IDGET_statuses_friends_timeline_idsmap[string]interface{}, *TimelineIDsstatuses/friends_timeline/ids
返回用户转发的最新微博GET_statuses_repost_by_memap[string]interface{}, *Statusesstatuses/repost_by_me
获取@当前用户的最新微博GET_statuses_mentionsmap[string]interface{}, *Statusesstatusesstatuses/mentions
获取@当前用户的最新微博的IDGET_statuses_mentions_idsmap[string]interface{}, *TimelineIDsstatuses/mentions/ids
获取双向关注用户的最新微博GET_statuses_bilateral_timelinemap[string]interface{}, *Statusesstatuses/bilateral_timeline
根据ID获取单条微博信息GET_statuses_showmap[string]interface{}, *Statusstatuses/show
根据微博ID批量获取微博信息GET_statuses_show_batchmap[string]interface{}, *Statusesstatuses/show_batch
通过id获取midGET_statuses_querymidmap[string]interface{}, *stringstatuses/querymid
通过mid获取idGET_statuses_queryidmap[string]interface{}, *stringstatuses/queryid
批量获取指定微博的转发数评论数GET_statuses_countmap[string]interface{}, *[]StatusCountstatuses/count
获取当前登录用户关注的人
发给其的定向微博
GET_statuses_to_memap[string]interface{}, *Statusesstatuses/to_me
获取当前登录用户关注的人
发给其的定向微博ID列表
GET_statuses_to_me_idsmap[string]interface{}, *TimelineIDsstatuses/to_me/ids
转发一条微博信息POST_statuses_repostmap[string]interface{}, *Statusstatuses/repost
删除微博信息POST_statuses_destroymap[string]interface{}, *Statusstatuses/destroy
发布一条微博信息POST_statuses_updatemap[string]interface{}, *Statusstatuses/update
上传图片并发布一条微博POST_statuses_uploadmap[string]interface{}, *Statusstatusesstatuses/upload
发布一条微博
同时指定上传的图片或图片url
POST_statuses_upload_url_textmap[string]interface{}, *Statusstatuses/upload_url_text
屏蔽某条微博POST_statuses_filter_createmap[string]interface{}, *Statusstatuses/filter/create
屏蔽某个@我的微博
及后续由其转发引起的@提及
POST_statuses_mentions_shieldmap[string]interface{}, interface{}statuses/mentions/shield

####相关数据结构如下

type Statuses struct {
    Statuses        *[]Status     `json:"statuses"`
    Hasvisible      bool          `json:"hasvisible"`
    Previous_cursor int64         `json:"previous_cursor"`
    Next_cursor     int64         `json:"next_cursor"`
    Total_number    int64         `json:"total_number"`
    Marks           []interface{} `json:"marks,omitempty"`
}

type Reposts struct {
    Reposts         *[]Status     `json:"reposts"`
    Hasvisible      bool          `json:"hasvisible"`
    Previous_cursor int64         `json:"previous_cursor"`
    Next_cursor     int64         `json:"next_cursor"`
    Total_number    int64         `json:"total_number"`
    Marks           []interface{} `json:"marks,omitempty"`
}

type TimelineIDs struct {
    Statuses        []string      `json:"statuses"`
    Hasvisible      bool          `json:"hasvisible"`
    Previous_cursor int64         `json:"previous_cursor"`
    Next_cursor     int64         `json:"next_cursor"`
    Total_number    int64         `json:"total_number"`
    Marks           []interface{} `json:"marks,omitempty"`
}

type Status struct {
    Id                      int64       `json:"id"`
    Mid                     string      `json:"mid"`
    Idstr                   string      `json:"idstr"`
    Text                    string      `json:"text"`
    Source                  string      `json:"source"`
    Favorited               bool        `json:"favorited"`
    Truncated               bool        `json:"truncated"`
    In_reply_to_status_id   string      `json:"in_reply_to_status_id"`   //暂未支持
    In_reply_to_user_id     string      `json:"in_reply_to_user_id"`     //暂未支持
    In_reply_to_screen_name string      `json:"in_reply_to_screen_name"` //暂未支持
    Thumbnail_pic           string      `json:"thumbnail_pic"`
    Bmiddle_pic             string      `json:"bmiddle_pic"`
    Original_pic            string      `json:"original_pic"`
    Geo                     interface{} `json:"geo"` //{"type": "Point","coordinates": [21.231153,110.418708]}
    User                    *User       `json:"user,omitempty"`
    Retweeted_status        *Status     `json:"retweeted_status,omitempty"`
    Reposts_count           int64       `json:"reposts_count"`
    Comments_count          int64       `json:"comments_count"`
    Attitudes_count         int64       `json:"attitudes_count"`
    Mlevel                  int64       `json:"mlevel"`  //暂未支持
    Visible                 interface{} `json:"visible"` //{"type": 0,"list_id": 0}
    Created_at              string      `json:"created_at"`
}


type User struct {
    Id                 int64   `json:"id"`
    Idstr              string  `json:"idstr"`
    Screen_name        string  `json:"screen_name"`
    Name               string  `json:"name"`
    Province           string  `json:"province"`
    City               string  `json:"city"`
    Location           string  `json:"location"`
    Description        string  `json:"description"`
    Url                string  `json:"url"`
    Profile_image_url  string  `json:"profile_image_url"`
    Profile_url        string  `json:"profile_url"`
    Domain             string  `json:"domain"`
    Weihao             string  `json:"weihao"`
    Gender             string  `json:"gender"`
    Followers_count    int64   `json:"followers_count"`
    Friends_count      int64   `json:"friends_count"`
    Statuses_count     int64   `json:"statuses_count"`
    Favourites_count   int64   `json:"favourites_count"`
    Created_at         string  `json:"created_at"`
    Following          bool    `json:"following"`
    Allow_all_act_msg  bool    `json:"allow_all_act_msg"`
    Geo_enabled        bool    `json:"geo_enabled"`
    Verified           bool    `json:"verified"`
    Verified_type      int64   `json:"verified_type"`
    Remark             string  `json:"remark"`
    Status             *Status `json:"status,omitempty"`
    Allow_all_comment  bool    `json:"allow_all_comment"`
    Avatar_large       string  `json:"avatar_large"`
    Verified_reason    string  `json:"verified_reason"`
    Follow_me          bool    `json:"follow_me"`
    Online_status      int64   `json:"online_status"`
    Bi_followers_count int64   `json:"bi_followers_count"`
    Lang               string  `json:"lang"`
    Star               int64   `json:"star"`
    Mbtype             int64   `json:"mbtype"`
    Mbrank             int64   `json:"mbrank"`
    Block_word         int64   `json:"block_word"`
}

###用户

接口名方法参数对应API
获取用户信息GET_users_showmap[string]interface{}, *Userusers/show
通过个性域名获取用户信息GET_users_domain_showmap[string]interface{}, *Userusers/domain_show
批量获取用户的粉丝数、关注数、微博数GET_users_countsmap[string]interface{}, *UserCountsusers/counts

####相关数据结构如下 type UserCounts struct { Id int64 json:"id" Followers_count int64 json:"followers_count" Friends_count int64 json:"friends_count" Statuses_count int64 json:"statuses_count" Private_friends_count int64 json:"private_friends_count,omitempty" }

###评论

接口名方法参数对应API
获取某条微博的评论列表GET_comments_showmap[string]interface{}, *Commentscomments/show
我发出的评论列表GET_comments_by_memap[string]interface{}, *Commentscomments/by_me
我收到的评论列表GET_comments_to_memap[string]interface{}, *Commentscomments/to_me
获取用户发送及收到的评论列表GET_comments_timelinemap[string]interface{}, *Commentscomments/timeline
获取@到我的评论GET_comments_mentionsmap[string]interface{}, *Commentscomments/mentions
批量获取评论内容GET_comments_show_batchmap[string]interface{}, *Commentscomments/show_batch
评论一条微博POST_comments_createmap[string]interface{}, *Commentscomments/create
删除一条评论POST_comments_destroymap[string]interface{}, *Commentscomments/destroy
批量删除评论POST_comments_destroy_batchmap[string]interface{}, *[]Commentscomments/destroy_batch
回复一条评论POST_comments_replymap[string]interface{}, *Commentscomments/reply

####相关数据结构如下 type Comments struct { Comments *[]Comment json:"comments,omitempty" Hasvisible bool json:"hasvisible" Previous_cursor int64 json:"previous_cursor" Next_cursor int64 json:"next_cursor" Total_number int64 json:"total_number" Marks []interface{} json:"marks,omitempty" }

type Comment struct {
    Created_at    string   `json:"created_at"`
    Id            int64    `json:"id"`
    Text          string   `json:"text"`
    Source        string   `json:"source"`
    User          *User    `json:"user,omitempty"`
    Mid           string   `json:"mid"`
    Idstr         string   `json:"idstr"`
    Status        *Status  `json:"status,omitempty"`
    Reply_comment *Comment `json:"reply_comment,omitempty"`

}

###关系

接口名方法参数对应API
获取用户的关注列表GET_friendships_friendsmap[string]interface{}, *Friendshipsfriendships/friends
批量获取当前登录用户的关注人的备注信息GET_friendships_friends_remark_batchmap[string]interface{}, interface{}friendships/friends/remark_batch
获取共同关注人列表GET_friendships_friends_in_commonmap[string]interface{}, *Friendshipsfriendships/friends/in_common
获取双向关注列表GET_friendships_friends_bilateralmap[string]interface{}, *Friendshipsfriendships/friends/bilateral
获取双向关注UID列表GET_friendships_friends_bilateral_idsmap[string]interface{}, *FriendsIDSfriendships/friends/bilateral/ids
获取用户关注对象UID列表GET_friendships_friends_idsmap[string]interface{}, *FriendsIDSfriendships/friends/ids
获取用户粉丝列表GET_friendships_followersmap[string]interface{}, *Friendshipsfriendships/followers
获取用户粉丝UID列表GET_friendships_followers_idsmap[string]interface{}, *FriendsIDSfriendships/followers/ids
获取用户优质粉丝列表GET_friendships_followers_activemap[string]interface{}, *[]Userfriendships/followers/active
获取我的关注人中关注了指定用户的人GET_friendships_friends_chain_followersmap[string]interface{}, *Friendshipsfriendships/friends_chain/followers
获取两个用户关系的详细情况GET_friendships_showmap[string]interface{}, interface{}friendships/show
关注某用户POST_friendships_createmap[string]interface{}, *Userfriendships/create
取消关注某用户POST_friendships_destroymap[string]interface{}, *Userfriendships/destroy
移除当前登录用户的粉丝POST_friendships_followers_destroymap[string]interface{}, *Userfriendships/followers/destroy
更新关注人备注POST_friendships_remark_updatemap[string]interface{}, *Userfriendships/remark/update

type Friendships struct {
    Users           *[]User `json:"users"`
    Previous_cursor int64   `json:"previous_cursor,omitempty"`
    Next_cursor     int64   `json:"next_cursor,omitempty"`
    Total_number    int64   `json:"total_number,omitempty"`
}

type FriendsIDS struct {
    Ids             *[]int64 `json:"ids"`
    Previous_cursor int64    `json:"previous_cursor,omitempty"`
    Next_cursor     int64    `json:"next_cursor,omitempty"`
    Total_number    int64    `json:"total_number,omitempty"`
}