|
| 1 | +// This file is auto-generated by @hey-api/openapi-ts |
| 2 | + |
| 3 | +import { oc } from '@orpc/contract'; |
| 4 | + |
| 5 | +import { zCreatePostData, zCreatePostResponse, zCreateUserData, zCreateUserResponse, zDeleteUserData, zGetPostByIdData, zGetPostByIdResponse, zGetPostsData, zGetPostsResponse, zGetUserByIdData, zGetUserByIdResponse, zGetUsersData, zGetUsersResponse, zUpdateUserData, zUpdateUserResponse } from '../zod.gen'; |
| 6 | + |
| 7 | +export const base = oc.$route({ inputStructure: 'detailed' }); |
| 8 | + |
| 9 | +/** |
| 10 | + * Get all users |
| 11 | + */ |
| 12 | +export const GetUsers = base.route({ |
| 13 | + method: 'GET', |
| 14 | + operationId: 'getUsers', |
| 15 | + path: '/users', |
| 16 | + summary: 'Get all users', |
| 17 | + tags: ['users'] |
| 18 | +}).input(zGetUsersData).output(zGetUsersResponse); |
| 19 | + |
| 20 | +/** |
| 21 | + * Create a new user |
| 22 | + */ |
| 23 | +export const CreateUser = base.route({ |
| 24 | + method: 'POST', |
| 25 | + operationId: 'createUser', |
| 26 | + path: '/users', |
| 27 | + successStatus: 201, |
| 28 | + summary: 'Create a new user', |
| 29 | + tags: ['users'] |
| 30 | +}).input(zCreateUserData).output(zCreateUserResponse); |
| 31 | + |
| 32 | +/** |
| 33 | + * Delete a user |
| 34 | + */ |
| 35 | +export const DeleteUser = base.route({ |
| 36 | + method: 'DELETE', |
| 37 | + operationId: 'deleteUser', |
| 38 | + path: '/users/{userId}', |
| 39 | + summary: 'Delete a user', |
| 40 | + tags: ['users'] |
| 41 | +}).input(zDeleteUserData); |
| 42 | + |
| 43 | +/** |
| 44 | + * Get a user by ID |
| 45 | + */ |
| 46 | +export const GetUserById = base.route({ |
| 47 | + method: 'GET', |
| 48 | + operationId: 'getUserById', |
| 49 | + path: '/users/{userId}', |
| 50 | + summary: 'Get a user by ID', |
| 51 | + tags: ['users'] |
| 52 | +}).input(zGetUserByIdData).output(zGetUserByIdResponse); |
| 53 | + |
| 54 | +/** |
| 55 | + * Update a user |
| 56 | + */ |
| 57 | +export const UpdateUser = base.route({ |
| 58 | + method: 'PUT', |
| 59 | + operationId: 'updateUser', |
| 60 | + path: '/users/{userId}', |
| 61 | + summary: 'Update a user', |
| 62 | + tags: ['users'] |
| 63 | +}).input(zUpdateUserData).output(zUpdateUserResponse); |
| 64 | + |
| 65 | +export const usersContracts = { |
| 66 | + GetUsers, |
| 67 | + CreateUser, |
| 68 | + DeleteUser, |
| 69 | + GetUserById, |
| 70 | + UpdateUser |
| 71 | +}; |
| 72 | + |
| 73 | +/** |
| 74 | + * Get all posts |
| 75 | + */ |
| 76 | +export const GetPosts = base.route({ |
| 77 | + method: 'GET', |
| 78 | + operationId: 'getPosts', |
| 79 | + path: '/posts', |
| 80 | + summary: 'Get all posts', |
| 81 | + tags: ['posts'] |
| 82 | +}).input(zGetPostsData).output(zGetPostsResponse); |
| 83 | + |
| 84 | +/** |
| 85 | + * Create a new post |
| 86 | + */ |
| 87 | +export const CreatePost = base.route({ |
| 88 | + method: 'POST', |
| 89 | + operationId: 'createPost', |
| 90 | + path: '/posts', |
| 91 | + successStatus: 201, |
| 92 | + summary: 'Create a new post', |
| 93 | + tags: ['posts'] |
| 94 | +}).input(zCreatePostData).output(zCreatePostResponse); |
| 95 | + |
| 96 | +/** |
| 97 | + * Get a post by ID |
| 98 | + */ |
| 99 | +export const GetPostById = base.route({ |
| 100 | + method: 'GET', |
| 101 | + operationId: 'getPostById', |
| 102 | + path: '/posts/{postId}', |
| 103 | + summary: 'Get a post by ID', |
| 104 | + tags: ['posts'] |
| 105 | +}).input(zGetPostByIdData).output(zGetPostByIdResponse); |
| 106 | + |
| 107 | +export const postsContracts = { |
| 108 | + GetPosts, |
| 109 | + CreatePost, |
| 110 | + GetPostById |
| 111 | +}; |
| 112 | + |
| 113 | +export const router = { |
| 114 | + getUsers: GetUsers, |
| 115 | + createUser: CreateUser, |
| 116 | + deleteUser: DeleteUser, |
| 117 | + getUserById: GetUserById, |
| 118 | + updateUser: UpdateUser, |
| 119 | + getPosts: GetPosts, |
| 120 | + createPost: CreatePost, |
| 121 | + getPostById: GetPostById |
| 122 | +}; |
| 123 | + |
| 124 | +export type Router = typeof router; |
0 commit comments