arbiter-servant-0.1.0.0: Servant REST API for arbiter job queue
Safe HaskellNone
LanguageGHC2024

Arbiter.Servant.API

Description

Servant API type definitions for Arbiter job queue admin interface.

The API is generated from the registry, creating separate endpoints for each table.

Synopsis

Documentation

type ArbiterAPI (registry :: [(Symbol, Type)]) = "api" :> ("v1" :> RegistryToAPI registry) Source #

Top-level Arbiter API

Routes are generated from the registry:

  • /api/v1/:tableName/jobs/... for each table in registry
  • /api/v1/queues - list all available queues
  • /api/v1/events/stream - real-time job updates (SSE)

type family RegistryToAPI (registry :: [(Symbol, Type)]) where ... Source #

Type family to build API routes from registry For registry '[ '("table1", Payload1), '("table2", Payload2) ] Generates: Capture "table1" :> NamedRoutes (TableAPI Payload1) :| Capture "table2" :> NamedRoutes (TableAPI Payload2) :| queues :| events

Equations

RegistryToAPI ('[] :: [(Symbol, Type)]) = ("queues" :> NamedRoutes (QueuesAPI :: Type -> Type)) :<|> (("events" :> EventsAPI) :<|> ("cron" :> NamedRoutes (CronAPI :: Type -> Type))) 
RegistryToAPI '['(tableName, payload)] = (tableName :> NamedRoutes (TableAPI payload :: Type -> Type)) :<|> (("queues" :> NamedRoutes (QueuesAPI :: Type -> Type)) :<|> (("events" :> EventsAPI) :<|> ("cron" :> NamedRoutes (CronAPI :: Type -> Type)))) 
RegistryToAPI ('(tableName, payload) ': rest) = (tableName :> NamedRoutes (TableAPI payload :: Type -> Type)) :<|> RegistryToAPI rest 

data TableAPI payload (mode :: k) Source #

API routes for a specific table

Constructors

TableAPI 

Fields

Instances

Instances details
Generic (TableAPI payload mode) Source # 
Instance details

Defined in Arbiter.Servant.API

Associated Types

type Rep (TableAPI payload mode) 
Instance details

Defined in Arbiter.Servant.API

type Rep (TableAPI payload mode) = D1 ('MetaData "TableAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "TableAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "jobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("jobs" :> NamedRoutes (JobsAPI payload :: Type -> Type)))) :*: (S1 ('MetaSel ('Just "dlq") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("dlq" :> NamedRoutes (DLQAPI payload :: Type -> Type)))) :*: S1 ('MetaSel ('Just "stats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("stats" :> NamedRoutes (StatsAPI :: Type -> Type)))))))

Methods

from :: TableAPI payload mode -> Rep (TableAPI payload mode) x #

to :: Rep (TableAPI payload mode) x -> TableAPI payload mode #

type Rep (TableAPI payload mode) Source # 
Instance details

Defined in Arbiter.Servant.API

type Rep (TableAPI payload mode) = D1 ('MetaData "TableAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "TableAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "jobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("jobs" :> NamedRoutes (JobsAPI payload :: Type -> Type)))) :*: (S1 ('MetaSel ('Just "dlq") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("dlq" :> NamedRoutes (DLQAPI payload :: Type -> Type)))) :*: S1 ('MetaSel ('Just "stats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("stats" :> NamedRoutes (StatsAPI :: Type -> Type)))))))

data JobsAPI payload (mode :: k) Source #

Jobs API routes - manage jobs in a specific table

Constructors

JobsAPI 

Fields

Instances

Instances details
Generic (JobsAPI payload mode) Source # 
Instance details

Defined in Arbiter.Servant.API

Associated Types

type Rep (JobsAPI payload mode) 
Instance details

Defined in Arbiter.Servant.API

type Rep (JobsAPI payload mode) = D1 ('MetaData "JobsAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "JobsAPI" 'PrefixI 'True) (((S1 ('MetaSel ('Just "listJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (QueryParam "limit" Int :> (QueryParam "offset" Int :> (QueryParam "group_key" Text :> (QueryParam "parent_id" Int64 :> (QueryParam "suspended" Bool :> Get '[JSON] (JobsResponse payload)))))))) :*: (S1 ('MetaSel ('Just "insertJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (ReqBody '[JSON] (ApiJobWrite payload) :> Post '[JSON] (JobResponse payload)))) :*: S1 ('MetaSel ('Just "insertJobsBatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("batch" :> (ReqBody '[JSON] (BatchInsertRequest payload) :> Post '[JSON] (BatchInsertResponse payload))))))) :*: (S1 ('MetaSel ('Just "getJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> Get '[JSON] (JobResponse payload)))) :*: (S1 ('MetaSel ('Just "getInFlightJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("in-flight" :> (QueryParam "limit" Int :> (QueryParam "offset" Int :> Get '[JSON] (JobsResponse payload)))))) :*: S1 ('MetaSel ('Just "cancelJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> DeleteNoContent)))))) :*: ((S1 ('MetaSel ('Just "promoteJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("promote" :> PostNoContent)))) :*: (S1 ('MetaSel ('Just "moveToDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("move-to-dlq" :> PostNoContent)))) :*: S1 ('MetaSel ('Just "pauseChildren") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("pause-children" :> PostNoContent)))))) :*: (S1 ('MetaSel ('Just "resumeChildren") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("resume-children" :> PostNoContent)))) :*: (S1 ('MetaSel ('Just "suspendJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("suspend" :> PostNoContent)))) :*: S1 ('MetaSel ('Just "resumeJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("resume" :> PostNoContent)))))))))

Methods

from :: JobsAPI payload mode -> Rep (JobsAPI payload mode) x #

to :: Rep (JobsAPI payload mode) x -> JobsAPI payload mode #

type Rep (JobsAPI payload mode) Source # 
Instance details

Defined in Arbiter.Servant.API

type Rep (JobsAPI payload mode) = D1 ('MetaData "JobsAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "JobsAPI" 'PrefixI 'True) (((S1 ('MetaSel ('Just "listJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (QueryParam "limit" Int :> (QueryParam "offset" Int :> (QueryParam "group_key" Text :> (QueryParam "parent_id" Int64 :> (QueryParam "suspended" Bool :> Get '[JSON] (JobsResponse payload)))))))) :*: (S1 ('MetaSel ('Just "insertJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (ReqBody '[JSON] (ApiJobWrite payload) :> Post '[JSON] (JobResponse payload)))) :*: S1 ('MetaSel ('Just "insertJobsBatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("batch" :> (ReqBody '[JSON] (BatchInsertRequest payload) :> Post '[JSON] (BatchInsertResponse payload))))))) :*: (S1 ('MetaSel ('Just "getJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> Get '[JSON] (JobResponse payload)))) :*: (S1 ('MetaSel ('Just "getInFlightJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("in-flight" :> (QueryParam "limit" Int :> (QueryParam "offset" Int :> Get '[JSON] (JobsResponse payload)))))) :*: S1 ('MetaSel ('Just "cancelJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> DeleteNoContent)))))) :*: ((S1 ('MetaSel ('Just "promoteJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("promote" :> PostNoContent)))) :*: (S1 ('MetaSel ('Just "moveToDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("move-to-dlq" :> PostNoContent)))) :*: S1 ('MetaSel ('Just "pauseChildren") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("pause-children" :> PostNoContent)))))) :*: (S1 ('MetaSel ('Just "resumeChildren") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("resume-children" :> PostNoContent)))) :*: (S1 ('MetaSel ('Just "suspendJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("suspend" :> PostNoContent)))) :*: S1 ('MetaSel ('Just "resumeJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("resume" :> PostNoContent)))))))))

data DLQAPI payload (mode :: k) Source #

DLQ API routes - manage failed jobs in a specific table

Constructors

DLQAPI 

Fields

Instances

Instances details
Generic (DLQAPI payload mode) Source # 
Instance details

Defined in Arbiter.Servant.API

Associated Types

type Rep (DLQAPI payload mode) 
Instance details

Defined in Arbiter.Servant.API

type Rep (DLQAPI payload mode) = D1 ('MetaData "DLQAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "DLQAPI" 'PrefixI 'True) ((S1 ('MetaSel ('Just "listDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (QueryParam "limit" Int :> (QueryParam "offset" Int :> (QueryParam "parent_id" Int64 :> (QueryParam "group_key" Text :> Get '[JSON] (DLQResponse payload))))))) :*: S1 ('MetaSel ('Just "retryFromDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("retry" :> PostNoContent))))) :*: (S1 ('MetaSel ('Just "deleteDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> DeleteNoContent))) :*: S1 ('MetaSel ('Just "deleteDLQBatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("batch-delete" :> (ReqBody '[JSON] BatchDeleteRequest :> Post '[JSON] BatchDeleteResponse)))))))

Methods

from :: DLQAPI payload mode -> Rep (DLQAPI payload mode) x #

to :: Rep (DLQAPI payload mode) x -> DLQAPI payload mode #

type Rep (DLQAPI payload mode) Source # 
Instance details

Defined in Arbiter.Servant.API

type Rep (DLQAPI payload mode) = D1 ('MetaData "DLQAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "DLQAPI" 'PrefixI 'True) ((S1 ('MetaSel ('Just "listDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (QueryParam "limit" Int :> (QueryParam "offset" Int :> (QueryParam "parent_id" Int64 :> (QueryParam "group_key" Text :> Get '[JSON] (DLQResponse payload))))))) :*: S1 ('MetaSel ('Just "retryFromDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("retry" :> PostNoContent))))) :*: (S1 ('MetaSel ('Just "deleteDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> DeleteNoContent))) :*: S1 ('MetaSel ('Just "deleteDLQBatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("batch-delete" :> (ReqBody '[JSON] BatchDeleteRequest :> Post '[JSON] BatchDeleteResponse)))))))

data StatsAPI (mode :: k) Source #

Stats API routes - queue statistics for a specific table

Constructors

StatsAPI 

Fields

Instances

Instances details
Generic (StatsAPI mode) Source # 
Instance details

Defined in Arbiter.Servant.API

Associated Types

type Rep (StatsAPI mode) 
Instance details

Defined in Arbiter.Servant.API

type Rep (StatsAPI mode) = D1 ('MetaData "StatsAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "StatsAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "getStats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- Get '[JSON] StatsResponse))))

Methods

from :: StatsAPI mode -> Rep (StatsAPI mode) x #

to :: Rep (StatsAPI mode) x -> StatsAPI mode #

type Rep (StatsAPI mode) Source # 
Instance details

Defined in Arbiter.Servant.API

type Rep (StatsAPI mode) = D1 ('MetaData "StatsAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "StatsAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "getStats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- Get '[JSON] StatsResponse))))

data QueuesAPI (mode :: k) Source #

Queues API routes - list available queues

Constructors

QueuesAPI 

Fields

Instances

Instances details
Generic (QueuesAPI mode) Source # 
Instance details

Defined in Arbiter.Servant.API

Associated Types

type Rep (QueuesAPI mode) 
Instance details

Defined in Arbiter.Servant.API

type Rep (QueuesAPI mode) = D1 ('MetaData "QueuesAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "QueuesAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "listQueues") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- Get '[JSON] QueuesResponse))))

Methods

from :: QueuesAPI mode -> Rep (QueuesAPI mode) x #

to :: Rep (QueuesAPI mode) x -> QueuesAPI mode #

type Rep (QueuesAPI mode) Source # 
Instance details

Defined in Arbiter.Servant.API

type Rep (QueuesAPI mode) = D1 ('MetaData "QueuesAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "QueuesAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "listQueues") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- Get '[JSON] QueuesResponse))))

type EventsAPI = "stream" :> Raw Source #

Events API type - raw WAI handler for SSE streaming

data CronAPI (mode :: k) Source #

Cron API routes - manage cron schedules

Constructors

CronAPI 

Fields

Instances

Instances details
Generic (CronAPI mode) Source # 
Instance details

Defined in Arbiter.Servant.API

Associated Types

type Rep (CronAPI mode) 
Instance details

Defined in Arbiter.Servant.API

type Rep (CronAPI mode) = D1 ('MetaData "CronAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "CronAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "listSchedules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("schedules" :> Get '[JSON] CronSchedulesResponse))) :*: S1 ('MetaSel ('Just "updateSchedule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("schedules" :> (Capture "name" Text :> (ReqBody '[JSON] CronScheduleUpdate :> Patch '[JSON] CronScheduleRow)))))))

Methods

from :: CronAPI mode -> Rep (CronAPI mode) x #

to :: Rep (CronAPI mode) x -> CronAPI mode #

type Rep (CronAPI mode) Source # 
Instance details

Defined in Arbiter.Servant.API

type Rep (CronAPI mode) = D1 ('MetaData "CronAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "CronAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "listSchedules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("schedules" :> Get '[JSON] CronSchedulesResponse))) :*: S1 ('MetaSel ('Just "updateSchedule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("schedules" :> (Capture "name" Text :> (ReqBody '[JSON] CronScheduleUpdate :> Patch '[JSON] CronScheduleRow)))))))