| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
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
- type ArbiterAPI (registry :: [(Symbol, Type)]) = "api" :> ("v1" :> RegistryToAPI registry)
- type family RegistryToAPI (registry :: [(Symbol, Type)]) where ...
- data TableAPI payload (mode :: k) = TableAPI {}
- data JobsAPI payload (mode :: k) = JobsAPI {
- listJobs :: mode :- (QueryParam "limit" Int :> (QueryParam "offset" Int :> (QueryParam "group_key" Text :> (QueryParam "parent_id" Int64 :> (QueryParam "suspended" Bool :> Get '[JSON] (JobsResponse payload))))))
- insertJob :: mode :- (ReqBody '[JSON] (ApiJobWrite payload) :> Post '[JSON] (JobResponse payload))
- insertJobsBatch :: mode :- ("batch" :> (ReqBody '[JSON] (BatchInsertRequest payload) :> Post '[JSON] (BatchInsertResponse payload)))
- getJob :: mode :- (Capture "id" Int64 :> Get '[JSON] (JobResponse payload))
- getInFlightJobs :: mode :- ("in-flight" :> (QueryParam "limit" Int :> (QueryParam "offset" Int :> Get '[JSON] (JobsResponse payload))))
- cancelJob :: mode :- (Capture "id" Int64 :> DeleteNoContent)
- promoteJob :: mode :- (Capture "id" Int64 :> ("promote" :> PostNoContent))
- moveToDLQ :: mode :- (Capture "id" Int64 :> ("move-to-dlq" :> PostNoContent))
- pauseChildren :: mode :- (Capture "id" Int64 :> ("pause-children" :> PostNoContent))
- resumeChildren :: mode :- (Capture "id" Int64 :> ("resume-children" :> PostNoContent))
- suspendJob :: mode :- (Capture "id" Int64 :> ("suspend" :> PostNoContent))
- resumeJob :: mode :- (Capture "id" Int64 :> ("resume" :> PostNoContent))
- data DLQAPI payload (mode :: k) = DLQAPI {
- listDLQ :: mode :- (QueryParam "limit" Int :> (QueryParam "offset" Int :> (QueryParam "parent_id" Int64 :> (QueryParam "group_key" Text :> Get '[JSON] (DLQResponse payload)))))
- retryFromDLQ :: mode :- (Capture "id" Int64 :> ("retry" :> PostNoContent))
- deleteDLQ :: mode :- (Capture "id" Int64 :> DeleteNoContent)
- deleteDLQBatch :: mode :- ("batch-delete" :> (ReqBody '[JSON] BatchDeleteRequest :> Post '[JSON] BatchDeleteResponse))
- data StatsAPI (mode :: k) = StatsAPI {
- getStats :: mode :- Get '[JSON] StatsResponse
- data QueuesAPI (mode :: k) = QueuesAPI {
- listQueues :: mode :- Get '[JSON] QueuesResponse
- type EventsAPI = "stream" :> Raw
- data CronAPI (mode :: k) = CronAPI {
- listSchedules :: mode :- ("schedules" :> Get '[JSON] CronSchedulesResponse)
- updateSchedule :: mode :- ("schedules" :> (Capture "name" Text :> (ReqBody '[JSON] CronScheduleUpdate :> Patch '[JSON] CronScheduleRow)))
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 | |
Instances
| Generic (TableAPI payload mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (TableAPI payload mode) Source # | |||||
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
| Generic (JobsAPI payload mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (JobsAPI payload mode) Source # | |||||
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
| Generic (DLQAPI payload mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (DLQAPI payload mode) Source # | |||||
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
| Generic (StatsAPI mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (StatsAPI mode) Source # | |||||
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
| Generic (QueuesAPI mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (QueuesAPI mode) Source # | |||||
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)))) | |||||
data CronAPI (mode :: k) Source #
Cron API routes - manage cron schedules
Constructors
| CronAPI | |
Fields
| |
Instances
| Generic (CronAPI mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (CronAPI mode) Source # | |||||
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))))))) | |||||