{"id":22092871,"url":"https://github.com/toyokumo/kintone-client","last_synced_at":"2025-12-12T01:18:29.919Z","repository":{"id":56299932,"uuid":"203698334","full_name":"toyokumo/kintone-client","owner":"toyokumo","description":"A kintone client for Clojure and ClojureScript","archived":false,"fork":false,"pushed_at":"2024-09-21T07:22:20.000Z","size":236,"stargazers_count":6,"open_issues_count":3,"forks_count":2,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-11-28T12:35:30.219Z","etag":null,"topics":["clojure","clojurescript","kintone","kintone-api"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toyokumo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-22T02:20:54.000Z","updated_at":"2024-07-16T08:46:59.000Z","dependencies_parsed_at":"2023-02-19T13:45:24.250Z","dependency_job_id":null,"html_url":"https://github.com/toyokumo/kintone-client","commit_stats":null,"previous_names":["toyokumo/kintone-clj"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toyokumo%2Fkintone-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toyokumo%2Fkintone-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toyokumo%2Fkintone-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toyokumo%2Fkintone-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toyokumo","download_url":"https://codeload.github.com/toyokumo/kintone-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227476038,"owners_count":17779417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","clojurescript","kintone","kintone-api"],"created_at":"2024-12-01T03:11:14.780Z","updated_at":"2025-12-12T01:18:24.891Z","avatar_url":"https://github.com/toyokumo.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kintone-client\n\nA [kintone](https://www.kintone.com) client for Clojure and ClojureScript.\n\n[![CircleCI](https://circleci.com/gh/toyokumo/kintone-client.svg?style=svg)](https://circleci.com/gh/toyokumo/kintone-client)\n[![cljdoc badge](https://cljdoc.org/badge/toyokumo/kintone-client)](https://cljdoc.org/d/toyokumo/kintone-client/CURRENT)\n[![Clojars Project](https://img.shields.io/clojars/v/toyokumo/kintone-client.svg)](https://clojars.org/toyokumo/kintone-client)\n\n## Overview\n\nThe SDK provides an easy way to use kintone API from Clojure or ClojureScript.\n\nEvery API run asynchronously to use [clj-http](https://github.com/dakrone/clj-http) for Clojure\n, [cljs-ajax](https://github.com/JulianBirch/cljs-ajax) for ClojureScript and\n[core.async](https://github.com/clojure/core.async).\nThey return a channel of core.async.\n\n- `kintone-client.authentication` : Make Auth object.\n- `kintone-client.connection` : Make connection object.\n- `kintone-client.types` : Type definitions such as response object.\n- `kintone-client.record` : kintone REST Record API.\n- `kintone-client.app` : kintone REST App API.\n- `kintone-client.user`: cybozu.com User API. (API Tokens cannot be used with user API.)\n- `kintone-client.url`: kintone url utilities.\n\n## Usage\n\nFollow bellow the steps.\n\n1. Make `Auth` object\n1. Make `Connection` object\n1. Call API with `Connection` object\n\n### Make `Auth` object\n\n`Auth` object is used in order to make `Connection` object.\n\nThis step is not necessary in case that you run JavaScript(ClojureScript)\non kintone as customize script for kintone app or portal.\n\n```clojure\n(require '[kintone-client.authentication :as auth])\n\n;; API token\n(auth/new-auth {:api-token \"xyz...\"})\n\n;; Basic authentication and password authentication\n(auth/new-auth {:basic {:username \"basic-username\" :password \"basic-password\"}\n                :password {:username \"login-name\" :password \"login-password\"}})\n\n;; Basic authentication, password authentication and API token\n;; In this case, the API token is going to be ignored,\n;; and the basic authentication and the password authentication is going to be used.\n(auth/new-auth {:basic {:username \"basic-username\" :password \"basic-password\"}\n                :password {:username \"login-name\" :password \"login-password\"}\n                :api-token \"xyz...\"})\n```\n\n### Make `Connection` object\n\n```clojure\n(require '[kintone-client.authentication :as auth])\n(require '[kintone-client.connection :as conn])\n\n;; Auth and domain\n(conn/new-connection {:auth (auth/new-auth {:api-token \"xyz..\"})\n                      :domain \"sample.kintone.com\"})\n\n;; To guest space\n(conn/new-connection {:auth (auth/new-auth {:api-token \"xyz..\"})\n                      :domain \"sample.kintone.com\"\n                      :guest-space-id 1})\n\n;; It is only accepted on ClojureScript that there is no auth.\n(conn/new-connection {:domain \"sample.cybozu.com\"})\n```\n\n### Call API\n\nYou should use `Connection` object as the first argument on every API call.\n\n```clojure\n(require '[kintone-client.authentication :as auth])\n(require '[kintone-client.connection :as conn])\n(require '[kintone-client.record :as record])\n\n;; Clojure\n(require '[clojure.core.async :refer [\u003c!!]])\n\n(def conn (conn/new-connection {:auth (auth/new-auth {:api-token \"xyz..\"})\n                                :domain \"sample.kintone.com\"}))\n\n(let [app 1111\n      id 1\n      ;; Block the thread and get response\n      res (\u003c!! (record/get-record conn app id))]\n  ;; Every API response is kintone-client.types/KintoneResonse\n  (if (:err res)\n    (log/error \"Something bad happen\")\n    (:res res)))\n;; success =\u003e {:record {:$id {:type \"__ID__\", :value \"1\"} ...}\n;; fail =\u003e {:status 404\n;;          :status-text \"Not Found\"\n;;          :failure :error\n;;          :response {:code \"GAIA_RE01\" ...}}\n\n\n;; ClojureScript\n(require '[cljs.core.async :refer [\u003c!] :refer-macros [go]])\n\n;; If you do not pass the domain string, (.-hostname js/location) will be used.\n(def conn (conn/new-connection {:auth (auth/new-auth {:api-token \"xyz..\"})}))\n\n;; Call in go block to handle response\n(go\n  (let [app 1111\n        id 1\n        res (\u003c! (record/get-record conn app id))]\n    (if (:err res)\n      (:err res)\n      (:res res))))\n```\n\n### bulk request\nYou can do insert, update, delete at once with `bulk-request`.\n`bulk-request` can be performed among different apps.\n```clojure\n(\u003c!! (r/bulk-request conn\n                     [ ;; NOTE: conn is omitted here.\n                      (r/add-record app {:name {:value \"foo\"}})\n                      (r/update-record app\n                                       {:id id\n                                        :record {:name {:value \"foo\"}}})\n                      (r/delete-records app [1 2 3])]))\n```\n`bulk-request` can be used with:\n- add-record\n- add-records\n- update-record\n- update-records\n- delete-records\n- delete-records-with-revision\n- update-record-status\n- update-records-status\n\n### url utilities\n```clojure\n(extract-base-url \"https://hoge.cybozu.com/k/12\")\n;; =\u003e \"https://hoge.cybozu.com\"\n(parse-base-url \"https://hoge.kintone.com/k/12\")\n;; =\u003e {:domain \"kintone.com\", :subdomain \"hoge\"}\n(valid-base-url? \"https://hoge.cybozu.com/k/12\")\n;; =\u003e true\n(extract-app-url \"https://hoge.cybozu.com/k/12/show\")\n;; =\u003e \"https://hoge.cybozu.com/k/12\"\n(parse-app-url \"https://foo.s.cybozu.com/k/guest/11/1\")\n;; =\u003e {:domain \"cybozu.com\", :subdomain \"foo\", :guest-space-id \"11\", :app-id \"1\"}\n(valid-app-url? \"https://hoge.cybozu.com\")\n;; =\u003e true\n```\n\nFor more information, See [API documents](https://cljdoc.org/d/toyokumo/kintone-client/CURRENT), `test/`, and `dev/test.clj`.\n\n## dev/test.clj\nThese tests actually interact with a kintone app and space (not included in CI).\nThese are good examples of the usage of kintone-client.\n\n### How to run\n- import dev-resources/kintone-clj-test.zip\n- create kintone space (the tests create many apps in this space)\n- fill dev-resources/config.edn\n```edn\n{:auth {:basic {:username \"username\" :password \"password\"}\n        :api-token \"api-token\"}\n :domain \"domain\"\n :app 9999\n :space 99}\n```\n- try tests\n\n## Note\n- kintone-client doesn't convert a camelCase keyword (in kintone REST api response map) into kebab-case.\nIt costs too much to do so (response map can be so complicated, and keyword can be non-ascii character).\n\n## License\n\n```\nCopyright 2019 TOYOKUMO,Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\nFor src/kintone_client/url.cljc and test/kintone_client/url_test.cljc:\n\n```\nMIT License\n\nCopyright (c) 2017 ayato-p\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoyokumo%2Fkintone-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoyokumo%2Fkintone-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoyokumo%2Fkintone-client/lists"}