libgvoice

package module
v0.0.0-...-fcb9cae Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

README

libgvoice

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrowserChannel

type BrowserChannel struct {
	*GoogleVoiceClient
	// contains filtered or unexported fields
}

func NewBrowserChannel

func NewBrowserChannel(eventChannel chan BrowserChannelEvent, log gvLog.Logger) *BrowserChannel

func (*BrowserChannel) ResetData

func (bc *BrowserChannel) ResetData()

func (*BrowserChannel) StartEventListener

func (bc *BrowserChannel) StartEventListener()

type BrowserChannelEvent

type BrowserChannelEvent int
const (
	RefreshInboxEvent BrowserChannelEvent = iota
	PingEvent
	NoopEvent
)

type GoogleVoiceClient

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

GoogleVoiceClient interfaces with the Google Voice API over HTTPS and works similar to how the web client at https://voice.google.com works.

func NewGoogleVoiceClient

func NewGoogleVoiceClient(log gvLog.Logger) *GoogleVoiceClient

NewGoogleVoiceClient creates a new GoogleVoiceClient to interact with the API

func (*GoogleVoiceClient) FetchInbox

func (gv *GoogleVoiceClient) FetchInbox(fetchPage string, alertNew bool) ([]models.Thread, error)

FetchInbox fetches the inbox for the current user. The fetchPage parameter is for pagination, which is not implemented yet. The alertNew parameter is set to false on the first call to cache the messages. Subsequent calls should be true, so new messages can be detected.

In the future we should support inbox type, thread count, and max recent parameters, that get set in the protobufMessage.

func (*GoogleVoiceClient) GetAccountInfo

func (gv *GoogleVoiceClient) GetAccountInfo() (*api.AccountInfo, error)

GetAccountInfo is used to get all the account details of the current user.

func (*GoogleVoiceClient) IsConnected

func (gv *GoogleVoiceClient) IsConnected() bool

IsConnected will return true if Auth has been setup, otherwise false

func (*GoogleVoiceClient) SendSMS

func (gv *GoogleVoiceClient) SendSMS(threadID, msg string) (*api.MessageResponse, error)

SendSMS sends a text message to the given thread. For a single recipient, the thread will always be in the format of "t.+1XXXXXXXXXX". For a group, there is a different format which is not yet supported. If you have an existing thread for a group message, you can send a message to that thread and it will work properly.

func (*GoogleVoiceClient) SetAuth

func (gv *GoogleVoiceClient) SetAuth(cookieParam string)

SetAuth takes the full list of cookies from the browser and creates the necessary auth headers for the API.

func (*GoogleVoiceClient) StartEventListener

func (gv *GoogleVoiceClient) StartEventListener()

StartEventListener is meant to be run in a goroutine. It will listen for events from the browser channel. Currently, it only prints out any new incoming messages. In the future we should support pushing new inbound messages over a channel, so the caller can be alerted in real-time of new messages.

Directories

Path Synopsis
log

Jump to

Keyboard shortcuts

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