Skip to content

Commit 664c8c9

Browse files
committed
add create project api call
1 parent c5b593b commit 664c8c9

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

nocodb/api.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44

55
class NocoDBAPIUris(Enum):
66
V1_DB_DATA_PREFIX = "api/v1/db/data"
7+
V1_DB_META_PREFIX = "api/v1/db/meta"
78

89

910
class NocoDBAPI:
1011
def __init__(self, base_uri: str):
1112
self.__base_data_uri = (
1213
f"{base_uri}/{NocoDBAPIUris.V1_DB_DATA_PREFIX.value}"
1314
)
15+
self.__base_meta_uri = (
16+
f"{base_uri}/{NocoDBAPIUris.V1_DB_META_PREFIX.value}"
17+
)
1418

1519
def get_table_uri(self, project: NocoDBProject, table: str) -> str:
1620
return "/".join(
@@ -54,3 +58,13 @@ def get_nested_relations_rows_list_uri(
5458
column_name,
5559
)
5660
)
61+
62+
def get_project_uri(
63+
self,
64+
) -> str:
65+
return "/".join(
66+
(
67+
self.__base_meta_uri,
68+
"projects"
69+
)
70+
)

nocodb/infra/requests_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,11 @@ def table_row_nested_relations_list(
7676
project, table, relation_type, row_id, column_name
7777
)
7878
).json()
79+
80+
def project_create(
81+
self,
82+
body
83+
):
84+
return self.__session.post(
85+
self.__api_info.get_project_uri(), json=body
86+
).json()

0 commit comments

Comments
 (0)