| 1540 | }) {} |
| 1541 | |
| 1542 | class GroupsApi extends HttpApiGroup.make("groups").add( |
| 1543 | HttpApiEndpoint.get("findById", "/:id", { |
| 1544 | params: { |
| 1545 | id: Schema.FiniteFromString |
| 1546 | }, |
| 1547 | success: Group, |
| 1548 | error: GroupError.pipe(HttpApiSchema.asNoContent({ |
| 1549 | decode: () => new GroupError({}) |
| 1550 | })) |
| 1551 | }), |
| 1552 | HttpApiEndpoint.post("create", "/", { |
| 1553 | payload: [ |
| 1554 | Schema.Struct(Struct.pick(Group.fields, ["name"])), |
| 1555 | Schema.Struct({ foo: Schema.String }).pipe( |
| 1556 | HttpApiSchema.asFormUrlEncoded() |
| 1557 | ), |
| 1558 | Schema.Struct(Struct.pick(Group.fields, ["name"])).pipe( |
| 1559 | HttpApiSchema.asMultipart() |
| 1560 | ) |
| 1561 | ], |
| 1562 | success: Group |
| 1563 | }), |
| 1564 | HttpApiEndpoint.post("handle", "/handle/:id", { |
| 1565 | params: { |
| 1566 | id: Schema.FiniteFromString |
| 1567 | }, |
| 1568 | payload: Schema.Struct({ |
| 1569 | name: Schema.String |
| 1570 | }), |
| 1571 | success: Schema.Struct({ |
| 1572 | id: Schema.Finite, |
| 1573 | name: Schema.String |
| 1574 | }) |
| 1575 | }), |
| 1576 | HttpApiEndpoint.post("handleRaw", "/handleraw/:id", { |
| 1577 | params: { |
| 1578 | id: Schema.FiniteFromString |
| 1579 | }, |
| 1580 | payload: Schema.Struct({ |
| 1581 | name: Schema.String |
| 1582 | }), |
| 1583 | success: Schema.Struct({ |
| 1584 | id: Schema.Finite, |
| 1585 | name: Schema.String |
| 1586 | }) |
| 1587 | }) |
| 1588 | ).prefix("/groups") {} |
| 1589 | |
| 1590 | class UsersApi extends HttpApiGroup.make("users") |
| 1591 | .add( |