Skip to content

Commit

Permalink
fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Apr 3, 2024
1 parent 6caa77a commit a3b6d3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions packages/platform-bun/examples/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const makeTodoService = Effect.gen(function*(_) {
Http.client.filterStatusOk,
Http.client.mapRequest(Http.request.prependUrl("https://jsonplaceholder.typicode.com"))
)
const decodeTodo = Http.response.schemaBodyJsonEffect(Todo)

const addTodoWithoutIdBody = Http.request.schemaBody(TodoWithoutId)
const create = (todo: TodoWithoutId) =>
Expand All @@ -36,7 +35,7 @@ const makeTodoService = Effect.gen(function*(_) {
todo
).pipe(
Effect.flatMap(clientWithBaseUrl),
decodeTodo
Http.response.schemaBodyJsonScoped(Todo)
)

return TodoService.of({ create })
Expand Down
7 changes: 4 additions & 3 deletions packages/platform-node/examples/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class Todo extends Schema.Class<Todo>("Todo")({
id: Schema.number,
title: Schema.string,
completed: Schema.boolean
}) {}
}) {
static decodeResponse = Http.response.schemaBodyJsonScoped(Todo)
}

const TodoWithoutId = Schema.struct(Todo.fields).pipe(Schema.omit("id"))
type TodoWithoutId = Schema.Schema.Type<typeof TodoWithoutId>
Expand All @@ -29,7 +31,6 @@ const makeTodoService = Effect.gen(function*(_) {
Http.client.filterStatusOk,
Http.client.mapRequest(Http.request.prependUrl("https://jsonplaceholder.typicode.com"))
)
const decodeTodo = Http.response.schemaBodyJsonEffect(Todo)

const addTodoWithoutIdBody = Http.request.schemaBody(TodoWithoutId)
const create = (todo: TodoWithoutId) =>
Expand All @@ -38,7 +39,7 @@ const makeTodoService = Effect.gen(function*(_) {
todo
).pipe(
Effect.flatMap(clientWithBaseUrl),
decodeTodo
Todo.decodeResponse
)

return TodoService.of({ create })
Expand Down

0 comments on commit a3b6d3d

Please sign in to comment.