 (defn generate-request
   "Generates the request map to be passed to the http library.
   NB: uses the `base-url` symbol, it should be generated in the ns including the method."
-  [http-method path parameters]
+  [{http-method :httpMethod
+    path :path
+    parameters :parameters}]
   (let [query-params (->> parameters
                           (filter (fn [[_ v]] (= (:location v) "query")))
                           (mapv   (fn [[k _]] (name k))))

(defn generate-ns
  "Given a service model, generates a clojure namespace with the implementation
   of all the API methods as functions and returns it as a pretty string."
  [{:keys [name version description documentationLink rootUrl servicePath]
    :as model}]
  (let [ns-declaration (generate-ns-declaration name version description documentationLink)
        global-vars (generate-global-vars rootUrl servicePath)
        functions (->> (:resources model)
                       (mapcat
                        (fn [[resource-id resource]]

            [camel-snake-kebab.core :refer :all]))

(defn generate-ns-declaration
  "Generates the ns declaration for the given API model."
  [{name :name
    version :version
    desc :description
    docs-link :documentationLink}]
  `(~'ns
    ~(symbol (str "gogolica." name "." version)) ;; HACK: instead of having the ns as string, we should probably read it from the current one
    ~(str desc "\n\n"
          "Documentation link: " docs-link)
    (:gen-class)
    (:require [gogolica.common :refer [~'?assoc ~'exec-http] :as ~'common]
              [clojure.string :as ~'str])))

(defn generate-global-vars
  "Generates global variables that are used throughout the generated
   namespace for the given API model"
  [{root-url :rootUrl
    service-path :servicePath}]
  `[(def ~'base-url ~(str root-url service-path))])

(defn split-required-params
