Documentation
¶
Index ¶
- Constants
- func Logf(prefix, pattern string, args ...interface{})
- type Article
- type ArticleHeader
- type Broker
- func (b *Broker) FetchLocalArticles() (articles map[string]*Article, err error)
- func (b *Broker) FetchRemoteArticles() ([]*Article, error)
- func (b *Broker) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- func (b *Broker) PostArticle(body *PostItem) error
- func (b *Broker) StoreFresh(localArticles map[string]*Article, remoteArticle *Article) (bool, error)
- func (b *Broker) UploadFresh(a *Article) (bool, error)
- type Config
- type Item
- type PostItem
- type PostItemResult
- type Tag
- type User
Constants ¶
const Version = "0.0.5"
Version is the version to be displayed in the command line help message.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Article ¶ added in v0.0.2
type Article struct {
*ArticleHeader
Item *Item
FilePath string
}
Article is a structure that holds the metadata of a file and the contents of an article.
func ArticleFromFile ¶ added in v0.0.2
ArticleFromFile extracts an article from local filesysytem.
type ArticleHeader ¶
type ArticleHeader struct {
ID string `yaml:"ID"`
Title string `yaml:"Title"`
Tags string `yaml:"Tags"`
Author string `yaml:"Author"`
Private bool `yaml:"Private"`
}
ArticleHeader is a structure that represents the metadata of a Article.
type Broker ¶
Broker is the core structure of qiisync that handles Qiita and the local filesystem with each other.
func (*Broker) FetchLocalArticles ¶ added in v0.0.2
FetchLocalArticles searches base_dir of local filesystem and extracts articles.
func (*Broker) FetchRemoteArticles ¶ added in v0.0.2
FetchRemoteArticles extracts articles from Qiita.
func (*Broker) NewRequest ¶
NewRequest is a testable NewRequest that wraps http.NewRequest.
func (*Broker) PostArticle ¶
PostArticle post the article on Qiita.
type Config ¶ added in v0.0.2
type Config struct {
Qiita qiitaConfig `toml:"qiita"`
Local localConfig `toml:"local"`
}
Config stores Qiita's configuration and local environment settings.
func LoadConfiguration ¶ added in v0.0.2
LoadConfiguration gets its configuration from "~/.config/qiisync/config".
type Item ¶
type Item struct {
ID string `json:"id"`
URL string `json:"url"`
User User `json:"user"`
Title string `json:"title"`
Body string `json:"body"`
RenderedBody string `json:"rendered_body"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Tags []*Tag `json:"tags"`
Private bool `json:"private"`
}
Item is a structure that represents the QiitaAPI.
type PostItem ¶
type PostItem struct {
Body string `json:"body"`
Private bool `json:"private"`
Tags []*Tag `json:"tags"`
Title string `json:"title"`
ID string
URL string
FilePath string
}
PostItem is a structure that represents the Qiita API required to post an Article to Qiita.
type PostItemResult ¶
type PostItemResult struct {
Body string `json:"body"`
CreatedAt time.Time `json:"created_at"`
ID string `json:"id"`
Private bool `json:"private"`
Tags []*Tag `json:"tags"`
Title string `json:"title"`
UpdatedAt time.Time `json:"updated_at"`
URL string `json:"url"`
User User `json:"user"`
}
PostItemResult is a structure that represents the response body when an Article is posted to Qiita.