feat: add open api client and types for API integration

This commit is contained in:
arraysid
2025-05-19 13:33:09 +07:00
parent 2de5fd56d8
commit 795bcb6ab1
4 changed files with 1362 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
import type { paths } from '@/openapi-types';
import createClient from 'openapi-fetch';
export const fetcher = createClient<paths>({
baseUrl: 'https://api.imphnen.dev',
});
File diff suppressed because it is too large Load Diff
+16
View File
@@ -30,6 +30,7 @@
"js-cookie": "^3.0.5",
"next": "~15.2.4",
"next-themes": "^0.4.6",
"openapi-fetch": "^0.14.0",
"payload": "^3.37.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
@@ -31047,6 +31048,21 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/openapi-fetch": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/openapi-fetch/-/openapi-fetch-0.14.0.tgz",
"integrity": "sha512-PshIdm1NgdLvb05zp8LqRQMNSKzIlPkyMxYFxwyHR+UlKD4t2nUjkDhNxeRbhRSEd3x5EUNh2w5sJYwkhOH4fg==",
"license": "MIT",
"dependencies": {
"openapi-typescript-helpers": "^0.0.15"
}
},
"node_modules/openapi-typescript-helpers": {
"version": "0.0.15",
"resolved": "https://registry.npmjs.org/openapi-typescript-helpers/-/openapi-typescript-helpers-0.0.15.tgz",
"integrity": "sha512-opyTPaunsklCBpTK8JGef6mfPhLSnyy5a0IN9vKtx3+4aExf+KxEqYwIy3hqkedXIB97u357uLMJsOnm3GVjsw==",
"license": "MIT"
},
"node_modules/opener": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
+2
View File
@@ -18,6 +18,7 @@
"landing:dev": "nx serve landing",
"landing:build": "nx build landing",
"landing:prod": "cd ./dist/apps/landing && npx next start",
"landing:openapi": "npx openapi-typescript https://api.imphnen.dev/openapi.json -o ./apps/landing/src/openapi-types.ts",
"landing:generate:importmap": "PAYLOAD_CONFIG_PATH=apps/landing/src/payload.config.ts payload generate:importmap",
"landing:generate:types": "PAYLOAD_CONFIG_PATH=apps/landing/src/payload.config.ts payload generate:types",
"ui:test": "nx test ui",
@@ -47,6 +48,7 @@
"js-cookie": "^3.0.5",
"next": "~15.2.4",
"next-themes": "^0.4.6",
"openapi-fetch": "^0.14.0",
"payload": "^3.37.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",