Current section
Files
Jump to
Current section
Files
src/dagger/dsl/generated_code.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 generated_code(code code: t.Directory) -> t.GeneratedCode {
let field = types.Field(name: "generatedCode", args: [#("code", types.GDeferred(code.op))], subfields: [])
t.GeneratedCode(op: types.Pure([field]))
}
/// The directory containing the generated code.
pub fn code(parent: t.GeneratedCode) -> t.Directory {
let field = types.Field(name: "code", args: [], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.Directory(op: new_op)
}
/// A unique identifier for this GeneratedCode.
pub fn id(parent: t.GeneratedCode) -> t.GeneratedCode {
let field = types.Field(name: "id", args: [], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.GeneratedCode(op: new_op)
}
/// List of paths to mark generated in version control (i.e. .gitattributes).
pub fn vcs_generated_paths(parent: t.GeneratedCode, client client: Client, then handler: fn(Try(List(String))) -> a) -> a {
let field = types.Field(name: "vcsGeneratedPaths", 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("vcsGeneratedPaths")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// List of paths to ignore in version control (i.e. .gitignore).
pub fn vcs_ignored_paths(parent: t.GeneratedCode, client client: Client, then handler: fn(Try(List(String))) -> a) -> a {
let field = types.Field(name: "vcsIgnoredPaths", 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("vcsIgnoredPaths")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// Set the list of paths to mark generated in version control.
pub fn with_v_c_s_generated_paths(parent: t.GeneratedCode, paths paths: List(String)) -> t.GeneratedCode {
let field = types.Field(name: "withVCSGeneratedPaths", args: [#("paths", types.GList(list.map(paths, fn(x) { types.GString(x) })))], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.GeneratedCode(op: new_op)
}
/// Set the list of paths to ignore in version control.
pub fn with_v_c_s_ignored_paths(parent: t.GeneratedCode, paths paths: List(String)) -> t.GeneratedCode {
let field = types.Field(name: "withVCSIgnoredPaths", args: [#("paths", types.GList(list.map(paths, fn(x) { types.GString(x) })))], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.GeneratedCode(op: new_op)
}