mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Experiment with addons
Addons allow to execute external programs in some context inside docspell. Currently it is possible to run them after processing files. Addons are provided by URLs to zip files.
This commit is contained in:
@ -122,8 +122,45 @@ paths:
|
||||
schema:
|
||||
$ref: "#/components/schemas/BasicResult"
|
||||
|
||||
/addon/config:
|
||||
get:
|
||||
operationId: "v1-addon-config-get"
|
||||
tags: [ Addons ]
|
||||
summary: What is supported running addons
|
||||
description: |
|
||||
Return what this joex supports when executing addons.
|
||||
responses:
|
||||
422:
|
||||
description: BadRequest
|
||||
200:
|
||||
description: Ok
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/AddonSupport"
|
||||
|
||||
components:
|
||||
schemas:
|
||||
AddonSupport:
|
||||
description: |
|
||||
How this joex supports executing addons.
|
||||
required:
|
||||
- nodeId
|
||||
- runners
|
||||
properties:
|
||||
nodeId:
|
||||
type: string
|
||||
format: ident
|
||||
runners:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
format: addon-runner-type
|
||||
enum:
|
||||
- nix-flake
|
||||
- docker
|
||||
- trivial
|
||||
|
||||
JobAndLog:
|
||||
description: |
|
||||
Some more details about the job.
|
||||
|
@ -10,7 +10,7 @@ import cats.effect._
|
||||
import cats.implicits._
|
||||
|
||||
import docspell.common.{Ident, LenientUri}
|
||||
import docspell.joexapi.model.BasicResult
|
||||
import docspell.joexapi.model.{AddonSupport, BasicResult}
|
||||
|
||||
import org.http4s.blaze.client.BlazeClientBuilder
|
||||
import org.http4s.circe.CirceEntityDecoder
|
||||
@ -25,6 +25,7 @@ trait JoexClient[F[_]] {
|
||||
|
||||
def cancelJob(base: LenientUri, job: Ident): F[BasicResult]
|
||||
|
||||
def getAddonSupport(base: LenientUri): F[AddonSupport]
|
||||
}
|
||||
|
||||
object JoexClient {
|
||||
@ -33,6 +34,13 @@ object JoexClient {
|
||||
new JoexClient[F] with CirceEntityDecoder {
|
||||
private[this] val logger = docspell.logging.getLogger[F]
|
||||
|
||||
def getAddonSupport(base: LenientUri): F[AddonSupport] = {
|
||||
val getUrl = base / "api" / "v1" / "addon" / "config"
|
||||
val req = Request[F](Method.GET, uri(getUrl))
|
||||
logger.debug(s"Getting addon support") *>
|
||||
client.expect[AddonSupport](req)
|
||||
}
|
||||
|
||||
def notifyJoex(base: LenientUri): F[BasicResult] = {
|
||||
val notifyUrl = base / "api" / "v1" / "notify"
|
||||
val req = Request[F](Method.POST, uri(notifyUrl))
|
||||
|
Reference in New Issue
Block a user