import { z } from 'zod'; import { APIResponseSchema, APIClient } from '@agentuity/api'; import { RegionResponseError } from './util.ts'; export const ListRegionsResponse = z.array( z.object({ region: z.string().describe('the region identifier'), description: z.string().describe('the human-readable description of the region'), }) ); export const ListRegionsResponseSchema = APIResponseSchema(ListRegionsResponse); export type ListRegionsResponse = z.infer; export type RegionList = z.infer; /** * List all available cloud regions * * @param client * @returns */ export async function listRegions(client: APIClient): Promise { const resp = await client.request( 'GET', '/cli/region', ListRegionsResponseSchema ); if (resp.success) { return resp.data; } throw new RegionResponseError({ message: resp.message }); }