You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
612 B
TypeScript
17 lines
612 B
TypeScript
import { api } from './client';
|
|
import type { UserApiKey, CreateApiKeyRequest, TestApiKeyResponse } from '~/types';
|
|
|
|
export const apiKeysApi = {
|
|
list: (): Promise<UserApiKey[]> =>
|
|
api.get<UserApiKey[]>('/user/api-keys'),
|
|
|
|
create: (data: CreateApiKeyRequest): Promise<UserApiKey> =>
|
|
api.post<UserApiKey>('/user/api-keys', data),
|
|
|
|
remove: (provider: string): Promise<void> =>
|
|
api.delete<void>(`/user/api-keys/${encodeURIComponent(provider)}`),
|
|
|
|
test: (provider: string): Promise<TestApiKeyResponse> =>
|
|
api.post<TestApiKeyResponse>(`/user/api-keys/${encodeURIComponent(provider)}/test`),
|
|
};
|