Documentation ¶
Index ¶
- Constants
- func TokensToString(tokens []MessageToken) string
- type AuthResponse
- type BaseUser
- type BooleanMap
- type ChatMode
- type Connection
- func (con *Connection) AddSpeaker(userId string)
- func (con *Connection) AskToSpeak()
- func (con *Connection) Ban(username string, reason string)
- func (con *Connection) BanFromRoomChat(userId string)
- func (con *Connection) ChangeModStatus(userId string, value bool)
- func (con *Connection) ChangeRoomCreator(userId string)
- func (con *Connection) Close()
- func (con *Connection) CreateRoom(name, privacy, description string) (*CreateRoomResponse, error)
- func (con *Connection) CreateRoomFromScheduledRoom(id, name, description string) (Room, error)
- func (con *Connection) CreateScheduledRoom(name, description string, scheduledFor time.Time) (*CreateScheduledRoomResponse, error)
- func (con *Connection) DeleteRoomChatMessage(userId, messageId string)
- func (con *Connection) DeleteScheduledRoom(id string) error
- func (con *Connection) EditScheduledRoom(id, name, description string, scheduledFor time.Time) (*EditScheduledRoomResponse, error)
- func (con *Connection) Follow(userId string) error
- func (con *Connection) GetBlockedFromRoomUsers(cursor int) (GetBlockedFromRoomUsersResponse, error)
- func (con *Connection) GetFollowList(cursor int) (GetFollowListResponse, error)
- func (con *Connection) GetInviteList(cursor int) (GetFollowListResponse, error)
- func (con *Connection) GetMyFollowing(cursor int) (GetMyFollowingResponse, error)
- func (con *Connection) GetMyScheduledRoomsAboutToStart(query string) (GetMyScheduledRoomsAboutToStartResponse, error)
- func (con *Connection) GetScheduledRooms(cursor string, getOnlyMyScheduledRooms bool) (GetScheduledRoomsResponse, error)
- func (con *Connection) GetTopPublicRooms(cursor int) (GetTopPublicRoomsResponse, error)
- func (con *Connection) GetUserProfile(idOrUsername string) (*UserWithFollowInfo, error)
- func (con *Connection) InviteToRoom(userId string)
- func (con *Connection) JoinRoomAndGetInfo(roomId string) (JoinRoomAndGetInfoResponse, error)
- func (con *Connection) LeaveRoom() (*LeaveRoomResponse, error)
- func (con *Connection) OnHandRaised(handler func(event OnHandRaisedEvent, err error))
- func (con *Connection) OnInvitationToRoom(handler func(event OnInvitationToRoomEvent, err error))
- func (con *Connection) OnNewChatMessage(handler func(event OnNewMessageEvent, err error))
- func (con *Connection) OnNewRoomDetails(handler func(event OnNewRoomDetailsEvent, err error))
- func (con *Connection) OnReady(handler func(event OnReadyEvent, err error))
- func (con *Connection) OnSpeakerAdded(handler func(event OnSpeakerAddedEvent, err error))
- func (con *Connection) OnSpeakerRemoved(handler func(event OnSpeakerRemovedEvent, err error))
- func (con *Connection) OnUserJoinRoom(handler func(event OnUserJoinRoomEvent, err error))
- func (con *Connection) OnUserLeaveRoom(handler func(event OnUserLeftRoomEvent, err error))
- func (con *Connection) RoomBan(userId string, shouldBanIp bool)
- func (con *Connection) RoomUpdate(args RoomUpdateArgs) error
- func (con *Connection) Search(query string) (SearchResult, error)
- func (con *Connection) SendRoomChatMessage(message string, whisperedTo ...UUID)
- func (con *Connection) SetDeaf(deaf bool) error
- func (con *Connection) SetListener(userId string)
- func (con *Connection) SetMute(isMuted bool) error
- func (con *Connection) SpeakingChange(value bool)
- func (con *Connection) Start() error
- func (con *Connection) UnbanFromRoom(userId string) error
- func (con *Connection) UnbanFromRoomChat(userId string)
- func (con *Connection) UserBlock(userId string) error
- func (con *Connection) UserCreateBot(username string) (*UserCreateBotResponse, error)
- func (con *Connection) UserUnblock(userId string) error
- type CreateRoomResponse
- type CreateScheduledRoomResponse
- type CurrentRoom
- type EditScheduledRoomResponse
- type GetBlockedFromRoomUsersResponse
- type GetFollowListResponse
- type GetInviteListResponse
- type GetMyFollowingResponse
- type GetMyScheduledRoomsAboutToStartResponse
- type GetScheduledRoomsResponse
- type GetTopPublicRoomsResponse
- type GetUserProfileResponse
- type JoinRoomAndGetInfoResponse
- type LeaveRoomResponse
- type Listener
- type ListenerHandler
- type Message
- type MessageToken
- type NullString
- type OnHandRaisedEvent
- type OnInvitationToRoomEvent
- type OnNewMessageEvent
- type OnNewRoomDetailsEvent
- type OnReadyEvent
- type OnSpeakerAddedEvent
- type OnSpeakerRemovedEvent
- type OnUserJoinRoomEvent
- type OnUserLeftRoomEvent
- type PaginatedBaseUsers
- type Room
- type RoomPermissions
- type RoomUpdateArgs
- type RoomUser
- type ScheduledRoom
- type SearchResult
- type Token
- type UUID
- type User
- type UserCreateBotResponse
- type UserPreview
- type UserWithFollowInfo
- type WhisperPrivacySetting
Constants ¶
View Source
const ( ChatModeDefault ChatMode = "default" ChatModeDisabled ChatMode = "disabled" ChatModeFollowerOnly ChatMode = "follower_only" WhisperPrivacyOn WhisperPrivacySetting = "on" WhisperPrivacyOff WhisperPrivacySetting = "off" )
View Source
const ConnectionTimeout = time.Second * 15
View Source
const HeartbeatInterval = 8 * time.Second
View Source
const HttpBaseUrl = "https://api.dogehouse.tv"
View Source
const VERSION = "0.0.0"
Some constants
View Source
const WebsocketBaseUrl = "wss://api.dogehouse.tv/socket"
Variables ¶
This section is empty.
Functions ¶
func TokensToString ¶
func TokensToString(tokens []MessageToken) string
Types ¶
type AuthResponse ¶
type AuthResponse struct { Username string `json:"username"` AccessToken string `json:"accessToken"` RefreshToken string `json:"refreshToken"` Error string `json:"error"` }
func Auth ¶
func Auth(apiKey string) (*AuthResponse, error)
type BaseUser ¶
type BaseUser struct { Username string `json:"username"` Online bool `json:"online"` LastOnline string `json:"lastOnline"` Id string `json:"id"` Bio string `json:"bio"` DisplayName string `json:"displayName"` AvatarUrl string `json:"avatarUrl"` BannerUrl string `json:"bannerUrl"` NumFollowing int `json:"numFollowing"` NumFollowers int `json:"numFollowers"` CurrentRoom *Room `json:"currentRoom"` BotOwnerId NullString `json:"botOwnerId"` }
type BooleanMap ¶
type Connection ¶
type Connection struct { Socket *websocket.Conn AccessToken string RefreshToken string Ready bool Connected bool Listeners []*Listener ToRemove chan *Listener DebugLog bool }
func (*Connection) AddSpeaker ¶
func (con *Connection) AddSpeaker(userId string)
func (*Connection) AskToSpeak ¶
func (con *Connection) AskToSpeak()
func (*Connection) Ban ¶
func (con *Connection) Ban(username string, reason string)
func (*Connection) BanFromRoomChat ¶
func (con *Connection) BanFromRoomChat(userId string)
func (*Connection) ChangeModStatus ¶
func (con *Connection) ChangeModStatus(userId string, value bool)
func (*Connection) ChangeRoomCreator ¶
func (con *Connection) ChangeRoomCreator(userId string)
func (*Connection) Close ¶
func (con *Connection) Close()
func (*Connection) CreateRoom ¶
func (con *Connection) CreateRoom(name, privacy, description string) (*CreateRoomResponse, error)
func (*Connection) CreateRoomFromScheduledRoom ¶
func (con *Connection) CreateRoomFromScheduledRoom(id, name, description string) (Room, error)
func (*Connection) CreateScheduledRoom ¶
func (con *Connection) CreateScheduledRoom(name, description string, scheduledFor time.Time) (*CreateScheduledRoomResponse, error)
func (*Connection) DeleteRoomChatMessage ¶
func (con *Connection) DeleteRoomChatMessage(userId, messageId string)
func (*Connection) DeleteScheduledRoom ¶
func (con *Connection) DeleteScheduledRoom(id string) error
func (*Connection) EditScheduledRoom ¶
func (con *Connection) EditScheduledRoom(id, name, description string, scheduledFor time.Time) (*EditScheduledRoomResponse, error)
func (*Connection) Follow ¶
func (con *Connection) Follow(userId string) error
func (*Connection) GetBlockedFromRoomUsers ¶
func (con *Connection) GetBlockedFromRoomUsers(cursor int) (GetBlockedFromRoomUsersResponse, error)
func (*Connection) GetFollowList ¶
func (con *Connection) GetFollowList(cursor int) (GetFollowListResponse, error)
func (*Connection) GetInviteList ¶
func (con *Connection) GetInviteList(cursor int) (GetFollowListResponse, error)
func (*Connection) GetMyFollowing ¶
func (con *Connection) GetMyFollowing(cursor int) (GetMyFollowingResponse, error)
func (*Connection) GetMyScheduledRoomsAboutToStart ¶
func (con *Connection) GetMyScheduledRoomsAboutToStart(query string) (GetMyScheduledRoomsAboutToStartResponse, error)
func (*Connection) GetScheduledRooms ¶
func (con *Connection) GetScheduledRooms(cursor string, getOnlyMyScheduledRooms bool) (GetScheduledRoomsResponse, error)
func (*Connection) GetTopPublicRooms ¶
func (con *Connection) GetTopPublicRooms(cursor int) (GetTopPublicRoomsResponse, error)
func (*Connection) GetUserProfile ¶
func (con *Connection) GetUserProfile(idOrUsername string) (*UserWithFollowInfo, error)
func (*Connection) InviteToRoom ¶
func (con *Connection) InviteToRoom(userId string)
func (*Connection) JoinRoomAndGetInfo ¶
func (con *Connection) JoinRoomAndGetInfo(roomId string) (JoinRoomAndGetInfoResponse, error)
func (*Connection) LeaveRoom ¶
func (con *Connection) LeaveRoom() (*LeaveRoomResponse, error)
func (*Connection) OnHandRaised ¶
func (con *Connection) OnHandRaised(handler func(event OnHandRaisedEvent, err error))
func (*Connection) OnInvitationToRoom ¶
func (con *Connection) OnInvitationToRoom(handler func(event OnInvitationToRoomEvent, err error))
func (*Connection) OnNewChatMessage ¶
func (con *Connection) OnNewChatMessage(handler func(event OnNewMessageEvent, err error))
Events
func (*Connection) OnNewRoomDetails ¶
func (con *Connection) OnNewRoomDetails(handler func(event OnNewRoomDetailsEvent, err error))
func (*Connection) OnReady ¶
func (con *Connection) OnReady(handler func(event OnReadyEvent, err error))
func (*Connection) OnSpeakerAdded ¶
func (con *Connection) OnSpeakerAdded(handler func(event OnSpeakerAddedEvent, err error))
func (*Connection) OnSpeakerRemoved ¶
func (con *Connection) OnSpeakerRemoved(handler func(event OnSpeakerRemovedEvent, err error))
func (*Connection) OnUserJoinRoom ¶
func (con *Connection) OnUserJoinRoom(handler func(event OnUserJoinRoomEvent, err error))
func (*Connection) OnUserLeaveRoom ¶
func (con *Connection) OnUserLeaveRoom(handler func(event OnUserLeftRoomEvent, err error))
func (*Connection) RoomBan ¶
func (con *Connection) RoomBan(userId string, shouldBanIp bool)
func (*Connection) RoomUpdate ¶
func (con *Connection) RoomUpdate(args RoomUpdateArgs) error
Initialization of RoomUpdateArgs is a pain in the ass but i don't have any ideas how to make is work and not make it even more confusing than it is
func (*Connection) Search ¶
func (con *Connection) Search(query string) (SearchResult, error)
func (*Connection) SendRoomChatMessage ¶
func (con *Connection) SendRoomChatMessage(message string, whisperedTo ...UUID)
func (*Connection) SetDeaf ¶
func (con *Connection) SetDeaf(deaf bool) error
func (*Connection) SetListener ¶
func (con *Connection) SetListener(userId string)
func (*Connection) SetMute ¶
func (con *Connection) SetMute(isMuted bool) error
func (*Connection) SpeakingChange ¶
func (con *Connection) SpeakingChange(value bool)
func (*Connection) Start ¶
func (con *Connection) Start() error
func (*Connection) UnbanFromRoom ¶
func (con *Connection) UnbanFromRoom(userId string) error
func (*Connection) UnbanFromRoomChat ¶
func (con *Connection) UnbanFromRoomChat(userId string)
func (*Connection) UserBlock ¶
func (con *Connection) UserBlock(userId string) error
func (*Connection) UserCreateBot ¶
func (con *Connection) UserCreateBot(username string) (*UserCreateBotResponse, error)
func (*Connection) UserUnblock ¶
func (con *Connection) UserUnblock(userId string) error
type CreateRoomResponse ¶
type CreateRoomResponse struct {
Room Room `json:"room"`
}
type CreateScheduledRoomResponse ¶
type CreateScheduledRoomResponse struct {
ScheduledRoom ScheduledRoom `json:"scheduledRoom"`
}
type CurrentRoom ¶
type CurrentRoom struct { Id string `json:"id"` Name string `json:"name"` Description string `json:"description"` IsPrivate bool `json:"isPrivate"` NumPeopleInside int `json:"numPeopleInside"` VoiceServerId string `json:"voiceServerId"` CreatorId string `json:"creatorId"` PeoplePreviewList []UserPreview `json:"peoplePreviewList"` InsertedAt string `json:"inserted_at"` ChatMode ChatMode `json:"chatMode"` ChatThrottle int `json:"chatThrottle"` Users []RoomUser `json:"users"` MuteMap BooleanMap `json:"muteMap"` DeafMap BooleanMap `json:"deafMap"` ActiveSpeakerMap BooleanMap `json:"activeSpeakerMap"` AutoSpeaker bool `json:"autoSpeaker"` }
type EditScheduledRoomResponse ¶
type EditScheduledRoomResponse CreateScheduledRoomResponse
type GetBlockedFromRoomUsersResponse ¶
type GetBlockedFromRoomUsersResponse GetInviteListResponse
type GetFollowListResponse ¶
type GetFollowListResponse struct { Users []UserWithFollowInfo `json:"users"` NextCursor *int `json:"nextCursor"` }
type GetInviteListResponse ¶
type GetMyFollowingResponse ¶
type GetMyFollowingResponse GetFollowListResponse
type GetMyScheduledRoomsAboutToStartResponse ¶
type GetMyScheduledRoomsAboutToStartResponse struct {
ScheduledRooms []ScheduledRoom `json:"scheduledRooms"`
}
type GetScheduledRoomsResponse ¶
type GetScheduledRoomsResponse struct { NextCursor NullString `json:"nextCursor"` ScheduledRooms []ScheduledRoom `json:"scheduledRooms"` }
type GetUserProfileResponse ¶
type GetUserProfileResponse struct {
Rooms []Room `json:"rooms"`
}
type JoinRoomAndGetInfoResponse ¶
type JoinRoomAndGetInfoResponse struct { Room Room `json:"room"` Users []RoomUser `json:"users"` MuteMap BooleanMap `json:"muteMap"` DeafMap BooleanMap `json:"deafMap"` RoomId UUID `json:"roomId"` ActiveSpeakerMap BooleanMap `json:"activeSpeakerMap"` }
type LeaveRoomResponse ¶
type LeaveRoomResponse struct {
RoomId UUID `json:"roomId"`
}
type Listener ¶
type Listener struct { Opcode string `json:"opcode"` Handler func(listenerHandler ListenerHandler) `json:"handler"` }
type ListenerHandler ¶
type Message ¶
type Message struct { Id UUID `json:"id"` UserId UUID `json:"userId"` AvatarUrl UUID `json:"avatarUrl"` Color string `json:"color"` DisplayName string `json:"displayName"` Tokens []MessageToken `json:"tokens"` Username string `json:"username"` Deleted bool `json:"deleted"` DeleterId UUID `json:"deleterId"` SentAt string `json:"sentAt"` IsWhisper bool `json:"isWhisper"` }
func (*Message) GetMessageString ¶
type MessageToken ¶
type MessageToken struct { T string `json:"t"` V interface{} `json:"v"` }
func StringToToken ¶
func StringToToken(input string) MessageToken
type NullString ¶
type NullString string
func (NullString) MarshalJSON ¶
func (c NullString) MarshalJSON() ([]byte, error)
func (*NullString) UnmarshalJSON ¶
func (c *NullString) UnmarshalJSON(in []byte) error
type OnHandRaisedEvent ¶
type OnHandRaisedEvent struct {
UserId UUID `json:"userId"`
}
type OnInvitationToRoomEvent ¶
type OnNewMessageEvent ¶
type OnNewRoomDetailsEvent ¶
type OnReadyEvent ¶
type OnReadyEvent struct {
User User `json:"user"`
}
type OnSpeakerAddedEvent ¶
type OnSpeakerAddedEvent struct { UserId UUID `json:"userId"` MuteMap BooleanMap `json:"muteMap"` DeafMap BooleanMap `json:"deafMap"` }
type OnSpeakerRemovedEvent ¶
type OnSpeakerRemovedEvent OnSpeakerAddedEvent
type OnUserJoinRoomEvent ¶
type OnUserJoinRoomEvent struct { User User `json:"user"` MuteMap BooleanMap `json:"muteMap"` DeafMap BooleanMap `json:"deafMap"` RoomId UUID `json:"roomId"` }
type OnUserLeftRoomEvent ¶
type PaginatedBaseUsers ¶
type Room ¶
type Room struct { Id string `json:"id"` Name string `json:"name"` Description string `json:"description"` IsPrivate bool `json:"isPrivate"` NumPeopleInside int `json:"numPeopleInside"` VoiceServerId string `json:"voiceServerId"` CreatorId string `json:"creatorId"` PeoplePreviewList []UserPreview `json:"peoplePreviewList"` AutoSpeaker bool `json:"autoSpeaker"` InsertedAt string `json:"inserted_at"` ChatMode ChatMode `json:"chatMode"` ChatThrottle int `json:"chatThrottle"` }
type RoomPermissions ¶
type RoomUpdateArgs ¶
type RoomUpdateArgs struct { Name *string `json:"name,omitempty"` Privacy *string `json:"privacy,omitempty"` ChatThrottle *int `json:"chatThrottle,omitempty"` Description *string `json:"description,omitempty"` AutoSpeaker *bool `json:"autoSpeaker,omitempty"` ChatMode *ChatMode `json:"chatMode,omitempty"` }
type RoomUser ¶
type RoomUser struct { Username string `json:"username"` Online bool `json:"online"` LastOnline string `json:"lastOnline"` Id string `json:"id"` Bio string `json:"bio"` DisplayName string `json:"displayName"` AvatarUrl string `json:"avatarUrl"` BannerUrl string `json:"bannerUrl"` NumFollowing int `json:"numFollowing"` NumFollowers int `json:"numFollowers"` CurrentRoom *Room `json:"currentRoom"` BotOwnerId NullString `json:"botOwnerId"` FollowsYou *bool `json:"followsYou"` YouAreFollowing *bool `json:"youAreFollowing"` IBlockedThem *bool `json:"iBlockedThem"` RoomPermissions *RoomPermissions `json:"roomPermissions"` }
type ScheduledRoom ¶
type SearchResult ¶
type UUID ¶
type UUID string
func (UUID) MarshalJSON ¶
Make UUID and NullString types nullable
func (*UUID) UnmarshalJSON ¶
type User ¶
type User struct { YouAreFollowing bool `json:"youAreFollowing"` Username string `json:"username"` Online bool `json:"online"` NumFollowing int `json:"numFollowing"` NumFollowers int `json:"numFollowers"` LastOnline string `json:"lastOnline"` Id UUID `json:"id"` FollowsYou bool `json:"followsYou"` BotOwnerId NullString `json:"botOwnerId"` DisplayName string `json:"displayName"` CurrentRoomId UUID `json:"currentRoomId"` CurrentRoom Room `json:"currentRoom"` Bio NullString `json:"bio"` AvatarUrl string `json:"avatarUrl"` BannerUrl NullString `json:"bannerUrl"` WhisperPrivacySetting WhisperPrivacySetting `json:"whisperPrivacySetting"` }
type UserCreateBotResponse ¶
type UserPreview ¶
type UserPreview struct { Id UUID `json:"id"` DisplayName string `json:"displayName"` NumFollowers int `json:"numFollowers"` AvatarUrl NullString `json:"avatarUrl"` }
type UserWithFollowInfo ¶
type UserWithFollowInfo struct { Username string `json:"username"` Online bool `json:"online"` LastOnline string `json:"lastOnline"` Id string `json:"id"` Bio string `json:"bio"` DisplayName string `json:"displayName"` AvatarUrl string `json:"avatarUrl"` BannerUrl string `json:"bannerUrl"` NumFollowing int `json:"numFollowing"` NumFollowers int `json:"numFollowers"` CurrentRoom *Room `json:"currentRoom"` BotOwnerId NullString `json:"botOwnerId"` FollowsYou *bool `json:"followsYou"` YouAreFollowing *bool `json:"youAreFollowing"` IBlockedThem *bool `json:"iBlockedThem"` }
type WhisperPrivacySetting ¶
type WhisperPrivacySetting string
Click to show internal directories.
Click to hide internal directories.