ProtoRune.XRPC.Client (proto_rune v0.3.0)

Copy Markdown

The XRPC.Client module handles executing queries and procedures in the XRPC system. It interacts with external services through HTTP requests and performs response validation and schema parsing. The client supports both GET and POST requests, depending on whether the request is a query or a procedure.

Overview

This module allows:

  • Executing Queries: Executes GET requests for queries.
  • Executing Procedures: Executes POST requests for procedures with a body.
  • Error Handling: Maps various HTTP response codes to custom error messages.

Functions

execute/1

Executes an XRPC query or procedure.

  • For queries, it performs a GET request and validates the query parameters.
  • For procedures, it performs a POST request and validates the request body.

Summary

Functions

Executes an XRPC query or procedure.

Functions

execute(query)

Executes an XRPC query or procedure.

Dispatches to the appropriate HTTP method based on the type:

  • Query: GET request
  • Procedure: POST request

Examples

# Execute a query
query = Query.new("app.bsky.actor.getProfile")
{:ok, response} = Client.execute(query)

# Execute a procedure
proc = Procedure.new("com.atproto.server.createSession")
{:ok, response} = Client.execute(proc)