honk/docs/honk.3

202 lines
4.6 KiB
Groff
Raw Permalink Normal View History

2019-11-11 01:49:35 +01:00
.\"
.\" Copyright (c) 2019 Ted Unangst
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate$
.Dt HONK 3
.Os
.Sh NAME
.Nm honk
.Nd API access
.Sh DESCRIPTION
In addition to the standard web interface, some functionality is
available via the
.Nm
HTTP API.
.Pp
With the exception of login, all requests should contain
the following form values.
.Bl -tag -width action
.It Fa action
The desired action.
See below.
.It Fa token
An authorization token.
2019-11-12 07:10:38 +01:00
Alternatively, may be passed in the
.Dq Authorization
HTTP header.
2019-11-11 01:49:35 +01:00
.El
2019-11-11 02:26:31 +01:00
.Pp
2019-11-11 05:51:11 +01:00
The API URL for all actions other than login and logout is
2019-11-11 02:26:31 +01:00
.Pa /api .
2019-11-11 01:49:35 +01:00
.Ss login
Send a POST request to
2019-11-11 05:51:11 +01:00
.Pa /dologin
2019-11-11 01:49:35 +01:00
with the following form values.
.Bl -tag -width username
.It Fa username
User name.
.It Fa password
Pass phrase.
.It Fa gettoken
Must be
.Dq 1 .
.El
.Pp
This will return a token to be used for future requests.
The token is valid for one year.
2019-11-11 05:51:11 +01:00
.Ss logout
Send a request to
.Pa /logout
with the
.Fa token
to be expired.
2019-11-11 01:49:35 +01:00
.Ss honk
The
.Fa action
value should be
.Dq honk .
2020-11-11 05:11:50 +01:00
Content type should be multipart/form-data if an attachment is included.
2019-11-11 01:49:35 +01:00
The following values are recognized:
.Bl -tag -width placename
.It Fa noise
The contents of the honk.
2020-04-04 07:39:44 +02:00
.It Fa format
The format of noise.
Defaults to markdown.
May also be html.
2019-11-11 01:49:35 +01:00
.It Fa donk
A file to attach.
.It Fa donkdesc
A description for the attached file.
2020-04-24 19:52:12 +02:00
.It Fa donkxid
The XID of a previously uploaded attachment.
2019-11-11 01:49:35 +01:00
.It Fa placename
The name of an associated location.
.It Fa placeurl
The url of an associated location.
.It Fa placelat
The latitude of an associated location.
.It Fa placelong
The longitude of an associated location.
.It Fa timestart
The start time of an event.
.It Fa rid
The ActivityPub ID that this honk is in reply to.
.El
.Pp
Upon success, the honk action will return the URL for the created honk.
2020-04-24 19:52:12 +02:00
.Ss donk
Upload just an attachment using
.Fa donk
and
.Fa donkdesc .
2020-04-25 10:45:13 +02:00
Content type must be multipart/form-data.
2020-04-24 19:52:12 +02:00
Will return the XID.
2019-11-12 07:09:08 +01:00
.Ss gethonks
The
.Dq gethonks
.Fa action
can be used to query for honks.
The following parameters are used.
.Bl -tag -width placename
.It Fa page
Should be one of
.Dq home
or
.Dq atme .
.It Fa after
Only return honks after the specified ID.
.It Fa wait
If there are no results, wait this many seconds for something to appear.
.El
.Pp
The result will be returned as json.
2020-04-26 21:03:23 +02:00
.Ss zonkit
The
.Dq zonkit
action began life as a delete function, but has since evolved some other
powers as specified by the
.Fa wherefore
parameter.
The target of the action is specified by the
.Fa what
parameter and is generally the XID of a honk.
.Pp
Wherefore must be one of the following.
.Bl -tag -width zonvoy
.It bonk
Share honk with others.
.It unbonk
Undo share.
.It save
Mark honk as saved.
.It unsave
Unmark honk as saved.
.It react
Post an emoji reaction.
A custom reaction may be specified with
.Fa reaction .
.It ack
Mark honk as read.
.It deack
Unmark honk as read.
.It zonk
Delete this honk.
.It zonvoy
Mute this thread.
What should identify a convoy.
.El
2023-02-19 23:46:59 +01:00
.Ss gethonkers
Returns a list of current honkers in json format.
.Ss savehonker
Save a new honker, or update an existing one.
The following fields are used.
.Bl -tag -width honkerid
.It Fa honkerid
The numeric ID of an existing honker to update.
.It Fa name
The preferred short name.
.It Fa url
The ActivityPub actor url.
.It Fa combos
Space separated list of combos.
.It Fa notes
Some notes.
.El
.Pp
The honker numeric ID will be returned for success.
To delete, unsub, or sub, include a form value with name and value equal.
As in, a form value named delete with the value delete, or unsub=unsub, etc.
2019-11-26 20:57:23 +01:00
.Ss sendactivity
Send anything.
No limits, no error checking.
.Bl -tag -width public
.It Fa rcpt
An actor to deliver the message to to.
May be specified more than once.
An inbox may be specified directly by prefixing with %.
.It Fa msg
The message.
It should be a valid json activity, but yolo.
.It Fa public
Set to 1 to use shared inboxes for delivery.
.El
2019-11-11 01:49:35 +01:00
.Sh EXAMPLES
Refer to the sample code in the
.Pa toys
directory.
.Sh SEE ALSO
.Xr vim 3