|
- /* eslint-disable */
- /* generated by scripts/generate-api.mjs — do not edit */
- import { request } from "./client";
-
- export type CreateItemRequest = {
- description?: string | null;
- name: string;
- };
-
- export type ErrorBody = {
- error: ErrorDetail;
- };
-
- export type ErrorDetail = {
- code: string;
- message: string;
- status: number;
- trace_id?: string | null;
- };
-
- export type HealthResponse = {
- service: string;
- status: string;
- };
-
- export type ItemPage = {
- items: Array<ItemResponse>;
- page: number;
- per_page: number;
- total: number;
- };
-
- export type ItemResponse = {
- created_at: string;
- description?: string | null;
- id: string;
- name: string;
- updated_at: string;
- };
-
- export type ReadyResponse = {
- database: string;
- status: string;
- };
-
- export type UpdateItemRequest = {
- description?: string | null;
- name?: string | null;
- };
-
- export function listItems(args: {
- query?: {
- page?: number;
- per_page?: number;
- }
- }): Promise<ItemPage> {
- return request<ItemPage>({
- method: "GET",
- path: "/api/v1/items",
- query: args.query,
- expectedStatus: 200,
- });
- }
-
- export function createItem(args: {
- body: CreateItemRequest
- }): Promise<ItemResponse> {
- return request<ItemResponse>({
- method: "POST",
- path: "/api/v1/items",
- body: args.body,
- expectedStatus: 201,
- });
- }
-
- export function getItem(args: {
- path: {
- id: string;
- }
- }): Promise<ItemResponse> {
- return request<ItemResponse>({
- method: "GET",
- path: "/api/v1/items/" + encodeURIComponent(String(args.path.id)),
- expectedStatus: 200,
- });
- }
-
- export function deleteItem(args: {
- path: {
- id: string;
- }
- }): Promise<void> {
- return request<void>({
- method: "DELETE",
- path: "/api/v1/items/" + encodeURIComponent(String(args.path.id)),
- expectedStatus: 204,
- });
- }
-
- export function updateItem(args: {
- path: {
- id: string;
- };
- body: UpdateItemRequest
- }): Promise<ItemResponse> {
- return request<ItemResponse>({
- method: "PATCH",
- path: "/api/v1/items/" + encodeURIComponent(String(args.path.id)),
- body: args.body,
- expectedStatus: 200,
- });
- }
-
- export function live(): Promise<HealthResponse> {
- return request<HealthResponse>({
- method: "GET",
- path: "/health/live",
- expectedStatus: 200,
- });
- }
-
- export function ready(): Promise<ReadyResponse> {
- return request<ReadyResponse>({
- method: "GET",
- path: "/health/ready",
- expectedStatus: 200,
- });
- }
|