Browse Source

refactor: apiToken path update

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1668/head
Pranav C 2 years ago
parent
commit
31d5236148
  1. 2
      packages/nc-gui/layouts/default.vue
  2. 12
      packages/nocodb-sdk/src/lib/Api.ts
  3. 6
      packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts
  4. 4
      scripts/sdk/swagger.json

2
packages/nc-gui/layouts/default.vue

@ -657,7 +657,7 @@ export default {
},
async copyProjectInfo() {
try {
const data = (await this.$api.project.metaGet(this.$store.state.project.projectId))// await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'ncProjectInfo'])
const data = (await this.$api.project.metaGet(this.$store.state.project.projectId))
copyTextToClipboard(Object.entries(data).map(([k, v]) => `${k}: **${v}**`).join('\n'))
this.$toast.info('Copied project info to clipboard').goAway(3000)
} catch (e) {

12
packages/nocodb-sdk/src/lib/Api.ts

@ -3382,12 +3382,12 @@ export class Api<
* @tags Api token
* @name List
* @summary Your GET endpoint
* @request GET:/api/v1/db/meta/projects/{projectId}/apiTokens
* @request GET:/api/v1/db/meta/projects/{projectId}/api-tokens
* @response `200` `(ApiTokenType)[]` OK
*/
list: (projectId: string, params: RequestParams = {}) =>
this.request<ApiTokenType[], any>({
path: `/api/v1/db/meta/projects/${projectId}/apiTokens`,
path: `/api/v1/db/meta/projects/${projectId}/api-tokens`,
method: 'GET',
format: 'json',
...params,
@ -3398,7 +3398,7 @@ export class Api<
*
* @tags Api token
* @name Create
* @request POST:/api/v1/db/meta/projects/{projectId}/apiTokens
* @request POST:/api/v1/db/meta/projects/{projectId}/api-tokens
* @response `200` `void` OK
* @response `201` `ApiTokenType` Created
*/
@ -3408,7 +3408,7 @@ export class Api<
params: RequestParams = {}
) =>
this.request<void, any>({
path: `/api/v1/db/meta/projects/${projectId}/apiTokens`,
path: `/api/v1/db/meta/projects/${projectId}/api-tokens`,
method: 'POST',
body: data,
type: ContentType.Json,
@ -3420,12 +3420,12 @@ export class Api<
*
* @tags Api token
* @name Delete
* @request DELETE:/api/v1/db/meta/projects/{projectId}/apiTokens/{token}
* @request DELETE:/api/v1/db/meta/projects/{projectId}/api-tokens/{token}
* @response `200` `void` OK
*/
delete: (projectId: string, token: string, params: RequestParams = {}) =>
this.request<void, any>({
path: `/api/v1/db/meta/projects/${projectId}/apiTokens/${token}`,
path: `/api/v1/db/meta/projects/${projectId}/api-tokens/${token}`,
method: 'DELETE',
...params,
}),

6
packages/nocodb/src/lib/noco/meta/api/apiTokenApis.ts

@ -18,15 +18,15 @@ export async function apiTokenDelete(req: Request, res: Response) {
const router = Router({ mergeParams: true });
router.get(
'/api/v1/db/meta/projects/:projectId/apiTokens',
'/api/v1/db/meta/projects/:projectId/api-tokens',
ncMetaAclMw(apiTokenList, 'apiTokenList')
);
router.post(
'/api/v1/db/meta/projects/:projectId/apiTokens',
'/api/v1/db/meta/projects/:projectId/api-tokens',
ncMetaAclMw(apiTokenCreate, 'apiTokenCreate')
);
router.delete(
'/api/v1/db/meta/projects/:projectId/apiTokens/:token',
'/api/v1/db/meta/projects/:projectId/api-tokens/:token',
ncMetaAclMw(apiTokenDelete, 'apiTokenDelete')
);

4
scripts/sdk/swagger.json

@ -4593,7 +4593,7 @@
"parameters": []
},
"/api/v1/db/meta/projects/{projectId}/apiTokens": {
"/api/v1/db/meta/projects/{projectId}/api-tokens": {
"get": {
"summary": "Your GET endpoint",
"tags": [
@ -4663,7 +4663,7 @@
}
]
},
"/api/v1/db/meta/projects/{projectId}/apiTokens/{token}": {
"/api/v1/db/meta/projects/{projectId}/api-tokens/{token}": {
"delete": {
"summary": "",
"operationId": "api-token-delete",

Loading…
Cancel
Save