diff --git a/.cljstyle b/.cljstyle new file mode 100644 index 0000000..910e1da --- /dev/null +++ b/.cljstyle @@ -0,0 +1,3 @@ +{:files {:extensions #{"clj" "cljs" "cljc" "cljx" "edn"} + :ignore #{"target" ".git" ".idea" ".vscode" "node_modules"}} + :rules {:namespaces {:enabled? false}}} diff --git a/.github/workflows/deploy_to_clojars.yml b/.github/workflows/deploy_to_clojars.yml new file mode 100644 index 0000000..6ccb2bf --- /dev/null +++ b/.github/workflows/deploy_to_clojars.yml @@ -0,0 +1,52 @@ +name: Deploy to Clojars + +on: + workflow_dispatch: + + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4.1.1 + + - name: Cache maven dependencies + uses: actions/cache@v4 + env: + cache-name: cache-maven + with: + path: ~/.m2 + save-always: true + key: ${{ runner.os }}-clj-${{ hashFiles('**/project.clj') }} + restore-keys: | + ${{ runner.os }}-clj + + - name: Install Clojure dependencies + run: | + lein deps && lein project-version + + - name: Run sanity tests + run: lein test + + - name: Run build test + run: lein jar + + - name: Publish to Clojars + env: + CLOJARS_USER: ${{ secrets.CLOJARS_USER }} + CLOJARS_PASS: ${{ secrets.CLOJARS_PASS }} + run: lein deploy clojars + + - name: Resolve version + id: versionchk + run: echo "::set-output name=VERSION::$(lein project-version)" + + - name: Push Tag + uses: hole19/git-tag-action@v1.0 + env: + TAG: v${{ steps.versionchk.outputs.VERSION }} + GITHUB_TOKEN: ${{ secrets.WALL_BREW_BOT_PAT }} + diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c1fb95..a91a46c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.1.0 / 2024 Mar 10 + +> This release marks the library as deprecated + ## v1.0.0 / 2021 Oct 22 > This release adds all initial functionality diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..29d1c14 --- /dev/null +++ b/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + com.wallbrew + strawpoll-client + jar + 1.1.0 + strawpoll-client + A clj-http client library for https://strawpoll.com/ + https://github.com/Wall-Brew-Co/strawpoll-client + + + MIT + https://opensource.org/licenses/MIT + + + + https://github.com/Wall-Brew-Co/strawpoll-client + scm:git:git://github.com/Wall-Brew-Co/strawpoll-client.git + scm:git:ssh://git@github.com/Wall-Brew-Co/strawpoll-client.git + a950d5a52f4a77010c121b95b5b7a78f94971021 + + + src + test + + + resources + + + + + resources + + + target + target/classes + + + + + central + https://repo1.maven.org/maven2/ + + false + + + true + + + + clojars + https://repo.clojars.org/ + + true + + + true + + + + + + + + + cheshire + cheshire + 5.12.0 + + + clj-http + clj-http + 3.12.3 + + + org.clojure + clojure + 1.11.2 + + + circleci + bond + 0.6.0 + test + + + clj-http-fake + clj-http-fake + 1.0.4 + test + + + + + diff --git a/project.clj b/project.clj index 20db0be..97d0ef6 100644 --- a/project.clj +++ b/project.clj @@ -1,12 +1,28 @@ -(defproject com.wallbrew/strawpoll-client "1.0.0" +(defproject com.wallbrew/strawpoll-client "1.1.0" :description "A clj-http client library for https://strawpoll.com/" :url "https://github.com/Wall-Brew-Co/strawpoll-client" - :license {:name "MIT" - :url "https://opensource.org/licenses/MIT"} + :license {:name "MIT" + :url "https://opensource.org/licenses/MIT" + :distribution :repo + :comments "Same-as all Wall-Brew projects."} + :scm {:name "git" + :url "https://github.com/Wall-Brew-Co/strawpoll-client"} :dependencies [[cheshire "5.12.0"] [clj-http "3.12.3"] [org.clojure/clojure "1.11.2"]] + :plugins [[com.github.clj-kondo/lein-clj-kondo "2024.03.05"] + [com.wallbrew/lein-sealog "1.2.0"] + [lein-cljsbuild "1.1.8"] + [lein-project-version "0.1.0"] + [mvxcvi/cljstyle "0.16.630"] + [ns-sort "1.0.3"]] :profiles {:uberjar {:aot :all} - :dev {:dependencies [[circleci/bond "0.6.0"] - [clj-http-fake "1.0.4"]]}} + :dev {:dependencies [[circleci/bond "0.6.0"] + [clj-http-fake "1.0.4"]]}} + :resource-paths ["resources"] + :deploy-branches ["master"] + :deploy-repositories [["clojars" {:url "https://clojars.org/repo" + :username :env/clojars_user + :password :env/clojars_pass + :sign-releases false}]] :min-lein-version "2.5.3") diff --git a/src/strawpoll_client/core.clj b/src/strawpoll_client/core.clj index 82dd78d..20f749f 100644 --- a/src/strawpoll_client/core.clj +++ b/src/strawpoll_client/core.clj @@ -1,12 +1,11 @@ (ns strawpoll-client.core "Basic functions to interact with [Strawpoll](https://strawpoll.com/en/api-docs/)" - (:require - [cheshire.core :as json] - [clj-http.client :as client] - [strawpoll-client.impl :as impl])) + (:require [cheshire.core :as json] + [clj-http.client :as client] + [strawpoll-client.impl :as impl])) -(defn ->client +(defn ^:deprecated ->client "Create a client, which is the required first argument to `create-poll!`, `get-poll-results!`, and `delete-poll!`. This function expects an option map, with the following key sets: - :api-key - The Strawpoll API key for your project. @@ -20,7 +19,7 @@ :clj-http-opts clj-http-opts}) -(defn create-poll! +(defn ^:deprecated create-poll! "Create a poll using the provided `client` titled `title` with `answers`. `client` is expected to be the return value of `strawpoll-client.core/->client` `title` is a string representing the title of the poll you wish to create. @@ -74,13 +73,15 @@ #_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} -(defn ->poll-id + + +(defn ^:deprecated ->poll-id "A convenience function to extract the identifier of a poll from the return value of `strawpoll-client.core/create-poll!`" [create-poll!-response] (:content_id create-poll!-response)) -(defn get-poll-results! +(defn ^:deprecated get-poll-results! "Get the current results of `poll-id` using the provided client. The poll-id is encoded in the response of `strawpoll-client.core/create-poll!` as `content_id`, which may be retreived by `strawpoll-client.core/->poll-id`" [{:keys [api-key clj-http-opts]} poll-id] @@ -92,7 +93,7 @@ (:body (client/get (impl/->url "/poll/" poll-id) request-opts)))) -(defn delete-poll! +(defn ^:deprecated delete-poll! "Permanently delete `poll-id` using the provided client. The poll-id is encoded in the response of `strawpoll-client.core/create-poll!` as `content_id`, which may be retreived by `strawpoll-client.core/->poll-id`" [{:keys [api-key clj-http-opts]} poll-id] diff --git a/src/strawpoll_client/impl.clj b/src/strawpoll_client/impl.clj index 20b303c..8022347 100644 --- a/src/strawpoll_client/impl.clj +++ b/src/strawpoll_client/impl.clj @@ -7,25 +7,25 @@ "https://strawpoll.com/api") -(defn ->url +(defn ^:deprecated ->url "Append `route` as a suffix to the strawpoll URI stem" [& route] (str strawpoll-api-stem (apply str route))) -(defn getenv +(defn ^:deprecated getenv "Wrapper - here to support testing since we can't redef static methods" [k] (System/getenv k)) -(defn getProperty +(defn ^:deprecated getProperty "Wrapper - here to support testing since we can't redef static methods" [k] (System/getProperty k)) -(defn load-api-key! +(defn ^:deprecated load-api-key! "Attempt to load the Strawpoll API key from `opts`, otherwise check for a matching Environment Variable or JVM Property" [opts] (if-let [api-key (or (:api-key opts) diff --git a/src/strawpoll_client/repl.clj b/src/strawpoll_client/repl.clj index 4ea9050..6c58984 100644 --- a/src/strawpoll_client/repl.clj +++ b/src/strawpoll_client/repl.clj @@ -1,7 +1,6 @@ (ns strawpoll-client.repl "A Rich comment block demonstrating the lifecycle of a poll" - (:require - [strawpoll-client.core :as straw])) + (:require [strawpoll-client.core :as straw])) (comment diff --git a/test/strawpoll_client/core_test.clj b/test/strawpoll_client/core_test.clj index a8bcf9f..f7467da 100644 --- a/test/strawpoll_client/core_test.clj +++ b/test/strawpoll_client/core_test.clj @@ -1,10 +1,9 @@ (ns strawpoll-client.core-test - (:require - [bond.james :as bond] - [clj-http.client :as http] - [clj-http.fake :refer [with-fake-routes-in-isolation]] - [clojure.test :as t] - [strawpoll-client.core :as sut])) + (:require [bond.james :as bond] + [clj-http.client :as http] + [clj-http.fake :refer [with-fake-routes-in-isolation]] + [clojure.test :as t] + [strawpoll-client.core :as sut])) (t/deftest create-poll!-test diff --git a/test/strawpoll_client/impl_test.clj b/test/strawpoll_client/impl_test.clj index 0219b3b..da6c47d 100644 --- a/test/strawpoll_client/impl_test.clj +++ b/test/strawpoll_client/impl_test.clj @@ -1,8 +1,7 @@ (ns strawpoll-client.impl-test - (:require - [bond.james :as bond] - [clojure.test :as t] - [strawpoll-client.impl :as sut])) + (:require [bond.james :as bond] + [clojure.test :as t] + [strawpoll-client.impl :as sut])) (t/deftest load-bugsnag-api-key!-test