diff --git a/frontend/src/gen/api.ts b/frontend/src/gen/api.ts index 35c37369..da4ef0bd 100644 --- a/frontend/src/gen/api.ts +++ b/frontend/src/gen/api.ts @@ -1259,6 +1259,40 @@ export interface paths { patch?: never; trace?: never; }; + "/kclips/create": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Create Kclip */ + post: operations["create_kclip_kclips_create_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/kclips/{kclip_id}/complete": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Complete Upload */ + post: operations["complete_upload_kclips__kclip_id__complete_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; } export type webhooks = Record; export interface components { @@ -1350,6 +1384,20 @@ export interface components { /** Client Id */ client_id: string; }; + /** CompletedKClipUploadRequest */ + CompletedKClipUploadRequest: { + /** Kclip Id */ + kclip_id: string; + /** Upload Id */ + upload_id: string; + /** Parts */ + parts: components["schemas"]["KClipPartCompleted"][]; + }; + /** CompletedKClipUploadResponse */ + CompletedKClipUploadResponse: { + /** Status */ + status: string; + }; /** CreateCheckoutSessionRequest */ CreateCheckoutSessionRequest: { /** Listing Id */ @@ -1371,6 +1419,19 @@ export interface components { /** Account Id */ account_id: string; }; + /** CreateKClipRequest */ + CreateKClipRequest: { + /** Name */ + name: string; + /** Robot Id */ + robot_id: string; + /** Description */ + description?: string | null; + /** File Size */ + file_size?: number | null; + /** Part Size */ + part_size?: number | null; + }; /** CreateRefundsRequest */ CreateRefundsRequest: { /** Payment Intent Id */ @@ -1510,6 +1571,16 @@ export interface components { /** Detail */ detail?: components["schemas"]["ValidationError"][]; }; + /** + * KClipPartCompleted + * @description Represents a completed part in a multipart upload. + */ + KClipPartCompleted: { + /** Part Number */ + part_number: number; + /** Etag */ + etag: string; + }; /** KeysResponseItem */ KeysResponseItem: { /** Token */ @@ -1660,6 +1731,22 @@ export interface components { /** Token */ token: string; }; + /** + * MultipartUploadDetails + * @description Details needed for multipart upload. + */ + MultipartUploadDetails: { + /** Upload Id */ + upload_id: string; + /** Presigned Urls */ + presigned_urls: { + [key: string]: string | number; + }[]; + /** Bucket */ + bucket: string; + /** Key */ + key: string; + }; /** MyUserInfoResponse */ MyUserInfoResponse: { /** User Id */ @@ -1682,6 +1769,12 @@ export interface components { bio: string | null; stripe_connect: components["schemas"]["UserStripeConnect"] | null; }; + /** NewKClipResponse */ + NewKClipResponse: { + /** Kclip Id */ + kclip_id: string; + upload_details: components["schemas"]["MultipartUploadDetails"]; + }; /** NewKeyRequest */ NewKeyRequest: { /** @@ -4374,4 +4467,70 @@ export interface operations { }; }; }; + create_kclip_kclips_create_post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreateKClipRequest"]; + }; + }; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["NewKClipResponse"]; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + complete_upload_kclips__kclip_id__complete_post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CompletedKClipUploadRequest"]; + }; + }; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CompletedKClipUploadResponse"]; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; } diff --git a/store/app/crud/base.py b/store/app/crud/base.py index 5a85ede9..760c1be6 100644 --- a/store/app/crud/base.py +++ b/store/app/crud/base.py @@ -11,7 +11,6 @@ Literal, Self, Sequence, - TypedDict, TypeVar, overload, ) @@ -26,6 +25,7 @@ CompletedPartTypeDef, CreateMultipartUploadOutputTypeDef, ) +from typing_extensions import TypedDict from store.app.errors import InternalError, ItemNotFoundError from store.app.model import StoreBaseModel diff --git a/store/app/crud/kclips.py b/store/app/crud/kclips.py index 45cf9515..00430939 100644 --- a/store/app/crud/kclips.py +++ b/store/app/crud/kclips.py @@ -1,6 +1,6 @@ """Defines the CRUD interface for handling user-uploaded KClips.""" -from typing import TypedDict +from typing_extensions import TypedDict from store.app.crud.base import BaseCrud, MultipartUploadDetails, MultipartUploadPart from store.app.model import KClip diff --git a/store/app/main.py b/store/app/main.py index 467dfde0..6ce1eef2 100644 --- a/store/app/main.py +++ b/store/app/main.py @@ -23,6 +23,7 @@ ) from store.app.routers.artifacts import router as artifacts_router from store.app.routers.auth import router as auth_router +from store.app.routers.kclips import router as kclips_router from store.app.routers.keys import router as keys_router from store.app.routers.listings import router as listings_router from store.app.routers.onshape import router as onshape_router @@ -189,6 +190,7 @@ async def validate_auth_token(auth_token: str = Depends(api_key_header)) -> str: app.include_router(stripe_router, prefix="/stripe", tags=["stripe"]) app.include_router(users_router, prefix="/users", tags=["users"]) app.include_router(teleop_router, prefix="/teleop", tags=["teleop"]) +app.include_router(kclips_router, prefix="/kclips", tags=["kclips"]) # For running with debugger if __name__ == "__main__":