api

package
v0.1.2-0...-99e1973 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PostFileExt = ".txt"
)

Variables

This section is empty.

Functions

func AddPost

func AddPost(c *cli.Context, id, token string) error

func ClaimPosts

func ClaimPosts(c *cli.Context, localPosts *[]Post) (*[]writeas.ClaimPostResult, error)

ClaimPost adds a local post to the authenticated user's account and deletes the local reference

func CmdPull

func CmdPull(c *cli.Context) error

func ComposeNewPost

func ComposeNewPost() (string, *[]byte)

func DoDelete

func DoDelete(c *cli.Context, friendlyID, token string) error

DoDelete deletes the given post on Write.as, and removes any local references

func DoFetch

func DoFetch(c *cli.Context, friendlyID string) error

DoFetch retrieves the Write.as post with the given friendlyID, optionally via the Tor hidden service.

func DoFetchPosts

func DoFetchPosts(c *cli.Context) ([]writeas.Post, error)

DoFetchPosts retrieves all remote posts for the authenticated user

func DoLogIn

func DoLogIn(c *cli.Context, username, password string) error

func DoLogOut

func DoLogOut(c *cli.Context) error

func DoPost

func DoPost(c *cli.Context, post []byte, font string, encrypt, code bool) (*writeas.Post, error)

DoPost creates a Write.as post, returning an error if it was unsuccessful.

func DoUpdate

func DoUpdate(c *cli.Context, post []byte, friendlyID, token, font string, code bool) error

DoUpdate updates the given post on Write.as.

func GetPosts

func GetPosts(c *cli.Context) *[]Post

func HostURL

func HostURL(c *cli.Context) string

func ReadStdIn

func ReadStdIn() []byte

func RemovePost

func RemovePost(c *cli.Context, id string)

func TokenFromID

func TokenFromID(c *cli.Context, id string) string

func WritePost

func WritePost(postsDir string, p *writeas.Post) error

Types

type Post

type Post struct {
	ID        string
	EditToken string
}

Post holds the basic authentication information for a Write.as post.

type RemoteColl

type RemoteColl struct {
	Alias string
	Title string
	URL   string
}

RemoteColl represents a collection of posts It is a reduced set of data from a go-writeas Collection

func DoFetchCollections

func DoFetchCollections(c *cli.Context) ([]RemoteColl, error)

DoFetchCollections retrieves a list of the currently logged in users collections.

type RemotePost

type RemotePost struct {
	Post
	Title,
	Excerpt,
	Slug,
	Collection,
	EditToken string
	Synced  bool
	Updated time.Time
}

RemotePost holds addition information about published posts

func GetUserPosts

func GetUserPosts(c *cli.Context, draftsOnly bool) ([]RemotePost, error)

Jump to

Keyboard shortcuts

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