pixela

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateGraphPayload

type CreateGraphPayload struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	Unit           string `json:"unit"`
	NumType        string `json:"type"`
	Color          string `json:"color"`
	Timezone       string `json:"timezone,omitempty"`
	SelfSufficient string `json:"selfSufficient,omitempty"`
}

CreateGraphPayload is payload for `graph create` subcommand

type CreatePixelPayload

type CreatePixelPayload struct {
	Date         string `json:"date"`
	Quantity     string `json:"quantity"`
	OptionalData string `json:"optionalData,omitempty"`
}

CreatePixelPayload is payload for `pixel create` subcommand

type CreateUserPayload

type CreateUserPayload struct {
	Username            string `json:"username"`
	Token               string `json:"token"`
	AgreeTermsOfService string `json:"agreeTermsOfService"`
	NotMinor            string `json:"notMinor"`
}

CreateUserPayload is payload for `user create` subcommand

type CreateWebhookPayload

type CreateWebhookPayload struct {
	GraphID string `json:"graphID"`
	Type    string `json:"type"`
}

CreateWebhookPayload is `webhook create` subcommand payload

type GetPixelResponseBody

type GetPixelResponseBody struct {
	Quantity     string `json:"quantity"`
	OptionalData string `json:"optionalData,omitempty"`
}

GetPixelResponseBody is response for `pixel get` subcommand

type Graph added in v0.0.3

type Graph struct {
	ID             string   `json:"id"`
	Name           string   `json:"name"`
	Unit           string   `json:"unit"`
	Type           string   `json:"type"`
	Color          string   `json:"color"`
	Timezone       string   `json:"timezone"`
	PurgeCacheURLs []string `json:"purgeCacheURLs"`
}

Graph is part of response for `graph def` subcommand

type GraphDefinitions

type GraphDefinitions struct {
	Graphs []Graph `json:"graphs"`
}

GraphDefinitions is response for `graph def` subcommand

type GraphStat added in v0.0.6

type GraphStat struct {
	TotalPixelsCount int     `json:"totalPixelsCount"`
	MaxQuantity      int     `json:"maxQuantity"`
	MinQuantity      int     `json:"minQuantity"`
	TotalQuantity    int     `json:"totalQuantity"`
	AvgQuantity      float64 `json:"avgQuantity"`
	TodaysQuantity   int     `json:"todaysQuantity"`
}

GraphStat is response for `graph stat` suncommand

type NoneGetResponseBody

type NoneGetResponseBody struct {
	Message     string `json:"message"`
	IsSuccess   bool   `json:"isSuccess"`
	WebhookHash string `json:"webhookHash,omitempty"`
}

NoneGetResponseBody - pixe.la response body that post, put and delete method requested

type Option added in v0.0.3

type Option func(*Pixela)

Option is customize Pixela properties function

func OptionHTTPClient added in v0.0.3

func OptionHTTPClient(c *http.Client) Option

OptionHTTPClient - provide a custom http client to the HTTPClient

type Pixela

type Pixela struct {
	HTTPClient *http.Client
	URL        string
	Username   string
	Validator  Validator
	Token      string
	Debug      bool
}

Pixela is application for pixe.la

func New

func New(username, token string, debug bool, opts ...Option) (*Pixela, error)

New creates pixe.la api client instance

func (*Pixela) CreateGraph

func (pixela *Pixela) CreateGraph(id, name, unit, numType, color, timezone, selfSufficient string) (NoneGetResponseBody, error)

CreateGraph is method for `graph create` subcommand

func (*Pixela) CreateUser

func (pixela *Pixela) CreateUser(agreeTermsOfService, notMinor string) (NoneGetResponseBody, error)

CreateUser is method for `user create` subcommand

func (*Pixela) CreateWebhook

func (pixela *Pixela) CreateWebhook(graphID, webhookType string) (NoneGetResponseBody, error)

CreateWebhook is method for `webhook create` subcommand

func (*Pixela) DecrementPixel added in v0.0.4

func (pixela *Pixela) DecrementPixel(graphID string) (NoneGetResponseBody, error)

DecrementPixel is method for `pixel decrement` subcommand

func (*Pixela) DeleteGraph

func (pixela *Pixela) DeleteGraph(graphID string) (NoneGetResponseBody, error)

DeleteGraph is method for `graph delete` subcommand

func (*Pixela) DeletePixel

func (pixela *Pixela) DeletePixel(graphID, date string) (NoneGetResponseBody, error)

DeletePixel is method for `pixel delete` subcommand

func (*Pixela) DeleteUser

func (pixela *Pixela) DeleteUser() (NoneGetResponseBody, error)

DeleteUser is method for `user delete` subcommand

func (*Pixela) DeleteWebhook

func (pixela *Pixela) DeleteWebhook(webhookHash string) (NoneGetResponseBody, error)

DeleteWebhook is method for `webhook delete` subcommand

func (*Pixela) GetGraphDefinition

func (pixela *Pixela) GetGraphDefinition() (GraphDefinitions, error)

GetGraphDefinition is method for `graph get` subcommand

func (*Pixela) GetGraphDetailURL added in v0.0.4

func (pixela *Pixela) GetGraphDetailURL(graphID string) string

GetGraphDetailURL is method for `graph detail` subcommand

func (*Pixela) GetGraphPixelsDateList added in v0.0.3

func (pixela *Pixela) GetGraphPixelsDateList(graphID, from, to string) (PixelsDateList, error)

GetGraphPixelsDateList is method for `graph pixels` subcommand

func (*Pixela) GetGraphStat added in v0.0.6

func (pixela *Pixela) GetGraphStat(graphID string) (GraphStat, error)

GetGraphStat is method for `graph stat` subcommand

func (*Pixela) GetGraphSvg

func (pixela *Pixela) GetGraphSvg(graphID, date, mode string) ([]byte, error)

GetGraphSvg is method for `graph svg` subcommand

func (*Pixela) GetPixel

func (pixela *Pixela) GetPixel(graphID string, date string) (GetPixelResponseBody, error)

GetPixel is method for `pixel get` subcommand

func (*Pixela) GetWebhookDefinitions

func (pixela *Pixela) GetWebhookDefinitions() (WebhookDefinitions, error)

GetWebhookDefinitions is method for `webhook get` subcommand

func (*Pixela) IncrementPixel added in v0.0.4

func (pixela *Pixela) IncrementPixel(graphID string) (NoneGetResponseBody, error)

IncrementPixel is method for `pixel increment` subcommand

func (*Pixela) InvokeWebhooks

func (pixela *Pixela) InvokeWebhooks(webhookHash string) (NoneGetResponseBody, error)

InvokeWebhooks is method for `webhook invoke` subcommand

func (*Pixela) PostPixel added in v0.0.4

func (pixela *Pixela) PostPixel(graphID, date, quantity, optionalData string) (NoneGetResponseBody, error)

PostPixel is method for `pixel post` subcommand

func (*Pixela) UpdateGraph

func (pixela *Pixela) UpdateGraph(graphID string, payload UpdateGraphPayload) (NoneGetResponseBody, error)

UpdateGraph is method for `graph update` subcommand

func (*Pixela) UpdatePixel

func (pixela *Pixela) UpdatePixel(graphID, date, quantity, optionalData string) (NoneGetResponseBody, error)

UpdatePixel is method for `pixel update` subcommand

func (*Pixela) UpdateUser

func (pixela *Pixela) UpdateUser(newToken string) (NoneGetResponseBody, error)

UpdateUser is method for `user update` subcommand

type PixelsDateList added in v0.0.3

type PixelsDateList struct {
	Pixels []string `json:"pixels"`
}

PixelsDateList is response for `graph pixels` subcommand

type UpdateGraphPayload

type UpdateGraphPayload struct {
	Name           string   `json:"name,omitempty"`
	Unit           string   `json:"unit,omitempty"`
	Color          string   `json:"color,omitempty"`
	Timezone       string   `json:"timezone,omitempty"`
	PurgeCacheURLs []string `json:"purgeCacheURLs,omitempty"`
}

UpdateGraphPayload is payload for `graph update` subcommand

type UpdateUserPayload

type UpdateUserPayload struct {
	NewToken string `json:"newToken"`
}

UpdateUserPayload is payload for `user update` subcommand

type Validator added in v0.0.2

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

Validator is struct for argument validation

func (*Validator) Validate added in v0.0.2

func (pv *Validator) Validate(i interface{}) error

Validate is method for argument validation

type Webhook

type Webhook struct {
	WebhookHash string `json:"webhookHash"`
	GraphID     string `json:"graphID"`
	Type        string `json:"type"`
}

Webhook is internal part of `webhook get` response

type WebhookDefinitions

type WebhookDefinitions struct {
	Webhooks []Webhook `json:"webhooks"`
}

WebhookDefinitions is `webhook get` response

Jump to

Keyboard shortcuts

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