Skip to content

Instantly share code, notes, and snippets.

@cloudmark
cloudmark / ziopoc.scala
Last active July 12, 2019 00:46
ZIO POC
package com.acme.poc
import zio.{Ref, Runtime, UIO, ZIO}
import cats.implicits._
import zio.internal.PlatformLive
import com.acme.poc.App.InteractionLog._
import scala.util.Try
export class HttpService {
constructor(private http: Http) {}
public getSingle<T>(clazz: { new(): T }, url: string, headers?: {}): Promise<T> {
return new Promise((resolve, reject) => {
this.http.get(url, this.getHeaders(headers)).toPromise().then((response: any) => {
let body = response.json();
if (body) {
resolve(MapUtils.deserialize(clazz, body));
} else {