devto

package
v0.0.0-...-dcf2eda Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateFresh  State = "fresh"
	StateRising       = "rising"
	StateAll          = "all"
)

Variables

View Source
var DefaultClient = http.DefaultClient
View Source
var Origin = "https://dev.to/api"

Functions

func GetWithQuery

func GetWithQuery(action, auth string, data, res interface{}) error

func PostWithJSON

func PostWithJSON(action, auth string, data, res interface{}) error

func PutWithJSON

func PutWithJSON(action, auth string, data, res interface{}) error

func SimpleGet

func SimpleGet(action, auth string, res interface{}) error

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"`
	Slug                 string       `json:"slug"`
	Path                 string       `json:"path"`
	Url                  string       `json:"url"`
	CanonicalUrl         string       `json:"canonical_url"`
	CommentsCount        int          `json:"comments_count"`
	PublicReactionsCount int          `json:"public_reactions_count"`
	PublishedAt          string       `json:"published_at"`
	PublishedTimestamp   string       `json:"published_timestamp"`
	User                 User         `json:"user"`
	Organization         Organization `json:"organization"`
	FlareTag             FlareTag     `json:"flare_tag"`
}

type ArticleContent

type ArticleContent struct {
	Title          string   `json:"title"`
	BodyMarkdown   string   `json:"body_markdown"`
	Published      bool     `json:"published"`
	Series         string   `json:"series"`
	MainImage      string   `json:"main_image"`
	CanonicalUrl   string   `json:"canonical_url"`
	Description    string   `json:"description"`
	Tags           []string `json:"tags"`
	OrganizationId int      `json:"organization_id"`
}

type Client

type Client struct {
	ApiKey string
}

func NewClient

func NewClient(apiKey string) *Client

func (*Client) AddArticle

func (c *Client) AddArticle(option *DraftArticle) (*Article, error)

POST /articles

func (*Client) ModifyArticle

func (c *Client) ModifyArticle(id int, option *DraftArticle) (*Article, error)

func (*Client) RetrieveArticleById

func (c *Client) RetrieveArticleById(id int) (*Article, error)

GET /articles/:id

func (*Client) RetrieveArticles

func (c *Client) RetrieveArticles(option *RetrieveArticlesOption) ([]*Article, error)

GET /articles

func (*Client) RetrieveAuthenticatedUser

func (c *Client) RetrieveAuthenticatedUser() (*User, error)

GET /users/me

func (*Client) RetrieveCommentById

func (c *Client) RetrieveCommentById(id string) (*Comment, error)

GET /comments/:id

func (*Client) RetrieveComments

func (c *Client) RetrieveComments(option *RetrieveCommentsOption) ([]*Comment, error)

GET /comments

func (*Client) RetrieveFollowers

func (c *Client) RetrieveFollowers(option *RetrieveFollowersOption) ([]*Follower, error)

GET /followers/users

func (*Client) RetrievePodcastEpisodes

func (c *Client) RetrievePodcastEpisodes(option *RetrievePodcastOption) ([]*PodcastEpisode, error)

GET /podcast_episodes

func (*Client) RetrieveTags

func (c *Client) RetrieveTags(option *RetrieveTagsOption) ([]*Tag, error)

GET /tags

func (*Client) RetrieveUser

func (c *Client) RetrieveUser(id int) (*User, error)

GET /users/me

func (*Client) RetrieveUserAllArticles

func (c *Client) RetrieveUserAllArticles(option *RetrieveUserArticlesOption) ([]*Article, error)

GET /articles/me/all

func (*Client) RetrieveUserArticles

func (c *Client) RetrieveUserArticles(option *RetrieveUserArticlesOption) ([]*Article, error)

GET /articles/me

func (*Client) RetrieveUserPublishedArticles

func (c *Client) RetrieveUserPublishedArticles(option *RetrieveUserArticlesOption) ([]*Article, error)

GET /articles/me/published

func (*Client) RetrieveUserUnpublishedArticles

func (c *Client) RetrieveUserUnpublishedArticles(option *RetrieveUserArticlesOption) ([]*Article, error)

GET /articles/me/unpublished

func (*Client) RetrieveVideoArticles

func (c *Client) RetrieveVideoArticles(option *RetrieveVideoArticlesOption) ([]*VideoArticle, error)

GET /videos

type Comment

type Comment struct {
	TypeOf   string     `json:"type_of"`
	IdCode   string     `json:"id_code"`
	BodyHtml string     `json:"body_html"`
	User     User       `json:"user"`
	Children []*Comment `json:"children"`
}

type DraftArticle

type DraftArticle struct {
	Article ArticleContent `json:"article"`
}

type FlareTag

type FlareTag struct {
	Name         string `json:"name"`
	BgColorHex   string `json:"bg_color_hex"`
	TextColorHex string `json:"text_color_hex"`
}

type Follower

type Follower struct {
	TypeOf       string `json:"type_of"`
	Id           int    `json:"id"`
	Name         string `json:"name"`
	Path         string `json:"path"`
	Username     string `json:"username"`
	ProfileImage string `json:"profile_image"`
}

type Organization

type Organization struct {
	Name           string `json:"name"`
	Username       string `json:"username"`
	Slug           string `json:"slug"`
	ProfileImage   string `json:"profile_image"`
	ProfileImage90 string `json:"profile_image_90"`
}

type Podcast

type Podcast struct {
	Title    string `json:"title"`
	Slug     string `json:"slug"`
	ImageUrl string `json:"image_url"`
}

type PodcastEpisode

type PodcastEpisode struct {
	TypeOf string `json:"type_of"`
	Id     int    `json:"id"`

	ImageUrl string  `json:"image_url"`
	Title    string  `json:"title"`
	Podcast  Podcast `json:"podcast"`
	// contains filtered or unexported fields
}

type RetrieveArticlesOption

type RetrieveArticlesOption struct {
	Page         int
	PerPage      int
	Tag          string
	Username     string
	State        State
	Top          int
	CollectionId int
}

type RetrieveCommentsOption

type RetrieveCommentsOption struct {
	AId int
}

type RetrieveFollowersOption

type RetrieveFollowersOption struct {
	Page    int
	PerPage int
}

type RetrievePodcastOption

type RetrievePodcastOption struct {
	Page     int
	PerPage  int
	Username string
}

type RetrieveTagsOption

type RetrieveTagsOption struct {
	Page    int
	PerPage int
}

type RetrieveUserArticlesOption

type RetrieveUserArticlesOption struct {
	Page    int
	PerPage int
}

type RetrieveVideoArticlesOption

type RetrieveVideoArticlesOption struct {
	Page    int
	PerPage int
}

type State

type State string

type Tag

type Tag struct {
	Id           int    `json:"id"`
	Name         string `json:"name"`
	BgColorHex   string `json:"bg_color_hex"`
	TextColorHex string `json:"text_color_hex"`
}

type User

type User struct {
	Id              int    `json:"id"`
	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 VideoArticle

type VideoArticle struct {
	TypeOf                 string `json:"type_of"`
	Id                     int    `json:"id"`
	Path                   string `json:"path"`
	CloudinaryVideoUrl     string `json:"cloudinary_video_url"`
	Title                  string `json:"title"`
	UserId                 int    `json:"user_id"`
	VideoDurationInMinutes string `json:"video_duration_in_minutes"`
	User                   User   `json:"user"`
}

Jump to

Keyboard shortcuts

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