Skip to content

Commit 9dac7c2

Browse files
authored
Merge pull request #757 from airweave-ai/fix/sdk-naming
fix/SDK
2 parents 66aeaf3 + 240d1af commit 9dac7c2

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed

backend/airweave/api/v1/endpoints/collections.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"Finance data collection",
3636
),
3737
)
38-
async def list_collections(
38+
async def list(
3939
skip: int = Query(0, description="Number of collections to skip for pagination"),
4040
limit: int = Query(
4141
100, description="Maximum number of collections to return (1-1000)", le=1000, ge=1
@@ -55,7 +55,7 @@ async def list_collections(
5555

5656

5757
@router.post("/", response_model=schemas.Collection)
58-
async def create_collection(
58+
async def create(
5959
collection: schemas.CollectionCreate,
6060
db: AsyncSession = Depends(deps.get_db),
6161
ctx: ApiContext = Depends(deps.get_context),
@@ -79,7 +79,7 @@ async def create_collection(
7979

8080

8181
@router.get("/{readable_id}", response_model=schemas.Collection)
82-
async def get_collection(
82+
async def get(
8383
readable_id: str = Path(
8484
...,
8585
description="The unique readable identifier of the collection (e.g., 'finance-data-ab123')",
@@ -95,7 +95,7 @@ async def get_collection(
9595

9696

9797
@router.put("/{readable_id}", response_model=schemas.Collection)
98-
async def update_collection(
98+
async def update(
9999
collection: schemas.CollectionUpdate,
100100
readable_id: str = Path(
101101
..., description="The unique readable identifier of the collection to update"
@@ -116,7 +116,7 @@ async def update_collection(
116116

117117

118118
@router.delete("/{readable_id}", response_model=schemas.Collection)
119-
async def delete_collection(
119+
async def delete(
120120
readable_id: str = Path(
121121
..., description="The unique readable identifier of the collection to delete"
122122
),
@@ -158,7 +158,7 @@ async def delete_collection(
158158
response_model=schemas.SearchResponse,
159159
responses=create_search_response("raw_results", "Raw search results with metadata"),
160160
)
161-
async def search_collection(
161+
async def search(
162162
readable_id: str = Path(
163163
..., description="The unique readable identifier of the collection to search"
164164
),
@@ -257,7 +257,7 @@ async def search_collection(
257257
response_model=schemas.SearchResponse,
258258
responses=create_search_response("completion_response", "Search with AI-generated completion"),
259259
)
260-
async def search_collection_advanced(
260+
async def search_advanced(
261261
readable_id: str = Path(
262262
..., description="The unique readable identifier of the collection to search"
263263
),
@@ -338,7 +338,7 @@ async def search_collection_advanced(
338338

339339
@router.post(
340340
"/{readable_id}/refresh_all",
341-
response_model=list[schemas.SourceConnectionJob],
341+
response_model=List[schemas.SourceConnectionJob],
342342
responses=create_job_list_response(["completed"], "Multiple sync jobs triggered"),
343343
)
344344
async def refresh_all_source_connections(
@@ -351,7 +351,7 @@ async def refresh_all_source_connections(
351351
guard_rail: GuardRailService = Depends(deps.get_guard_rail_service),
352352
background_tasks: BackgroundTasks,
353353
logger: ContextualLogger = Depends(deps.get_logger),
354-
) -> list[schemas.SourceConnectionJob]:
354+
) -> List[schemas.SourceConnectionJob]:
355355
"""Trigger data synchronization for all source connections in the collection.
356356
357357
The sync jobs run asynchronously in the background, so this endpoint

backend/airweave/api/v1/endpoints/source_connections.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
["engineering_docs"], "Multiple source connections across collections"
3636
),
3737
)
38-
async def list_source_connections(
38+
async def list(
3939
*,
4040
db: AsyncSession = Depends(deps.get_db),
4141
collection: Optional[str] = Query(
@@ -69,7 +69,7 @@ async def list_source_connections(
6969

7070

7171
@router.get("/{source_connection_id}", response_model=schemas.SourceConnection)
72-
async def get_source_connection(
72+
async def get(
7373
*,
7474
db: AsyncSession = Depends(deps.get_db),
7575
source_connection_id: UUID = Path(
@@ -91,7 +91,7 @@ async def get_source_connection(
9191

9292

9393
@router.post("/", response_model=schemas.SourceConnection)
94-
async def create_source_connection(
94+
async def create(
9595
*,
9696
db: AsyncSession = Depends(deps.get_db),
9797
source_connection_in: schemas.SourceConnectionCreate = Body(...),
@@ -219,7 +219,7 @@ async def create_source_connection(
219219

220220

221221
@router.post("/internal/", response_model=schemas.SourceConnection)
222-
async def create_source_connection_with_credential(
222+
async def create_with_credential(
223223
*,
224224
db: AsyncSession = Depends(deps.get_db),
225225
source_connection_in: schemas.SourceConnectionCreateWithCredential = Body(...),
@@ -534,7 +534,7 @@ async def _create_minute_level_schedule(
534534

535535

536536
@router.post("/continuous", response_model=schemas.SourceConnectionContinuousResponse)
537-
async def create_continuous_source_connection_BETA(
537+
async def create_continuous_BETA(
538538
*,
539539
db: AsyncSession = Depends(deps.get_db),
540540
source_connection_in: schemas.SourceConnectionCreateContinuous = Body(...),
@@ -769,7 +769,7 @@ async def create_continuous_source_connection_BETA(
769769

770770

771771
@router.put("/{source_connection_id}", response_model=schemas.SourceConnection)
772-
async def update_source_connection(
772+
async def update(
773773
*,
774774
db: AsyncSession = Depends(deps.get_db),
775775
source_connection_id: UUID = Path(
@@ -792,7 +792,7 @@ async def update_source_connection(
792792

793793

794794
@router.delete("/{source_connection_id}", response_model=schemas.SourceConnection)
795-
async def delete_source_connection(
795+
async def delete(
796796
*,
797797
db: AsyncSession = Depends(deps.get_db),
798798
source_connection_id: UUID = Path(
@@ -820,7 +820,7 @@ async def delete_source_connection(
820820
response_model=schemas.SourceConnectionJob,
821821
responses=create_single_job_response("completed", "Sync job successfully triggered"),
822822
)
823-
async def run_source_connection(
823+
async def run(
824824
*,
825825
db: AsyncSession = Depends(deps.get_db),
826826
source_connection_id: UUID = Path(
@@ -918,7 +918,7 @@ async def run_source_connection(
918918
response_model=List[schemas.SourceConnectionJob],
919919
responses=create_job_list_response(["completed"], "Complete sync job history"),
920920
)
921-
async def list_source_connection_jobs(
921+
async def list_jobs(
922922
*,
923923
db: AsyncSession = Depends(deps.get_db),
924924
source_connection_id: UUID = Path(
@@ -941,7 +941,7 @@ async def list_source_connection_jobs(
941941
response_model=schemas.SourceConnectionJob,
942942
responses=create_single_job_response("completed", "Detailed sync job information"),
943943
)
944-
async def get_source_connection_job(
944+
async def get_job(
945945
*,
946946
db: AsyncSession = Depends(deps.get_db),
947947
source_connection_id: UUID = Path(
@@ -962,7 +962,7 @@ async def get_source_connection_job(
962962
response_model=schemas.SourceConnectionJob,
963963
responses=create_single_job_response("cancelled", "Successfully cancelled sync job"),
964964
)
965-
async def cancel_source_connection_job(
965+
async def cancel_job(
966966
*,
967967
db: AsyncSession = Depends(deps.get_db),
968968
source_connection_id: UUID = Path(

backend/airweave/api/v1/endpoints/sources.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""The API module that contains the endpoints for sources."""
22

3+
from typing import List
4+
35
from fastapi import Depends, HTTPException, Path
46
from sqlalchemy.ext.asyncio import AsyncSession
57

@@ -22,7 +24,7 @@
2224
"github", "Source details with authentication and configuration schemas"
2325
),
2426
)
25-
async def read_source(
27+
async def read(
2628
*,
2729
db: AsyncSession = Depends(deps.get_db),
2830
short_name: str = Path(
@@ -97,16 +99,16 @@ async def read_source(
9799

98100
@router.get(
99101
"/list",
100-
response_model=list[schemas.Source],
102+
response_model=List[schemas.Source],
101103
responses=create_source_list_response(
102104
["github"], "List of all available data source connectors"
103105
),
104106
)
105-
async def read_sources(
107+
async def list(
106108
*,
107109
db: AsyncSession = Depends(deps.get_db),
108110
ctx: ApiContext = Depends(deps.get_context),
109-
) -> list[schemas.Source]:
111+
) -> List[schemas.Source]:
110112
"""List all available data source connectors.
111113
112114
<br/><br/>

0 commit comments

Comments
 (0)