fanfou

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LibraryVersion represents this library version
	LibraryVersion = "1"

	// UserAgent represents this client User-Agent
	UserAgent = "github.com/mogita/go-fanfou v" + LibraryVersion

	// BaseURL represents Fanfou API base URL
	BaseURL = "https://api.fanfou.com/"

	// AuthBaseURL represents Fanfou API authorization base URL
	AuthBaseURL = "https://fanfou.com/"
)

Functions

func CheckAuthResponse

func CheckAuthResponse(err error, tag string) error

CheckAuthResponse checks the API response for error for the requests during authorization, and returns it if present.

A response is considered an error if it has non StatusOK code.

func CheckResponse

func CheckResponse(res *http.Response) error

CheckResponse checks the API response for error, and returns it if present. A response is considered an error if it has non StatusOK code.

Types

type AccessToken

type AccessToken struct {
	Token          string
	Secret         string
	AdditionalData map[string]string
}

AccessToken provides the structure as oauth.AccessToken

type AccountOptParams

type AccountOptParams struct {
	URL         string
	Location    string
	Description string
	Name        string
	Email       string
	Mode        string
	Format      string
	NotifyNum   int64
}

AccountOptParams specifies the optional params for account API

type AccountService

type AccountService struct {
	// contains filtered or unexported fields
}

AccountService handles communication with the account related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#account

func (*AccountService) Notification

func (s *AccountService) Notification() (*NotificationResult, *string, error)

Notification shall get the unread counts for mentions, direct messages and friend requests of the current user

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/account.notification

func (*AccountService) NotifyNum

func (s *AccountService) NotifyNum() (*NotifyNumResult, *string, error)

NotifyNum shall get new notification number of the current app

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/account.notify-num

func (*AccountService) RateLimitStatus

func (s *AccountService) RateLimitStatus() (*RateLimitStatusResult, *string, error)

RateLimitStatus shall get the API rate limit information of the current user

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/account.rate-limit-status

func (*AccountService) UpdateNotifyNum

func (s *AccountService) UpdateNotifyNum(opt *AccountOptParams) (*NotifyNumResult, *string, error)

UpdateNotifyNum shall update the notification number of the current app

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/account.update-notify-num

func (*AccountService) UpdateProfile

func (s *AccountService) UpdateProfile(opt *AccountOptParams) (*UserResult, *string, error)

UpdateProfile shall update the current user's profile

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/account.update-profile

func (*AccountService) UpdateProfileImage

func (s *AccountService) UpdateProfileImage(filePath string, opt *AccountOptParams) (*UserResult, *string, error)

UpdateProfileImage shall update the current user's profile image

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/account.update-profile-image

func (*AccountService) VerifyCredentials

func (s *AccountService) VerifyCredentials(opt *AccountOptParams) (*UserResult, *string, error)

VerifyCredentials shall verify the current user's username and password

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/account.verify-credentials

type BlocksOptParams

type BlocksOptParams struct {
	ID      string
	SinceID string
	MaxID   string
	Page    int64
	Count   int64
	Mode    string
	Format  string
}

BlocksOptParams specifies the optional params for blocks API

type BlocksService

type BlocksService struct {
	// contains filtered or unexported fields
}

BlocksService handles communication with the blocks related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#blocks

func (*BlocksService) Blocking

func (s *BlocksService) Blocking(opt *BlocksOptParams) ([]UserResult, *string, error)

Blocking shall get the list of blocked user details

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/blocks.blocking

func (*BlocksService) Create

func (s *BlocksService) Create(ID string, opt *BlocksOptParams) (*UserResult, *string, error)

Create shall block a specified user

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/blocks.create

func (*BlocksService) Destroy

func (s *BlocksService) Destroy(ID string, opt *BlocksOptParams) (*UserResult, *string, error)

Destroy shall unblock a specified user

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/blocks.destroy

func (*BlocksService) Exists

func (s *BlocksService) Exists(ID string, opt *BlocksOptParams) (*UserResult, *string, error)

Exists shall check whether the specified user is blocked by the current user

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/blocks.exists

func (*BlocksService) IDs

func (s *BlocksService) IDs() (*UserIDs, *string, error)

IDs shall get the list of blocked user IDs

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/blocks.ids

type Client

type Client struct {

	// Base URL for API requests.
	BaseURL *url.URL

	// UserAgent agent used when communicating with Fanfou API.
	UserAgent string

	// Application consumer key
	ConsumerKey string

	// Application consumer secret
	ConsumerSecret string

	// Services used for talking to different parts of the API.
	Users          *UsersService
	Statuses       *StatusesService
	Search         *SearchService
	Trends         *TrendsService
	Blocks         *BlocksService
	Account        *AccountService
	SavedSearches  *SavedSearchesService
	Photos         *PhotosService
	Followers      *FollowersService
	Favorites      *FavoritesService
	Friends        *FriendsService
	Friendships    *FriendshipsService
	DirectMessages *DirectMessagesService

	// Temporary Response
	Response *Response
	// contains filtered or unexported fields
}

A Client manages communication with the Fanfou API.

func NewClient

func NewClient(consumerKey, consumerSecret string) *Client

NewClient returns a new Fanfou API client.

func (*Client) AuthorizeClient

func (c *Client) AuthorizeClient(requestToken *RequestToken, verificationCode string) (*AccessToken, error)

AuthorizeClient completes the OAuth authorization to the client so it can make requests to protected contents

If you use "oob" mode, you also need to provide the verificationCode

func (*Client) AuthorizeClientWithAccessTokens

func (c *Client) AuthorizeClientWithAccessTokens(accessToken, accessTokenSecret string, additionalData map[string]string) error

AuthorizeClientWithAccessTokens completes the OAuth authorization to the client with provided access token and secret so it can make requests to protected contents

func (*Client) AuthorizeClientWithXAuth

func (c *Client) AuthorizeClientWithXAuth(username, password string) error

AuthorizeClientWithXAuth completes the OAuth authorization to the client with XAuth so it can make requests to protected contents

This method is a simplified OAuth process, taking username and password to authorize the client, without the need to redirect to the web UI

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the API response. The API response is decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.

func (*Client) GetRequestTokenAndURL

func (c *Client) GetRequestTokenAndURL(callbackURL string) (*RequestToken, string, error)

GetRequestTokenAndURL returns the request token and the login url for authorizing this token.

"callbackURL" can be "oob" if you're running your application outside a browser.

Read more about "oob" authorization at: https://github.com/mogita/FanFouAPIDoc/wiki/Oauth#%E4%BD%BF%E7%94%A8pin%E7%A0%81%E8%8E%B7%E5%BE%97%E6%8E%88%E6%9D%83

func (*Client) NewRequest

func (c *Client) NewRequest(method, uri string, body string) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in uri, in which case it is resolved relative to the BaseURL of the Client.

Relative URLs should always be specified without a preceding slash.

func (*Client) NewUploadRequest

func (c *Client) NewUploadRequest(method, uri string, params map[string]string, fileParamName, filePath string) (*http.Request, error)

NewUploadRequest creates an API request dedicated to image uploads.

A relative URL can be provided in uri, in which case it is resolved relative to the BaseURL of the Client.

Relative URLs should always be specified without a preceding slash.

type DirectMessageConversationListItem

type DirectMessageConversationListItem struct {
	Dm      *DirectMessageResult `json:"dm"`
	Otherid string               `json:"otherid"`
	MsgNum  int64                `json:"msg_num"`
	NewConv bool                 `json:"new_conv"`
}

DirectMessageConversationListItem specifies Fanfou's direct messages conversation list item data structure

type DirectMessageConversationListResult

type DirectMessageConversationListResult []DirectMessageConversationListItem

DirectMessageConversationListResult specifies Fanfou's direct messages conversation list data structure

type DirectMessageResult

type DirectMessageResult struct {
	ID                  string               `json:"id,omitempty"`
	Text                string               `json:"text,omitempty"`
	SenderID            string               `json:"sender_id,omitempty"`
	RecipientID         string               `json:"recipient_id,omitempty"`
	CreatedAt           string               `json:"created_at,omitempty"`
	SenderScreenName    string               `json:"sender_screen_name,omitempty"`
	RecipientScreenName string               `json:"recipient_screen_name,omitempty"`
	Sender              *UserResult          `json:"sender,omitempty"`
	Recipient           *UserResult          `json:"recipient,omitempty"`
	InReplyTo           *DirectMessageResult `json:"in_reply_to,omitempty"`
}

DirectMessageResult specifies Fanfou's direct messages structure

type DirectMessagesOptParams

type DirectMessagesOptParams struct {
	ID          string
	InReplyToID string
	Page        int64
	Count       int64
	MaxID       string
	SinceID     string
	Mode        string
	Format      string
}

DirectMessagesOptParams specifies the optional params for direct messages API

type DirectMessagesService

type DirectMessagesService struct {
	// contains filtered or unexported fields
}

DirectMessagesService handles communication with the direct messages related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#direct-messages

func (*DirectMessagesService) Conversation

Conversation shall get the conversation of direct messages between the specified user and the current user

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/direct-messages.conversation

func (*DirectMessagesService) ConversationList

ConversationList shall get the conversation list of the direct messages of the current user

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/direct-messages.conversation-list

func (*DirectMessagesService) Destroy

Destroy shall delete a specified direct message

ID represents the direct message ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/direct-messages.destroy

func (*DirectMessagesService) Inbox

Inbox shall get the latest direct messages in the inbox

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/direct-messages.inbox

func (*DirectMessagesService) New

New shall send a new direct message to the specified user

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/direct-messages.new

func (*DirectMessagesService) Sent

Sent shall get the sent direct messages by the current user

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/direct-messages.sent

type ErrorResponse

type ErrorResponse Response

ErrorResponse represents a Response which contains an error

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

Error implements the error interface

func (*ErrorResponse) GetFanfouError

func (r *ErrorResponse) GetFanfouError() string

GetFanfouError gets the error message returned by Fanfou API if presented in the response

func (*ErrorResponse) GetRequestMethod

func (r *ErrorResponse) GetRequestMethod() string

GetRequestMethod gets the request method of the error response

func (*ErrorResponse) GetRequestURL

func (r *ErrorResponse) GetRequestURL() string

GetRequestURL gets the request url of the error response

func (*ErrorResponse) GetStatusCode

func (r *ErrorResponse) GetStatusCode() string

GetStatusCode gets the status code of the error response

type FavoritesOptParams

type FavoritesOptParams struct {
	ID     string
	Page   int64
	Count  int64
	Mode   string
	Format string
}

FavoritesOptParams specifies the optional params for favorites API

type FavoritesService

type FavoritesService struct {
	// contains filtered or unexported fields
}

FavoritesService handles communication with the followers related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#followers

func (*FavoritesService) Create

Create shall create a favorite

ID represents the status ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/favorites.create

func (*FavoritesService) Destroy

Destroy shall delete a favorite

ID represents the status ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/favorites.destroy

func (*FavoritesService) IDs

IDs shall get favorites of the specified user, or of the current user if no ID specified

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/favorites

type FollowersOptParams

type FollowersOptParams struct {
	ID    string
	Page  int64
	Count int64
}

FollowersOptParams specifies the optional params for followers API

type FollowersService

type FollowersService struct {
	// contains filtered or unexported fields
}

FollowersService handles communication with the followers related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#followers

func (*FollowersService) IDs

IDs shall get follower IDs of the specified user, or of the current user if no ID specified

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/followers.ids

type FriendsOptParams

type FriendsOptParams struct {
	ID    string
	Page  int64
	Count int64
}

FriendsOptParams specifies the optional params for friends API

type FriendsService

type FriendsService struct {
	// contains filtered or unexported fields
}

FriendsService handles communication with the friends related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#friends

func (*FriendsService) IDs

func (s *FriendsService) IDs(opt *FriendsOptParams) (*UserIDs, *string, error)

IDs shall get friends IDs of the specified user, or of the current user if no ID specified

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/friends.ids

type FriendshipsOptParams

type FriendshipsOptParams struct {
	ID     string
	Page   int64
	Count  int64
	Mode   string
	Format string
}

FriendshipsOptParams specifies the optional params for friendships API

type FriendshipsService

type FriendshipsService struct {
	// contains filtered or unexported fields
}

FriendshipsService handles communication with the friendships related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#friendships

func (*FriendshipsService) Accept

Accept shall accept the friendship request from the specified user

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/friendships.accept

func (*FriendshipsService) Create

Create shall add the specified user as a friend (follow)

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/friendships.create

func (*FriendshipsService) Deny

Deny shall reject the friendship request from the specified user

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/friendships.deny

func (*FriendshipsService) Destroy

Destroy shall unfriend the specified user (unfollow)

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/friendships.destroy

func (*FriendshipsService) Exists

func (s *FriendshipsService) Exists(userA, userB string) (bool, *string, error)

Exists shall check if user A follows user B.

"userA" and "userB" can be either the user ID or login name

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/friendships.exists

func (*FriendshipsService) Requests

Requests shall get the list of friendship requests (other users' requests to follow the current user)

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/friendships.requests

func (*FriendshipsService) Show

Show shall get the friendship between two users.

Note: Please either supply both a source and a target.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/friendships.show

type FriendshipsShowOptParams

type FriendshipsShowOptParams struct {
	SourceLoginName string
	TargetLoginName string
	SourceID        string
	TargetID        string
}

FriendshipsShowOptParams specifies the params specifically for friendship show API

type FriendshipsShowResult

type FriendshipsShowResult struct {
	Relationship *RelationshipResult `json:"relationship,omitempty"`
}

FriendshipsShowResult specifies Fanfou's friendship show structure

type NotificationResult

type NotificationResult struct {
	Mentions       int64 `json:"mentions,omitempty"`
	DirectMessages int64 `json:"direct_messages,omitempty"`
	FriendRequests int64 `json:"friend_requests,omitempty"`
}

NotificationResult is the structure of notification

type NotifyNumResult

type NotifyNumResult struct {
	Result    string `json:"result,omitempty"`
	NotifyNum int64  `json:"notify_num,omitempty"`
}

NotifyNumResult is the structure of notify number

type PhotosOptParams

type PhotosOptParams struct {
	ID       string
	Status   string
	Source   string
	Location string
	SinceID  string
	MaxID    string
	Page     int64
	Count    int64
	Mode     string
	Format   string
}

PhotosOptParams specifies the optional params for search API

type PhotosService

type PhotosService struct {
	// contains filtered or unexported fields
}

PhotosService handles communication with the saved photos related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#photos

func (*PhotosService) Upload

func (s *PhotosService) Upload(filePath string, opt *PhotosOptParams) (*StatusResult, *string, error)

Upload shall send a new status with a photo

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/photos.upload

func (*PhotosService) UserTimeline

func (s *PhotosService) UserTimeline(opt *PhotosOptParams) ([]StatusResult, *string, error)

UserTimeline shall get photos of the specified user, or of the current user if no ID specified

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/photos.user-timeline

type RateLimitStatusResult

type RateLimitStatusResult struct {
	ResetTime          string `json:"reset_time,omitempty"`
	RemainingHits      int64  `json:"remaining_hits,omitempty"`
	HourlyLimit        int64  `json:"hourly_limit,omitempty"`
	ResetTimeInSeconds int64  `json:"reset_time_in_seconds,omitempty"`
}

RateLimitStatusResult is the structure of rate limit

type RelationshipItem

type RelationshipItem struct {
	ID                   string `json:"id,omitempty"`
	ScreenName           string `json:"screen_name,omitempty"`
	Following            string `json:"following,omitempty"`
	FollowedBy           string `json:"followed_by,omitempty"`
	NotificationsEnabled string `json:"notifications_enabled,omitempty"`
	Blocking             string `json:"blocking,omitempty"`
}

RelationshipItem is the structure of relationship item

type RelationshipResult

type RelationshipResult struct {
	Source *RelationshipItem `json:"source,omitempty"`
	Target *RelationshipItem `json:"target,omitempty"`
}

RelationshipResult is the structure of relationship

type RequestToken

type RequestToken struct {
	Token  string
	Secret string
}

RequestToken provides the structure as oauth.RequestToken

type Response

type Response struct {
	Response   *http.Response // HTTP response
	BodyStrPtr *string
	Data       interface{}
	Meta       *ResponseMeta
}

Response specifies Fanfou's response structure.

type ResponseMeta

type ResponseMeta struct {
	Request string `json:"request,omitempty" xml:"request"`
	Error   string `json:"error,omitempty" xml:"error"`
}

ResponseMeta represents information about the response. If all goes well, only a Code key with value 200 will present. However, sometimes things go wrong, and in that case ErrorType and ErrorMessage are present.

type SavedSearchResult

type SavedSearchResult struct {
	ID        int64  `json:"id,omitempty"`
	Query     string `json:"query,omitempty"`
	Name      string `json:"name,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
}

SavedSearchResult is the structure of saved search

type SavedSearchesService

type SavedSearchesService struct {
	// contains filtered or unexported fields
}

SavedSearchesService handles communication with the saved searches related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#saved-searches

func (*SavedSearchesService) Create

func (s *SavedSearchesService) Create(query string) (*SavedSearchResult, *string, error)

Create shall create a saved search

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/saved-searches.create

func (*SavedSearchesService) Destroy

Destroy shall delete a saved search

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/saved-searches.destroy

func (*SavedSearchesService) List

List shall get the list of the current user's saved searches

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/saved-searches.list

func (*SavedSearchesService) Show

Show shall get a saved searches detail

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/saved-searches.show

type SearchOptParams

type SearchOptParams struct {
	ID      string
	SinceID string
	MaxID   string
	Page    int64
	Count   int64
	Mode    string
	Format  string
}

SearchOptParams specifies the optional params for search API

type SearchService

type SearchService struct {
	// contains filtered or unexported fields
}

SearchService handles communication with the search related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#search

func (*SearchService) PublicTimeline

func (s *SearchService) PublicTimeline(q string, opt *SearchOptParams) ([]StatusResult, *string, error)

PublicTimeline shall search for statuses of the whole platform

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/search.public-timeline

func (*SearchService) UserTimeline

func (s *SearchService) UserTimeline(q string, opt *SearchOptParams) ([]StatusResult, *string, error)

UserTimeline shall search for statuses of the specified user, or of the current user if no ID specified

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/search.user-timeline

func (*SearchService) Users

Users shall search for users of the whole platform

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/search.users

type SearchUsersResult

type SearchUsersResult struct {
	TotalNumber int64        `json:"total_number,omitempty"`
	Users       []UserResult `json:"users,omitempty"`
}

SearchUsersResult is the structure of search users

type StatusResult

type StatusResult struct {
	CreatedAt           string        `json:"created_at,omitempty"`
	ID                  string        `json:"id,omitempty"`
	Rawid               int64         `json:"rawid,omitempty"`
	Text                string        `json:"text,omitempty"`
	Source              string        `json:"source,omitempty"`
	Location            string        `json:"location,omitempty"`
	Truncated           bool          `json:"truncated,omitempty"`
	InReplyToStatusID   string        `json:"in_reply_to_status_id,omitempty"`
	InReplyToUserID     string        `json:"in_reply_to_user_id,omitempty"`
	InReplyToScreenName string        `json:"in_reply_to_screen_name,omitempty"`
	RepostStatusID      string        `json:"repost_status_id,omitempty"`
	RepostStatus        *StatusResult `json:"repost_status,omitempty"`
	RepostUserID        string        `json:"repost_user_id,omitempty"`
	RepostScreenName    string        `json:"repost_screen_name,omitempty"`
	Favorited           bool          `json:"favorited,omitempty"`
	User                struct {
		ID                        string `json:"id,omitempty"`
		Name                      string `json:"name,omitempty"`
		ScreenName                string `json:"screen_name,omitempty"`
		Location                  string `json:"location,omitempty"`
		Gender                    string `json:"gender,omitempty"`
		Birthday                  string `json:"birthday,omitempty"`
		Description               string `json:"description,omitempty"`
		ProfileImageURL           string `json:"profile_image_url,omitempty"`
		ProfileImageURLLarge      string `json:"profile_image_url_large,omitempty"`
		URL                       string `json:"url,omitempty"`
		Protected                 bool   `json:"protected,omitempty"`
		FollowersCount            int64  `json:"followers_count,omitempty"`
		FriendsCount              int64  `json:"friends_count,omitempty"`
		FavouritesCount           int64  `json:"favourites_count,omitempty"`
		StatusesCount             int64  `json:"statuses_count,omitempty"`
		Following                 bool   `json:"following,omitempty"`
		Notifications             bool   `json:"notifications,omitempty"`
		CreatedAt                 string `json:"created_at,omitempty"`
		UtcOffset                 int64  `json:"utc_offset,omitempty"`
		ProfileBackgroundColor    string `json:"profile_background_color,omitempty"`
		ProfileTextColor          string `json:"profile_text_color,omitempty"`
		ProfileLinkColor          string `json:"profile_link_color,omitempty"`
		ProfileSidebarFillColor   string `json:"profile_sidebar_fill_color,omitempty"`
		ProfileSidebarBorderColor string `json:"profile_sidebar_border_color,omitempty"`
		ProfileBackgroundImageURL string `json:"profile_background_image_url,omitempty"`
		ProfileBackgroundTile     bool   `json:"profile_background_tile,omitempty"`
	} `json:"user,omitempty"`
	Photo struct {
		Imageurl string `json:"imageurl,omitempty"`
		Thumburl string `json:"thumburl,omitempty"`
		Largeurl string `json:"largeurl,omitempty"`
	} `json:"photo,omitempty"`
}

StatusResult specifies Fanfou's statuses data structure

type StatusesOptParams

type StatusesOptParams struct {
	ID                string
	SinceID           string
	MaxID             string
	Page              int64
	Count             int64
	InReplyToStatusID string
	InReplyToUserID   string
	RepostStatusID    string
	Source            string
	Mode              string
	Format            string
	Location          string
}

StatusesOptParams specifies the optional params for statuses API

type StatusesService

type StatusesService struct {
	// contains filtered or unexported fields
}

StatusesService handles communication with the statuses related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#statuses

func (*StatusesService) ContextTimeline

func (s *StatusesService) ContextTimeline(ID string, opt *StatusesOptParams) ([]StatusResult, *string, error)

ContextTimeline shall get contextual statuses of a given status ID

ID represents the status ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/statuses.context-timeline

func (*StatusesService) Destroy

func (s *StatusesService) Destroy(ID string, opt *StatusesOptParams) (*StatusResult, *string, error)

Destroy shall delete a status by ID

ID represents the status ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/statuses.destroy

func (*StatusesService) Followers

func (s *StatusesService) Followers(opt *StatusesOptParams) ([]UserResult, *string, error)

Followers shall get followers of the specified user, or of the current user if not specified

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/statuses.followers

func (*StatusesService) Friends

func (s *StatusesService) Friends(opt *StatusesOptParams) ([]UserResult, *string, error)

Friends shall get friends of the specified user, or of the current user if not specified

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/statuses.friends

func (*StatusesService) HomeTimeline

func (s *StatusesService) HomeTimeline(opt *StatusesOptParams) ([]StatusResult, *string, error)

HomeTimeline shall get statuses of the specified user and his/her followed users or of the current user if no ID specified

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/statuses.home-timeline

func (*StatusesService) Mentions

func (s *StatusesService) Mentions(opt *StatusesOptParams) ([]StatusResult, *string, error)

Mentions shall get latest statuses mentioning the current user

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/statuses.mentions

func (*StatusesService) PublicTimeline

func (s *StatusesService) PublicTimeline(opt *StatusesOptParams) ([]StatusResult, *string, error)

PublicTimeline shall get latest public statuses

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/statuses.public-timeline

func (*StatusesService) Replies

func (s *StatusesService) Replies(opt *StatusesOptParams) ([]StatusResult, *string, error)

Replies shall get latest replies to the current user

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/statuses.replies

func (*StatusesService) Show

Show shall get a status by ID

ID represents the status ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/statuses.show

func (*StatusesService) Update

func (s *StatusesService) Update(status string, opt *StatusesOptParams) (*StatusResult, *string, error)

Update shall post a new status

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/statuses.update

func (*StatusesService) UserTimeline

func (s *StatusesService) UserTimeline(opt *StatusesOptParams) ([]StatusResult, *string, error)

UserTimeline shall get statuses of the specified user or of the current user if no ID specified

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/statuses.user-timeline

type Tag

type Tag string

Tag specifies Fanfou's tags data structure

type TrendsItem

type TrendsItem struct {
	Name  string `json:"name,omitempty"`
	Query string `json:"query,omitempty"`
	URL   string `json:"url,omitempty"`
}

TrendsItem specifies Fanfou's trends item data structure

type TrendsResult

type TrendsResult struct {
	AsOf   string        `json:"as_of,omitempty"`
	Trends []*TrendsItem `json:"trends,omitempty"`
}

TrendsResult specifies Fanfou's trends data structure

type TrendsService

type TrendsService struct {
	// contains filtered or unexported fields
}

TrendsService handles communication with the trends related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#trends

func (*TrendsService) List

func (s *TrendsService) List() (*TrendsResult, *string, error)

List shall get information about the most recent trends.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/trends.list

type UserIDs

type UserIDs []string

UserIDs is the structure of user ID slices

type UserResult

type UserResult struct {
	ID                        string        `json:"id,omitempty"`
	Name                      string        `json:"name,omitempty"`
	UniqueID                  string        `json:"unique_id,omitempty"`
	ScreenName                string        `json:"screen_name,omitempty"`
	Location                  string        `json:"location,omitempty"`
	Gender                    string        `json:"gender,omitempty"`
	Birthday                  string        `json:"birthday,omitempty"`
	Description               string        `json:"description,omitempty"`
	ProfileImageURL           string        `json:"profile_image_url,omitempty"`
	ProfileImageURLLarge      string        `json:"profile_image_url_large,omitempty"`
	URL                       string        `json:"url,omitempty"`
	Protected                 bool          `json:"protected,omitempty"`
	FollowersCount            int64         `json:"followers_count,omitempty"`
	FriendsCount              int64         `json:"friends_count,omitempty"`
	FavouritesCount           int64         `json:"favourites_count,omitempty"`
	StatusesCount             int64         `json:"statuses_count,omitempty"`
	Following                 bool          `json:"following,omitempty"`
	Notifications             bool          `json:"notifications,omitempty"`
	CreatedAt                 string        `json:"created_at,omitempty"`
	UtcOffset                 int64         `json:"utc_offset,omitempty"`
	ProfileBackgroundColor    string        `json:"profile_background_color,omitempty"`
	ProfileTextColor          string        `json:"profile_text_color,omitempty"`
	ProfileLinkColor          string        `json:"profile_link_color,omitempty"`
	ProfileSidebarFillColor   string        `json:"profile_sidebar_fill_color,omitempty"`
	ProfileSidebarBorderColor string        `json:"profile_sidebar_border_color,omitempty"`
	ProfileBackgroundImageURL string        `json:"profile_background_image_url,omitempty"`
	ProfileBackgroundTile     bool          `json:"profile_background_tile,omitempty"`
	ProfileImageOrigin        string        `json:"profile_image_origin,omitempty"`
	ProfileImageOriginLarge   string        `json:"profile_image_origin_large,omitempty"`
	SignName                  string        `json:"sign_name,omitempty"`
	Status                    *StatusResult `json:"status,omitempty"`
}

UserResult specifies Fanfou's users data structure

type UsersOptParams

type UsersOptParams struct {
	ID     string
	Page   int64
	Count  int64
	Mode   string
	Format string
}

UsersOptParams specifies the optional params for statuses API

type UsersService

type UsersService struct {
	// contains filtered or unexported fields
}

UsersService handles communication with the users related methods of the Fanfou API.

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/API-Endpoints#users

func (*UsersService) CancelRecommendation

func (s *UsersService) CancelRecommendation(ID string, opt *UsersOptParams) (*UserResult, *string, error)

CancelRecommendation shall dismiss user recommended by Fanfou by ID

ID represents the user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/users.cancel-recommendation

func (*UsersService) Followers

func (s *UsersService) Followers(opt *UsersOptParams) ([]UserResult, *string, error)

Followers shall get recently logged in followers

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/users.followers

func (*UsersService) Friends

func (s *UsersService) Friends(opt *UsersOptParams) ([]UserResult, *string, error)

Friends shall get recently logged in friends

ID represents user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/users.friends

func (*UsersService) Recommendation

func (s *UsersService) Recommendation(opt *UsersOptParams) ([]UserResult, *string, error)

Recommendation shall get users recommended by Fanfou

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/users.recommendation

func (*UsersService) Show

func (s *UsersService) Show(opt *UsersOptParams) (*UserResult, *string, error)

Show shall get a user by ID, or the current user if not specified

ID represents user ID

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/users.show

func (*UsersService) TagList

func (s *UsersService) TagList(opt *UsersOptParams) ([]Tag, *string, error)

TagList shall get tags of a specified user or of the current user if not specified

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/users.tag-list

func (*UsersService) Tagged

func (s *UsersService) Tagged(Tag string, opt *UsersOptParams) ([]UserResult, *string, error)

Tagged shall get users by tag

Fanfou API docs: https://github.com/mogita/FanFouAPIDoc/wiki/users.tagged

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL