Documentation ¶
Index ¶
- type Article
- type ArticleState
- type ArticleVariant
- type Articles
- func (a *Articles) ById(ctx context.Context, id int) (ArticleVariant, error)
- func (a *Articles) ByPath(ctx context.Context, username string, slug string) (ArticleVariant, error)
- func (a *Articles) Create(ctx context.Context, payload CreateArticlePayload) (ArticleVariant, error)
- func (a *Articles) Latest(ctx context.Context, opts LatestArticlesOpts) ([]Article, error)
- func (a *Articles) Published(ctx context.Context, opts PublishedArticlesOpts) ([]Article, error)
- func (a *Articles) Update(ctx context.Context, id int, payload UpdateArticlePayload) (ArticleVariant, error)
- func (a *Articles) UserAll(ctx context.Context, opts UserArticlesOpts) ([]Article, error)
- func (a *Articles) UserPublished(ctx context.Context, opts UserArticlesOpts) ([]Article, error)
- func (a *Articles) UserUnpublished(ctx context.Context, opts UserArticlesOpts) ([]Article, error)
- type Client
- type ClientOption
- type CreateArticlePayload
- type ErrorResponse
- type FlareTag
- type LatestArticlesOpts
- type Organization
- type PublishedArticlesOpts
- type UpdateArticlePayload
- type User
- type UserArticlesOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { TypeOf string `json:"type_of"` ID int `json:"id"` Title string `json:"title"` Description string `json:"description"` CoverImage string `json:"cover_image"` ReadablePublishDate string `json:"readable_publish_date"` SocialImage string `json:"social_image"` TagList []string `json:"tag_list"` Tags string `json:"tags"` Slug string `json:"slug"` Path string `json:"path"` URL string `json:"url"` CanonicalURL string `json:"canonical_url"` CommentsCount int `json:"comments_count"` PositiveReactionsCount int `json:"positive_reactions_count"` PublicReactionsCount int `json:"public_reactions_count"` CollectionID int `json:"collection_id"` CreatedAt string `json:"created_at"` EditedAt string `json:"edited_at"` CrosspostedAt string `json:"crossposted_at"` PublishedAt string `json:"published_at"` LastCommentAt string `json:"last_comment_at"` PublishedTimestamp string `json:"published_timestamp"` ReadingTimeMinutes int `json:"reading_time_minutes"` BodyHTML string `json:"body_html"` BodyMarkdown string `json:"body_markdown"` User *User `json:"user,omitempty"` Organization *Organization `json:"organization,omitempty"` FlareTag *FlareTag `json:"flare_tag,omitempty"` }
type ArticleState ¶
type ArticleState string
const ( StateFresh ArticleState = "fresh" StateRising ArticleState = "rising" StateAll ArticleState = "all" )
type ArticleVariant ¶
type Articles ¶
type Articles struct {
// contains filtered or unexported fields
}
func (*Articles) ByPath ¶
func (a *Articles) ByPath(ctx context.Context, username string, slug string) (ArticleVariant, error)
GET articles/{username}/{slug}
func (*Articles) Create ¶
func (a *Articles) Create(ctx context.Context, payload CreateArticlePayload) (ArticleVariant, error)
POST articles
func (*Articles) Update ¶
func (a *Articles) Update(ctx context.Context, id int, payload UpdateArticlePayload) (ArticleVariant, error)
PUT articles/{id}
func (*Articles) UserPublished ¶
GET articles/me/published requires ApiKey to be set
func (*Articles) UserUnpublished ¶
GET articles/me/unpublished requires ApiKey to be set
type ClientOption ¶
type ClientOption func(c *Client)
func WithAPIKey ¶
func WithAPIKey(apiKey string) ClientOption
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
type CreateArticlePayload ¶
type CreateArticlePayload struct { Article struct { Title string `json:"title,omitempty"` BodyMarkdown string `json:"body_markdown,omitempty"` Published bool `json:"published,omitempty"` Series string `json:"series,omitempty"` MainImage string `json:"main_image,omitempty"` CanonicalURL string `json:"canonical_url,omitempty"` Description string `json:"description,omitempty"` Tags []string `json:"tags,omitempty"` OrganizationID int `json:"organization_id,omitempty"` } `json:"article"` }
type ErrorResponse ¶
type LatestArticlesOpts ¶
type Organization ¶
type PublishedArticlesOpts ¶
type PublishedArticlesOpts struct { Page int `url:"page,omitempty"` PerPage int `url:"per_page,omitempty"` Tag string `url:"tag,omitempty"` Tags []string `url:"tags,omitempty" del:","` TagsExclude []string `url:"tags_exclude,omitempty" del:","` Username string `url:"username,omitempty"` State ArticleState `url:"state,omitempty"` Top int `url:"top,omitempty"` CollectionId int `url:"collection_id,omitempty"` }
type UpdateArticlePayload ¶
type UpdateArticlePayload CreateArticlePayload
type User ¶
type User struct { Name string `json:"name"` Username string `json:"username"` TwitterUsername string `json:"twitter_username"` GithubUsername string `json:"github_username"` WebsiteURL string `json:"website_url"` ProfileImage string `json:"profile_image"` ProfileImage90 string `json:"profile_image_90"` }
type UserArticlesOpts ¶
type UserArticlesOpts LatestArticlesOpts
Click to show internal directories.
Click to hide internal directories.