Thanks to visit codestin.com
Credit goes to github.com

Skip to content

hden/apex-rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

122 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apex-rpc Build Status codecov

Clojure client for https://github.com/apex/rpc

Usage

(require '[apex-rpc.core :refer [call]])

(call {:url "http://localhost:18080"
       :method "get_headers"
       :auth-token "token"
       :args-map {:foo "bar"}})

Or you can choose to generate syntax sugar from the schema.json.

./script/gen.clj gen -i examples/todo.json -n myclient.core > myclient.clj

Generated client

;; myclient.clj
;; Do not edit, this file was generated by github.com/hden/apex-rpc.

(ns myclient
  (:require [apex-rpc.core :refer [call]]))

(defn add-item
  "adds an item to the list."
  [spec arg-map]
  (call (merge spec {:method "add_item" :arg-map arg-map})))

(defn get-items
  "returns all items in the list."
  [spec arg-map]
  (call (merge spec {:method "get_items" :arg-map arg-map})))

(defn remove-item
  "removes an item from the to-do list."
  [spec arg-map]
  (call (merge spec {:method "remove_item" :arg-map arg-map})))

Use it from your code

(require '[myclient.core :as myclient])

(def conn {:url "http://localhost:18080"
           :auth-token "token"})

(myclient/add-item conn {:item "foobar"})

License

Copyright © 2020 Haokang Den

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.

About

Simple RPC style APIs with generated clients.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •