This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def getBlocks: Route = (get & paging & sorting(sortByFieldMappings, Some("height")) & startEndDate) { | |
| (o, l, field, so, start, end) => | |
| val sTs = start.getOrElse(0L) | |
| val eTs = end.getOrElse(System.currentTimeMillis() + oneDayMillis) | |
| val p = Paging(offset = o, limit = l) | |
| val s = Sorting(sortBy = field, order = so) | |
| val items = bs.getBlocks(p, s, sTs, eTs) | |
| val count = bs.count(sTs, eTs) | |
| val itemsResponse = (items, count).parMapN(ItemsResponse.apply) | |
| itemsResponse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.daron.html | |
| import cats.syntax.either._ | |
| import cats.syntax.flatMap._ | |
| import cats.syntax.functor._ | |
| import com.softwaremill.sttp.{SttpBackend, _} | |
| import io.chrisdavenport.log4cats.Logger | |
| trait HttpClient[F[_]] { | |
| def getPageSource(uri: java.net.URI): F[String] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private def buildTelegramClient[F[_]: Execute: ConcurrentEffect](isProd: Boolean, token: String): Resource[F, TelegramClient[F]] = | |
| buildHttp4sClient.map { httpsClient => | |
| TelegramClient.fromHttp4sClient[F](token)( | |
| if (isProd) httpsClient | |
| else ResponseLogger(true, true)(httpsClient) | |
| ) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Loggers { | |
| final val Welcome = "welcome" | |
| final val Messages = "messages" | |
| final val Users = "messages" | |
| type MessagesLogging[F[_]] = Logging[F] @Id(Welcome) | |
| type UsersLogging[F[_]] = Logging[F] @Id(Users) | |
| type WelcomeLogging[F[_]] = Logging[F] @Id(Messages) |
OlderNewer