What the nodes that reach other services have in common, for integrations written in Elixir.
Each action of a service is its own node, so it shows only the fields it needs.
They all use a stored credential, and they answer through the success and
error outputs, so a flow can handle a service being down.
The host (Heddle) fills templates and keeps credentials, see Bobbin.Host.
Example
defmodule Acme.Nodes.GetItem do
use Bobbin.Node
@service %{title: "Acme", category: :acme, credential: "acme", icon: "hero-cube"}
@impl true
def definition do
Bobbin.Service.definition(@service, "Get Item", "Reads an item.", [
%{type: :text, name: :id, label: "Item ID", default: ""}
])
end
@impl true
def handler(context, _input) do
Bobbin.Service.run(context, "acme", fn credential ->
Acme.get(credential, Bobbin.Service.field(context, "id"))
end)
end
end
Summary
Functions
Returns what a file field holds.
Returns the values of the credential the node picked, as its flow's workspace sees
it. refresh: true renews an OAuth token. See Bobbin.Host.credential/4.
Builds the definition of one action of a service.
Reads a field that holds JSON, or a single placeholder pointing at a value.
Reads a field that holds an image or audio: what another node returned, or a URL.
Reads a field that holds a positive number, or returns default.
Calls fun with the credential and answers through the node's outputs.
Makes a generated file safe to keep in a run's context, in the shape file fields read.
Makes content safe to keep in a run's context, which is saved as JSON.
Makes what a driver returned safe to keep in a run's context, which is saved as JSON.
Functions
Returns what a file field holds.
A field that is a single placeholder can point at what a Download node returned, which keeps binary files intact from one service to the other.
Returns the values of the credential the node picked, as its flow's workspace sees
it. refresh: true renews an OAuth token. See Bobbin.Host.credential/4.
Builds the definition of one action of a service.
Reads a field that holds JSON, or a single placeholder pointing at a value.
Returns {:ok, value} or {:error, message}. See Bobbin.Template.json/3.
Reads a field that holds an image or audio: what another node returned, or a URL.
Returns {:ok, {bytes, media_type}} or {:error, message}.
Reads a field that holds a positive number, or returns default.
Calls fun with the credential and answers through the node's outputs.
fun returns {:ok, result} or {:error, message}.
Makes a generated file safe to keep in a run's context, in the shape file fields read.
Makes content safe to keep in a run's context, which is saved as JSON.
Makes what a driver returned safe to keep in a run's context, which is saved as JSON.
Decimals become strings, because a float would lose cents.