Skip to content
violetgo edited this page Dec 9, 2013 · 2 revisions

Welcome to the weigo wiki!

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

###目前未完成的功能有

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

###微博

接口名 方法 参数 对应API
获取最新的公共微博 GET_statuses_public_timeline map[string]interface{}, *Statuses statuses/public_timeline
获取用户发布的微博 GET_statuses_user_timeline map[string]interface{}, *Statuses statuses/user_timeline
获取当前登录用户
及其所关注用户的最新微博
GET_statuses_friends_timeline map[string]interface{}, *Statuses statuses/friends_timeline
获取当前登录用户
及其所关注用户的最新微博
GET_statuses_home_timeline map[string]interface{}, *Statuses statuses/home_timeline
返回一条原创微博的最新转发微博 GET_statuses_repost_timeline map[string]interface{}, *Reposts statusesstatuses/repost_timeline
批量获取指定的一批用户的微博列表 GET_statuses_timeline_batch map[string]interface{}, *Statuses statuses/timeline_batch
获取用户发布的微博的ID GET_statuses_user_timeline_ids map[string]interface{}, *TimelineIDs statuses/repost_timeline/ids
获取一条原创微博的最新转发微博的ID GET_statuses_repost_timeline_ids map[string]interface{}, *TimelineIDs statuses/repost_timeline/ids
获取当前登录用户及其所关注用户的最新微博的ID GET_statuses_friends_timeline_ids map[string]interface{}, *TimelineIDs statuses/friends_timeline/ids
返回用户转发的最新微博 GET_statuses_repost_by_me map[string]interface{}, *Statuses statuses/repost_by_me
获取@当前用户的最新微博 GET_statuses_mentions map[string]interface{}, *Statuses statusesstatuses/mentions
获取@当前用户的最新微博的ID GET_statuses_mentions_ids map[string]interface{}, *TimelineIDs statuses/mentions/ids
获取双向关注用户的最新微博 GET_statuses_bilateral_timeline map[string]interface{}, *Statuses statuses/bilateral_timeline
根据ID获取单条微博信息 GET_statuses_show map[string]interface{}, *Status statuses/show
根据微博ID批量获取微博信息 GET_statuses_show_batch map[string]interface{}, *Statuses statuses/show_batch
通过id获取mid GET_statuses_querymid map[string]interface{}, *string statuses/querymid
通过mid获取id GET_statuses_queryid map[string]interface{}, *string statuses/queryid
批量获取指定微博的转发数评论数 GET_statuses_count map[string]interface{}, *[]StatusCount statuses/count
获取当前登录用户关注的人
发给其的定向微博
GET_statuses_to_me map[string]interface{}, *Statuses statuses/to_me
获取当前登录用户关注的人
发给其的定向微博ID列表
GET_statuses_to_me_ids map[string]interface{}, *TimelineIDs statuses/to_me/ids
转发一条微博信息 POST_statuses_repost map[string]interface{}, *Status statuses/repost
删除微博信息 POST_statuses_destroy map[string]interface{}, *Status statuses/destroy
发布一条微博信息 POST_statuses_update map[string]interface{}, *Status statuses/update
上传图片并发布一条微博 POST_statuses_upload map[string]interface{}, *Status statusesstatuses/upload
发布一条微博
同时指定上传的图片或图片url
POST_statuses_upload_url_text map[string]interface{}, *Status statuses/upload_url_text
屏蔽某条微博 POST_statuses_filter_create map[string]interface{}, *Status statuses/filter/create
屏蔽某个@我的微博
及后续由其转发引起的@提及
POST_statuses_mentions_shield map[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_show map[string]interface{}, *User users/show
通过个性域名获取用户信息 GET_users_domain_show map[string]interface{}, *User users/domain_show
批量获取用户的粉丝数、关注数、微博数 GET_users_counts map[string]interface{}, *UserCounts users/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_show map[string]interface{}, *Comments comments/show
我发出的评论列表 GET_comments_by_me map[string]interface{}, *Comments comments/by_me
我收到的评论列表 GET_comments_to_me map[string]interface{}, *Comments comments/to_me
获取用户发送及收到的评论列表 GET_comments_timeline map[string]interface{}, *Comments comments/timeline
获取@到我的评论 GET_comments_mentions map[string]interface{}, *Comments comments/mentions
批量获取评论内容 GET_comments_show_batch map[string]interface{}, *Comments comments/show_batch
评论一条微博 POST_comments_create map[string]interface{}, *Comments comments/create
删除一条评论 POST_comments_destroy map[string]interface{}, *Comments comments/destroy
批量删除评论 POST_comments_destroy_batch map[string]interface{}, *[]Comments comments/destroy_batch
回复一条评论 POST_comments_reply map[string]interface{}, *Comments comments/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_friends map[string]interface{}, *Friendships friendships/friends
批量获取当前登录用户的关注人的备注信息 GET_friendships_friends_remark_batch map[string]interface{}, interface{} friendships/friends/remark_batch
获取共同关注人列表 GET_friendships_friends_in_common map[string]interface{}, *Friendships friendships/friends/in_common
获取双向关注列表 GET_friendships_friends_bilateral map[string]interface{}, *Friendships friendships/friends/bilateral
获取双向关注UID列表 GET_friendships_friends_bilateral_ids map[string]interface{}, *FriendsIDS friendships/friends/bilateral/ids
获取用户关注对象UID列表 GET_friendships_friends_ids map[string]interface{}, *FriendsIDS friendships/friends/ids
获取用户粉丝列表 GET_friendships_followers map[string]interface{}, *Friendships friendships/followers
获取用户粉丝UID列表 GET_friendships_followers_ids map[string]interface{}, *FriendsIDS friendships/followers/ids
获取用户优质粉丝列表 GET_friendships_followers_active map[string]interface{}, *[]User friendships/followers/active
获取我的关注人中关注了指定用户的人 GET_friendships_friends_chain_followers map[string]interface{}, *Friendships friendships/friends_chain/followers
获取两个用户关系的详细情况 GET_friendships_show map[string]interface{}, interface{} friendships/show
关注某用户 POST_friendships_create map[string]interface{}, *User friendships/create
取消关注某用户 POST_friendships_destroy map[string]interface{}, *User friendships/destroy
移除当前登录用户的粉丝 POST_friendships_followers_destroy map[string]interface{}, *User friendships/followers/destroy
更新关注人备注 POST_friendships_remark_update map[string]interface{}, *User friendships/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"`
}
Clone this wiki locally