View Source Dagger.TypeDef (dagger v0.14.0)

A definition of a parameter or return type in a Module.

Summary

Functions

If kind is ENUM, the enum-specific type definition. If kind is not ENUM, this will be null.

If kind is INPUT, the input-specific type definition. If kind is not INPUT, this will be null.

If kind is INTERFACE, the interface-specific type definition. If kind is not INTERFACE, this will be null.

If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null.

If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null.

If kind is SCALAR, the scalar-specific type definition. If kind is not SCALAR, this will be null.

A unique identifier for this TypeDef.

The kind of type this is (e.g. primitive, list, object).

Whether this type can be set to null. Defaults to false.

Adds a function for constructing a new instance of an Object TypeDef, failing if the type is not an object.

Returns a TypeDef of kind Enum with the provided name.

Adds a static value for an Enum TypeDef, failing if the type is not an enum.

Adds a static field for an Object TypeDef, failing if the type is not an object.

Adds a function for an Object or Interface TypeDef, failing if the type is not one of those kinds.

Returns a TypeDef of kind Interface with the provided name.

Sets the kind of the type.

Returns a TypeDef of kind List with the provided type for its elements.

Returns a TypeDef of kind Object with the provided name.

Sets whether this type can be set to null.

Returns a TypeDef of kind Scalar with the provided name.

Types

@type t() :: %Dagger.TypeDef{client: term(), query_builder: term()}

Functions

@spec as_enum(t()) :: Dagger.EnumTypeDef.t() | nil

If kind is ENUM, the enum-specific type definition. If kind is not ENUM, this will be null.

@spec as_input(t()) :: Dagger.InputTypeDef.t() | nil

If kind is INPUT, the input-specific type definition. If kind is not INPUT, this will be null.

@spec as_interface(t()) :: Dagger.InterfaceTypeDef.t() | nil

If kind is INTERFACE, the interface-specific type definition. If kind is not INTERFACE, this will be null.

@spec as_list(t()) :: Dagger.ListTypeDef.t() | nil

If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null.

@spec as_object(t()) :: Dagger.ObjectTypeDef.t() | nil

If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null.

@spec as_scalar(t()) :: Dagger.ScalarTypeDef.t() | nil

If kind is SCALAR, the scalar-specific type definition. If kind is not SCALAR, this will be null.

@spec id(t()) :: {:ok, Dagger.TypeDefID.t()} | {:error, term()}

A unique identifier for this TypeDef.

@spec kind(t()) :: {:ok, Dagger.TypeDefKind.t()} | {:error, term()}

The kind of type this is (e.g. primitive, list, object).

@spec optional(t()) :: {:ok, boolean()} | {:error, term()}

Whether this type can be set to null. Defaults to false.

Link to this function

with_constructor(type_def, function)

View Source
@spec with_constructor(t(), Dagger.Function.t()) :: t()

Adds a function for constructing a new instance of an Object TypeDef, failing if the type is not an object.

Link to this function

with_enum(type_def, name, optional_args \\ [])

View Source
@spec with_enum(t(), String.t(),
  description: String.t() | nil,
  source_map: Dagger.SourceMapID.t() | nil
) :: t()

Returns a TypeDef of kind Enum with the provided name.

Note that an enum's values may be omitted if the intent is only to refer to an enum. This is how functions are able to return their own, or any other circular reference.

Link to this function

with_enum_value(type_def, value, optional_args \\ [])

View Source
@spec with_enum_value(t(), String.t(),
  description: String.t() | nil,
  source_map: Dagger.SourceMapID.t() | nil
) :: t()

Adds a static value for an Enum TypeDef, failing if the type is not an enum.

Link to this function

with_field(type_def_, name, type_def, optional_args \\ [])

View Source
@spec with_field(t(), String.t(), t(),
  description: String.t() | nil,
  source_map: Dagger.SourceMapID.t() | nil
) :: t()

Adds a static field for an Object TypeDef, failing if the type is not an object.

Link to this function

with_function(type_def, function)

View Source
@spec with_function(t(), Dagger.Function.t()) :: t()

Adds a function for an Object or Interface TypeDef, failing if the type is not one of those kinds.

Link to this function

with_interface(type_def, name, optional_args \\ [])

View Source
@spec with_interface(t(), String.t(),
  description: String.t() | nil,
  source_map: Dagger.SourceMapID.t() | nil
) :: t()

Returns a TypeDef of kind Interface with the provided name.

Link to this function

with_kind(type_def, kind)

View Source
@spec with_kind(t(), Dagger.TypeDefKind.t()) :: t()

Sets the kind of the type.

Link to this function

with_list_of(type_def, element_type)

View Source
@spec with_list_of(t(), t()) :: t()

Returns a TypeDef of kind List with the provided type for its elements.

Link to this function

with_object(type_def, name, optional_args \\ [])

View Source
@spec with_object(t(), String.t(),
  description: String.t() | nil,
  source_map: Dagger.SourceMapID.t() | nil
) :: t()

Returns a TypeDef of kind Object with the provided name.

Note that an object's fields and functions may be omitted if the intent is only to refer to an object. This is how functions are able to return their own object, or any other circular reference.

Link to this function

with_optional(type_def, optional)

View Source
@spec with_optional(t(), boolean()) :: t()

Sets whether this type can be set to null.

Link to this function

with_scalar(type_def, name, optional_args \\ [])

View Source
@spec with_scalar(t(), String.t(), [{:description, String.t() | nil}]) :: t()

Returns a TypeDef of kind Scalar with the provided name.