| 1588 | ).prefix("/groups") {} |
| 1589 | |
| 1590 | class UsersApi extends HttpApiGroup.make("users") |
| 1591 | .add( |
| 1592 | HttpApiEndpoint.get("findById", "/:id", { |
| 1593 | params: { |
| 1594 | id: Schema.Finite |
| 1595 | }, |
| 1596 | success: User, |
| 1597 | error: UserError |
| 1598 | }), |
| 1599 | HttpApiEndpoint.post("create", "/", { |
| 1600 | payload: Schema.Struct(Struct.omit(User.fields, ["id", "createdAt"])), |
| 1601 | query: { |
| 1602 | id: Schema.Finite |
| 1603 | }, |
| 1604 | success: User, |
| 1605 | error: [UserError, UserError] |
| 1606 | }), |
| 1607 | HttpApiEndpoint.get("list", "/", { |
| 1608 | headers: { |
| 1609 | page: Schema.Finite.pipe( |
| 1610 | Schema.optionalKey, |
| 1611 | Schema.decode({ |
| 1612 | decode: SchemaGetter.withDefault(Effect.succeed(1)), |
| 1613 | encode: SchemaGetter.passthrough() |
| 1614 | }) |
| 1615 | ) |
| 1616 | }, |
| 1617 | query: { |
| 1618 | query: Schema.optional(Schema.String).annotate({ description: "search query" }) |
| 1619 | }, |
| 1620 | success: Schema.Array(User), |
| 1621 | error: NoStatusError |
| 1622 | }) |
| 1623 | .annotate(OpenApi.Deprecated, true) |
| 1624 | .annotate(OpenApi.Summary, "test summary") |
| 1625 | .annotateMerge(OpenApi.annotations({ identifier: "listUsers" })), |
| 1626 | HttpApiEndpoint.post("upload", "/upload/:0?", { |
| 1627 | params: { |
| 1628 | 0: Schema.optional(Schema.String) |
| 1629 | }, |
| 1630 | payload: Schema.Struct({ |
| 1631 | file: Multipart.SingleFileSchema |
| 1632 | }).pipe(HttpApiSchema.asMultipart()), |
| 1633 | success: Schema.Struct({ |
| 1634 | contentType: Schema.String, |
| 1635 | length: Schema.Int |
| 1636 | }) |
| 1637 | }), |
| 1638 | HttpApiEndpoint.post("uploadStream", `/uploadstream`, { |
| 1639 | payload: Schema.Struct({ |
| 1640 | file: Multipart.SingleFileSchema |
| 1641 | }).pipe(HttpApiSchema.asMultipartStream()), |
| 1642 | success: Schema.Struct({ |
| 1643 | contentType: Schema.String, |
| 1644 | length: Schema.Int |
| 1645 | }) |
| 1646 | }) |
| 1647 | ) |
nothing calls this directly
no test coverage detected
searching dependent graphs…