Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

refactor: mapping correction and swagger update

Pranav C811c59036b56
diff --git a/packages/nocodb-sdk-v2/src/lib/Api.ts b/packages/nocodb-sdk-v2/src/lib/Api.ts
index 4f68e4124e..bfd9de458a 100644
--- a/packages/nocodb-sdk-v2/src/lib/Api.ts
+++ b/packages/nocodb-sdk-v2/src/lib/Api.ts
@@ -1226,6 +1226,105 @@ export interface Paginated {
nestedPrev?: string;
}
+/** Basic workspace information */
+export interface Workspace {
+ /** Unique identifier for the workspace */
+ id: string;
+ /** Title of the workspace */
+ title: string;
+ /**
+ * Timestamp when the workspace was created
+ * @format date-time
+ */
+ created_at: string;
+ /**
+ * Timestamp when the workspace was last updated
+ * @format date-time
+ */
+ updated_at: string;
+}
+
+/** Workspace information including member details */
+export type WorkspaceWithMembers = Workspace & {
+ individual_members: {
+ /** List of workspace members */
+ workspace_members: WorkspaceMember[];
+ };
+};
+
+/** Individual workspace member information */
+export interface WorkspaceMember {
+ /**
+ * Email address of the member
+ * @format email
+ */
+ email: string;
+ /** Unique identifier for the user */
+ user_id: string;
+ /**
+ * Timestamp when the user was added to the workspace
+ * @format date-time
+ */
+ created_at: string;
+ /**
+ * Timestamp when the user was last updated in the workspace
+ * @format date-time
+ */
+ updated_at: string;
+ /** Role assigned to the user in the workspace */
+ workspace_role: WorkspaceRoles;
+}
+
+/** Workspace user information */
+export interface WorkspaceUser {
+ /**
+ * Email address of the user
+ * @format email
+ */
+ user_email: string;
+ /** Unique identifier for the user */
+ user_id: string;
+ /**
+ * Timestamp when the user was added to the workspace
+ * @format date-time
+ */
+ created_at: string;
+ /**
+ * Timestamp when the user was last updated in the workspace
+ * @format date-time
+ */
+ updated_at: string;
+ /** Role assigned to the user in the workspace */
+ workspace_role: WorkspaceRoles;
+}
+
+/** Request body for creating workspace users */
+export interface WorkspaceUserCreate {
+ /** Unique identifier for the user (optional if user_email is provided) */
+ user_id?: string;
+ /**
+ * Email address of the user (optional if user_id is provided)
+ * @format email
+ */
+ user_email?: string;
+ /** Workspace role to assign to the user */
+ workspace_role: WorkspaceRoles;
+}
+
+/** Request body for updating workspace users */
+export interface WorkspaceUserUpdate {
+ /** Unique identifier for the user */
+ user_id?: string;
+ /** New workspace role to assign to the user */
+ workspace_role: WorkspaceRoles;
+}
+
+/** Request body for deleting workspace users */
+export interface WorkspaceUserDelete {
+ /** Unique identifier for the user */
+ user_id: string;
+}
+
type BaseFieldOptionsButton = object;
type BaseFieldOptionsButtonTypeMapping<Key, Type> = {
@@ -1455,6 +1554,127 @@ export class InternalApi<
...params,
}),
+ /**
+ * @description Retrieve metadata for a specific workspace. Optionally include workspace members.
+ *
+ * @tags Workspaces
+ * @name WorkspaceRead
+ * @summary Get workspace metadata
+ * @request GET:/api/v3/meta/workspaces/{workspaceId}
+ */
+ workspaceRead: (
+ workspaceId: string,
+ query?: {
+ /**
+ * Include additional data. Use 'members' to include workspace member information.
+ * @example "members"
+ */
+ include?: 'members' | 'members'[];
+ },
+ params: RequestParams = {},
+ ) =>
+ this.request<Workspace | WorkspaceWithMembers, void>({
+ path: `/api/v3/meta/workspaces/${workspaceId}`,
+ method: 'GET',
+ query: query,
+ format: 'json',
+ ...params,
+ }),
+
+ /**
+ * @description Retrieve a list of members associated with a specific workspace.
+ *
+ * @tags Workspace Members
+ * @name WorkspaceMembersList
+ * @summary List workspace members
+ * @request GET:/api/v3/meta/workspaces/{workspaceId}/members
+ */
+ workspaceMembersList: (workspaceId: string, params: RequestParams = {}) =>
+ this.request<
+ {
+ /** List of workspace members. */
+ list?: WorkspaceUser[];
+ },
+ void
+ >({
+ path: `/api/v3/meta/workspaces/${workspaceId}/members`,
+ method: 'GET',
+ format: 'json',
+ ...params,
+ }),
+
+ /**
+ * @description Add new members to a workspace. The request requires the workspace identifier in the path and member details in the request body.
+ *
+ * @tags Workspace Members
+ * @name WorkspaceMembersInvite
+ * @summary Add workspace members
+ * @request POST:/api/v3/meta/workspaces/{workspaceId}/members
+ */
+ workspaceMembersInvite: (
+ workspaceId: string,
+ data: WorkspaceUserCreate | WorkspaceUserCreate[],
+ params: RequestParams = {},
+ ) =>
+ this.request<WorkspaceUser[], void>({
+ path: `/api/v3/meta/workspaces/${workspaceId}/members`,
+ method: 'POST',
+ body: data,
+ type: ContentType.Json,
+ format: 'json',
+ ...params,
+ }),
+
+ /**
+ * @description Update roles of existing workspace members. The request requires the workspace identifier in the path and member update details in the request body.
+ *
+ * @tags Workspace Members
+ * @name WorkspaceMembersUpdate
+ * @summary Update workspace members
+ * @request PATCH:/api/v3/meta/workspaces/{workspaceId}/members
+ */
+ workspaceMembersUpdate: (
+ workspaceId: string,
+ data: WorkspaceUserUpdate | WorkspaceUserUpdate[],
+ params: RequestParams = {},
+ ) =>
+ this.request<WorkspaceUser[], void>({
+ path: `/api/v3/meta/workspaces/${workspaceId}/members`,
+ method: 'PATCH',
+ body: data,
+ type: ContentType.Json,
+ format: 'json',
+ ...params,
+ }),
+
+ /**
+ * @description Remove members from a workspace. The request requires the workspace identifier in the path and member details in the request body.
+ *
+ * @tags Workspace Members
+ * @name WorkspaceMembersDelete
+ * @summary Delete workspace members
+ * @request DELETE:/api/v3/meta/workspaces/{workspaceId}/members
+ */
+ workspaceMembersDelete: (
+ workspaceId: string,
+ data: WorkspaceUserDelete | WorkspaceUserDelete[],
+ params: RequestParams = {},
+ ) =>
+ this.request<
+ {
+ /** @example "The user has been deleted successfully" */
+ msg?: string;
+ },
+ void
+ >({
+ path: `/api/v3/meta/workspaces/${workspaceId}/members`,
+ method: 'DELETE',
+ body: data,
+ type: ContentType.Json,
+ format: 'json',
+ ...params,
+ }),
+
/**
* @description Retrieve meta details of a specific base using its unique identifier.
*
diff --git a/packages/nocodb/src/schema/swagger-v3.json b/packages/nocodb/src/schema/swagger-v3.json
index e2252af055..0cd3dbc18a 100644
--- a/packages/nocodb/src/schema/swagger-v3.json
+++ b/packages/nocodb/src/schema/swagger-v3.json
@@ -354,24 +354,24 @@
]
},
"examples": {
- "Example 1": {
- "value": {
- "email": "[email protected]",
- "workspace_role": "workspace-level-viewer"
- }
- },
- "Example 2": {
- "value": [
- {
- "email": "[email protected]",
- "workspace_role": "workspace-level-editor"
- },
- {
- "email": "[email protected]",
+ "Example 1": {
+ "value": {
+ "user_email": "[email protected]",
"workspace_role": "workspace-level-viewer"
}
- ]
- }
+ },
+ "Example 2": {
+ "value": [
+ {
+ "user_email": "[email protected]",
+ "workspace_role": "workspace-level-editor"
+ },
+ {
+ "user_email": "[email protected]",
+ "workspace_role": "workspace-level-viewer"
+ }
+ ]
+ }
}
}
}
@@ -434,24 +434,24 @@
]
},
"examples": {
- "Example 1": {
- "value": {
- "id": "user123",
- "workspace_role": "workspace-level-editor"
- }
- },
- "Example 2": {
- "value": [
- {
- "id": "user123",
+ "Example 1": {
+ "value": {
+ "user_id": "user123",
"workspace_role": "workspace-level-editor"
- },
- {
- "id": "user456",
- "workspace_role": "workspace-level-viewer"
}
- ]
- }
+ },
+ "Example 2": {
+ "value": [
+ {
+ "user_id": "user123",
+ "workspace_role": "workspace-level-editor"
+ },
+ {
+ "user_id": "user456",
+ "workspace_role": "workspace-level-viewer"
+ }
+ ]
+ }
}
}
}
@@ -514,21 +514,21 @@
]
},
"examples": {
- "Example 1": {
- "value": {
- "id": "user123"
- }
- },
- "Example 2": {
- "value": [
- {
- "id": "user123"
- },
- {
- "id": "user456"
+ "Example 1": {
+ "value": {
+ "user_id": "user123"
}
- ]
- }
+ },
+ "Example 2": {
+ "value": [
+ {
+ "user_id": "user123"
+ },
+ {
+ "user_id": "user456"
+ }
+ ]
+ }
}
}
}
@@ -7344,7 +7344,7 @@
"type": "object",
"description": "Workspace user information",
"properties": {
- "email": {
+ "user_email": {
"type": "string",
"format": "email",
"description": "Email address of the user"
@@ -7368,20 +7368,20 @@
"description": "Role assigned to the user in the workspace"
}
},
- "required": ["email", "user_id", "created_at", "updated_at", "workspace_role"]
+ "required": ["user_email", "user_id", "created_at", "updated_at", "workspace_role"]
},
"WorkspaceUserCreate": {
"type": "object",
"description": "Request body for creating workspace users",
"properties": {
- "id": {
+ "user_id": {
"type": "string",
- "description": "Unique identifier for the user (optional if email is provided)"
+ "description": "Unique identifier for the user (optional if user_email is provided)"
},
- "email": {
+ "user_email": {
"type": "string",
"format": "email",
- "description": "Email address of the user (optional if id is provided)"
+ "description": "Email address of the user (optional if user_id is provided)"
},
"workspace_role": {
"$ref": "#/components/schemas/WorkspaceRoles",
@@ -7394,14 +7394,9 @@
"type": "object",
"description": "Request body for updating workspace users",
"properties": {
- "id": {
- "type": "string",
- "description": "Unique identifier for the user (optional if email is provided)"
- },
- "email": {
+ "user_id": {
"type": "string",
- "format": "email",
- "description": "Email address of the user (optional if id is provided)"
+ "description": "Unique identifier for the user"
},
"workspace_role": {
"$ref": "#/components/schemas/WorkspaceRoles",
@@ -7414,16 +7409,12 @@
"type": "object",
"description": "Request body for deleting workspace users",
"properties": {
- "id": {
- "type": "string",
- "description": "Unique identifier for the user (optional if email is provided)"
- },
- "email": {
+ "user_id": {
"type": "string",
- "format": "email",
- "description": "Email address of the user (optional if id is provided)"
+ "description": "Unique identifier for the user"
}
- }
+ },
+ "required": ["user_id"]
},
"WorkspaceRoles": {
"type": "string",