Pull-based remote protocol over HTTP.
(require '[sg.flybot.pullable.remote :as remote])
;; Define API as a function: request → {:data ... :schema ...}
(defn my-api [ring-request]
{:data {:user {:name "Alice" :age 30}}
:schema {:user {:name :string :age :number}}})
;; Create Ring handler
(def handler (remote/make-handler my-api))
(require '[sg.flybot.pullable.remote.client :as client])
(def api (client/connect "http://localhost:8080/api"))
(api '{:user {:name ?n}})
;; => {'n "Alice"}
(client/schema api) ; introspect
POST /api - Execute pull patternGET /api/_schema - Schema introspection (session-aware)Content negotiation via Accept/Content-Type headers:
application/transit+json (default)application/transit+msgpackapplication/ednRequest: {:pattern '{:user {:name ?n}}}
Success: {'n "Alice"}
Failure: {:errors [{:code :schema-violation :reason "..."}]}
Pull-based remote protocol over HTTP.
## Server Quick Start
```clojure
(require '[sg.flybot.pullable.remote :as remote])
;; Define API as a function: request → {:data ... :schema ...}
(defn my-api [ring-request]
{:data {:user {:name "Alice" :age 30}}
:schema {:user {:name :string :age :number}}})
;; Create Ring handler
(def handler (remote/make-handler my-api))
```
## Client Quick Start (JVM only)
```clojure
(require '[sg.flybot.pullable.remote.client :as client])
(def api (client/connect "http://localhost:8080/api"))
(api '{:user {:name ?n}})
;; => {'n "Alice"}
(client/schema api) ; introspect
```
## Endpoints
- `POST /api` - Execute pull pattern
- `GET /api/_schema` - Schema introspection (session-aware)
## Wire Format
Content negotiation via Accept/Content-Type headers:
- `application/transit+json` (default)
- `application/transit+msgpack`
- `application/edn`
## Request/Response
Request: `{:pattern '{:user {:name ?n}}}`
Success: `{'n "Alice"}`
Failure: `{:errors [{:code :schema-violation :reason "..."}]}`HTTP client for pull-based APIs.
Provides a simple way to interact with remote pull APIs from the REPL.
(def api (connect "http://localhost:8080/api"))
;; Pull data
(api '{:posts ?posts})
;; With params
(api '{:post {:title ?t}} {:post-id 1})
;; Introspect schema
(schema api)
HTTP client for pull-based APIs.
Provides a simple way to interact with remote pull APIs from the REPL.
```clojure
(def api (connect "http://localhost:8080/api"))
;; Pull data
(api '{:posts ?posts})
;; With params
(api '{:post {:title ?t}} {:post-id 1})
;; Introspect schema
(schema api)
```cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |