MCPcopy
hub / github.com/Effect-TS/effect / UsersApi

Class UsersApi

packages/platform-node/examples/api.ts:44–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42const idParam = HttpApiSchema.param("id", Schema.NumberFromString)
43
44class UsersApi extends HttpApiGroup.make("users")
45 .add(
46 HttpApiEndpoint.get("findById")`/${idParam}`
47 .addSuccess(User)
48 .setHeaders(Schema.Struct({
49 page: Schema.NumberFromString.pipe(
50 Schema.optionalWith({ default: () => 1 })
51 )
52 }))
53 .addError(Schema.String.pipe(
54 HttpApiSchema.asEmpty({ status: 413, decode: () => "boom" })
55 ))
56 )
57 .add(
58 HttpApiEndpoint.post("create", "/")
59 .setPayload(HttpApiSchema.Multipart(Schema.Struct({
60 name: Schema.String
61 })))
62 .addSuccess(User)
63 )
64 .add(
65 HttpApiEndpoint.get("me", "/me")
66 .addSuccess(User)
67 )
68 .middleware(Authentication)
69 .prefix("/users")
70 .annotateContext(OpenApi.annotations({
71 title: "Users API",
72 description: "API for managing users"
73 }))
74{}
75
76class TopLevelApi extends HttpApiGroup.make("topLevel", { topLevel: true })
77 .add(

Callers

nothing calls this directly

Calls 12

setHeadersMethod · 0.80
addSuccessMethod · 0.80
annotateContextMethod · 0.65
prefixMethod · 0.65
middlewareMethod · 0.65
addMethod · 0.65
makeMethod · 0.65
addErrorMethod · 0.65
getMethod · 0.65
pipeMethod · 0.65
setPayloadMethod · 0.65
annotationsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…