Skip to content

Commit

Permalink
Release 1.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfrog26 committed Jun 28, 2023
1 parent f37ce72 commit d27e16e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# sendgrid4s

[![CI](https://github.com/outr/sendgrid4s/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/outr/sendgrid4s/actions/workflows/ci.yml)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.outr/sendgrid4s_3.3.0/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.outr/sendgrid4s_3.3.0)
[![Latest version](https://index.scala-lang.org/outr/sendgrid4s/sendgrid4s/latest.svg)](https://index.scala-lang.org/outr/sendgrid4s)
[![Javadocs](https://javadoc.io/badge/com.outr/sendgrid4s_3.3.0.svg)](https://javadoc.io/doc/com.outr/sendgrid4s_3.3.0)
[![javadoc](https://javadoc.io/badge2/com.outr/sendgrid4s_3/javadoc.svg)](https://javadoc.io/doc/com.outr/sendgrid4s_3)

Simple asynchronous, non-blocking client implementation of Sendgrid.

### Dependency Configuration

```scala
libraryDependencies += "com.outr" %% "sendgrid4s" % "1.0.9"
libraryDependencies += "com.outr" %% "sendgrid4s" % "1.0.12"
```
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ val scala213 = "2.13.11"

name := "sendgrid4s"
organization := "com.outr"
version := "1.0.11"
version := "1.0.12"

scalaVersion := scala213
crossScalaVersions := List(scala3, scala213)
Expand Down Expand Up @@ -35,5 +35,5 @@ outputStrategy := Some(StdoutOutput)
fork := true

libraryDependencies ++= Seq(
"com.outr" %% "spice-client-okhttp" % "0.0.36"
"com.outr" %% "spice-client" % "0.1.0"
)
14 changes: 5 additions & 9 deletions src/main/scala/sendgrid/Sendgrid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,11 @@ case class Sendgrid(apiKey: String) {
.post
.json(message.json.filterOne(RemoveEmptyFilter))
.send()
.map { response =>
response.content.map { c =>
val s = c.asString
if (s == null || s.isEmpty) {
obj()
} else {
JsonParser(s)
}
}.getOrElse(obj())
.flatMap { response =>
response.content match {
case Some(c) => c.asString.map(s => JsonParser(s))
case None => IO.pure(obj())
}
}
.map { json =>
json.get("errors" \ 0 \ "message").map(_.asString)
Expand Down

0 comments on commit d27e16e

Please sign in to comment.