Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active February 3, 2026 20:19
Show Gist options
  • Select an option

  • Save dacr/5de34df6e63f0ec797ead103603aa278 to your computer and use it in GitHub Desktop.

Select an option

Save dacr/5de34df6e63f0ec797ead103603aa278 to your computer and use it in GitHub Desktop.
List a user github gists using sttp for client http and json4s for json processing. / published by https://github.com/dacr/code-examples-manager #a3d60a09-897a-450c-a1d5-e73e5bc4ded1/c7518480630c1e845bfcb16a5365ab15a86255a9
// summary : List a user github gists using sttp for client http and json4s for json processing.
// keywords : scala, sttp, json4s, json, gists-api
// publish : gist
// authors : David Crosson
// license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
// id : a3d60a09-897a-450c-a1d5-e73e5bc4ded1
// created-on : 2019-05-19T16:59:54Z
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
//> using scala 2.12.20
//> using dep com.softwaremill.sttp::core:1.5.17
//> using dep com.softwaremill.sttp::json4s:1.5.17
//> using dep org.json4s::json4s-native:3.6.5
import com.softwaremill.sttp.quick._
import com.softwaremill.sttp.json4s._
case class Gist(
id:String,
description:String,
html_url:String,
)
implicit val serialization = org.json4s.native.Serialization
implicit val formats = org.json4s.DefaultFormats
val gists =sttp.get(uri"https://api.github.com/users/dacr/gists").response(asJson[Array[Gist]]).send()
gists.body.right.get.foreach{ println }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment