gist

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 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 Cache added in v1.2.0

type Cache struct {
	Token string `json:"token"`
	Pages []Page `json:"pages"`
	Path  string `json:"-"`
}

func NewCache added in v1.2.0

func NewCache(path string) *Cache

func (*Cache) Delete added in v1.2.0

func (c *Cache) Delete() error

func (*Cache) Open added in v1.2.0

func (c *Cache) Open() error

func (*Cache) Save added in v1.2.0

func (c *Cache) Save(pages []Page) error

type Client added in v1.2.0

type Client struct {
	*github.Client
}

func NewClient added in v1.2.0

func NewClient(token string) Client

func (Client) List added in v1.2.0

func (c Client) List(user string) ([]Page, error)

List lists gist pages

type File

type File struct {
	Name     string `json:"name"`
	Content  string `json:"content"`
	FullPath string `json:"fullpath"`

	Page `json:"-"`
}

File represents a single file hosted on gist

func (File) HasUpdated added in v1.2.1

func (f File) HasUpdated() (bool, error)

func (File) Update added in v1.2.1

func (f File) Update() error

type Gist

type Gist struct {
	User   string
	Token  string
	Editor string

	Client Client

	WorkDir string
	Pages   []Page
}

func (*Gist) Checkout added in v1.2.1

func (g *Gist) Checkout() error

func (Gist) Create

func (g Gist) Create(page Page) (string, error)

func (Gist) Delete added in v1.1.0

func (g Gist) Delete(page Page) error

func (Gist) Files

func (g Gist) Files() []File

type Page

type Page struct {
	ID          string    `json:"id"`
	Description string    `json:"description"`
	User        string    `json:"user"`
	URL         string    `json:"url"`
	Public      bool      `json:"public"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	Files       []File    `json:"files"`

	Repo *git.Repo `json:"-"`
}

Page represents gist page itself

Jump to

Keyboard shortcuts

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