Request.variables.readJsonWithSchema
fx-fetch / Request / readJsonWithSchema
Variable: readJsonWithSchema()
Section titled “Variable: readJsonWithSchema()”
constreadJsonWithSchema: {<A,I,R>(self,schema):Effect<A,MalformedJsonError|ParseError,R>; <A,I,R>(self): (request) =>Effect<A,MalformedJsonError|ParseError,R>; }
Defined in: packages/fx-fetch/src/Request/readJsonWithSchema.ts:33
Reads a JSON request with the given schema.
Call Signature
Section titled “Call Signature”<
A,I,R>(self,schema):Effect<A,MalformedJsonError|ParseError,R>
Reads a JSON request with the given schema.
Type Parameters
Section titled “Type Parameters”A
I
R
Parameters
Section titled “Parameters”schema
Section titled “schema”Schema<A, I, R>
Returns
Section titled “Returns”Effect<A, MalformedJsonError | ParseError, R>
Example
Section titled “Example”import { Request } from 'fx-fetch';import { Effect, Schema } from 'effect';
const UserSchema = Schema.Struct({ name: Schema.String, age: Schema.Number});
const request = Request.make({ url: 'https://api.example.com' });const userEffect = Request.readJsonWithSchema(request, UserSchema);0.1.0
Call Signature
Section titled “Call Signature”<
A,I,R>(self): (request) =>Effect<A,MalformedJsonError|ParseError,R>
Reads a JSON request with the given schema.
Type Parameters
Section titled “Type Parameters”A
I
R
Parameters
Section titled “Parameters”Schema<A, I, R>
Returns
Section titled “Returns”(
request):Effect<A,MalformedJsonError|ParseError,R>
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”Effect<A, MalformedJsonError | ParseError, R>
Example
Section titled “Example”import { Request } from 'fx-fetch';import { Effect, Schema, pipe } from 'effect';
const UserSchema = Schema.Struct({ name: Schema.String, age: Schema.Number});const request = Request.make({ url: 'https://api.example.com' });
const userEffect = pipe( request, Request.readJsonWithSchema(UserSchema));0.1.0
Example
Section titled “Example”import { Request } from 'fx-fetch';import { Effect, Schema } from 'effect';
const UserSchema = Schema.Struct({ name: Schema.String, age: Schema.Number});
const request = Request.make({ url: 'https://api.example.com' });const userEffect = Request.readJsonWithSchema(request, UserSchema);0.1.0