Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/uipath-core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-core"
version = "0.5.22"
version = "0.5.23"
description = "UiPath Core abstractions"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
24 changes: 23 additions & 1 deletion packages/uipath-core/src/uipath/core/workspace/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Protocol, runtime_checkable
from typing import Protocol, overload, runtime_checkable
from uuid import UUID


Expand All @@ -20,6 +20,28 @@ async def download_async(
) -> str:
"""Download an attachment to a local path."""

# Overloads mirror the concrete AttachmentsService: content XOR source_path,
# so the real service is a structural subtype of this protocol.
@overload
async def upload_async(
self,
*,
name: str,
content: str | bytes,
folder_key: str | None = None,
folder_path: str | None = None,
) -> UUID: ...

@overload
async def upload_async(
self,
*,
name: str,
source_path: str,
folder_key: str | None = None,
folder_path: str | None = None,
) -> UUID: ...

async def upload_async(
self,
*,
Expand Down
2 changes: 1 addition & 1 deletion packages/uipath-core/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1193,3 +1193,17 @@ async def test_open_async_write_mode(
assert upload_request is not None
assert upload_request.method == "PUT"
assert upload_request.url == blob_uri_response["BlobFileAccess"]["Uri"]


def test_attachments_service_conforms_to_attachments_protocol(
service: AttachmentsService,
) -> None:
"""AttachmentsService must satisfy AttachmentsProtocol (workspace hydration).

The static annotation makes mypy verify the upload_async overloads line up;
the isinstance check covers the runtime_checkable contract.
"""
from uipath.core.workspace import AttachmentsProtocol

conforming: AttachmentsProtocol = service
assert isinstance(conforming, AttachmentsProtocol)
2 changes: 1 addition & 1 deletion packages/uipath-platform/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/uipath/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading