<commit_before>(ns saved-for-reddit.reddit-api
  (:require [reagent.core :as r]
            [cljs-http.client :as http]
            [cljs.core.async :refer [<!]])
  (:require-macros [cljs.core.async.macros :refer [go]]))

(def client-id "ZZ370hqcmUVsRQ")
(def redirect-uri "http://127.0.0.1:3449/")

(defn make-remote-call [endpoint]
  (go (let [response (<! (http/get endpoint {:with-credentials? false}))]
        ;;enjoy your data
        (js/console.log (:body response)))))

(defn authorize []
  (go (let [response (<! (http/get "https://www.reddit.com/api/v1/authorize" {:query-params {:client_id client-id
                                                                                             :response_type "code"
                                                                                             :state "abcdef"
                                                                                             :redirect_uri redirect-uri
                                                                                             :duration "temporary"
                                                                                             :scope "save"}
                                                                              :with-credentials? false }))]
        (r/render-component response (.getElementById js/document "app")))))<commit_msg>added gen-auth-url<commit_after>(ns saved-for-reddit.reddit-api
  (:require [reagent.core :as r]
            [cljs-http.client :as http]
            [cljs.core.async :refer [<!]]
            [cemerick.url :as url])
  (:require-macros [cljs.core.async.macros :refer [go]]))

(def client-id "ZZ370hqcmUVsRQ")
(def redirect-uri "http://127.0.0.1:3449/")

(defn gen-auth-url []
  (let [cem-url (url/url "https://www.reddit.com/api/v1/authoriz"
                         :query  {:client_id client-id
                                  :response_type "code"
                                  :state "abcdef"
                                  :redirect_uri redirect-uri
                                  :duration "temporary"
                                  :scope "save"} )]
    (str cem-url)))

(defn make-remote-call [endpoint]
  (go (let [response (<! (http/get endpoint {:with-credentials? false}))]
        ;;enjoy your data
        (js/console.log (:body response)))))

(defn authorize []
  (go (let [response (<! (http/get "https://www.reddit.com/api/v1/authorize" {:query-params {:client_id client-id
                                                                                             :response_type "code"
                                                                                             :state "abcdef"
                                                                                             :redirect_uri redirect-uri
                                                                                             :duration "temporary"
                                                                                             :scope "save"}
                                                                              :with-credentials? false }))]
        (r/render-component response (.getElementById js/document "app")))))
{'fraction_non_alphanumeric': 0.1120396162178892, 'fraction_numerical': 0.00897554936552151, 'mean_word_length': 0.9169632265717675, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 51, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2871495', 'n_tokens_mistral': 753, 'n_tokens_neox': 720, 'n_words': 152}