google

package
v0.0.0-...-16adccd Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package google has Google API client stuff

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeFileID

func NormalizeFileID(s string) (string, error)

func SheetToDonorWall

func SheetToDonorWall(ctx context.Context, cl *http.Client, sheetID string) (map[string]DonorWall, error)

SheetToDonorWall connects to Google Sheets, downloads the spreadsheet and returns a map from file name to JSON objects

Types

type AnalyticsRequest

type AnalyticsRequest struct {
	ReportRequests []ReportRequest `json:"reportRequests"`
}

type AnalyticsResponse

type AnalyticsResponse struct {
	Reports []Report `json:"reports"`
}

type ColumnHeader

type ColumnHeader struct {
	Dimensions   []string     `json:"dimensions"`
	MetricHeader MetricHeader `json:"metricHeader"`
}

type Data

type Data struct {
	Rows     []Row    `json:"rows"`
	Totals   []Values `json:"totals"`
	RowCount int      `json:"rowCount"`
	Minimums []Values `json:"minimums"`
	Maximums []Values `json:"maximums"`
}

type DateRange

type DateRange struct {
	EndDate   string `json:"endDate"`
	StartDate string `json:"startDate"`
}

type Dimension

type Dimension struct {
	Name string `json:"name"`
}

type Donor

type Donor struct {
	Display string `json:"display"`
	Sort    string `json:"sort"`
	URL     string `json:"url"`
}

type DonorWall

type DonorWall struct {
	List []Donor `json:"list"`
}

type FileList

type FileList struct {
	Files []*Files `json:"files"`
}

type Files

type Files struct {
	ID                string            `json:"id"`
	Name              string            `json:"name"`
	LastModifyingUser LastModifyingUser `json:"lastModifyingUser"`
}

type LastModifyingUser

type LastModifyingUser struct {
	Kind         string `json:"kind"`
	DisplayName  string `json:"displayName"`
	PhotoLink    string `json:"photoLink"`
	Me           bool   `json:"me"`
	PermissionID string `json:"permissionId"`
	EmailAddress string `json:"emailAddress"`
}

type Metric

type Metric struct {
	Expression string `json:"expression"`
}

type MetricHeader

type MetricHeader struct {
	MetricHeaderEntries []MetricHeaderEntry `json:"metricHeaderEntries"`
}

type MetricHeaderEntry

type MetricHeaderEntry struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type OrderBy

type OrderBy struct {
	FieldName string `json:"fieldName"`
	SortOrder string `json:"sortOrder"`
}

type Report

type Report struct {
	ColumnHeader ColumnHeader `json:"columnHeader"`
	Data         Data         `json:"data"`
}

type ReportRequest

type ReportRequest struct {
	ViewID            string      `json:"viewId"`
	DateRanges        []DateRange `json:"dateRanges"`
	Dimensions        []Dimension `json:"dimensions"`
	Metrics           []Metric    `json:"metrics"`
	FiltersExpression string      `json:"filtersExpression"`
	OrderBys          []OrderBy   `json:"orderBys"`
	PageSize          int         `json:"pageSize"`
	PageToken         string      `json:"pageToken"`
}

type Row

type Row struct {
	Dimensions []string `json:"dimensions"`
	Metrics    []Values `json:"metrics"`
}

type Service

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

func (*Service) AddFlags

func (gsvc *Service) AddFlags(fl *flag.FlagSet)

func (*Service) ConfigureCert

func (gsvc *Service) ConfigureCert(s string) error

func (*Service) DownloadFile

func (gsvc *Service) DownloadFile(ctx context.Context, cl *http.Client, fileID string) ([]byte, error)

func (*Service) DownloadURLForDriveID

func (gsvc *Service) DownloadURLForDriveID(fileID string) (string, error)

func (*Service) DriveClient

func (gsvc *Service) DriveClient(ctx context.Context) (cl *http.Client, err error)

func (*Service) Files

func (gsvc *Service) Files(ctx context.Context, cl *http.Client) (files []*Files, err error)

func (*Service) GAClient

func (gsvc *Service) GAClient(ctx context.Context) (cl *http.Client, err error)

func (*Service) GDocsClient

func (gsvc *Service) GDocsClient(ctx context.Context) (cl *http.Client, err error)

func (*Service) HasCert

func (gsvc *Service) HasCert() bool

func (*Service) MostPopularNews

func (gsvc *Service) MostPopularNews(ctx context.Context, cl *http.Client) (pages []string, err error)

func (*Service) SetMockClient

func (gsvc *Service) SetMockClient(cl *http.Client)

func (*Service) SheetsClient

func (gsvc *Service) SheetsClient(ctx context.Context) (cl *http.Client, err error)

type SheetMap

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

func NewSheetMap

func NewSheetMap(sheet *spreadsheet.Sheet) *SheetMap

func (*SheetMap) Field

func (sm *SheetMap) Field(fieldname string) string

Field returns the value in the currently loaded row of the column corresponding to fieldname.

func (*SheetMap) Next

func (sm *SheetMap) Next() bool

type Values

type Values struct {
	Values []string `json:"values"`
}

Jump to

Keyboard shortcuts

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