lines

package module
v0.0.0-...-5587f24 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GatherProjects

func GatherProjects(c *catalog.Catalog) error

GatherProjects collects up project information from the Library topic on lines

func GuessProjectURLFromLinks(links []Link) (string, bool)

GuessProjectURLFromLinks attempts to find a URL for the project among the links posted in the topic

func LookupCategoryID

func LookupCategoryID(name string, categories []Category) (int, bool)

func ProjectNameFromTopicTitle

func ProjectNameFromTopicTitle(title string) string

ProjectNameFromTopicTitle attempts to determine the project name from topic title

func TopicHasTag

func TopicHasTag(t *Topic, tag string) bool

Types

type Category

type Category struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

Category captures a subset of the properties of a Discourse category

func GetCategories

func GetCategories(client *Client) ([]Category, error)

type Client

type Client struct {
	Endpoint string
	// contains filtered or unexported fields
}

Client struct to represent a connection to the lines Discourse API

func NewClient

func NewClient(endpoint string) *Client

NewClient builds a new HTTP client

func (*Client) Get

func (c *Client) Get(resource string) ([]byte, int, error)

Get a resource

type CreatedBy

type CreatedBy struct {
	AvatarTemplate string `json:"avatar_template"`
	ID             int    `json:"id"`
	Name           string `json:"name"`
	Username       string `json:"username"`
}

type Details

type Details struct {
	CreatedBy CreatedBy `json:"created_by"`
	Links     []Link    `json:"links"`
}

func GetTopicDetails

func GetTopicDetails(client *Client, topicID int) (*Details, error)
type Link struct {
	IsAttachment bool   `json:"attachment"`
	Domain       string `json:"domain"`
	Title        string `json:"title"`
	URL          string `json:"url"`
	UserID       int    `json:"user_id"`
}

type Topic

type Topic struct {
	ID         int      `json:"id"`
	Title      string   `json:"title"`
	FancyTitle string   `json:"fancy_title"`
	PostsCount int      `json:"posts_count"`
	CategoryID int      `json:"category_id"`
	Tags       []string `json:"tags"`
	IsVisible  bool     `json:"visible"`
	IsArchived bool     `json:"archived"`
}

Topic represents a Topic resource from the Discourse API

func GetTopics

func GetTopics(client *Client, categoryID int) ([]Topic, error)

Jump to

Keyboard shortcuts

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