From d27e16e8b24e92bbd9809528874115f28bdcca3e Mon Sep 17 00:00:00 2001 From: Matt Hicks Date: Wed, 28 Jun 2023 08:18:01 -0500 Subject: [PATCH] Release 1.0.12 --- README.md | 5 ++--- build.sbt | 4 ++-- src/main/scala/sendgrid/Sendgrid.scala | 14 +++++--------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index d8143ea..f81c751 100644 --- a/README.md +++ b/README.md @@ -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" ``` \ No newline at end of file diff --git a/build.sbt b/build.sbt index 9d3c6de..27dae01 100644 --- a/build.sbt +++ b/build.sbt @@ -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) @@ -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" ) \ No newline at end of file diff --git a/src/main/scala/sendgrid/Sendgrid.scala b/src/main/scala/sendgrid/Sendgrid.scala index 95c862f..073e140 100644 --- a/src/main/scala/sendgrid/Sendgrid.scala +++ b/src/main/scala/sendgrid/Sendgrid.scala @@ -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)