         template->path-vector'
         (fn [result-acc template matches]
           (if-some [[match arg] (first matches)]
-            (let [[pre post] (s/split template
+            (let [[pre post] (str/split template
                                       (re-pattern (str "\\{" arg "\\}")))]
               (recur (concat result-acc [pre (get args->symbols arg)])
                      post

                              keys
                              (map name))))

(defn generate-request [base-url method]
  {:method (-> method :httpMethod s/lower-case keyword)
   :url `(str ~base-url ~@(generate-path method))})

(defn generate-function-from-method
  [base-url method]
  (-> `(defn ~(generate-function-name method)
         ~(generate-docs method)
         ~(generate-args method)
         (http/request ~(generate-request base-url method)))
      (f/pprint {:width 100}))) ;; This pretty prints the generated code in an idiomatic way
      ;(with-out-str))) ;; TODO: uncomment this line to return formatted code as a string

(defn generate-function-name
  "Generates a symbol in the form of 'verb-resource', from a method map."
  [method]
  (let [[_ resource-name method-name] (str/split (:id method) #"\.")]
    (-> (str method-name "-" resource-name)
        ->kebab-case-symbol)))

