/dogeapi-clojure

DogeAPI wrapper for Clojure when DogeAPI was still around [mainProject, deprecated, graveyard]

Primary LanguageClojureMIT LicenseMIT

dogeapi-clojure

A DogeAPI wrapper for clojure. For those who don't know, Clojure is a really cool programming language. Check it out!

Installation

dogeapi-clojure is available on Clojars.

[dogeapi-clojure "0.1.0"]

Usage

Declare dogeapi-clojure in your project.clj file.

(defproject whatever "x.x.x-SNAPSHOT"
  :dependencies [[dogeapi-clojure "0.1.0"]])

To use:

;; include dogeapi-clojure
(require '[dogeapi-clojure.core :as doge])

;; create instance of doge with your api key and the api endpoint you want to use
;; version-number is either 1 or 2
;; note that some functionality is unavailable through version 1
(def wow (doge/init-doge "your-api-key" version-number))

If you're using v2, all the methods will return a map, like so:

;; example for calling get-balance
=> (doge/get-balance wow)
{:data {:balance 1.9}}

If you're using v1, all the methods will return a string, like so:

;; example for calling get-balance
=> (doge/get-balance wow)
"1.9"

Individual functions

For more information on what these methods do, go to the DogeAPI documentation.

get_balance

(doge/get-balance wow)

withdraw

(doge/withdraw wow pin amount-doge payment-address)

get_new_address

(doge/get-new-address wow [this address-label])

get_my_addresses

(doge/get-my-addresses wow)

get_address_received

;; use either a map with keyword :payment-address + whatever your payment address is
(doge/get-address-received wow {:payment-address "whatever-your-payment-address-is"})
;; or keyword :address-label + whatever your address label is
(doge/get-address-received wow {:address-label "whatever-your-address-label-is"})

get_address_by_label

(doge/get-address-by-label wow "address-label")

get_difficulty

(doge/get-difficulty wow)

get_current_block

(doge/get-current-block wow)

get_current_price

(doge/get-current-price wow)
;; you can also pass in a map with a :convert-to option and an :amount-doge option (both of which are optional)
;; convert-to defaults to USD by default
(doge/get-current-price wow {:convert-to "BTC" :amount-doge 1000})

v2 functions

create_user

(doge/create-user wow user-id])

get_user_address

(doge/get-user-address wow user-id)

get_user_balance

(doge/get-user-balance wow user-id)

withdraw_from_user

(doge/withdraw-from-user wow pin amount-doge user-id payment-address)

move_to_user

(doge/move-to-user wow to-user-id from-user-id amount-doge)

get_users

(doge/get-users wow number)

get_transactions

(doge/get-transactions wow number)
;; optional arguments are :user-id, :payment-address, :label, and :type
;; they are passed in after the number argument in a single map
(doge/get-transactions wow number {:user-id "whatever-user-id-is"
                                   :payment-address "whatever-your-payment-address-is"
                                   :label "whatever-your-label-is"
                                   :type "whatever-your-type-is"})

get_network_hashrate

(doge/get-network-hashrate wow)

get_info

(doge/get-info wow)

License

Copyright © 2014 Gabriel Ruiz

Distributed under the MIT License.