 
 (defn api-request
   "Returns a request map for a particular api call.
-  The change spotify playlist cover api call demands raw data in the :form-params call
+  The change spotify playlist cover api call demands raw data in the request body
   and content-type to be set to image/jpeg that's why we do the if statements below."
   [method endpoint query-params-spec m t]
   (let [url (replace-url-values m (str spotify-api-url endpoint))


(def defined-query-params [:fields :ids :limit :offset :market :position :state :position_ms :volume_percent :device_id :locale :country :timestamp :type]) 

(defn json-string-to-map
  "Read string and transform into json"
  [s]

(defn response-to-map
  "Parse body of http response to json.
  Include header as meta-data.
  If http status 204 (No content) return an empty map.
  If http status 202 (Async requested for processing) return an empty map."
  [response]
  (with-meta
    (try
      (if (http-code-should-return-empty-map (:status response))
        {}
        (json-string-to-map (:body response)))
      (catch java.lang.NullPointerException e
