Documentation ¶
Index ¶
- Constants
- type CreationOptions
- type CreationPost
- type EmptyIDError
- type ITime
- type InvalidError
- type InvalidStatus
- type Meta
- type Post
- func (post *Post) Create(client api.Client, opts CreationOptions) (err error)
- func (post *Post) Decode(b []byte) (err error)
- func (post *Post) Delete(client api.Client) (err error)
- func (post Post) Encode(w io.Writer) (err error)
- func (post *Post) Save(cachedPaths map[string]string) (err error)
- func (post *Post) Update(client api.Client) (err error)
- func (post Post) Validate() (err InvalidError)
- type Posts
- type Tag
- type Tags
- type Team
- type Teams
- type Time
- type User
Constants ¶
const (
// DirMine is the directory of saving posts in Qiita. (Not for posts in Qiita:Team)
DirMine = "mine"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreationOptions ¶
CreationOptions is options for creating a post.
type CreationPost ¶
type CreationPost struct { Post CreationOptions }
CreationPost is sent to Qiita server when creating post.
type EmptyIDError ¶
type EmptyIDError struct{}
EmptyIDError occurs when operate a post without ID.
func (EmptyIDError) Error ¶
func (err EmptyIDError) Error() (msg string)
type InvalidError ¶
type InvalidError map[string]InvalidStatus
InvalidError occurs when some fields are wrong.
func (InvalidError) Error ¶
func (err InvalidError) Error() (msg string)
type InvalidStatus ¶
InvalidStatus suggests what is wrong.
func (InvalidStatus) String ¶
func (s InvalidStatus) String() (msg string)
type Meta ¶
type Meta struct { ID string `json:"id" yaml:"id"` // 投稿の一意なID URL string `json:"url" yaml:"url"` // 投稿のURL CreatedAt Time `json:"created_at" yaml:"created_at"` // データが作成された日時 UpdatedAt Time `json:"updated_at" yaml:"updated_at"` // データが最後に更新された日時 Private bool `json:"private" yaml:"private"` // 限定共有状態かどうかを表すフラグ (Qiita:Teamでは無効) Coediting bool `json:"coediting" yaml:"coediting"` // この投稿が共同更新状態かどうか (Qiita:Teamでのみ有効) Tags Tags `json:"tags" yaml:"tags"` // 投稿に付いたタグ一覧 Team *Team `json:"-"` // チーム }
Meta is meta data of post.
type Post ¶
type Post struct { Meta User User `json:"user"` Title string `json:"title"` // 投稿のタイトル Body string `json:"body"` // Markdown形式の本文 RenderedBody string `json:"rendered_body"` // HTML形式の本文 Path string `json:"-"` }
Post is a post in Qiita.
func NewPostWithFile ¶
NewPostWithFile loads local file and create a Post from the content of the file.
func (*Post) Create ¶
func (post *Post) Create(client api.Client, opts CreationOptions) (err error)
Create creates a new post in Qiita.
func (Post) Validate ¶
func (post Post) Validate() (err InvalidError)
Validate validates fields in Post.
type Posts ¶
type Posts []Post
Posts is a collection of post.
func FetchPosts ¶
FetchPosts fetches posts from Qiita and Qiita:Team.
type Tag ¶
Tag is a label for a content of a post.
func (Tag) MarshalJSON ¶
MarshalJSON encodes the Tag into JSON formatted bytes.
type Tags ¶
type Tags []Tag
Tags is slice of Tag.
func (Tags) MarshalYAML ¶
MarshalYAML encodes Tags to YAML encoded string.
func (*Tags) UnmarshalYAML ¶
UnmarshalYAML decodes YAML encoded string to Tag struct.
type Team ¶
type Team struct { Active bool `json:"active"` // チームが利用可能な状態かどうか ID string `json:"id"` // チームの一意なID Name string `json:"name"` // チームに設定されている名前を表します。 }
Team is a team data of Qiita:Team.
type Time ¶
Time is a wrapper of time.Time.
func (Time) FormatDate ¶
FormatDate formats only date as slashed style.
func (Time) MarshalYAML ¶
MarshalYAML marshals time as YAML.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON unmarshals time as JSON.
type User ¶
type User struct { Description string `json:"description"` // 自己紹介文 FacebookID string `json:"facebook_id"` // Facebook ID FolloweesCount int `json:"followees_count"` // このユーザがフォローしているユーザの数 FollowersCount int `json:"followers_count"` // このユーザをフォローしているユーザの数 GithubLoginName string `json:"github_login_name"` // GitHub ID ID string `json:"id"` // ユーザID ItemsCount int `json:"items_count"` // このユーザが qiita.com 上で公開している投稿の数 (Qiita:Teamでの投稿数は含まれません) LinkedinID string `json:"linkedin_id"` // LinkedIn ID Location string `json:"location"` // 居住地 Name string `json:"name"` // 設定している名前 Organization string `json:"organization"` // 所属している組織 PermanentID int `json:"permanent_id"` // ユーザごとに割り当てられる整数のID ProfileImageURL string `json:"profile_image_url"` // 設定しているプロフィール画像のURL TwitterScreenName string `json:"twitter_screen_name"` // Twitterのスクリーンネーム WebsiteURL string `json:"website_url"` // 設定しているWebサイトのURL }
User is data of user in Qiita.