 
 (defn spotify-api-call
   "Returns a function that takes a map m and an optional oauth-token t as arguments."
-  [verb url]
+  [verb endpoint]
   (fn f
     ([m] (f m nil))
     ([m t]
-     (let [query-params {(select-params-type verb) (modify-form-params m) :oauth-token t :content-type :json}]
-       (->
-         (try
-           (verb (replace-url-values m url) query-params)
-           (catch Exception e (ex-data e)))
-         (response-to-map))))))
+     (let [query-params {(select-params-type verb) (modify-form-params m)
+                         :oauth-token t
+                         :content-type :json}
+           url (str spotify-api-url endpoint)]
+       (-> (try
+             (verb (replace-url-values m url) query-params)
+             (catch Exception e (ex-data e)))
+           (response-to-map))))))
+
+
+; Define (api-get), (api-post), etc.
+(let [defverb #(intern *ns*
+                       (symbol (str "api-" %))
+                       (partial spotify-api-call
+                                (resolve (symbol "client" %))))]
+  (doseq [verb ["get" "post" "put" "delete"]]
+    (defverb verb)))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;  Public API
+
 
 ;Albums
-(def get-an-album 
+(def get-an-album
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :id, optional key is :market.
   :id has to have the value of an existing album's id.
   :market is an ISO 3166-1 alpha-2 country code.
 
   Example: (get-an-album {:id \"0MnG7y5F1n4Wns63RjEItx\" :market \"SE\"} \"BQBw-JtC..._7GvA\")"
-  (spotify-api-call client/get (str spotify-api-url "albums/id")))
-
-(def get-several-albums 
+  (api-get "albums/id"))
+
+(def get-several-albums
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
   Compulsory key in m is :ids, optional key is :market.
   :ids has to be a comma separated string of spotify album ids.
   :market is an ISO 3166-1 alpha-2 country code.
 
   Example: (get-several-albums {:ids \"4hTil0JVdMyxK2vH11ZbiX,4RjjFbiqFaO8mKTDM2Kzna\" :market \"SE\"} \"BQBw-JtC..._7GvA\") "
-  (spotify-api-call client/get (str spotify-api-url "albums")))
+  (api-get "albums"))
 
 (def get-an-albums-tracks
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.

  :limit is the maxium number of tracks to return, default is 20.
  :offset is the index of the first track to return, default is 0.

  Example: (search {:q \"Gerry Rafferty\" :type \"artist\"  :market \"SE\" :limit 50 :offset 50}} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "search")))

;Tracks
(def get-a-track  
  " Takes two arguments, a map m with query parameters and an optional oauth-token t.
  Compulsory key in m is :id, optional key is :market.
  :id has to have the value of an existing track's id.
  :market is an ISO 3166-1 alpha-2 country code.

  Example: (get-a-track {:id \"3BEmmHuv5jm0tbCUVI6ceD\" :market \"SE\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "tracks/id")))

(def get-several-tracks  
  " Takes two arguments, a map m with query parameters and an optional oauth-token t.
  Compulsory key in m is :ids, optional key is :market.
  :ids has to be a comma separated string of spotify track ids.
  :market is an ISO 3166-1 alpha-2 country code.

  Example: (get-several-tracks {:ids \"2Dlo9QsN9ohaz9kASYkKmv,6XYvLpqJFebcjnOTolwkGw\" :market \"SE\"} \"BQBw-JtC..._7GvA\")" (spotify-api-call client/get (str spotify-api-url "tracks")))

  :limit is the maxium number of tracks to return, default is 20.
  :offset is the index of the first track to return, default is 0.

  Example: (get-a-playlist {:owner_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :fields \"href,name,owner\" :market \"SE\" :limit 50 :offset 50} \"BQBw-JtC..._7GvA\")"
  (api-get "users/owner_id/playlists/playlist_id"))

(def get-a-playlists-tracks
  " Takes two arguments, a map m with query parameters and an optional oauth-token t.
  Compulsory keys in  m are :user_id and :playlist_id, optional keys are :fields, :limit and :offset and :market.
  :owner_id is the users spotify id.
