gohost

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 20 Imported by: 0

README

gohost

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

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

func AttachmentBlock

func AttachmentBlock(filepath, altText string) (Attachment, error)

Returns an Attachment struct that contains information about an image given a filepath. Can return a path error.

type Markdown

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

func MarkdownBlock

func MarkdownBlock(content string) Markdown

Returns a markdown block that represent text data on a Cohost post

type Post

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

TODO: add rest of getter functions

func (Post) Blocks

func (p Post) Blocks() ([]Markdown, []Attachment)

func (Post) ContentWarnings

func (p Post) ContentWarnings() []string

func (Post) Filename

func (p Post) Filename() string

func (Post) Headline

func (p Post) Headline() string

func (Post) Id

func (p Post) Id() int

func (Post) NumComments

func (p Post) NumComments() int

func (Post) NumSharedComments

func (p Post) NumSharedComments() int

func (Post) PlainTextBody

func (p Post) PlainTextBody() string

func (Post) PostingProject

func (p Post) PostingProject(u User) Project

func (Post) PublishedAt

func (p Post) PublishedAt() time.Time

func (Post) State

func (p Post) State() int

func (Post) Tags

func (p Post) Tags() []string

func (Post) Url

func (p Post) Url() string

type Project

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

func (Project) AvatarShape

func (p Project) AvatarShape() string

func (Project) AvatarURL

func (p Project) AvatarURL() string

func (Project) Description

func (p Project) Description() string

func (Project) DisplayName

func (p Project) DisplayName() string

func (Project) EditPost

func (p Project) EditPost(postId int, adult bool, markdown []Markdown, attachments []Attachment, tags, cws []string, headline string, draft bool) (Post, error)

func (Project) Flags

func (p Project) Flags() [][]byte

func (Project) FrequentlyUsedTags

func (p Project) FrequentlyUsedTags() []string

func (Project) GetPosts

func (p Project) GetPosts(page int) ([]Post, error)

Returns all the posts on a given page of the current project.

func (Project) Handle

func (p Project) Handle() string

func (Project) HeaderURL

func (p Project) HeaderURL() string

func (Project) Headline

func (p Project) Headline() string

func (Project) Post

func (p Project) Post(adult bool, markdown []Markdown, attachments []Attachment, tags, cws []string, headline string, draft bool) (Post, error)

Makes a post on your current project Returns a Post struct that contains info about the post, including the postId needed for editing! Returns an empty Post in the case of a draft or an error

func (Project) Privacy

func (p Project) Privacy() string

func (Project) ProjectId

func (p Project) ProjectId() int

func (Project) Pronouns

func (p Project) Pronouns() string

func (Project) URL

func (p Project) URL() string

type User

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

func LoginWithCookie

func LoginWithCookie(client *http.Client, cookie string) (User, error)

Start a user session with your connect.sid cookie from Cohost If you don't have any special needs for an HTTP client, pass it as nil

func LoginWithPass

func LoginWithPass(client *http.Client, email, password string) (User, error)

Start a user session with your Cohost email and password If you don't have any special needs for an HTTP client, pass it as nil

func (User) Activated

func (u User) Activated() bool

func (User) DefaultProject

func (u User) DefaultProject() (Project, error)

Returns your first project.

func (User) Email

func (u User) Email() string

func (User) GetEditedProjects

func (u User) GetEditedProjects() ([]Project, error)

Lists all the projects for an authenticated user

func (User) GetProject

func (u User) GetProject(handle string) (Project, error)

Retrieve one of your projects by its handle

func (User) Id

func (u User) Id() int

func (User) ModMode

func (u User) ModMode() bool

func (User) ProjectId

func (u User) ProjectId() int

func (User) ReadOnly

func (u User) ReadOnly() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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