Documentation
¶
Index ¶
- Constants
- func BrowserOpen(url string) error
- func CheckError(err error)
- func ProcessCSV(filename string) (output []string, ok bool)
- func ToCSV(file *os.File, data [][]string) bool
- func WebCallback(ch chan string)
- type AccessData
- type AuthCode
- type AuthData
- type AuthInfo
- type DataFrameData
- type Daterange
- type DiffMap
- type GError
- type OauthData
- func (d *OauthData) ImportConfig(filename string) (err error)
- func (d *OauthData) InitConnection() (err error)
- func (d *OauthData) ProcessRefreshResponse(contents []byte) (data *RefreshData, err error)
- func (d *OauthData) ProcessTokenResponse(contents []byte) (data *AccessData, err error)
- func (d *OauthData) RefreshToken() (err error)
- func (d *OauthData) RegisterClient() (err error)
- type RefreshData
- type SeriesData
- func (s *SeriesData) Add(key string, val interface{}) (ok bool)
- func (s *SeriesData) ApplyDiff(diff *DiffMap)
- func (s *SeriesData) Delete(key string) (ok bool)
- func (s *SeriesData) Diff(s2 *SeriesData) (out *DiffMap, ok bool)
- func (s *SeriesData) Get(key string) (loc int, val interface{}, ok bool)
- func (s *SeriesData) Index() *[]string
- func (s *SeriesData) SetIndex(newIndex *[]string) (ok bool)
- func (s *SeriesData) Sum() (total float64, ok bool)
- func (s *SeriesData) Swap(i int, j int)
Constants ¶
const ( Scope string = "https://www.googleapis.com/auth/analytics.readonly" ReturnURI string = "localhost:9000" LocalStoreFile string = "localStore.dat" )
Base constants
Variables ¶
This section is empty.
Functions ¶
func BrowserOpen ¶
BrowserOpen opens a URL is the OS' default web browser
func ProcessCSV ¶
func WebCallback ¶
func WebCallback(ch chan string)
WebCallback listens on a predefined port for a oauth response sends back via channel once it receives a response and shuts down.
Types ¶
type AccessData ¶
type AccessData struct {
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
TokenType string `json:"token_type"`
RefreshToken string `json:"refresh_token"`
}
AccessData contains the access and refresh token information received after a successful retrieval from Google or local stores
type AuthCode ¶
type AuthCode struct {
Code string `json:"code"`
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
RedirectURI string `json:"redirect_uri"`
GrantType string `json:"grant_type"`
}
AuthCode is the authorisation code POST request struct for exchanging for access and refresh tokens
func (*AuthCode) ToURLValues ¶
type AuthData ¶
type AuthData struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
AuthURI string `json:"auth_uri"`
TokenURI string `json:"token_uri"`
RedirectURIs []string `json:"redirect_uris"`
}
AuthData is the primary struct of JSON config file
type AuthInfo ¶
type AuthInfo struct {
Data AuthData `json:"installed"`
}
AuthInfo is the outer structure of client_secret.json
type DataFrameData ¶
type DataFrameData struct {
Index *[]string
Data *[]*SeriesData
Size int
}
Set of results
type Daterange ¶
type Daterange struct {
Start string
End string
Precision string
Segments []*Daterange
IsSplit bool
}
Daterange object
func GenDayRanges ¶
type GError ¶
type GError struct {
Error string `json:"error"`
ErrorDescription string `json:"error_description"`
}
GError is the error strucure of oauth2 server response when requesting the token set
type OauthData ¶
type OauthData struct {
Tokens *AccessData
JSONfile string
// contains filtered or unexported fields
}
Client is the working struct of the library
func (*OauthData) ImportConfig ¶
ImportConfig imports client secret information from the JSON obtained from Google Developer Console (API console).
func (*OauthData) InitConnection ¶
func (*OauthData) ProcessRefreshResponse ¶
func (d *OauthData) ProcessRefreshResponse(contents []byte) (data *RefreshData, err error)
Process token refresh
func (*OauthData) ProcessTokenResponse ¶
func (d *OauthData) ProcessTokenResponse(contents []byte) (data *AccessData, err error)
func (*OauthData) RefreshToken ¶
RefreshToken refreshes access token in case of expiry
func (*OauthData) RegisterClient ¶
type RefreshData ¶
type RefreshData struct {
AccessToken string `json:"access_token"`
Expires int `json:"expires_in"`
TokenType string `json:"token_type"`
}
RefreshData is the token refresh response data structure
type SeriesData ¶
Results Row data structure
func (*SeriesData) Add ¶
func (s *SeriesData) Add(key string, val interface{}) (ok bool)
func (*SeriesData) Delete ¶
func (s *SeriesData) Delete(key string) (ok bool)
func (*SeriesData) Diff ¶
func (s *SeriesData) Diff(s2 *SeriesData) (out *DiffMap, ok bool)
Find difference between Series
func (*SeriesData) SetIndex ¶
func (s *SeriesData) SetIndex(newIndex *[]string) (ok bool)
Set or replace column index
func (*SeriesData) Sum ¶
func (s *SeriesData) Sum() (total float64, ok bool)
If row is made up of numeric numbers, get total