Documentation
¶
Index ¶
- type ChannelInfo
- type ChannelInfoIDInt
- type ChannelInfoIDString
- type ChannelInfoRadikal
- type ChannelInfoResponse
- type ChannelInfoResponsePayload
- type CheckResponse
- type CheckResponsePayload
- type Client
- func (api *Client) Check() (bool, error)
- func (api *Client) CreateConversation(users []User) (Conversation, error)
- func (api *Client) Debugf(format string, v ...interface{})
- func (api *Client) Debugln(v ...interface{})
- func (api *Client) DecryptMessages(messages []Message, encryptedKey string) ([]Message, error)
- func (api *Client) GetChannelContent(channel ChannelInfo, limit, offset int) ([]Message, error)
- func (api *Client) GetChannelInfo(channelID int) (ChannelInfo, error)
- func (api *Client) GetConversationContent(conversation Conversation, limit, offset int) ([]Message, error)
- func (api *Client) GetFile(f File) (string, error)
- func (api *Client) GetFolderContent(ch ChannelInfo, fID, limit, offset int) (FolderGetResponseContent, error)
- func (api *Client) GetFromCache() error
- func (api *Client) GetMessageByHash(hash string) (Message, error)
- func (api *Client) GetSubscribedChannels() ([]ChannelInfo, error)
- func (api *Client) GetUserInfo(userID int) (User, error)
- func (api *Client) GetUserMe() (User, error)
- func (api *Client) ListUsers(limit int, offset int, search string) ([]User, error)
- func (api *Client) LoadPrivateKey(encryptionPassword string) error
- func (api *Client) Login() error
- func (api *Client) ManageListUsers(limit int, offset int, search string, companyID string) ([]User, error)
- func (api *Client) SendAlarmMessageToConversation(conversation Conversation, plainMessage string) (Message, error)
- func (api *Client) SendAlarmMessageToUser(userID int, message string) (Message, error)
- func (api *Client) SendMessageToChannel(channel ChannelInfo, plainMessage string) (Message, error)
- func (api *Client) SendMessageToConversation(conversation Conversation, plainMessage string) (Message, error)
- func (api *Client) SendMessageToUser(userID int, message string) (Message, error)
- func (api *Client) SetDebug()
- func (api *Client) SetLogger(logger *log.Logger)
- type ClientConfig
- type Conversation
- type ConversationResponse
- type ConversationResponsePayload
- type File
- type FlexInt
- type Folder
- type FolderGetResponse
- type FolderGetResponseContent
- type FolderGetResponsePayload
- type IDKeyCombo
- type Key
- type KeyDerivationProperties
- type Keys
- type LoginResponse
- type LoginResponsePayload
- type ManageUser
- type ManageUsersListingResponse
- type ManageUsersListingResponsePayload
- type MembershipInfo
- type Message
- type MessageContentResponse
- type MessageContentResponsePayload
- type MessageResponse
- type MessageResponsePayload
- type NestedKey
- type PrivateKeyResponse
- type PrivateKeyResponsePayload
- type ReplyTo
- type Role
- type Status
- type StatusResponse
- type StatusTyped
- type SubscribedChannelsResponse
- type SubscribedChannelsResponsePayload
- type User
- type UserIDKeyCombination
- type UserInfoResponse
- type UserListingResponsePayload
- type UsersListingResponse
- type UsersListingResponsePayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelInfo ¶
type ChannelInfo struct {
ID int
ChannelInfoRadikal
}
type ChannelInfoIDInt ¶
type ChannelInfoIDInt struct {
ID int `json:"id"`
ChannelInfoRadikal
}
type ChannelInfoIDString ¶
type ChannelInfoIDString struct {
ID int `json:"id,string"`
ChannelInfoRadikal
}
type ChannelInfoRadikal ¶
type ChannelInfoRadikal struct {
Name string `json:"name"`
// Image
Description string `json:"description"`
// GroupID
// LDAPName
CompanyID string `json:"company"`
Type string `json:"type"`
Visible bool `json:"visible"`
// Password
Encrypted bool `json:"encrypted"`
LastAction string `json:"last_action"`
LastActivity FlexInt `json:"last_activity"`
Writable string `json:"writable"`
Inviteable string `json:"inviteable"`
CanLeave bool `json:"can_leave"`
ShowMembershipActivities bool `json:"show_membership_activities"`
UserCount int `json:"user_count"`
PendingCount int `json:"pending_count"`
NumMembersWithoutKeys int `json:"num_members_without_keys"`
Membership MembershipInfo `json:"membership"`
Key string `json:"key"`
// KeyRequested
Unread int `json:"unread"`
}
type ChannelInfoResponse ¶
type ChannelInfoResponse struct {
Status Status `json:"status"`
Payload ChannelInfoResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
type ChannelInfoResponsePayload ¶
type ChannelInfoResponsePayload struct {
Channel ChannelInfoIDInt `json:"channels"`
}
type CheckResponse ¶
type CheckResponse struct {
Status Status `json:"status"`
Payload CheckResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
CheckResponse is the structure returned by a call to /auth/check
type CheckResponsePayload ¶
type CheckResponsePayload struct {
Success bool `json:"success"`
}
CheckResponsePayload is the structure returned in the payload of a call to /auth/check
type Client ¶
type Client struct {
UserInfo User
// contains filtered or unexported fields
}
Client for the stashcat API
func New ¶
func New(cc ClientConfig) *Client
func (*Client) CreateConversation ¶
func (api *Client) CreateConversation(users []User) (Conversation, error)
func (*Client) DecryptMessages ¶
func (*Client) GetChannelContent ¶
func (api *Client) GetChannelContent(channel ChannelInfo, limit, offset int) ([]Message, error)
func (*Client) GetChannelInfo ¶
func (api *Client) GetChannelInfo(channelID int) (ChannelInfo, error)
func (*Client) GetConversationContent ¶
func (api *Client) GetConversationContent(conversation Conversation, limit, offset int) ([]Message, error)
func (*Client) GetFolderContent ¶
func (api *Client) GetFolderContent(ch ChannelInfo, fID, limit, offset int) (FolderGetResponseContent, error)
func (*Client) GetFromCache ¶
GetFromCache retrieves the client_key from a cache file, validates it and does a login if validation does not succeed
func (*Client) GetMessageByHash ¶ added in v0.3.1
func (*Client) GetSubscribedChannels ¶
func (api *Client) GetSubscribedChannels() ([]ChannelInfo, error)
func (*Client) LoadPrivateKey ¶
LoadPrivateKey retrieves the encrypted private key and decrypts it
func (*Client) ManageListUsers ¶
func (*Client) SendAlarmMessageToConversation ¶
func (api *Client) SendAlarmMessageToConversation(conversation Conversation, plainMessage string) (Message, error)
func (*Client) SendAlarmMessageToUser ¶
Wrapper to creating a new conversation with user and sending a message to it
func (*Client) SendMessageToChannel ¶
func (api *Client) SendMessageToChannel(channel ChannelInfo, plainMessage string) (Message, error)
func (*Client) SendMessageToConversation ¶
func (api *Client) SendMessageToConversation(conversation Conversation, plainMessage string) (Message, error)
func (*Client) SendMessageToUser ¶
SendMessageToUser is a wrapper to creating a new conversation with a single user and sending a message to it
type ClientConfig ¶
type Conversation ¶
type Conversation struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Created string `json:"created"`
LastAction string `json:"last_action"`
LastActivity string `json:"last_activity"`
Encrypted bool `json:"encrypted"`
UserCount int `json:"user_count"`
UnreadMessages int `json:"unread_messages"`
Key string `json:"key"`
}
type ConversationResponse ¶
type ConversationResponse struct {
Status Status `json:"status"`
Payload ConversationResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
type ConversationResponsePayload ¶
type ConversationResponsePayload struct {
Conversation Conversation `json:"conversation"`
}
type File ¶
type File struct {
ID int `json:"id,string"`
Name string `json:"name"`
SizeBytes int `json:"size_byte,string"`
TypeID int `json:"type_id,string"`
Ext string `json:"ext"`
Mime string `json:"mime"`
Uploaded int `json:"uploaded,string"`
Modified int `json:"modified,string"`
OwnerID int `json:"owner_id,string"`
LastDownload int `json:"last_download,string"`
TimesDownloaded int `json:"times_downloaded,string"`
Encrypted bool `json:"encrypted"`
E2EIV string `json:"e2e_iv"`
MD5 string `json:"md5"`
Keys []Key `json:"keys"`
}
type FolderGetResponse ¶
type FolderGetResponse struct {
Status Status `json:"status"`
Payload FolderGetResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
type FolderGetResponsePayload ¶
type FolderGetResponsePayload struct {
Content FolderGetResponseContent `json:"content"`
}
type IDKeyCombo ¶
type KeyDerivationProperties ¶
type LoginResponse ¶
type LoginResponse struct {
Status Status `json:"status"`
Payload LoginResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
type LoginResponsePayload ¶
type ManageUser ¶
type ManageUser struct {
ID string `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Tag string `json:"tag"`
Email bool `json:"email"`
TimeJoined string `json:"time_joined"`
MembershipExpiry string `json:"membership_expiry,omitempty"`
Deactivated string `json:"deactivated,omitempty"`
Active string `json:"active,omitempty"`
LastLogin int `json:"last_login,omitempty"`
Image string `json:"image,omitempty"`
AllowsVoipCalls bool `json:"allows_voip_calls,omitempty"`
}
type ManageUsersListingResponse ¶
type ManageUsersListingResponse struct {
Status Status `json:"status"`
Payload ManageUsersListingResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
type MembershipInfo ¶
type Message ¶
type Message struct {
ID int `json:"id"`
Text string `json:"text"`
ConversationID int `json:"conversation_id,omitempty"`
ChannelID int `json:"channel_id,omitempty"`
ThreadID int `json:"thread_id,omitempty"`
Hash string `json:"hash"`
Verification string `json:"verification"`
Sender User `json:"sender"`
IV string `json:"iv"`
Alarm bool `json:"alarm"`
Kind string `json:"kind"`
Encrypted bool `json:"encrypted"`
// SendTime is the unix timestamp for when the message was send
// Depending on in what response this field is present it's either
// encoded as a string (e.g. when requesting the contents of a channel)
// or encoded as an integer (e.g. in the response to sending a message)
SendTime FlexInt `json:"time"`
DeleteTime int `json:"deleted,string,omitempty"`
IsForwarded bool `json:"is_forwarded"`
DeviceID string `json:"devicce_id"`
Type string `json:"type"`
ReplyTo ReplyTo `json:"reply_to,omitempty"`
}
type MessageContentResponse ¶
type MessageContentResponse struct {
Status Status `json:"status"`
Payload MessageContentResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
type MessageContentResponsePayload ¶
type MessageContentResponsePayload struct {
Messages []map[string]interface{} `json:"messages"`
}
type MessageResponse ¶
type MessageResponse struct {
Status Status `json:"status"`
Payload MessageResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
type MessageResponsePayload ¶
type MessageResponsePayload struct {
Message Message `json:"message"`
}
type NestedKey ¶
type NestedKey struct {
Ciphertext string `json:"ciphertext"`
IV string `json:"iv"`
KDP KeyDerivationProperties `json:"key_derivation_properties"`
}
type PrivateKeyResponse ¶
type PrivateKeyResponse struct {
Status Status `json:"status"`
Payload PrivateKeyResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
type PrivateKeyResponsePayload ¶
type PrivateKeyResponsePayload struct {
Keys Keys `json:"keys"`
}
type ReplyTo ¶ added in v0.3.1
type ReplyTo struct {
MessageId int `json:"message_id,omitempty"`
MessageHash string `json:"message_hash,omitempty"`
MessageVerification string `json:"message_verification,omitempty"`
}
func (*ReplyTo) UnmarshalJSON ¶ added in v0.3.1
type Status ¶
type Status struct {
Value string `json:"value"`
ShortMessage json.RawMessage `json:"short_message"` // on some endpoints these are bool(false) instead of an empty string
Message json.RawMessage `json:"message"`
}
type StatusResponse ¶
type StatusResponse struct {
Status json.RawMessage `json:"status"`
}
type StatusTyped ¶
type SubscribedChannelsResponse ¶
type SubscribedChannelsResponse struct {
Status Status `json:"status"`
Payload SubscribedChannelsResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
type SubscribedChannelsResponsePayload ¶
type SubscribedChannelsResponsePayload struct {
Channels []ChannelInfoIDString `json:"channels"`
}
type User ¶
type User struct {
ID string `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
SocketID string `json:"socket_id,omitempty"`
Online bool `json:"online"`
Active string `json:"active,omitempty"`
Deleted string `json:"deleted,omitempty"`
AllowsVoipCalls bool `json:"allows_voip_calls,omitempty"`
Tag string `json:"tag,omitempty"`
PublicKey string `json:"public_key"`
Roles []Role `json:"roles"`
}
type UserIDKeyCombination ¶
type UserInfoResponse ¶
type UserInfoResponse struct {
Status Status `json:"status"`
Payload UserListingResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
type UserListingResponsePayload ¶
type UserListingResponsePayload struct {
User User `json:"user"`
}
type UsersListingResponse ¶
type UsersListingResponse struct {
Status Status `json:"status"`
Payload UsersListingResponsePayload `json:"payload"`
Signature string `json:"signature"`
}
type UsersListingResponsePayload ¶
type UsersListingResponsePayload struct {
Users []User `json:"users"`
}
Click to show internal directories.
Click to hide internal directories.