Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

feat(sdk): add getCurrentApiKey method in sdk (#739)

Corentin Thomasset8bb396b6e1bc
diff --git a/packages/api-sdk/src/api-client.ts b/packages/api-sdk/src/api-client.ts
index e183560d..3745c32b 100644
--- a/packages/api-sdk/src/api-client.ts
+++ b/packages/api-sdk/src/api-client.ts
@@ -17,6 +17,7 @@ export function createClient({ apiKey, apiBaseUrl = PAPRA_API_URL }: { apiKey: s
listTags,
createTag,
addTagToDocument,
+ getCurrentApiKey,
},
{ apiClient },
);
@@ -91,3 +92,15 @@ async function addTagToDocument({
body: { tagId },
});
}
+
+async function getCurrentApiKey({ apiClient }: { apiClient: ApiClient }) {
+ return await apiClient<{
+ apiKey: {
+ id: string;
+ name: string;
+ permissions: string[];
+ };
+ }>('/api/api-keys/current', {
+ method: 'GET',
+ });
+}