{"id":20768155,"url":"https://github.com/softwaremill/sttp-model","last_synced_at":"2025-04-10T18:33:25.188Z","repository":{"id":38049687,"uuid":"210826009","full_name":"softwaremill/sttp-model","owner":"softwaremill","description":"Simple Scala HTTP model","archived":false,"fork":false,"pushed_at":"2024-05-22T11:58:32.000Z","size":1209,"stargazers_count":43,"open_issues_count":8,"forks_count":27,"subscribers_count":28,"default_branch":"master","last_synced_at":"2024-05-22T12:56:27.022Z","etag":null,"topics":["http","model","scala","sttp"],"latest_commit_sha":null,"homepage":"https://softwaremill.com/open-source","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/softwaremill.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":"2019-09-25T11:16:02.000Z","updated_at":"2024-05-30T02:34:59.574Z","dependencies_parsed_at":"2023-12-21T19:14:36.760Z","dependency_job_id":"edd71f93-ad3d-4364-b73e-66307d8f04f1","html_url":"https://github.com/softwaremill/sttp-model","commit_stats":null,"previous_names":[],"tags_count":85,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fsttp-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fsttp-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fsttp-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fsttp-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softwaremill","download_url":"https://codeload.github.com/softwaremill/sttp-model/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226172001,"owners_count":17584909,"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":["http","model","scala","sttp"],"created_at":"2024-11-17T11:35:57.845Z","updated_at":"2025-04-10T18:33:25.181Z","avatar_url":"https://github.com/softwaremill.png","language":"Scala","readme":"![sttp-model](https://github.com/softwaremill/sttp-model/raw/master/banner.png)\n\n[![Ideas, suggestions, problems, questions](https://img.shields.io/badge/Discourse-ask%20question-blue)](https://softwaremill.community/c/sttp-client)\n[![CI](https://github.com/softwaremill/sttp-model/workflows/CI/badge.svg)](https://github.com/softwaremill/sttp-model/actions?query=workflow%3ACI+branch%3Amaster)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.softwaremill.sttp.model/core_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.softwaremill.sttp.model/core_2.13)\n\nsttp is a family of Scala HTTP-related projects, and currently includes:\n\n* [sttp client](https://github.com/softwaremill/sttp): The Scala HTTP client you always wanted!\n* [sttp tapir](https://github.com/softwaremill/tapir): rapid development of self-documenting APIs\n* sttp model: this project; simple HTTP model classes (used by client \u0026 tapir)\n* [sttp shared](https://github.com/softwaremill/sttp-shared): shared web socket, FP abstractions, capabilities and streaming code.\n* [sttp apispec](https://github.com/softwaremill/sttp-apispec): OpenAPI, AsyncAPI and JSON Schema models.\n* [sttp openai](https://github.com/softwaremill/sttp-openai): Scala client wrapper for OpenAI and OpenAI-compatible APIs. Use the power of ChatGPT inside your code!\n\n## Quickstart with sbt\n\nAdd the following dependency:\n\n```scala\n\"com.softwaremill.sttp.model\" %% \"core\" % \"1.7.13\"\n```\n\nsttp model is available for 2.12, 2.13, 3, Scala.JS and Scala Native.\n\n## Project content\n\nAvailable model classes include:\n\n* `Uri`\n* `Method`\n* `StatusCode`\n* `MediaType`\n* `Header`\n* `HeaderNames`\n* `QueryParams`\n* body fragments:  \n   * `Part`\n   * `ServerSentEvent`  \n* header values:\n   * `Accepts`\n   * `Accept-Encoding`\n   * `CacheDirective`\n   * `Cookie`\n   * `ETag`\n   * `Range`\n   * `ContentRange`\n   * `WWWAuthenticateChallenge`\n   * `Forwarded`\n\nMost classes contain both serialisation \u0026 parsing functionality, following these conventions:\n\n* `.toString` returns a representation of the model class in a format as in an HTTP request/response. For example,\n  for an uri this will be `http://...`, for a header `[name]: [value]`, etc.\n* `[SthCompanionObject].parse(serialized: String): Either[String, Sth]`: returns an error message, or an instance of\n  the model class\n* `[SthCompanionObject].unsafeApply(values)`: creates an instance of the model class; validates the input values and in \n  case of an error, *throws an exception*. An error could be e.g. that the input values contain characters outside\n  the allowed range\n* `[SthCompanionObject].safeApply(...): Either[String, Sth]`: same as above, but doesn't throw exceptions. Instead,\n  returns an error message, or the model class instance\n* `[SthCompanionObject].apply(...): Sth`: creates the model type, without validation, and without throwing\n  exceptions \n\n## Documentation\n\n[Javadocs](https://www.javadoc.io/doc/com.softwaremill.sttp.model/core_2.12/latest/sttp/model/index.html)\n\nThe docs for sttp client contain documentation for the model classes: [overview](https://sttp.softwaremill.com/en/latest/model/model.html),\n[uri interpolator](https://sttp.softwaremill.com/en/latest/model/uri.html).\n\n## Contributing\n\nIf you have a question, or hit a problem, feel free to ask on our [discourse forum](https://softwaremill.community/c/sttp-client)!\n\nOr, if you encounter a bug, something is unclear in the code or documentation, don’t hesitate and open an issue on GitHub.\n\n### Testing Scala.js\n\nScala.js tests require [chromedriver](https://chromedriver.chromium.org/). It is downloaded automatically\nby the `test` task. Make sure to run it before running tests in any other way, e.g. using `testOnly`.\n\n### Building \u0026 testing the scala-native version\n\nBy default, sttp-native will **not** be included in the aggregate build of the root project. To include it, define the `STTP_NATIVE` environmental variable before running sbt, e.g.:\n\n```\nSTTP_NATIVE=1 sbt\n```\n\nYou might need to install some additional libraries, see the [scala native](http://www.scala-native.org/en/latest/user/setup.html) documentation site.\n\n## FAQ: Encoding \u0026 decoding URI components\n\nSee [sttp client `Uri` docs](https://sttp.softwaremill.com/en/latest/model/uri.html#faq-encoding-decoding-uri-components)\n\n## Commercial Support\n\nWe offer commercial support for sttp and related technologies, as well as development services. [Contact us](https://softwaremill.com) to learn more about our offer!\n\n## Copyright\n\nCopyright (C) 2019-2025 SoftwareMill [https://softwaremill.com](https://softwaremill.com).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwaremill%2Fsttp-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftwaremill%2Fsttp-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwaremill%2Fsttp-model/lists"}