ifunny

package
v0.0.0-...-86d0d79 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNK_0 messageType = iota
	TEXT_MESSAGE
	UNK_2
	JOIN_CHANNEL
	EXIT_CHANNEL
)
View Source
const (
	EVENT_UNKNOWN = -1
	EVENT_JOIN    = 100
	EVENT_EXIT    = 101
	EVENT_MESSAGE = 200
	EVENT_INVITED = 300
)
View Source
const (
	LogLevel = logrus.InfoLevel
)

Variables

This section is empty.

Functions

func JSONDecode

func JSONDecode(data, output interface{}) error

Types

type APIContentPost

type APIContentPost struct {
	ID          string   `json:"id"`
	Link        string   `json:"link"`
	DateCreated int64    `json:"date_created"`
	PublushAt   int64    `json:"publish_at"`
	Tags        []string `json:"tags"`
	State       string   `json:"state"`
	ShotStatus  string   `json:"shot_status"`

	FastStart  bool `json:"fast_start"`
	IsFeatured bool `json:"is_featured"`
	IsPinned   bool `json:"is_pinned"`
	IsAbused   bool `json:"is_abused"`
	IsUnsafe   bool `json:"is_unsafe"`

	IsRepublished bool `json:"is_republished"`
	IsSmiled      bool `json:"is_smiled"`
	IsUnsmiled    bool `json:"is_unsmiled"`

	Size struct {
		Height int `json:"h"`
		Width  int `json:"w"`
	} `json:"size"`

	Num struct {
		Comments    int `json:"comments"`
		Republished int `json:"republished"`
		Smiles      int `json:"smiles"`
		Unsmiles    int `json:"unsmiles"`
		Views       int `json:"views"`
	} `json:"num"`

	Creator struct {
		ID   string `json:"id"`
		Nick string `json:"nick"`
	} `json:"creator"`
}

type APIFeedPage

type APIFeedPage struct {
	Items  []APIContentPost `json:"items"`
	Paging APIPaging        `json:"paging"`
}

type APIPaging

type APIPaging struct {
	Cursors struct {
		Next string `json:"next,omitempty"`
		Prev string `json:"prev,omitempty"` // TODO is this right
	} `json:"cursors"`
	HasNext bool `json:"hasNext"`
	HasPrev bool `json:"hasPrev"`
}

type Chat

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

func (*Chat) Call

func (chat *Chat) Call(desc turnpike.Call, output interface{}) error

func (*Chat) GetChannel

func (chat *Chat) GetChannel(call turnpike.Call) (*ChatChannel, error)

func (*Chat) GetUsers

func (chat *Chat) GetUsers(desc turnpike.Call) ([]*User, error)

func (*Chat) IterMessages

func (chat *Chat) IterMessages(desc turnpike.Call) <-chan *ChatEvent

func (*Chat) ListMessages

func (chat *Chat) ListMessages(desc turnpike.Call) ([]*ChatEvent, int64, int64, error)

func (*Chat) OnChanneEvent

func (chat *Chat) OnChanneEvent(channel string, handle func(event *ChatEvent) error) (func(), error)

func (*Chat) OnChannelInvite

func (chat *Chat) OnChannelInvite(handle func(eventType int, channel *ChatChannel) error) (func(), error)

func (*Chat) OnChannelUpdate

func (chat *Chat) OnChannelUpdate(handle func(eventType int, channel *ChatChannel) error) (func(), error)

func (*Chat) Publish

func (chat *Chat) Publish(desc turnpike.Publish) error

func (*Chat) Subscribe

func (chat *Chat) Subscribe(desc turnpike.Subscribe, handle EventHandler) (func(), error)

type ChatChannel

type ChatChannel struct {
	Name          string `json:"name"`
	Title         string `json:"title"`
	MembersOnline int    `json:"members_online"`
	MembersTotal  int    `json:"members_total"`

	Type      compose.ChannelType      `json:"type"`
	JoinState compose.ChannelJoinState `json:"join_state"`
	Role      compose.ChannelRole      `json:"role"`
	TouchDT   int64                    `json:"touch_dt"` // maybe when we last were online ??

	User struct {
		ID         string `json:"id"`
		Nick       string `json:"nick"`
		LastSeenAt int64  `json:"last_seen_at"`

		IsVerified bool `json:"is_verified"`
	} `json:"user"`
}

type ChatChannelPage

type ChatChannelPage struct {
	Channels struct {
		Items  []*ChatChannel `json:"items"`
		Paging APIPaging      `json:"paging"`
	} `json:"channels"`
	Num int `json:"num"`
}

type ChatEvent

type ChatEvent struct {
	ID   string `json:"id"`
	Text string `json:"text"`

	Type   messageType `json:"type"`
	Status int         `json:"status"`
	PubAt  float64     `json:"pub_at"`

	User struct {
		ID         string `json:"user"`
		Nick       string `json:"nick"`
		IsVerified bool   `json:"is_verified"`
		LastSeenAt int64  `json:"last_seen_at"`
	} `json:"user"`

	Channel string
}

type Client

type Client struct {
	Self *User
	// contains filtered or unexported fields
}

func MakeClient

func MakeClient(bearer, userAgent string) (*Client, error)

func MakeClientLog

func MakeClientLog(bearer, userAgent string, log *logrus.Logger) (*Client, error)

func (*Client) Chat

func (client *Client) Chat() (*Chat, error)

func (*Client) DMChannelName

func (client *Client) DMChannelName(them ...string) string

func (*Client) GetChannels

func (client *Client) GetChannels(desc compose.Request) ([]*ChatChannel, error)

func (*Client) GetChannelsPage

func (client *Client) GetChannelsPage(desc compose.Request) (*ChatChannelPage, error)

func (*Client) GetUser

func (client *Client) GetUser(desc compose.Request) (*User, error)

func (*Client) IterChannels

func (client *Client) IterChannels(desc compose.Request) <-chan *ChatChannel

func (*Client) RequestJSON

func (client *Client) RequestJSON(desc compose.Request, output interface{}) error

type EventHandler

type EventHandler func(eventType int, kwargs map[string]interface{}) error

type User

type User struct {
	Email            string `json:"email"`
	SafeMode         bool   `json:"safe_mode"`
	OriginalNick     string `json:"original_nick"`
	MessagingPrivacy string `json:"messaging_privacy_status"`

	ID    string `json:"id"`
	Nick  string `json:"nick"`
	About string `json:"about"`

	IsAvailableForChat bool `json:"is_available_for_chat"`
	IsBanned           bool `json:"is_banned"`
	IsDeleted          bool `json:"is_deleted"`
	IsModerator        bool `json:"is_moderator"`
	IsVerified         bool `json:"is_verified"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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