Coder Social home page Coder Social logo

hammock's Introduction

Hammock

Typelevel incubator Join the chat at https://gitter.im/pepegar/hammock Build Status codecov Maven Central

Hammock is yet another HTTP client for Scala. It tries to be typeful, purely functional, and work along other technologies that you're already using such as akka-http, circe, or cats.

Installation

Add the following to your build.sbt.

// For Scala 2.10, 2.11, or 2.12
libraryDependencies ++= Seq(
  "com.pepegar" %% "hammock-core" % "0.10.0",
  
  // Hammock for standard Scala doesn't ship with a standard implementation
  "com.pepegar" %% "hammock-apache-http" % "0.10.0"
)

// For ScalaJS
libraryDependencies += "com.pepegar" %%% "hammock-core" % "0.10.0"

Rationale

  1. It's easy to use, has a high level API
  2. It's typeful, tries to represent effects at type level.
  3. It does not force a specific target context. You can run your computations in any type F[_] that has an instance of cats-effect's Sync[F].
  4. It has good documentation.
  5. It's modular

Modules

Module name Description Version
hammock-core the core functionality of hammock, using XHR in JS 0.10.0
hammock-circe encode and decode HTTP entities with Circe 0.10.0
hammock-apache-http run your HTTP requests with Apache HTTP commons 0.10.0
hammock-akka-http run your HTTP requests with akka-http 0.10.0
hammock-asynchttpclient run your HTTP requests with AsyncHttpClient 0.10.0

How does Hammock look in action?

import cats.effect.IO
import hammock._
import hammock.marshalling._
import hammock.apache.ApacheInterpreter
import hammock.circe.implicits._

object HttpClient {
  // Using the Apache HTTP commons interpreter
  implicit val interpreter = ApacheInterpreter.instance[IO]

  val response = Hammock
    .request(Method.GET, uri"https://api.fidesmo.com/apps", Map()) // In the `request` method, you describe your HTTP request
    .as[List[String]]
    .exec[IO]
}

Code of conduct

People are expected to follow the Typelevel Code of Conduct when discussing Hammock on the Github page, Gitter channel, or other venues.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.