AtlatestRenderedmarkdown
Readme

sigil-discourse

A Sigil library for the Discourse forum REST API.

Modules

ModuleDescription
(discourse client)Shared auth headers, URL construction, HTTP helpers
(discourse topics)List, get, create, update, close/open/pin, delete topics
(discourse posts)Get, create, update, delete posts
(discourse messages)Send, list private messages
(discourse search)Full-text search
(discourse categories)List, get, create, update categories
(discourse users)List, get, create, suspend/unsuspend, activate/deactivate users
(discourse groups)List, get, create, delete groups and manage members
(discourse admin)Site settings and invites

Usage

Add sigil-discourse as a dependency in your package.sgl:

(from-git url: "codeberg:sigil/sigil-discourse" package: "sigil-discourse")

Then import the modules you need:

(import (discourse topics)
        (discourse users))

(define base-url "https://forum.example.com")
(define api-key (getenv "DISCOURSE_API_KEY"))
(define username (getenv "DISCOURSE_USERNAME"))

;; List latest topics
(discourse-list-latest-topics base-url api-key username)

;; Create a new topic
(discourse-create-topic base-url api-key username
                        "Hello World" "This is the body" 5)

;; Get a user
(discourse-get-user base-url api-key username "david")

Authentication

Discourse uses Api-Key and Api-Username headers. Every library function takes (base-url api-key username ...) as its first three parameters.

Building

sigil deps install
sigil build
sigil test

License

BSD-3-Clause