github

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionFileName     = "todo-cli.yaml"
	DefaultGistDescription = "TODO CLI CONFIG"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileRequest

type FileRequest struct {
	Content string `json:"content"`
}

type FileResponse

type FileResponse struct {
	Filename string `json:"filename"`
	Type     string `json:"type"`
	Language string `json:"language"`
	RawURL   string `json:"raw_url"`
	Size     int    `json:"size"`
}

type GistAPI

type GistAPI struct {
	Config         *GistConfig
	GistContent    []byte
	UpdatedAt      time.Time
	DisabledStatus string
}

func NewGistAPI

func NewGistAPI(config *GistConfig) (api *GistAPI, err error)

func (*GistAPI) Delete

func (api *GistAPI) Delete() (err error)

func (*GistAPI) Save

func (api *GistAPI) Save(gistContent []byte) (err error)

type GistConfig

type GistConfig struct {
	Authorization    string        `yaml:"authorization"`
	GistId           string        `yaml:"gist_id"`
	RawURL           string        `yaml:"raw_url"`
	AutoSync         bool          `yaml:"auto_sync"`
	GistDescription  string        `yaml:"gist_description"`
	LastSync         time.Time     `yaml:"last_sync"`
	AutoSyncInterval time.Duration `yaml:"auto_sync_interval"`
}

func GetDefaultGistConfig

func GetDefaultGistConfig() GistConfig

func (*GistConfig) SetToken

func (c *GistConfig) SetToken(token string) error

func (GistConfig) String

func (c GistConfig) String() string

type GistRequest

type GistRequest struct {
	Description string                 `json:"description"`
	Public      bool                   `json:"public"`
	Files       map[string]FileRequest `json:"files"`
}

type GistResponse

type GistResponse struct {
	URL         string                  `json:"url"`
	Id          string                  `json:"id"`
	Files       map[string]FileResponse `json:"files"`
	Public      bool                    `json:"public"`
	CreatedAt   time.Time               `json:"created_at"`
	UpdatedAt   time.Time               `json:"updated_at"`
	Description string                  `json:"description"`
}

type GitHubGistAPI

type GitHubGistAPI struct {
	Authorization     string
	GistId            string
	GistDescription   string
	ConfigFileRawURL  string
	ConfigFileContent []byte
	UpdatedAt         time.Time

	LastError error
	// contains filtered or unexported fields
}

func NewGitHubGistAPI

func NewGitHubGistAPI(authorization string) *GitHubGistAPI

func (*GitHubGistAPI) DeleteGist

func (api *GitHubGistAPI) DeleteGist() error

func (*GitHubGistAPI) Enabled

func (api *GitHubGistAPI) Enabled() bool

func (*GitHubGistAPI) GetConfigFileContent

func (api *GitHubGistAPI) GetConfigFileContent() error

func (*GitHubGistAPI) GetToDoConfigFileGist

func (api *GitHubGistAPI) GetToDoConfigFileGist() error

func (*GitHubGistAPI) SetConfigFileGist

func (api *GitHubGistAPI) SetConfigFileGist(configFileName string) error

func (*GitHubGistAPI) ValidateAuth

func (api *GitHubGistAPI) ValidateAuth(authorization string) error

Jump to

Keyboard shortcuts

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