platform

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Google Search Console

Index

Constants

View Source
const (
	// Determine if the time will be display as x-axis headers, or something else
	XHeaderTime uint16 = iota
	XHeaderOtherDim
)

Variables

This section is empty.

Functions

func ConvertDates

func ConvertDates(
	base time.Time,
	startDate string,
	endDate string,
) (start time.Time, end time.Time, err error)

ConvertDates from configuration string values to formatted start date / end date with layout. Example: "next_month" => startDate "2019-01-01", endDate "2019-01-31".

func ExtractCountPeriod

func ExtractCountPeriod(period string) (int64, error)

ExtractCountPeriod from a period like "5_weeks_ago". Return the count of the period, "5" in the case of "5_weeks_ago".

func HostBar

func HostBar(runner runnerFunc, command string) (data []int, err error)

func HostBox

func HostBox(runner runnerFunc, command string) (string, error)

func HostCPURate

func HostCPURate(runner runnerFunc) (float64, error)

See https://www.idnt.net/en-US/kb/941772

func HostDisk

func HostDisk(runner runnerFunc, headers []string, unit string) ([][]string, error)

func HostDiskIO

func HostDiskIO(runner runnerFunc, unit string) (string, error)

func HostGauge

func HostGauge(runner runnerFunc, command string) (float64, error)

func HostLoad

func HostLoad(runner runnerFunc) (string, error)

func HostMemory

func HostMemory(runner runnerFunc, metrics []string, unit string) (val []int, err error)

func HostMemoryRate

func HostMemoryRate(runner runnerFunc) (float64, error)

func HostNetIO

func HostNetIO(runner runnerFunc, unit string) (string, error)

GetNetStat returns net stat

func HostProcesses

func HostProcesses(runner runnerFunc) (string, error)

func HostSwapRate

func HostSwapRate(runner runnerFunc) (float64, error)

TODO to refactor - DRY

func HostTable

func HostTable(runner runnerFunc, command string, headers []string) (cells [][]string, err error)

func HostUptime

func HostUptime(runner runnerFunc) (int64, error)

func NewTermUI

func NewTermUI(d bool) (*termUI, error)

NewTermUI returns a new Terminal Interface object with a given output mode.

Types

type AnalyticValues

type AnalyticValues struct {
	ViewID     string
	StartDate  string
	EndDate    string
	TimePeriod string
	Global     bool
	Metrics    []string
	Dimensions []string
	Filters    []string
	Orders     []string
	RowLimit   int64
	XHeaders   uint16
}

AnalyticValues which can be possibly send to the Google Analytics API. This is a pure value object without behavior.

type Analytics

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

Analytics connect to Google Analytics API.

func NewAnalyticsClient

func NewAnalyticsClient(keyfile string) (*Analytics, error)

NewAnalyticsClient to connect to Google Analytics APIs.

func (*Analytics) BarMetric

func (c *Analytics) BarMetric(val AnalyticValues) ([]string, []int, error)

BarMetric provides a qualitive dimension linked to a quantitative value, for example a date (dimension) with an int.

func (*Analytics) RealTimeUsers

func (c *Analytics) RealTimeUsers(viewID string) (string, error)

RealTimeUsers return the number of visitor currently on the website.

func (*Analytics) SimpleMetric

func (c *Analytics) SimpleMetric(val AnalyticValues) (string, error)

SimpleMetric get a value depending on Google Analytics metrics.

func (*Analytics) StackedBar

func (c *Analytics) StackedBar(an AnalyticValues) (dim []string, values map[string][]int, err error)

StackedBar returns one dimension set linked with multiple values.

func (*Analytics) Table

func (c *Analytics) Table(
	an AnalyticValues,
	firstHeader string,
) (headers []string, dim []string, u [][]string, err error)

Table display dimensions and values. The headers on the first row are qualitative dimensions, the values can be qualitative or quantitative.

type Feedly

type Feedly struct {
	Address string
	Client  *http.Client
}

func NewFeedly

func NewFeedly(address string) *Feedly

func (*Feedly) Subscribers

func (f *Feedly) Subscribers() (string, error)

type FeedlyResponse

type FeedlyResponse struct {
	Results []map[string]interface{} `json:"results"`
}

type Git

type Git struct {
	Path string
}

func NewGit

func NewGit(path string) *Git

func (*Git) Branches

func (g *Git) Branches() ([][]string, error)

type Github

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

Github structure connects to the Github API.

func NewGithubClient

func NewGithubClient(token string, owner string, repoName string) (*Github, error)

GithubClient to fetch Github related data.

func (*Github) CountCommits

func (g *Github) CountCommits(
	repository string,
	scope string,
	startWeek int64,
	endWeek int64,
	startDate time.Time,
) ([]string, []int, error)

CountCommits of a repository overtime.

func (*Github) CountStars

func (g *Github) CountStars(repository string, startDate, endDate time.Time) (dim []string, val []int, err error)

CountStars of a repository overtime. Only on a daily basis for now.

func (*Github) ListBranches

func (g *Github) ListBranches(repository string, limit int) ([][]string, error)

ListBranches of a repository.

func (*Github) ListIssues

func (g *Github) ListIssues(repository string, limit int) ([][]string, error)

ListIssues of a repository.

func (*Github) ListPullRequests

func (g *Github) ListPullRequests(repository string, limit int) ([][]string, error)

ListPullRequests of a repository.

func (*Github) ListRepo

func (g *Github) ListRepo(limit int, order string, metrics []string) ([][]string, error)

ListRepo of a Github account.

func (*Github) TotalOpenIssues

func (g *Github) TotalOpenIssues(repository string) (int, error)

TotalOpenIssues of a repository overtime.

func (*Github) TotalStars

func (g *Github) TotalStars(repository string) (int, error)

TotalStars of a repository.

func (*Github) TotalWatchers

func (g *Github) TotalWatchers(repository string) (int, error)

TotalWatchers of a repository overtime.

func (*Github) Views

func (g *Github) Views(repository string, days int) ([]string, []int, error)

Views on a github repository the last 7 days.

type Host

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

func NewHost

func NewHost(username, addr string) (*Host, error)

func (*Host) Runner

func (s *Host) Runner(command string) (string, error)

Run a command on remote server via SSH or on localhost

type SearchConsole

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

SearchConsole connect to the Google Search Console API.

func NewSearchConsoleClient

func NewSearchConsoleClient(keyfile string) (*SearchConsole, error)

NewSearchConsoleClient create a SearchConsole.

func (*SearchConsole) Table

func (w *SearchConsole) Table(
	startDate string,
	endDate string,
	limit int64,
	address string,
	dimension string,
	filters string,
) ([]SearchConsoleResponse, error)

Table of Google Search Console with a dimension and its values.

type SearchConsoleResponse

type SearchConsoleResponse struct {
	Dimension   string
	Clicks      float64
	Impressions float64
	Ctr         float64
	Position    float64
}

SearchConsoleResponse returned after requesting the API.

type TravisCI

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

func NewTravisCI

func NewTravisCI(token string) *TravisCI

func (TravisCI) Builds

func (tc TravisCI) Builds(repository string, owner string, limit int64) ([][]string, error)

Jump to

Keyboard shortcuts

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