           :headers {"Content-Type" "application/json"}
           :body    (js/JSON.stringify #js {:addLabelIds #js ["UNREAD"]})}))
 
-(comment
-  (js/console.log @video-id->message-id)
-
-  (go
-    (-> (gmail-youtube-label-id) <! js/console.log))
-
-  (go
-    (-> (request-token) <! js/console.log))
-  (go
-    (-> (youtube-queue-ids {}) <!
-        js/console.log))
-
-  (go
-    (let [results (<! (gmail-messages {:gmail.label/id "Label_97618004354056322"}))]
-      (js/console.log "Res" results)))
-
-  (go
-    (let [thread (->> (gmail-thread {::access-token   @auth-token
-                                     :gmail.thread/id "15b4a26a9e0bddff"})
-                      (<!))]
-      (js/console.log thread)))
-
-  (go
-    (let [message (->> (gmail-message {::access-token    @auth-token
-                                       :gmail.message/id "15b4f81b65e0b951"})
-                       (<!))]
-      (js/console.log message)))
-
-  (go
-    (let [message (->> (mark-message-unread {::access-token    @auth-token
-                                             :gmail.message/id "15b4f81b65e0b951"})
-                       (<!))]
-      (js/console.log message)))
-
-  (go
-    (let [video (->> (youtube-details #:youtube.video {::access-token auth-token
-                                                       :id            "4b85UX-bxWc"
-                                                       :parts         ["snippet"]})
-                     (<!)
-                     )]
-      (js/console.log video)))
-
-  (let [uri (Uri. (str "https://www.googleapis.com/?access-token=123"))]
-
-    (.toString uri)
-    (.getQueryData uri))
-
-  (uri-set-query-param "https://www.googleapis.com/?access-token=123" "access-token" "over"))

    (swap! video-id->message-id assoc youtube-id id)
    youtube-id))

(s/def :common-specs.internet/email (s/and string? #(re-find #"\w+@\w+\.\w+" %)))

(s/def :common-specs.auth/password (s/and string? (comp #(-> % (>= 8)) count)))
(s/def :common-specs.auth/password-confirmation :common-specs.auth/password)

(s/def :common-specs.auth/password+confirmation
  (s/and (s/keys :req [:common-specs.auth/password :common-specs.auth/password-confirmation])
         (fn [{:common-specs.auth/keys [password password-confirmation]}]
           (= password password-confirmation))))

(s/def ::new-user
  (s/merge (s/keys :req [:common-specs.internet/email])
           :common-specs.auth/password+confirmation))

(defn youtube-queue-ids [options]
  (go
    (->> (gmail-messages options) <!
         (map :id)
         (distinct)
         (map #(assoc options :gmail.message/id %))

     (.setQueryData uri (make-query query))
     (.toString uri))))

(defn gmail-messages [{::keys [gmail-query]}]
  (go
    (-> (fetch (api-uri "gmail/v1/users/me/messages" [[:includeSpamTrash false]
                                                      [:q gmail-query]]))
        <! :messages)))

(defn gmail-message [{:gmail.message/keys [id]}]
  (fetch (api-uri (str "gmail/v1/users/me/messages/" id) [])))

(s/fdef gmail-message
  :args (s/cat :request (s/keys :req [:gmail.message/id])))

(defn extract-youtube-id [msg]
  (if-let [[_ id] (re-find #"youtube\.com/watch\?v=([^&]+)" msg)]
