{"id":19466932,"url":"https://github.com/scommons/scommons-api","last_synced_at":"2025-02-25T13:48:07.244Z","repository":{"id":35664451,"uuid":"130809499","full_name":"scommons/scommons-api","owner":"scommons","description":"Common REST API Scala/Scala.js components","archived":false,"fork":false,"pushed_at":"2024-03-09T14:25:41.000Z","size":140,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-08T04:14:31.781Z","etag":null,"topics":["ajax-request","api","api-client","api-interface","api-rest","apis","http","joda-time","rest","rest-api","rest-client","scala","scala-js","scalajs"],"latest_commit_sha":null,"homepage":"https://scommons.github.io/scommons-api","language":"Scala","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/scommons.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-24T06:51:28.000Z","updated_at":"2024-03-09T13:01:55.000Z","dependencies_parsed_at":"2024-11-10T18:33:16.062Z","dependency_job_id":null,"html_url":"https://github.com/scommons/scommons-api","commit_stats":{"total_commits":48,"total_committers":1,"mean_commits":48.0,"dds":0.0,"last_synced_commit":"f99672c7620ab2d6df1317d3e9f7b24f24b0694c"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scommons%2Fscommons-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scommons%2Fscommons-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scommons%2Fscommons-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scommons%2Fscommons-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scommons","download_url":"https://codeload.github.com/scommons/scommons-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240680800,"owners_count":19840314,"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":["ajax-request","api","api-client","api-interface","api-rest","apis","http","joda-time","rest","rest-api","rest-client","scala","scala-js","scalajs"],"created_at":"2024-11-10T18:31:47.989Z","updated_at":"2025-02-25T13:48:07.207Z","avatar_url":"https://github.com/scommons.png","language":"Scala","readme":"\n[![CI](https://github.com/scommons/scommons-api/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/scommons/scommons-api/actions/workflows/ci.yml?query=workflow%3Aci+branch%3Amaster)\n[![Coverage Status](https://coveralls.io/repos/github/scommons/scommons-api/badge.svg?branch=master)](https://coveralls.io/github/scommons/scommons-api?branch=master)\n[![scala-index](https://index.scala-lang.org/scommons/scommons-api/scommons-api-core/latest.svg)](https://index.scala-lang.org/scommons/scommons-api/scommons-api-core)\n[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-1.8.0.svg)](https://www.scala-js.org)\n\n## scommons-api\nCommon REST API Scala/Scala.js components\n\n### How to add it to your project\n\n```scala\nval scommonsApiVer = \"1.0.0-SNAPSHOT\"\n\nlibraryDependencies ++= Seq(\n  // shared\n  \"org.scommons.api\" %%% \"scommons-api-core\" % scommonsApiVer,\n  \"org.scommons.api\" %%% \"scommons-api-joda-time\" % scommonsApiVer,\n\n  // client/js only\n  \"org.scommons.api\" %%% \"scommons-api-xhr\" % scommonsApiVer,\n  \n  // server/jvm only\n  \"org.scommons.api\" %% \"scommons-api-play-ws\" % scommonsApiVer\n)\n```\n\nLatest `SNAPSHOT` version is published to [Sonatype Repo](https://oss.sonatype.org/content/repositories/snapshots/org/scommons/), just make sure you added\nthe proper dependency resolver to your `build.sbt` settings:\n```scala\nresolvers += \"Sonatype Snapshots\" at \"https://oss.sonatype.org/content/repositories/snapshots/\"\n```\n\n### How to use it\n\n#### Joda Date/Time\n\nYou can use in your shared API data case classes date/time types from\nthe [joda](https://www.joda.org/joda-time/) library:\n```scala\nimport org.joda.time._\nimport play.api.libs.json._\n\ncase class User(firstName: String,\n                lastName: String,\n                registeredAt: DateTime,\n                birthDate: LocalDate,\n                birthTime: LocalTime)\n\nobject User {\n  // you only need to provide appropriate implicits:\n  import scommons.api.jodatime.JodaTimeImplicits.{dateTimeReads =\u003e dtReads, dateTimeWrites =\u003e dtWrites}\n  import scommons.api.jodatime.JodaTimeImplicits.{dateReads =\u003e dReads, dateWrites =\u003e dWrites}\n  import scommons.api.jodatime.JodaTimeImplicits.{timeReads =\u003e tReads, timeWrites =\u003e tWrites}\n\n  implicit val jsonFormat: Format[User] = Json.format[User]\n}\n```\n\nFor `JS` part the following types are defined as wrappers around\nthe corresponding `ISO time formatted string`\nand do not contain any logic:\n- [DateTime](joda-time/js/src/main/scala/org/joda/time/DateTime.scala) =\u003e [tests](joda-time/js/src/test/scala/org/joda/time/DateTimeSpec.scala)\n- [LocalDate](joda-time/js/src/main/scala/org/joda/time/LocalDate.scala) =\u003e [tests](joda-time/js/src/test/scala/org/joda/time/LocalDateSpec.scala)\n- [LocalTime](joda-time/js/src/main/scala/org/joda/time/LocalTime.scala) =\u003e [tests](joda-time/js/src/test/scala/org/joda/time/LocalTimeSpec.scala)\n\nOnce you receive from an API on `JS` side an object that uses them\nyou can use `toString` method to get an `ISO time formatted string`\nand pass it to your favorite `JS time library` to parse it.\n\nFor example, you could use standard [JS Date](https://www.w3schools.com/jS/js_date_methods.asp)\nclass to parse it:\n```scala\nimport scala.scalajs.js\n\nnew js.Date(user.registeredAt.toString).getDate\n```\n\n### How to Build\n\nTo build and run all the tests use the following command:\n```bash\nsbt test\n```\n\n## Documentation\n\nYou can find more documentation [here](https://scommons.github.io/scommons-api)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscommons%2Fscommons-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscommons%2Fscommons-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscommons%2Fscommons-api/lists"}