micropub

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

README

Micropub

A command-line tool to interact with Micropub servers.

Building

Building the tool can be performed by running:

go build

This will produce a command-line application micropub.

Pre-built releases can be found on GitLab.

Configuration

By default, a default profile is required, which provides configuration for the given identity to be used for a given Micropub server.

If you have multiple identities, or Micropub servers, creating new profiles will allow easier switching between them, using the -p / --profile flag.

Configuration can be bootstrapped using the micropub config init command, alternatively you can manually create the files:

Configuration Files

A configuration file can be used, expected to be in the location $HOME/.config/micropub/config.toml, but can be configured using the -c / --config flag on the command-line.

with the following configuration:

[profiles]
[profiles.default]
me = "..."

Authentication can be set up / refreshed by running micropub auth reauth.

Environment Variables

This tool uses Viper, which means that you can use environment variables, too, like so:

# notice that the property name is capitalised!
env PROFILES.DEFAULT.ENDPOINT=https://www-api.jvt.me/micropub/media \
  ./micropub ...
Discovering configuration

Once the me is specified, running micropub config discover will look up a rel=micropub in the me and update the configuration accordingly, discovering other metadata through q=config accordingly.

Stability

This is still a very early version, and as such I'd recommend even myself as the author avoid using it too much.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Endpoint      string
	MediaEndpoint string
	AccessToken   string
}

Client A client to interact with a given Micropub server

func (*Client) CreateForm

func (c *Client) CreateForm(thePost *p.Post) (*post.MicropubEndpointResponse, error)

CreateForm Create a post using the form POST method

func (*Client) CreateJSON added in v0.8.0

func (c *Client) CreateJSON(thePost *p.Post) (*post.MicropubEndpointResponse, error)

CreateJSON Create a post using a JSON-encoded body

func (*Client) DeleteForm added in v0.5.0

func (c *Client) DeleteForm(URL string) (*post.UpdateResponse, error)

DeleteForm Delete a post using the form POST method

func (*Client) GenericQuery

func (c *Client) GenericQuery(args []string) (map[string]any, error)

GenericQuery Perform a given query to the Micropub server

func (*Client) QueryConfig

func (c *Client) QueryConfig(endpoint string) (*query.MicropubConfig, error)

QueryConfig Perform the q=config query for the Micropub server

func (*Client) UndeleteForm added in v0.5.0

func (c *Client) UndeleteForm(URL string) (*post.UpdateResponse, error)

UndeleteForm Undelete a post using the form POST method

func (*Client) UploadFile

func (c *Client) UploadFile(filePath string) (*media.Response, error)

UploadFile Upload a given file to the Media Endpoint

Directories

Path Synopsis
cmd
domain
internal
mf2

Jump to

Keyboard shortcuts

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