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 pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath_sdk"
version = "0.0.2"
version = "0.0.3"
description = "UiPath Client for the UiPath API"
readme = "README.md"
requires-python = ">=3.13"
Expand Down
4 changes: 3 additions & 1 deletion src/uipath_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from ._uipath_client import UiPathClient as UiPathClient
from ._uipath_sdk import UiPathSDK

__all__ = ["UiPathSDK"]
61 changes: 0 additions & 61 deletions src/uipath_sdk/_assets_service.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
load_dotenv()


class UiPathClientConfig(metaclass=SingletonMeta):
class Config(metaclass=SingletonMeta):
def __init__(self) -> None:
self._uipath_url = self._get_env_var("UIPATH_URL")
self._account_name = self._get_env_var("UIPATH_ACCOUNT_NAME")
Expand Down
3 changes: 3 additions & 0 deletions src/uipath_sdk/_models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .assets import UserAsset

__all__ = ["UserAsset"]
23 changes: 23 additions & 0 deletions src/uipath_sdk/_models/assets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from typing import TypedDict


class CredentialsConnectionData(TypedDict):
url: str
body: str
bearerToken: str


class UserAsset(TypedDict):
Name: str
Value: str
ValueType: str
StringValue: str
BoolValue: bool
IntValue: int
CredentialUsername: str
CredentialPassword: str
ExternalName: str
CredentialStoreId: int
KeyValueList: list[dict[str, str]]
ConnectionData: CredentialsConnectionData
Id: int
4 changes: 4 additions & 0 deletions src/uipath_sdk/_services/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .assets_service import RobotAssetsService
from .processes_service import ProcessesService

__all__ = ["RobotAssetsService", "ProcessesService"]
48 changes: 48 additions & 0 deletions src/uipath_sdk/_services/assets_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from typing import cast

from httpx import Response

from .._models import UserAsset
from ._base_service import BaseService


class RobotAssetsService(BaseService):
def retrieve(
self,
assetName: str,
robotKey: str,
) -> UserAsset:
endpoint = "/orchestrator_/odata/Assets/UiPath.Server.Configuration.OData.GetRobotAssetByNameForRobotKey"
content = str(
{
"assetName": assetName,
"robotKey": robotKey,
"supportsCredentialsProxyDisconnected": True,
}
)

return cast(
UserAsset,
self.client.post(
endpoint,
content=content,
).json(),
)

def update(
self,
robotKey: str,
robotAsset: UserAsset,
) -> Response:
endpoint = "/orchestrator_/odata/Assets/UiPath.Server.Configuration.OData.SetRobotAssetByRobotKey"
content = str(
{
"robotKey": robotKey,
"robotAsset": robotAsset,
}
)

return self.client.post(
endpoint,
content=content,
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

class ProcessesService(BaseService):
def invoke_process(self, release_key: str) -> Response:
endpoint = (
"/orchestrator_/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs"
)
content = str({"startInfo": {"ReleaseKey": release_key}})

return self.client.post(
"/orchestrator_/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs",
content=str({"startInfo": {"ReleaseKey": release_key}}),
endpoint,
content=content,
)
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from httpx import Client, Headers

from ._assets_service import RobotAssetsService
from ._processes_service import ProcessesService
from ._uipath_client_config import UiPathClientConfig
from ._config import Config
from ._services import ProcessesService, RobotAssetsService


class UiPathClient:
class UiPathSDK:
def __init__(self, secret: str | None) -> None:
self.config = UiPathClientConfig()
self.config = Config()

if secret is not None:
self.config.secret = secret
Expand Down
3 changes: 3 additions & 0 deletions src/uipath_sdk/_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .singleton import SingletonMeta

__all__ = ["SingletonMeta"]
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ def __call__(cls, *args: tuple[Any, ...], **kwargs: dict[str, Any]) -> type:
instance = super().__call__(*args, **kwargs)
cls._instances[cls] = instance
return cls._instances[cls]


# TODO: add utils for retry