From another service
A service calls the other services of its own account that its program declares, through berm_lang::call or the typed calls declare_program! generates.
Declaring
A program names the services it calls with #[program(programs = ["hn"])]. A call to a service it does not declare is refused.
Calling
berm_lang::call(program, tool, args) calls with JSON arguments and answers JSON text:
let top = berm_lang::call("hn", "top", r#"{"limit": 10}"#)?;
For typed calls, save the service's interface from GET /services/{owner}/hn/idl as idls/hn.json, and berm_lang::declare_program!(hn) generates its types and calls. Calling another program covers the generated code.
Rules
- The target is a service of the same account, named without its owner.
- The target tool is
#[public], and not#[callers(accounts)]. - The called service sees the calling service as its caller.
- Calls nest at most 4 deep.
- A redeploy that breaks a tool another service called in the last 30 days is refused unless forced. See Deploying.