import { get, post, put } from './apiClient'; import type { ApiKey, ApiKeyDetail, ApiKeyCreateResponse, CreateApiKeyRequest, ApiKeyRequest, ApiKeyRequestCreateDto, ApiKeyRequestReviewDto, Permission, UpdatePermissionsRequest, } from '../types/apikey'; // My Keys export const getMyKeys = () => get('/keys'); export const getAllKeys = () => get('/keys/all'); export const getKeyDetail = (id: number) => get(`/keys/${id}`); export const createKey = (req: CreateApiKeyRequest) => post('/keys', req); export const revokeKey = (id: number) => put(`/keys/${id}/revoke`); // Requests export const createKeyRequest = (req: ApiKeyRequestCreateDto) => post('/keys/requests', req); export const getMyRequests = () => get('/keys/requests/my'); export const getAllRequests = () => get('/keys/requests'); export const reviewRequest = (id: number, req: ApiKeyRequestReviewDto) => put(`/keys/requests/${id}/review`, req); // Permissions export const getPermissions = (keyId: number) => get(`/keys/${keyId}/permissions`); export const updatePermissions = (keyId: number, req: UpdatePermissionsRequest) => put(`/keys/${keyId}/permissions`, req);