forem

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevToEndpoint = "https://dev.to"
)

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"`
	ReadablePublishDate    string     `json:"readable_publish_date"`
	Slug                   string     `json:"slug"`
	Path                   string     `json:"path"`
	Url                    string     `json:"url"`
	CommentsCount          int        `json:"comments_count"`
	PublicReactionsCount   int        `json:"public_reactions_count"`
	PublishedTimestamp     *time.Time `json:"published_timestamp"`
	PositiveReactionsCount int        `json:"positive_reactions_count"`
	CoverImage             string     `json:"cover_image"`
	SocialImage            string     `json:"social_image"`
	CanonicalUrl           string     `json:"canonical_url"`
	CreatedAt              *time.Time `json:"created_at"`
	EditedAt               *time.Time `json:"*"`
	PublishedAt            *time.Time `json:"published_at"`
	LastCommentAt          *time.Time `json:"last_comment_at"`
	ReadingTimeMinutes     int        `json:"reading_time_minutes"`
	TagList                any        `json:"tag_list"`
	Tags                   any        `json:"tags"`
	User                   User       `json:"user"`

	BodyMarkdown *string `json:"body_markdown"`
	BodyHtml     *string `json:"body_html"`
}

func (*Article) GetTags

func (a *Article) GetTags() []string

type GetArticlesPrams

type GetArticlesPrams struct {
	MostRecent   bool
	Page         int
	PerPage      int
	Tag          string
	Tags         []string
	TagsExclude  []string
	UserName     string
	State        string
	Top          int
	CollectionID int
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service docs: https://developers.forem.com/api

func NewAuthenticatedService

func NewAuthenticatedService(APIEndpoint string, rps int, authToken string) *Service

func NewService

func NewService(APIEndpoint string, rps int) *Service

func (*Service) GetArticleById

func (s *Service) GetArticleById(ctx context.Context, id string) (*Article, error)

func (*Service) SubmitArticle

func (s *Service) SubmitArticle(ctx context.Context, article model.Article) error

type SubmitArticleRequest

type SubmitArticleRequest struct {
	Title        string   `json:"title"`
	Published    bool     `json:"published"`
	BodyMarkdown string   `json:"body_markdown"`
	Tags         []string `json:"tags"`
	Series       string   `json:"series,omitempty"`
}

type User

type User struct {
	Name            string `json:"name"`
	Username        string `json:"username"`
	TwitterUsername string `json:"twitter_username"`
	GithubUsername  string `json:"github_username"`
	UserId          int    `json:"user_id"`
	WebsiteUrl      string `json:"website_url"`
	ProfileImage    string `json:"profile_image"`
	ProfileImage90  string `json:"profile_image_90"`
}

Jump to

Keyboard shortcuts

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