|
1 | 1 | <script lang="ts"> |
2 | 2 | import { goto } from "$app/navigation"; |
| 3 | + import { page } from "$app/stores"; |
3 | 4 | import type { PageData } from "./$types"; |
4 | 5 | import { trackedFetch } from "$lib/utils/trackedFetch"; |
5 | 6 | import { |
|
13 | 14 | let entity = $derived(data.entity); |
14 | 15 | let userEntitlements = $derived(data.userEntitlements || []); |
15 | 16 |
|
| 17 | + const apiExplorerUrl = |
| 18 | + $page.data.externalLinks?.API_EXPLORER_URL || |
| 19 | + "https://apiexplorer-ii-sandbox.openbankproject.com"; |
| 20 | +
|
16 | 21 | // Helper function to get the entity name (in v6.0.0, this is in the entity_name field) |
17 | 22 | function getEntityName(entity: any): string { |
18 | 23 | return entity.entity_name || "Unknown"; |
|
49 | 54 | role: `CanCreateDynamicEntity_System${entityName}`, |
50 | 55 | description: `Create new ${entityName} records`, |
51 | 56 | endpoint: `POST /obp/dynamic-entity/${entityName}`, |
| 57 | + explorerUrl: `${apiExplorerUrl}/resource-docs/OBPdynamic-entity?operationid=OBPv4.0.0-dynamicEntity_create${entityName}_`, |
52 | 58 | }, |
53 | 59 | { |
54 | | - operation: "Read", |
| 60 | + operation: "Read (list)", |
55 | 61 | role: `CanGetDynamicEntity_System${entityName}`, |
56 | | - description: `View ${entityName} records`, |
| 62 | + description: `List all ${entityName} records`, |
57 | 63 | endpoint: `GET /obp/dynamic-entity/${entityName}`, |
| 64 | + explorerUrl: `${apiExplorerUrl}/resource-docs/OBPdynamic-entity?operationid=OBPv4.0.0-dynamicEntity_get${entityName}List_`, |
| 65 | + }, |
| 66 | + { |
| 67 | + operation: "Read (single)", |
| 68 | + role: `CanGetDynamicEntity_System${entityName}`, |
| 69 | + description: `View a single ${entityName} record by ID`, |
| 70 | + endpoint: `GET /obp/dynamic-entity/${entityName}/{RECORD_ID}`, |
| 71 | + explorerUrl: `${apiExplorerUrl}/resource-docs/OBPdynamic-entity?operationid=OBPv4.0.0-dynamicEntity_getSingle${entityName}_`, |
58 | 72 | }, |
59 | 73 | { |
60 | 74 | operation: "Update", |
61 | 75 | role: `CanUpdateDynamicEntity_System${entityName}`, |
62 | 76 | description: `Update existing ${entityName} records`, |
63 | 77 | endpoint: `PUT /obp/dynamic-entity/${entityName}/{RECORD_ID}`, |
| 78 | + explorerUrl: `${apiExplorerUrl}/resource-docs/OBPdynamic-entity?operationid=OBPv4.0.0-dynamicEntity_update${entityName}_`, |
64 | 79 | }, |
65 | 80 | { |
66 | 81 | operation: "Delete", |
67 | 82 | role: `CanDeleteDynamicEntity_System${entityName}`, |
68 | 83 | description: `Delete ${entityName} records`, |
69 | 84 | endpoint: `DELETE /obp/dynamic-entity/${entityName}/{RECORD_ID}`, |
| 85 | + explorerUrl: `${apiExplorerUrl}/resource-docs/OBPdynamic-entity?operationid=OBPv4.0.0-dynamicEntity_delete${entityName}_`, |
70 | 86 | }, |
71 | 87 | ]; |
72 | 88 | }); |
|
732 | 748 | {roleReq.role} |
733 | 749 | </p> |
734 | 750 | <p |
735 | | - class="mt-1 font-mono text-xs text-blue-600 dark:text-blue-400" |
| 751 | + class="mt-1 flex items-center gap-2 font-mono text-xs text-blue-600 dark:text-blue-400" |
736 | 752 | > |
737 | | - {roleReq.endpoint} |
| 753 | + <span>{roleReq.endpoint}</span> |
| 754 | + <a |
| 755 | + href={roleReq.explorerUrl} |
| 756 | + target="_blank" |
| 757 | + rel="noopener noreferrer" |
| 758 | + class="inline-flex items-center gap-1 rounded bg-purple-100 px-1.5 py-0.5 text-xs font-medium text-purple-700 no-underline hover:bg-purple-200 dark:bg-purple-900/30 dark:text-purple-300 dark:hover:bg-purple-900/50" |
| 759 | + title="Open in API Explorer" |
| 760 | + > |
| 761 | + <svg class="h-3 w-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 762 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" /> |
| 763 | + </svg> |
| 764 | + API Explorer |
| 765 | + </a> |
738 | 766 | </p> |
739 | 767 | </div> |
740 | 768 | {#if !userHasRole(roleReq.role)} |
|
0 commit comments