#+OPTIONS: toc:nil

#+html: <a href="https://elpa.gnu.org/packages/srht.html"><img alt="GNU ELPA" src="https://elpa.gnu.org/packages/srht.svg"/></a>
#+html: <a href="https://elpa.gnu.org/devel/srht.html"><img alt="GNU-devel ELPA" src="https://elpa.gnu.org/devel/srht.svg"/></a>
#+html: <a href="https://builds.sr.ht/~akagi/srht.el/commits/master/.build.yml"><img alt="Build" src="https://builds.sr.ht/~akagi/srht.el/commits/master/.build.yml.svg"/></a>
*** Version 0.2

* About

GNU Emacs [[https://sr.ht][sourcehut]] API client.

=srht= provides bindings to the Sourcehut REST API as well as commands for
interacting with it. It currently supports two services: =git.sr.ht= — git
hosting and =paste.sr.ht= — ad-hoc text file hosting.

* Installation

** With Guix

#+begin_src sh
git clone https://git.sr.ht/~akagi/srht.el srht
cd srht
guix package -f guix.scm
#+end_src

** Manual

=srht= depends on the HTTP library =plz= which is available in ELPA. After
installing it, place files from /lisp folder in =load-path=.

* Setup
To use this client, you need to [[https://meta.sr.ht/oauth/personal-token][generate]] a personal access token (Oauth not
Oauth2). This token will have unrestricted access to all sr.ht APIs and can be
used like a normal access token to authenticate API requests.

After creating the token:

#+begin_src elisp :lexical t
(setq srht-token TOKEN)
#+end_src

It is also possible to store the token using =auth-source.el=, the host must be
set to sr.ht.

#+begin_example
machine sr.ht password TOKEN
#+end_example

You also need to set srht-username:

#+begin_src elisp :lexical t
(setq srht-username USERNAME)
#+end_src

If you are using a self-hosted instanse:

#+begin_src elisp :lexical t
(setq srht-domain '(DOMAIN ...))
#+end_src

* Commands

| Function             | Description                           |
|----------------------+---------------------------------------|
| =srht-git-repo-update= | Update information for git repository |
| =srht-git-repo-delete= | Delete existing git repository        |
| =srht-git-repo-create= | Create git repository                 |
| =srht-paste-link=      | Kill the link of the selected paste   |
| =srht-paste-delete=    | Detete paste with SHA                 |
| =srht-paste-region=    | Paste region or buffer to sourcehut   |

* Copyright assignment

This package is part of [[https://www.gnu.org/software/emacs/][GNU Emacs]], being distributed in [[https://elpa.gnu.org/][GNU ELPA]].  Contributions
to this project must follow GNU guidelines, which means that, as with other
parts of Emacs, patches of more than a few lines must be accompanied by having
assigned copyright for the contribution to the FSF.  Contributors who wish to do
so may contact [[mailto:emacs-devel@gnu.org][emacs-devel@gnu.org]] to request the assignment form.

* License

GPLv3

# Local Variables:
# eval: (require 'ox-md)
# End:
