ProtoRune. XRPC. Procedure
(proto_rune v0.5.2)
Copy Markdown
The XRPC.Procedure module represents a procedure in the XRPC system, encapsulating the method name, request body, and a parser for validating the body. It provides functions to create and manipulate procedure structures.
Overview
This module allows for:
- Creating Procedures: Use the
new/2function to create a new procedure with a method and a parser. - Adding a Body: Use the
put_body/2function to attach a validated body to the procedure. - String Representation: The procedure can be converted to a string that represents its full URL.
Functions
new/2
Creates a new procedure with a given method and parser.
XRPC.Procedure.new("app.bsky.actor.mute", from: MyParser)put_body/2
Attaches a validated body to the procedure.
{:ok, updated_proc} = XRPC.Procedure.put_body(proc, %{"actor_id" => "123"})Validates the body using the specified parser and updates the procedure via peri.
Summary
Functions
Creates a new procedure with the given method.
Sets the base URL for the procedure.
Attaches a raw binary body to the procedure, skipping schema validation.
Functions
Creates a new procedure with the given method.
Options
:from- Parser module for body validation:base_url- Service base URL (e.g., "https://bsky.social"):response- Response decoding::auto(default) routes on the response content-type,:jsonforces JSON decoding and:binaryreturns the raw body
Examples
Procedure.new("app.bsky.feed.post")
Procedure.new("app.bsky.feed.post", from: parser, base_url: "https://bsky.social")
Sets the base URL for the procedure.
Examples
proc = Procedure.new("app.bsky.feed.post")
proc = Procedure.put_base_url(proc, "https://bsky.social")
Attaches a raw binary body to the procedure, skipping schema validation.
Used by endpoints that expect a non-JSON payload, such as
com.atproto.repo.uploadBlob.
proc = Procedure.put_raw_body(proc, <<0, 1, 2>>)