From 488cfa59d2f29f618036d7623ab4be3efd85b242 Mon Sep 17 00:00:00 2001 From: Markus Thielker Date: Sun, 15 Dec 2024 03:37:24 +0100 Subject: [PATCH] NORY-36: add Ory Keto APIs to dashboard project --- dashboard/src/ory/sdk/server/index.ts | 64 ++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/dashboard/src/ory/sdk/server/index.ts b/dashboard/src/ory/sdk/server/index.ts index fb2a176..7649433 100644 --- a/dashboard/src/ory/sdk/server/index.ts +++ b/dashboard/src/ory/sdk/server/index.ts @@ -1,6 +1,14 @@ 'use server'; -import { Configuration, FrontendApi, IdentityApi, MetadataApi, OAuth2Api } from '@ory/client'; +import { + Configuration, + FrontendApi, + IdentityApi, + MetadataApi, + OAuth2Api, + PermissionApi, + RelationshipApi, +} from '@ory/client'; // #################################################################################### @@ -92,3 +100,57 @@ const kratosMetadataApi = new MetadataApi( export async function getKratosMetadataApi() { return kratosMetadataApi; } + + +// #################################################################################### +// Relationship API +// #################################################################################### + +const relationshipApi = new RelationshipApi(new Configuration( + { + basePath: process.env.ORY_KETO_ADMIN_URL, + baseOptions: { + withCredentials: true, + }, + }, +)); + +export async function getRelationshipApi() { + return relationshipApi; +} + + +// #################################################################################### +// Permission API +// #################################################################################### + +const permissionApi = new PermissionApi(new Configuration( + { + basePath: process.env.ORY_KETO_ADMIN_URL, + baseOptions: { + withCredentials: true, + }, + }, +)); + +export async function getPermissionApi() { + return permissionApi; +} + + +// #################################################################################### +// Keto Metadata API +// #################################################################################### + +const ketoMetadataApi = new MetadataApi(new Configuration( + { + basePath: process.env.ORY_KETO_ADMIN_URL, + baseOptions: { + withCredentials: true, + }, + }, +)); + +export async function getKetoMetadataApi() { + return ketoMetadataApi; +}