Current section
Files
Jump to
Current section
Files
src/dagger/dsl/check.gleam
// AUTO-GENERATED BY DAGGER_GLEAM - DO NOT EDIT
import dagger/types.{type Client, type Try} as types
import dagger/interpreter
import dagger/dsl/types as t
import gleam/dynamic/decode
import gleam/list
pub fn check(id id: t.Check) -> t.Check {
let field = types.Field(name: "loadCheckFromID", args: [#("id", types.GDeferred(id.op))], subfields: [])
t.Check(op: types.Pure([field]))
}
/// Whether the check completed
pub fn completed(parent: t.Check, client client: Client, then handler: fn(Try(Bool)) -> a) -> a {
let field = types.Field(name: "completed", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.bool)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("completed")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The description of the check
pub fn description(parent: t.Check, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "description", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.string)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("description")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// If the check failed, this is the error
pub fn error(parent: t.Check) -> t.Error {
let field = types.Field(name: "error", args: [], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.Error(op: new_op)
}
/// A unique identifier for this Check.
pub fn id(parent: t.Check) -> t.Check {
let field = types.Field(name: "id", args: [], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.Check(op: new_op)
}
/// Return the fully qualified name of the check
pub fn name(parent: t.Check, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "name", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.string)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("name")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The original module in which the check has been defined
pub fn original_module(parent: t.Check) -> t.Module {
let field = types.Field(name: "originalModule", args: [], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.Module(op: new_op)
}
/// Whether the check passed
pub fn passed(parent: t.Check, client client: Client, then handler: fn(Try(Bool)) -> a) -> a {
let field = types.Field(name: "passed", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.bool)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("passed")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The path of the check within its module
pub fn path(parent: t.Check, client client: Client, then handler: fn(Try(List(String))) -> a) -> a {
let field = types.Field(name: "path", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.list(decode.string))) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("path")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// An emoji representing the result of the check
pub fn result_emoji(parent: t.Check, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "resultEmoji", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.string)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("resultEmoji")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// Execute the check
pub fn run(parent: t.Check) -> t.Check {
let field = types.Field(name: "run", args: [], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.Check(op: new_op)
}