Documentation
¶
Index ¶
- Variables
- type APIAlerts
- func (a *APIAlerts) AddAllAsFan() error
- func (a *APIAlerts) AddAsFan(userId int64) error
- func (a *APIAlerts) AddAsFriend(userId int64) error
- func (a *APIAlerts) DenyAsFriend(userId int64) error
- func (a *APIAlerts) GetActive() ([]any, error)
- func (a *APIAlerts) GetHistory() ([]any, error)
- func (a *APIAlerts) RemoveNotification(userId int64) error
- type APIPolling
- type APIProfile
- type APIRealtime
- type APIResponses
- func (u *APIResponses) Get(plurkId int64, fromResoponse int64, count int64) (*Responses, error)
- func (u *APIResponses) GetById(plurkId int64, fromResoponseId int64, count int64) (*Responses, error)
- func (u *APIResponses) ResponseAdd(plurkId int64, qualifier string, content string) (*Response, error)
- func (u *APIResponses) ResponseDelete(responseId int64, plurkId int64) error
- type APITimeline
- func (u *APITimeline) FavoritePlurks(plurkIds []int64) error
- func (u *APITimeline) GetPlurk(plurkId int64) (*Plurk, error)
- func (u *APITimeline) GetPlurkCountsInfo(plurkId int64) (*PlurkCountsInfo, error)
- func (u *APITimeline) GetPlurks(optionSets ...Options) (*Plurks, error)
- func (u *APITimeline) GetPublicPlurks(optionSets ...Options) (*Plurks, error)
- func (u *APITimeline) GetUnreadPlurks(optionSets ...Options) (*Plurks, error)
- func (u *APITimeline) MarkAsRead(plurkIds []int64) error
- func (u *APITimeline) MutePlurks(plurkIds []int64) error
- func (u *APITimeline) PlurkAdd(qualifier string, content string, optionSets ...Options) (*Plurk, error)
- func (u *APITimeline) PlurkDelete(plurkId int64) error
- func (u *APITimeline) Replurk(plurkIds []int64) error
- func (u *APITimeline) UnfavoritePlurks(plurkIds []int64) error
- func (u *APITimeline) UnmutePlurks(plurkIds []int64) error
- func (u *APITimeline) Unreplurk(plurkIds []int64) error
- type APIUsers
- type AlertsEvent
- type AlertsFriendshipAcceptedEvent
- type AlertsFriendshipPendingEvent
- type AlertsFriendshipRequestEvent
- type AlertsMentionedEvent
- type AlertsMyRespondedEvent
- type AlertsNewFanEvent
- type AlertsNewFriendEvent
- type AlertsPlurkLikedEvent
- type AlertsPlurkReplurkedEvent
- type AlertsPrivatePlurkEvent
- type AlertsUnhandledEvent
- type Birthday
- type Client
- type Engine
- type EngineImpl
- type GetPlurksOptions
- func (o *GetPlurksOptions) FilterFavorite() *GetPlurksOptions
- func (o *GetPlurksOptions) FilterMentioned() *GetPlurksOptions
- func (o *GetPlurksOptions) FilterMy() *GetPlurksOptions
- func (o *GetPlurksOptions) FilterPrivate() *GetPlurksOptions
- func (o *GetPlurksOptions) FilterReplurked() *GetPlurksOptions
- func (o *GetPlurksOptions) FilterResponded() *GetPlurksOptions
- func (o *GetPlurksOptions) Get() map[string]string
- func (o *GetPlurksOptions) Limit(limit int64) *GetPlurksOptions
- func (o *GetPlurksOptions) Offset(offset time.Time) *GetPlurksOptions
- type KarmaStates
- type KarmaTrendNode
- type NewPlurkEvent
- type NewResponseEvent
- type OAuthRequest
- type Options
- type Plurk
- type PlurkAddOptions
- type PlurkCountsInfo
- type Plurks
- type Profile
- type RealtimeEventHandler
- type Response
- type Responses
- type UnreadCount
- type UpdateNotificationEvent
- type User
- type UserChannel
- type UserChannelListener
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidParameters = errors.New("invalid parameters")
)
Functions ¶
This section is empty.
Types ¶
type APIAlerts ¶ added in v0.2.0
type APIAlerts struct {
// contains filtered or unexported fields
}
func (*APIAlerts) AddAllAsFan ¶ added in v0.2.0
func (*APIAlerts) AddAsFriend ¶ added in v0.2.0
func (*APIAlerts) DenyAsFriend ¶ added in v0.2.0
func (*APIAlerts) GetHistory ¶ added in v0.2.0
func (*APIAlerts) RemoveNotification ¶ added in v0.2.0
type APIPolling ¶ added in v0.1.3
type APIPolling struct {
// contains filtered or unexported fields
}
func (*APIPolling) GetPlurks ¶ added in v0.1.3
func (u *APIPolling) GetPlurks(optionSets ...Options) (*Plurks, error)
Return plurks newer than offset You must set offset in GetPlurksOptions or you will get nothing.
func (*APIPolling) GetUnreadCount ¶ added in v0.1.3
func (u *APIPolling) GetUnreadCount() (*UnreadCount, error)
type APIProfile ¶
type APIProfile struct {
// contains filtered or unexported fields
}
func (*APIProfile) GetOwnProfile ¶
func (u *APIProfile) GetOwnProfile() (*Profile, error)
Returns data that's private for the current user. This can be used to construct a profile and render a timeline of the latest plurks.
func (*APIProfile) GetPublicProfile ¶
func (u *APIProfile) GetPublicProfile(userIdOrNickName any) (*Profile, error)
Fetches public information such as a user's public plurks and basic information. Fetches also if the current user is following the user, are friends with or is a fan. userIdOrNickName must be int64 for user_id or string for nick_name
type APIRealtime ¶ added in v0.1.3
type APIRealtime struct {
// contains filtered or unexported fields
}
func (*APIRealtime) GetUserChannel ¶ added in v0.1.3
func (u *APIRealtime) GetUserChannel() (*UserChannel, error)
func (*APIRealtime) Listen ¶ added in v0.1.3
func (u *APIRealtime) Listen(ctx context.Context, listener *UserChannelListener)
type APIResponses ¶
type APIResponses struct {
// contains filtered or unexported fields
}
func (*APIResponses) ResponseAdd ¶
func (*APIResponses) ResponseDelete ¶
func (u *APIResponses) ResponseDelete(responseId int64, plurkId int64) error
type APITimeline ¶
type APITimeline struct {
// contains filtered or unexported fields
}
func (*APITimeline) FavoritePlurks ¶
func (u *APITimeline) FavoritePlurks(plurkIds []int64) error
func (*APITimeline) GetPlurkCountsInfo ¶ added in v0.1.3
func (u *APITimeline) GetPlurkCountsInfo(plurkId int64) (*PlurkCountsInfo, error)
func (*APITimeline) GetPlurks ¶ added in v0.1.3
func (u *APITimeline) GetPlurks(optionSets ...Options) (*Plurks, error)
Return plurks older than offset see GetPlurksOptions
func (*APITimeline) GetPublicPlurks ¶ added in v0.1.3
func (u *APITimeline) GetPublicPlurks(optionSets ...Options) (*Plurks, error)
Return public plurks older than offset see GetPlurksOptions
func (*APITimeline) GetUnreadPlurks ¶ added in v0.1.3
func (u *APITimeline) GetUnreadPlurks(optionSets ...Options) (*Plurks, error)
Return unread plurks older than offset see GetPlurksOptions
func (*APITimeline) MarkAsRead ¶
func (u *APITimeline) MarkAsRead(plurkIds []int64) error
func (*APITimeline) MutePlurks ¶
func (u *APITimeline) MutePlurks(plurkIds []int64) error
func (*APITimeline) PlurkDelete ¶
func (u *APITimeline) PlurkDelete(plurkId int64) error
func (*APITimeline) Replurk ¶
func (u *APITimeline) Replurk(plurkIds []int64) error
func (*APITimeline) UnfavoritePlurks ¶
func (u *APITimeline) UnfavoritePlurks(plurkIds []int64) error
func (*APITimeline) UnmutePlurks ¶
func (u *APITimeline) UnmutePlurks(plurkIds []int64) error
func (*APITimeline) Unreplurk ¶
func (u *APITimeline) Unreplurk(plurkIds []int64) error
type APIUsers ¶
type APIUsers struct {
// contains filtered or unexported fields
}
func (*APIUsers) GetKarmaStats ¶ added in v0.2.1
func (u *APIUsers) GetKarmaStats() (*KarmaStates, error)
type AlertsEvent ¶ added in v0.2.0
type AlertsFriendshipAcceptedEvent ¶ added in v0.2.0
type AlertsFriendshipAcceptedEvent struct {
AlertsEvent
FriendInfo User `json:"friend_info"`
}
Friendship accepted notification
type AlertsFriendshipPendingEvent ¶ added in v0.2.0
type AlertsFriendshipPendingEvent struct {
AlertsEvent
FromUser User `json:"to_user"`
}
requires action from the user
type AlertsFriendshipRequestEvent ¶ added in v0.2.0
type AlertsFriendshipRequestEvent struct {
AlertsEvent
FromUser User `json:"from_user"`
}
requires action from the user
type AlertsMentionedEvent ¶ added in v0.2.0
type AlertsMentionedEvent struct {
AlertsEvent
FromUser User `json:"from_user"`
PlurkId int64 `json:"plurk_id"`
NumOthers int64 `json:"num_others"`
// response_id may be null if user was mentioned in the plurk and not in a response.
ResponseId *int64 `json:"response_id"`
}
User got mentioned in a plurk
type AlertsMyRespondedEvent ¶ added in v0.2.0
type AlertsMyRespondedEvent struct {
AlertsEvent
FromUser User `json:"from_user"`
PlurkId int64 `json:"plurk_id"`
NumOthers int64 `json:"num_others"`
ResponseId int64 `json:"response_id"`
}
User's own plurk got responded
type AlertsNewFanEvent ¶ added in v0.2.0
type AlertsNewFanEvent struct {
AlertsEvent
NewFan User `json:"new_fan"`
}
type AlertsNewFriendEvent ¶ added in v0.2.0
type AlertsNewFriendEvent struct {
AlertsEvent
NewFriend User `json:"new_friend"`
}
New friend notification
type AlertsPlurkLikedEvent ¶ added in v0.2.0
type AlertsPlurkLikedEvent struct {
AlertsEvent
FromUser User `json:"from_user"`
PlurkId int64 `json:"plurk_id"`
NumOthers int64 `json:"num_others"`
}
User's plurk got liked
type AlertsPlurkReplurkedEvent ¶ added in v0.2.0
type AlertsPlurkReplurkedEvent struct {
AlertsEvent
FromUser User `json:"from_user"`
PlurkId int64 `json:"plurk_id"`
NumOthers int64 `json:"num_others"`
}
User's plurk got replurked
type AlertsPrivatePlurkEvent ¶ added in v0.2.0
type AlertsPrivatePlurkEvent struct {
AlertsEvent
Owner User `json:"owner"`
PlurkId int64 `json:"plurk_id"`
}
New private plurk
type AlertsUnhandledEvent ¶ added in v0.2.0
type AlertsUnhandledEvent struct {
AlertsEvent
RawMessage json.RawMessage
}
type Client ¶
type Client struct {
Users *APIUsers
Timeline *APITimeline
Responses *APIResponses
Profile *APIProfile
Polling *APIPolling
Realtime *APIRealtime
Alerts *APIAlerts
Engine Engine
}
type EngineImpl ¶
type EngineImpl struct {
Credentials *oauth.Credentials
// contains filtered or unexported fields
}
func (*EngineImpl) CallAPIUnmarshal ¶ added in v0.1.3
type GetPlurksOptions ¶ added in v0.1.3
type GetPlurksOptions struct {
// contains filtered or unexported fields
}
func NewGetPlurksOptions ¶ added in v0.1.3
func NewGetPlurksOptions() *GetPlurksOptions
func (*GetPlurksOptions) FilterFavorite ¶ added in v0.1.3
func (o *GetPlurksOptions) FilterFavorite() *GetPlurksOptions
Limit the favorite plurks returned
func (*GetPlurksOptions) FilterMentioned ¶ added in v0.1.3
func (o *GetPlurksOptions) FilterMentioned() *GetPlurksOptions
Limit the mentioned plurks returned
func (*GetPlurksOptions) FilterMy ¶ added in v0.1.3
func (o *GetPlurksOptions) FilterMy() *GetPlurksOptions
Limit the my plurks returned
func (*GetPlurksOptions) FilterPrivate ¶ added in v0.1.3
func (o *GetPlurksOptions) FilterPrivate() *GetPlurksOptions
Limit the private plurks returned
func (*GetPlurksOptions) FilterReplurked ¶ added in v0.1.3
func (o *GetPlurksOptions) FilterReplurked() *GetPlurksOptions
Limit the replurked plurks returned
func (*GetPlurksOptions) FilterResponded ¶ added in v0.1.3
func (o *GetPlurksOptions) FilterResponded() *GetPlurksOptions
Limit the responded plurks returned
func (*GetPlurksOptions) Limit ¶ added in v0.1.3
func (o *GetPlurksOptions) Limit(limit int64) *GetPlurksOptions
Limit the number of plurks returned
func (*GetPlurksOptions) Offset ¶ added in v0.1.3
func (o *GetPlurksOptions) Offset(offset time.Time) *GetPlurksOptions
type KarmaStates ¶ added in v0.2.1
type KarmaStates struct {
CurrentKarma float64 `json:"current_karma"`
KarmaFallReason string `json:"karma_fall_reason"`
KarmaGraph string `json:"karma_graph"`
KarmaTrendRaw []string `json:"karma_trend"`
KarmaTrend []KarmaTrendNode
}
type KarmaTrendNode ¶ added in v0.2.1
type NewResponseEvent ¶ added in v0.1.3
type NewResponseEvent struct {
PlurkId int64 `json:"plurk_id"`
Plurk Plurk `json:"plurk"`
ResponseCount int64 `json:"response_count"`
Response Response `json:"response"`
User map[string]User
}
Realtime event "new_response"
type OAuthRequest ¶
type OAuthRequest struct {
Url string
// contains filtered or unexported fields
}
func NewOAuthRequest ¶
func NewOAuthRequest(consumerToken string, consumerSecret string) (*OAuthRequest, error)
type Plurk ¶
type Plurk struct {
PlurkId int64 `json:"plurk_id"`
Qualifier string `json:"qualifier"`
QualifierTranslated string `json:"qualifier_translated"`
IsUnread int64 `json:"is_unread"`
PlurkType int64 `json:"plurk_type"`
UserId int64 `json:"user_id"`
OwnerId int64 `json:"owner_id"`
Posted string `json:"posted"`
NoComments int64 `json:"no_comments"`
Content string `json:"content"`
ContentRaw string `json:"content_raw"`
ResponseCount int64 `json:"response_count"`
ResponseSeen int64 `json:"responses_seen"`
LimitedTo string `json:"limited_to"`
Favorite bool `json:"favorite"`
FavoriteCount int64 `json:"favorite_count"`
Favorers []int64 `json:"favorers"`
Replurkable bool `json:"replurkable"`
Replurked bool `json:"replurked"`
ReplurkerId int64 `json:"replurker_id"`
ReplurkerCount int64 `json:"replurkers_count"`
Replurkers []int64 `json:"replurkers"`
}
type PlurkAddOptions ¶
type PlurkAddOptions struct {
// contains filtered or unexported fields
}
func NewPlurkAddOptions ¶
func NewPlurkAddOptions() *PlurkAddOptions
func (*PlurkAddOptions) FriendsOnlyComments ¶
func (o *PlurkAddOptions) FriendsOnlyComments() *PlurkAddOptions
func (*PlurkAddOptions) Lang ¶
func (o *PlurkAddOptions) Lang(lang string) *PlurkAddOptions
func (*PlurkAddOptions) LimitedTo ¶
func (o *PlurkAddOptions) LimitedTo(ids ...int64) *PlurkAddOptions
func (*PlurkAddOptions) NoComments ¶
func (o *PlurkAddOptions) NoComments() *PlurkAddOptions
type PlurkCountsInfo ¶ added in v0.1.3
type Profile ¶
type Profile struct {
FriendsCount int64 `json:"friends_count"`
FansCount int64 `json:"fans_count"`
UserInfo User `json:"user_info"`
Privacy string `json:"privacy"`
Plurks []Plurk `json:"plurks"`
// OwnProfileOnly
UnreadCount *int64 `json:"unread_count"`
PlurksUsers map[string]User `json:"plurks_users"`
// PublicProfileOnly
AreFriends *bool `json:"are_friends"`
IsFan *bool `json:"is_fan"`
IsFollowing *bool `json:"is_following"`
HasReadPermission *bool `json:"has_read_permission"`
}
type RealtimeEventHandler ¶ added in v0.2.0
type RealtimeEventHandler func(eventType string, btyes json.RawMessage) error
func NewPlurkHandler ¶ added in v0.2.0
func NewPlurkHandler(handler func(*NewPlurkEvent)) RealtimeEventHandler
func NewResponseHandler ¶ added in v0.2.0
func NewResponseHandler(handler func(*NewResponseEvent)) RealtimeEventHandler
func UpdateNotificationHandler ¶ added in v0.2.0
func UpdateNotificationHandler(handler func(*UpdateNotificationEvent)) RealtimeEventHandler
type Response ¶
type Response struct {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
PlurkId int64 `json:"plurk_id"`
Content string `json:"content"`
ContentRaw string `json:"content_raw"`
Qualifier string `json:"qualifier"`
QualifierTranslated *string `json:"qualifier_translated"`
Posted string `json:"posted"`
Lang string `json:"lang"`
LastEdited *string `json:"last_edited"`
Coins *string `json:"coins"`
Editability int64 `json:"editability"`
}
type UnreadCount ¶ added in v0.1.3
type UpdateNotificationEvent ¶ added in v0.2.0
type UpdateNotificationEvent struct {
Counts struct {
Noti int64 `json:"noti"`
Req int64 `json:"req"`
} `json:"counts"`
}
Realtime event "update_notification" {"counts": {"noti": 1, "req": 0}, "type": "update_notification"}
type User ¶
type User struct {
Id int64 `json:"id"`
NickName string `json:"nick_name"`
DisplayName string `json:"display_name"`
FullName string `json:"full_name"`
NameColor string `json:"name_color"`
Premium bool `json:"premium"`
HasProfileImage int64 `json:"has_profile_image"`
Avatar int64 `json:"avatar"`
ShowLocation int64 `json:"show_location"`
Location string `json:"location"`
Timezone string `json:"timezone"`
DefaultLang string `json:"default_lang"`
DateFormat int64 `json:"dateformat"`
DateOfBirth string `json:"date_of_birth"`
Birthday Birthday `json:"birthday"`
BdayPrivacy int64 `json:"bday_privacy"`
Gender int64 `json:"gender"`
Karma float64 `json:"karma"`
Recruited int64 `json:"recruited"`
Relationship string `json:"relationship"`
Status string `json:"status"`
TimelinePrivacy int64 `json:"timeline_privacy"`
VerifiedAccount bool `json:"verified_account"`
FriendListPrivacy string `json:"friend_list_privacy"`
EmailConfirmed bool `json:"email_confirmed"`
PhoneVerified *int64 `json:"phone_verified"`
PinnedPlurkId *int64 `json:"pinned_plurk_id"`
BackgroundId int64 `json:"background_id"`
ShowAds bool `json:"show_ads"`
Version string `json:"_version"`
}
type UserChannel ¶ added in v0.1.3
type UserChannelListener ¶ added in v0.2.0
type UserChannelListener struct {
LogHandler func(log string, err error)
EventHandlers []RealtimeEventHandler
}
func (*UserChannelListener) AddHandler ¶ added in v0.2.0
func (l *UserChannelListener) AddHandler(h RealtimeEventHandler)
func (*UserChannelListener) Err ¶ added in v0.2.0
func (l *UserChannelListener) Err(s error)
func (*UserChannelListener) Log ¶ added in v0.2.0
func (l *UserChannelListener) Log(s string)