Documentation ¶
Index ¶
- Constants
- func Ase256(plaintext string, key string, iv string, blockSize int) string
- func PKCS5Padding(ciphertext []byte, blockSize int, after int) []byte
- type AccountID
- type BasicCredentials
- type Chat
- type ChatID
- type Client
- func (c *Client) AccountID() AccountID
- func (c *Client) Disconnect()
- func (c *Client) GenerateKey(creds KeyCredentials) error
- func (c *Client) GetChat(chatID ChatID) (Chat, bool)
- func (c *Client) GetContactByName(name string) (Contact, bool)
- func (c *Client) GetContactByPhone(phone PhoneNumber) (Contact, bool)
- func (c *Client) GetKeyCredentials() KeyCredentials
- func (c *Client) GetMessages(conversationID int, offset int) ([]Message, error)
- func (c *Client) IsConnected() bool
- func (c *Client) Login(creds BasicCredentials) error
- func (c *Client) Send(data string, chatID ChatID) error
- func (c *Client) SendMessage(m Message, chatID string) error
- func (c *Client) SetMessageHandler(f func(Message))
- func (c *Client) Stream() error
- func (c *Client) Sync() error
- type Contact
- type DeviceID
- type KeyCredentials
- type Message
- type MessageID
- type NotificationMessage
- type PhoneNumber
- type Store
- type WSMessage
Constants ¶
View Source
const ( EndpointLogin = "accounts/login/" EndpointUpdateSetting = "accounts/update_setting" EndpointMessages = "messages/" EndpointRemoveMessage = "messages/remove/" EndpointAddMessage = "messages/add/" EndpointNewThread = "messages/forward_to_phone" EndpointFolders = "folders/" EndpointRemoveFolder = "folders/remove/" EndpointConversations = "conversations/" EndpointConversation = "conversations/" EndpointUpdateConversation = "conversations/update/" EndpointRead = "conversations/read/" EndpointArchive = "conversations/archive/" EndpointUnarchive = "conversations/unarchive/" EndpoinntDelete = "conversations/remove/" EndpointDismiss = "accounts/dismissed_notification/" Endpointsettings = "accounts/settings/" EndpointWebsocket = "stream" EndpointMedia = "media/" EndpointContacts = "contacts/simple/" EndpointRemoveContact = "contacts/remove_ids/" EndpointBlacklists = "blacklists" EndpointRemoveBlacklist = "blacklists/remove/" EndpointCreateBlacklist = "blacklists/add/" EndpointScheduled = "scheduled_messages" EndpointRemoveScheduled = "scheduled_messages/remove/" EndpointCreateScheduled = "scheduled_messages/add/" EndpointAccountStats = "accounts/count" EndpointDrafts = "drafts" EndpointDraftsConversation = "drafts/" EndpointCreateDrafts = "drafts/add/" EndpointRemoveDrafts = "drafts/remove/" EndpointReplaceDrafts = "drafts/replace/" EndpointDevices = "devices" EndpointRemoveDevice = "devices/remove/" EndpointTemplates = "templates" EndpointCreateTemplate = "templates/add/" EndpointUpdateTemplate = "templates/update/" EndpointRemoveTemplate = "templates/remove/" EndpointAutoReplies = "auto_replies" EndpointRemoveAutoReply = "auto_replies/remove/" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountID ¶ added in v0.0.3
type AccountID string
AccountID is a PulseSMS account ID this reflects the Pulse SMS subscriber, not a contact or "sms user"
type BasicCredentials ¶ added in v0.0.6
type BasicCredentials struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` }
LoginCredentials is used for basic username/password login These are required to obtain KeyCredentials required for encryption
type Client ¶
type Client struct { Store *Store // contains filtered or unexported fields }
func (*Client) Disconnect ¶ added in v0.0.9
func (c *Client) Disconnect()
func (*Client) GenerateKey ¶ added in v0.0.6
func (c *Client) GenerateKey(creds KeyCredentials) error
GenerateKey generates and configures the client's encryption key
func (*Client) GetContactByName ¶ added in v0.0.7
func (*Client) GetContactByPhone ¶ added in v0.0.7
func (c *Client) GetContactByPhone(phone PhoneNumber) (Contact, bool)
func (*Client) GetKeyCredentials ¶ added in v0.0.6
func (c *Client) GetKeyCredentials() KeyCredentials
func (*Client) GetMessages ¶
func (*Client) IsConnected ¶ added in v0.0.7
func (*Client) Login ¶
func (c *Client) Login(creds BasicCredentials) error
Login authenticates with pulse and setups up client encryption
func (*Client) SetMessageHandler ¶
type Contact ¶ added in v0.0.4
type Contact struct { PhoneNumber PhoneNumber Notify string Name string Short string }
type DeviceID ¶ added in v0.0.3
type DeviceID = int
DeviceID is the generated internal ID of the device used to interact with a PulseSMS account
type KeyCredentials ¶ added in v0.0.6
type KeyCredentials struct { // the account id required to access API resources AccountID AccountID // hash of account password and pepper (salt2) PasswordHash string // salt used Salt string }
KeyCredentials are the inputs used to generate an encryption key Note these can only be generated after calling Login
type Message ¶
type Message struct { ID MessageID `json:"id,omitempty"` ConversationID conversationID `json:"conversation_id,omitempty"` DeviceID DeviceID `json:"device_id,omitempty"` Type int `json:"message_type,omitempty"` Data string `json:"data,omitempty"` Timestamp int64 `json:"timestamp,omitempty"` MimeType string `json:"mime_type,omitempty"` Read bool `json:"read,omitempty"` Seen bool `json:"seen,omitempty"` From string `json:"message_from,omitempty"` Archive bool `json:"archive,omitempty"` SentDevice DeviceID `json:"sent_device,omitempty"` SimStamp string `json:"sim_stamp,omitempty"` Snippet string `json:"snippet,omitempty"` }
type MessageID ¶ added in v0.0.3
type MessageID = int
MessageID is the internal ID of a Pulse SMS message
type NotificationMessage ¶
type PhoneNumber ¶ added in v0.0.4
type PhoneNumber = string
type WSMessage ¶
type WSMessage struct { Identifier string `json:"identifier,omitempty"` Message NotificationMessage `json:"message,omitempty"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.