/** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.0.1-dev * User agent: apibuilder app.apibuilder.io/nicolai-moraru/joglog-api/0.0.1-dev/http4s_0_22 */ package nm.joglog.api.v0.mock { class Client[F[_]: cats.Applicative] extends nm.joglog.api.v0.interfaces.Client[F] { val baseUrl: org.http4s.Uri = org.http4s.Uri.unsafeFromString("http://mock.localhost") override def times: nm.joglog.api.v0.Times[F] = new MockTimes[F] override def users: nm.joglog.api.v0.Users[F] = new MockUsers[F] } class MockTimes[F[_]: cats.Applicative] extends nm.joglog.api.v0.Times[F] { /** * Create a time entry */ def post( minimal: .models.Minimal, requestHeaders: Seq[(String, String)] = Nil ): F[nm.joglog.api.v0.models.Time] = cats.Applicative[F].pure { nm.joglog.api.v0.mock.Factories.makeTime() } /** * List all times */ def get( requestHeaders: Seq[(String, String)] = Nil ): F[Seq[nm.joglog.api.v0.models.Time]] = cats.Applicative[F].pure { Nil } /** * Get a specific time entry * * @param id Time entry ID */ def getById( id: Int, requestHeaders: Seq[(String, String)] = Nil ): F[nm.joglog.api.v0.models.Time] = cats.Applicative[F].pure { nm.joglog.api.v0.mock.Factories.makeTime() } /** * Patch a time entry */ def patch( entries: Seq[time.models.Entry], requestHeaders: Seq[(String, String)] = Nil ): F[nm.joglog.api.v0.models.Time] = cats.Applicative[F].pure { nm.joglog.api.v0.mock.Factories.makeTime() } /** * Remove a specific time entry * * @param id Time ID */ def deleteById( id: Int, requestHeaders: Seq[(String, String)] = Nil ): F[nm.joglog.api.v0.models.Time] = cats.Applicative[F].pure { nm.joglog.api.v0.mock.Factories.makeTime() } } class MockUsers[F[_]: cats.Applicative] extends nm.joglog.api.v0.Users[F] { /** * Authentication */ def postAuthenticate( minimal: .models.Minimal, requestHeaders: Seq[(String, String)] = Nil ): F[String] = cats.Applicative[F].pure { Factories.randomString() } /** * Create a user */ def post( minimal: .models.Minimal, requestHeaders: Seq[(String, String)] = Nil ): F[nm.joglog.api.v0.models.User] = cats.Applicative[F].pure { nm.joglog.api.v0.mock.Factories.makeUser() } /** * List all users */ def get( requestHeaders: Seq[(String, String)] = Nil ): F[Seq[nm.joglog.api.v0.models.User]] = cats.Applicative[F].pure { Nil } /** * Get a specific user * * @param id User ID */ def getById( id: Int, requestHeaders: Seq[(String, String)] = Nil ): F[nm.joglog.api.v0.models.User] = cats.Applicative[F].pure { nm.joglog.api.v0.mock.Factories.makeUser() } /** * Patch a user */ def patch( entries: Seq[user.models.Entry], requestHeaders: Seq[(String, String)] = Nil ): F[nm.joglog.api.v0.models.User] = cats.Applicative[F].pure { nm.joglog.api.v0.mock.Factories.makeUser() } /** * Remove a specific user * * @param id User ID */ def deleteById( id: Int, requestHeaders: Seq[(String, String)] = Nil ): F[nm.joglog.api.v0.models.User] = cats.Applicative[F].pure { nm.joglog.api.v0.mock.Factories.makeUser() } } object Factories { def randomString(length: Int = 24): String = { _root_.scala.util.Random.alphanumeric.take(length).mkString } def makePatchOperation(): nm.joglog.api.v0.models.PatchOperation = nm.joglog.api.v0.models.PatchOperation.Test def makeStringOrInteger(): nm.joglog.api.v0.models.StringOrInteger = nm.joglog.api.v0.models.StringOrInteger.String def makeTimePatchPath(): nm.joglog.api.v0.models.TimePatchPath = nm.joglog.api.v0.models.TimePatchPath.Distance def makeUserPatchPath(): nm.joglog.api.v0.models.UserPatchPath = nm.joglog.api.v0.models.UserPatchPath.Username def makeUserRole(): nm.joglog.api.v0.models.UserRole = nm.joglog.api.v0.models.UserRole.User def makeTime(): nm.joglog.api.v0.models.Time = nm.joglog.api.v0.models.Time( id = 1, distance = 1, time = 1, createdAt = _root_.java.time.Instant.now, updatedAt = _root_.java.time.Instant.now ) def makeTimeMinimal(): nm.joglog.api.v0.models.TimeMinimal = nm.joglog.api.v0.models.TimeMinimal( distance = 1, time = 1 ) def makeTimePatchEntry(): nm.joglog.api.v0.models.TimePatchEntry = nm.joglog.api.v0.models.TimePatchEntry( op = .mock.Factories.makeOperation(), path = time.mock.Factories.makePath(), value = 1 ) def makeUser(): nm.joglog.api.v0.models.User = nm.joglog.api.v0.models.User( id = 1, username = Factories.randomString(24), role = .mock.Factories.makeRole(), createdAt = _root_.java.time.Instant.now, updatedAt = _root_.java.time.Instant.now ) def makeUserMinimal(): nm.joglog.api.v0.models.UserMinimal = nm.joglog.api.v0.models.UserMinimal( username = Factories.randomString(24), password = Factories.randomString(24) ) def makeUserPatchEntry(): nm.joglog.api.v0.models.UserPatchEntry = nm.joglog.api.v0.models.UserPatchEntry( op = .mock.Factories.makeOperation(), path = user.mock.Factories.makePath(), value = nm.joglog.api.v0.mock.Factories.makeStringOrInteger() ) } }