Documentation
¶
Overview ¶
Package medium provides thin wrapper for Medium API.
Index ¶
- type Article
- type Client
- func (c *Client) Image(filename string) (i *Image, err error)
- func (c *Client) RefreshToken(refreshToken string) (token *Token, err error)
- func (c *Client) SetLogger(logger *log.Logger)
- func (c *Client) Token(code, redirectURI string) (token *Token, err error)
- func (c *Client) User() (u *User, err error)
- type Contributor
- type Error
- type Image
- type PostedArticle
- type Publication
- type Token
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
Title string `json:"title"`
ContentFormat string `json:"contentFormat"`
Content string `json:"content"`
CanonicalURL string `json:"canonicalUrl"`
Tags []string `json:"tags"`
PublishStatus string `json:"publishStatus"`
PublishedAt string `json:"publishedAt"`
License string `json:"license"`
NotifyFollowers bool `json:"notifyFollowers"`
}
Article represents an article.
type Client ¶
type Client struct {
Root *url.URL
ApplicationID string
ApplicationSecret string
AccessToken string
// contains filtered or unexported fields
}
Client represents Medium API client.
func (*Client) RefreshToken ¶ added in v0.3.0
RefreshToken gets a new API token based off refresh token.
type Contributor ¶
type Contributor struct {
PublicationID string `json:"publicationId"`
UserID string `json:"userId"`
Role string `json:"role"`
}
Contributor represents a contributor for the specific publication.
type PostedArticle ¶
type PostedArticle struct {
ID string `json:"id"`
Title string `json:"title"`
AuthorID string `json:"authorId"`
Tags []string `json:"tags"`
URL string `json:"url"`
CanonicalURL string `json:"canonicalUrl"`
PublishStatus string `json:"publishStatus"`
PublishAt int `json:"publishedAt"`
License string `json:"license"`
LicenseURL string `json:"licenseUrl"`
}
PostedArticle represents an article on
type Publication ¶
type Publication struct {
ID string `json:"id"`
Description string `json:"description"`
Name string `json:"name"`
URL string `json:"url"`
ImageURL string `json:"imageUrl"`
// contains filtered or unexported fields
}
Publication represents a Medium Publication.
func (*Publication) Contributors ¶
func (p *Publication) Contributors() ([]*Contributor, error)
Contributors returns a list of contributors for the publication.
func (*Publication) Post ¶
func (p *Publication) Post(a Article) (*PostedArticle, error)
Post posts an article to the authenticated user's publication.
type Token ¶
type Token struct {
TokenType string `json:"token_type"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
Scope []string `json:"scope"`
ExpiresAt int `json:"expires_at"`
}
Token represents response from /v1/tokens.
type User ¶
type User struct {
ID string `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
URL string `json:"url"`
ImageURL string `json:"imageUrl"`
// contains filtered or unexported fields
}
User represents a Medium user
func (*User) Post ¶
func (u *User) Post(a Article) (*PostedArticle, error)
Post posts an article to the authenticated user's profile.
func (*User) Publications ¶
func (u *User) Publications() (p []*Publication, err error)
Publications returns specified user's publications.