()
| 14 | * @returns A promise with the list of namespaces |
| 15 | */ |
| 16 | export async function listNamespaces(): Promise<BaseResponse<NamespaceResponse[]>> { |
| 17 | try { |
| 18 | const response = await fetchApi<BaseResponse<NamespaceResponse[]>>('/namespaces'); |
| 19 | |
| 20 | if (!response) { |
| 21 | throw new Error("Failed to get namespaces"); |
| 22 | } |
| 23 | |
| 24 | return { |
| 25 | message: "Namespaces fetched successfully", |
| 26 | data: response.data, |
| 27 | }; |
| 28 | } catch (error) { |
| 29 | return createErrorResponse<NamespaceResponse[]>(error, "Error getting namespaces"); |
| 30 | } |
| 31 | } |
no test coverage detected