All Projects → softwaremill → sttp-model

softwaremill / sttp-model

Licence: Apache-2.0 license
Simple Scala HTTP model

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to sttp-model

factoria
Simplistic model factory for Node/JavaScript
Stars: ✭ 49 (+63.33%)
Mutual labels:  model
TorXakis
A tool for Model Based Testing
Stars: ✭ 40 (+33.33%)
Mutual labels:  model
Blender-Tools-for-DSCS
This repository provides a work-in-progress addon for Blender 2.8 that can (to some degree) import model files from the PC version of Digimon Story: Cyber Sleuth. It provides new options in File > Import and File > Export named "DSCS Model", which should be pointed towards 'name' files in the game data. The file format is mostly understood; but …
Stars: ✭ 18 (-40%)
Mutual labels:  model
MVVM-Design-Pattern-Demo
An Xcode 9 project written in Swift 4 code designed using the MVVM design pattern, truly extolling the virtues of MVVM over MVC.
Stars: ✭ 31 (+3.33%)
Mutual labels:  model
shyft
⬡ Shyft is a server-side framework for building powerful GraphQL APIs 🚀
Stars: ✭ 56 (+86.67%)
Mutual labels:  model
Quadcopter SimCon
Quadcopter Simulation and Control. Dynamics generated with PyDy.
Stars: ✭ 84 (+180%)
Mutual labels:  model
sttp-openapi-generator
Generate sttp client from openapi specification with ease!
Stars: ✭ 26 (-13.33%)
Mutual labels:  sttp
BMExport
一个 JSON 转 Objective-C,Swift class, Swift struct Model 属性的 Mac 小工具,【点击直接下载 https://github.com/liangdahong/BMExport/releases/download/2.0/BMExport2.0.dmg 】。
Stars: ✭ 22 (-26.67%)
Mutual labels:  model
godmt
Tool that can parse Go files into an abstract syntax tree and translate it to several programming languages.
Stars: ✭ 42 (+40%)
Mutual labels:  model
django-serializable-model
Django classes to make your models, managers, and querysets serializable, with built-in support for related objects in ~150 LoC
Stars: ✭ 15 (-50%)
Mutual labels:  model
PRISM
An alternative to MCMC for rapid analysis of models
Stars: ✭ 40 (+33.33%)
Mutual labels:  model
grafikon
Timetables for model railway. Useful for meets with modules (like FREMO, Free-mo etc).
Stars: ✭ 19 (-36.67%)
Mutual labels:  model
backscatter
Reactive extension for Backbone
Stars: ✭ 17 (-43.33%)
Mutual labels:  model
go-topics
Latent Dirichlet Allocation
Stars: ✭ 23 (-23.33%)
Mutual labels:  model
compose plantuml
Generate Plantuml graphs from docker-compose files
Stars: ✭ 77 (+156.67%)
Mutual labels:  model
covid19 scenarios data
Data preprocessing scripts and preprocessed data storage for COVID-19 Scenarios project
Stars: ✭ 43 (+43.33%)
Mutual labels:  model
db-safedelete
Attempts to invoke force delete, if it fails - falls back to soft delete
Stars: ✭ 16 (-46.67%)
Mutual labels:  model
FireSnapshot
A useful Firebase-Cloud-Firestore Wrapper with Codable.
Stars: ✭ 56 (+86.67%)
Mutual labels:  model
mutable
State containers with dirty checking and more
Stars: ✭ 32 (+6.67%)
Mutual labels:  model
ldview
Real-time 3D viewer for displaying LDraw models
Stars: ✭ 65 (+116.67%)
Mutual labels:  model

sttp-model

Join the chat at https://gitter.im/softwaremill/sttp CI Maven Central

Open in Gitpod

sttp is a family of Scala HTTP-related projects, and currently includes:

  • sttp client: The Scala HTTP client you always wanted!
  • sttp tapir: Typed API descRiptions
  • sttp model: this project. Simple Scala HTTP model. Used by sttp client & sttp tapir

Quickstart with sbt

Add the following dependency:

"com.softwaremill.sttp.model" %% "core" % "1.5.0"

sttp model is available for Scala 2.11, 2.12, 2.13, 3.0.0, Scala.JS and Scala Native.

Project content

Available model classes include:

  • Uri
  • Method
  • StatusCode
  • MediaType
  • Header
  • HeaderNames
  • QueryParams
  • body fragments:
    • Part
    • ServerSentEvent
  • header values:
    • Accepts
    • Accept-Encoding
    • CacheDirective
    • Cookie
    • ETag
    • Range
    • ContentRange
    • WWWAuthenticateChallenge

Most classes contain both serialisation & parsing functionality, following these conventions:

  • .toString returns a representation of the model class in a format as in an HTTP request/response. For example, for an uri this will be http://..., for a header [name]: [value], etc.
  • [SthCompanionObject].parse(serialized: String): Either[String, Sth]: returns an error message, or an instance of the model class
  • [SthCompanionObject].unsafeApply(values): creates an instance of the model class; validates the input values and in case of an error, throws an exception. An error could be e.g. that the input values contain characters outside the allowed range
  • [SthCompanionObject].safeApply(...): Either[String, Sth]: same as above, but doesn't throw exceptions. Instead, returns an error message, or the model class instance
  • [SthCompanionObject].apply(...): Sth: creates the model type, without validation, and without throwing exceptions

Documentation

Javadocs

The docs for sttp client contain documentation for the model classes: overview, uri interpolator.

Contributing

If you have a question, or hit a problem, feel free to ask on our gitter channel!

Or, if you encounter a bug, something is unclear in the code or documentation, don’t hesitate and open an issue on GitHub.

Building & testing the scala-native version

By 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.:

STTP_NATIVE=1 sbt

You might need to install some additional libraries, see the scala native documentation site.

Commercial Support

We offer commercial support for sttp and related technologies, as well as development services. Contact us to learn more about our offer!

Copyright

Copyright (C) 2019-2021 SoftwareMill https://softwaremill.com.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].