https://github.com/brianium/bestie
Best Buy API toolkit for Clojure
https://github.com/brianium/bestie
Last synced: about 1 year ago
JSON representation
Best Buy API toolkit for Clojure
- Host: GitHub
- URL: https://github.com/brianium/bestie
- Owner: brianium
- License: epl-1.0
- Created: 2016-07-25T01:54:31.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-25T03:00:06.000Z (almost 10 years ago)
- Last Synced: 2025-03-18T05:56:26.522Z (about 1 year ago)
- Language: Clojure
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#bestie
[](https://clojars.org/bestie)
[](https://travis-ci.org/brianium/bestie)
A Clojure library to work with the Best Buy API
## Installation
Add the following dependency to your `project.clj` file:
```
[bestie "0.1.0"]
```
## Usage
```clojure
(ns my.app
(:require [bestie.core :refer :all]))
;; Product Lookup Operation
(def result (products {:apiKey "my-api-key"
:search "(upc=12345)"}))
;; results are futures containing response as a map
(def realized @result);
```
## Functions
The main function is `request`. All functions are a specialization of this function.
### `request`
```clojure
(defn request
([api params config] ,,,)
([api params] (request api params {})))
```
* `api` is a string representing the Best Buy API of interest - i.e "items"
* `params` is a map that will be converted straight to query params
* `config` is an optional map that gets fed right to [http-kit](http://www.http-kit.org/client.html)
If `params` contains a `:search` key it will structure the url using the search syntax specified in [Best Buy's API docs](https://bestbuyapis.github.io/api-documentation/#search-techniques).
There is currently one specialized function `products` which fills in the "products" api in the `request` function
```clojure
(defn products
([params config] (request "products" params config))
([params] (requeset "products" params)))
```
`request` has a single pre-condition defined to ensure the presence of the `:apiKey` key on the `params` map.
## License
Copyright © 2016 Brian Scaturro
Distributed under the Eclipse Public License, the same as Clojure