         (.setRequestItems
          (utils/name-map
           (fn [reqs]
-            (reduce (fn [v [verb _ item]] (conj v (write-request verb item)))
+            (reduce (fn [v [action _ item]] (conj v (write-request action item)))
                     [] (partition 3 (flatten reqs))))
           (group-by (fn [[_ table _]] table) requests)))))))
 

       (.setExpected     (expected-values expected))
       (.setReturnValues (utils/enum return))))))

(defn delete-item
  "Deletes an item from a table by its hash key, {attr match-value}.
  See `put-item` for option docs."
  [creds table hash-key & [{:keys [return expected]
                            :or   {return :none}}]]
  (as-map
   (.deleteItem (db-client creds)
     (doto (DeleteItemRequest.)
       (.setTableName    (name table))
       (.setKey          (clj-item->db-item hash-key))
       (.setExpected     (expected-values expected))
       (.setReturnValues (utils/enum return))))))

(defn get-item
  "Retrieves an item from a table by its hash key, {attr match-value}."
  [creds table hash-key & [{:keys [consistent? attrs-to-get]}]]
  (as-map
   (.getItem (db-client creds)
    (doto (GetItemRequest.)
      (.setTableName      (name table))
      (.setKey            (clj-item->db-item hash-key))
      (.setConsistentRead  consistent?)
      (.setAttributesToGet attrs-to-get)))))

(defn update-item
  "Updates an item in a table by its hash key, {attr match-value}.
  See `put-item` for option docs."


;;;; API - tables

(defn list-tables "Returns a list of tables."
  [creds] (->> (db-client creds) (.listTables) (.getTableNames) (mapv keyword)))

(defn describe-table
  "Returns a map describing a table, or nil if the table doesn't exist."
  [creds table]
  (try (as-map (.describeTable (db-client creds)
                (doto (DescribeTableRequest.) (.setTableName (name table)))))
       (catch ResourceNotFoundException _ nil)))

(defn create-table
  "Creates a table with the given map of options:
    :name       - (required) table name.
