refactor: Move api-keys endpoints to their own controller (#11000)

This commit is contained in:
Ricardo Espinoza
2024-09-30 09:10:22 -04:00
committed by GitHub
parent 77fec195d9
commit e54a396088
11 changed files with 334 additions and 261 deletions

View File

@@ -2,16 +2,16 @@ import type { ApiKey, IRestApiContext } from '@/Interface';
import { makeRestApiRequest } from '@/utils/apiUtils';
export async function getApiKeys(context: IRestApiContext): Promise<ApiKey[]> {
return await makeRestApiRequest(context, 'GET', '/me/api-keys');
return await makeRestApiRequest(context, 'GET', '/api-keys');
}
export async function createApiKey(context: IRestApiContext): Promise<ApiKey> {
return await makeRestApiRequest(context, 'POST', '/me/api-keys');
return await makeRestApiRequest(context, 'POST', '/api-keys');
}
export async function deleteApiKey(
context: IRestApiContext,
id: string,
): Promise<{ success: boolean }> {
return await makeRestApiRequest(context, 'DELETE', `/me/api-keys/${id}`);
return await makeRestApiRequest(context, 'DELETE', `/api-keys/${id}`);
}