RustRover cargo-generate template: Axum + Vue 3 + TypeScript + Tailwind + sqlx
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

generated.ts 2.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* eslint-disable */
  2. /* generated by scripts/generate-api.mjs — do not edit */
  3. import { request } from "./client";
  4. export type CreateItemRequest = {
  5. description?: string | null;
  6. name: string;
  7. };
  8. export type ErrorBody = {
  9. error: ErrorDetail;
  10. };
  11. export type ErrorDetail = {
  12. code: string;
  13. message: string;
  14. status: number;
  15. trace_id?: string | null;
  16. };
  17. export type HealthResponse = {
  18. service: string;
  19. status: string;
  20. };
  21. export type ItemPage = {
  22. items: Array<ItemResponse>;
  23. page: number;
  24. per_page: number;
  25. total: number;
  26. };
  27. export type ItemResponse = {
  28. created_at: string;
  29. description?: string | null;
  30. id: string;
  31. name: string;
  32. updated_at: string;
  33. };
  34. export type ReadyResponse = {
  35. database: string;
  36. status: string;
  37. };
  38. export type UpdateItemRequest = {
  39. description?: string | null;
  40. name?: string | null;
  41. };
  42. export function listItems(args: {
  43. query?: {
  44. page?: number;
  45. per_page?: number;
  46. }
  47. }): Promise<ItemPage> {
  48. return request<ItemPage>({
  49. method: "GET",
  50. path: "/api/v1/items",
  51. query: args.query,
  52. expectedStatus: 200,
  53. });
  54. }
  55. export function createItem(args: {
  56. body: CreateItemRequest
  57. }): Promise<ItemResponse> {
  58. return request<ItemResponse>({
  59. method: "POST",
  60. path: "/api/v1/items",
  61. body: args.body,
  62. expectedStatus: 201,
  63. });
  64. }
  65. export function getItem(args: {
  66. path: {
  67. id: string;
  68. }
  69. }): Promise<ItemResponse> {
  70. return request<ItemResponse>({
  71. method: "GET",
  72. path: "/api/v1/items/" + encodeURIComponent(String(args.path.id)),
  73. expectedStatus: 200,
  74. });
  75. }
  76. export function deleteItem(args: {
  77. path: {
  78. id: string;
  79. }
  80. }): Promise<void> {
  81. return request<void>({
  82. method: "DELETE",
  83. path: "/api/v1/items/" + encodeURIComponent(String(args.path.id)),
  84. expectedStatus: 204,
  85. });
  86. }
  87. export function updateItem(args: {
  88. path: {
  89. id: string;
  90. };
  91. body: UpdateItemRequest
  92. }): Promise<ItemResponse> {
  93. return request<ItemResponse>({
  94. method: "PATCH",
  95. path: "/api/v1/items/" + encodeURIComponent(String(args.path.id)),
  96. body: args.body,
  97. expectedStatus: 200,
  98. });
  99. }
  100. export function live(): Promise<HealthResponse> {
  101. return request<HealthResponse>({
  102. method: "GET",
  103. path: "/health/live",
  104. expectedStatus: 200,
  105. });
  106. }
  107. export function ready(): Promise<ReadyResponse> {
  108. return request<ReadyResponse>({
  109. method: "GET",
  110. path: "/health/ready",
  111. expectedStatus: 200,
  112. });
  113. }