lemmy

package module
v0.0.0-...-35bde0c Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: ISC Imports: 14 Imported by: 0

README

godocs.io

Package lemmy provides a client interface to a subset of the Lemmy HTTP API version 3.

go get olowe.co/lemmy

Development

Please send patches, questions or a friendly "hello" to the mailing list:

git send-email --to="~otl/public-inbox@lists.sr.ht" HEAD^

For those unfamiliar with this workflow, see git-send-email.io

Documentation

Overview

Package lemmy provides a client interface to the Lemmy HTTP API version 3.

Index

Constants

View Source
const (
	ListAll        ListMode = "All"
	ListLocal               = "Local"
	ListSubscribed          = "Subscribed"
)

Variables

View Source
var ErrNotFound error = errors.New("not found")

Functions

func ParseCommentPath

func ParseCommentPath(s string) []int

ParseCommentPath returns the comment IDs referenced by a Comment.

Types

type Client

type Client struct {
	*http.Client
	Address string
	// If true, HTTP request summaries are printed to standard error.
	Debug bool
	// contains filtered or unexported fields
}

func (*Client) Authenticated

func (c *Client) Authenticated() bool

func (*Client) Comments

func (c *Client) Comments(post int, mode ListMode) ([]Comment, error)

func (*Client) Communities

func (c *Client) Communities(mode ListMode) ([]Community, error)

func (*Client) Login

func (c *Client) Login(name, password string) error

func (*Client) LookupComment

func (c *Client) LookupComment(id int) (Comment, error)

func (*Client) LookupCommunity

func (c *Client) LookupCommunity(name string) (Community, Counts, error)

func (*Client) LookupPost

func (c *Client) LookupPost(id int) (Post, error)

func (*Client) Posts

func (c *Client) Posts(community string, mode ListMode) ([]Post, error)

func (*Client) Reply

func (c *Client) Reply(post int, parent int, msg string) error

type Comment

type Comment struct {
	ID     int
	PostID int `json:"post_id"`
	// Holds ordered comment IDs referenced by this comment
	// for threading.
	Path        string
	Content     string
	CreatorID   int `json:"creator_id"`
	Published   time.Time
	Updated     time.Time
	ActivityURL string `json:"ap_id"`
	Creator     Person `json:"-"`
}

func (*Comment) IsDir

func (c *Comment) IsDir() bool

func (*Comment) ModTime

func (c *Comment) ModTime() time.Time

func (*Comment) Mode

func (c *Comment) Mode() fs.FileMode

func (*Comment) Name

func (c *Comment) Name() string

func (*Comment) Size

func (c *Comment) Size() int64

func (*Comment) Sys

func (c *Comment) Sys() interface{}

type Community

type Community struct {
	ID        int    `json:"id"`
	FName     string `json:"name"`
	Title     string `json:"title"`
	Local     bool
	ActorID   string `json:"actor_id"`
	Published time.Time
}

func (*Community) IsDir

func (c *Community) IsDir() bool

func (*Community) ModTime

func (c *Community) ModTime() time.Time

func (*Community) Mode

func (c *Community) Mode() fs.FileMode

func (*Community) Name

func (c *Community) Name() string

func (*Community) Size

func (c *Community) Size() int64

func (Community) String

func (c Community) String() string

func (*Community) Sys

func (c *Community) Sys() interface{}

type Counts

type Counts struct {
	Posts       int
	Comments    int
	CommunityID int `json:"community_id"`
	PostID      int `json:"post_id"`
}

type ListMode

type ListMode string

type Person

type Person struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	ActorID string `json:"actor_id"`
	Local   bool   `json:"local"`
}

func (Person) String

func (p Person) String() string

type Post

type Post struct {
	ID        int
	Title     string `json:"name"`
	Body      string
	CreatorID int `json:"creator_id"`
	URL       string
	Published time.Time
	Updated   time.Time
	Creator   Person `json:"-"`
}

func (*Post) IsDir

func (p *Post) IsDir() bool

func (*Post) ModTime

func (p *Post) ModTime() time.Time

func (*Post) Mode

func (p *Post) Mode() fs.FileMode

func (*Post) Name

func (p *Post) Name() string

func (*Post) Size

func (p *Post) Size() int64

func (*Post) Sys

func (p *Post) Sys() interface{}

Directories

Path Synopsis
cmd
FS is a read-only filesystem interface to a Lemmy instance.
FS is a read-only filesystem interface to a Lemmy instance.

Jump to

Keyboard shortcuts

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