From 45271fa46e5701770b65aab55c96fb4303d1f02f Mon Sep 17 00:00:00 2001 From: Nathan Thorpe Date: Wed, 21 May 2025 11:16:30 -0700 Subject: [PATCH] add tags to create dataset --- cirro_api_client/v1/models/dataset_detail.py | 8 ++++ .../v1/models/import_data_request.py | 47 ++++++++++++++++++- .../v1/models/upload_dataset_request.py | 47 ++++++++++++++++++- pyproject.toml | 2 +- 4 files changed, 101 insertions(+), 3 deletions(-) diff --git a/cirro_api_client/v1/models/dataset_detail.py b/cirro_api_client/v1/models/dataset_detail.py index 93083e1..b99d906 100644 --- a/cirro_api_client/v1/models/dataset_detail.py +++ b/cirro_api_client/v1/models/dataset_detail.py @@ -30,6 +30,7 @@ class DatasetDetail: project_id (str): source_dataset_ids (List[str]): source_datasets (List['NamedItem']): + source_sample_ids (List[str]): status (Status): status_message (str): tags (List['Tag']): @@ -50,6 +51,7 @@ class DatasetDetail: project_id: str source_dataset_ids: List[str] source_datasets: List["NamedItem"] + source_sample_ids: List[str] status: Status status_message: str tags: List["Tag"] @@ -84,6 +86,8 @@ def to_dict(self) -> Dict[str, Any]: source_datasets_item = source_datasets_item_data.to_dict() source_datasets.append(source_datasets_item) + source_sample_ids = self.source_sample_ids + status = self.status.value status_message = self.status_message @@ -125,6 +129,7 @@ def to_dict(self) -> Dict[str, Any]: "projectId": project_id, "sourceDatasetIds": source_dataset_ids, "sourceDatasets": source_datasets, + "sourceSampleIds": source_sample_ids, "status": status, "statusMessage": status_message, "tags": tags, @@ -170,6 +175,8 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: source_datasets.append(source_datasets_item) + source_sample_ids = cast(List[str], d.pop("sourceSampleIds")) + status = Status(d.pop("status")) status_message = d.pop("statusMessage") @@ -219,6 +226,7 @@ def _parse_share(data: object) -> Union["NamedItem", None, Unset]: project_id=project_id, source_dataset_ids=source_dataset_ids, source_datasets=source_datasets, + source_sample_ids=source_sample_ids, status=status, status_message=status_message, tags=tags, diff --git a/cirro_api_client/v1/models/import_data_request.py b/cirro_api_client/v1/models/import_data_request.py index 5ef5e2e..c8c3c92 100644 --- a/cirro_api_client/v1/models/import_data_request.py +++ b/cirro_api_client/v1/models/import_data_request.py @@ -1,10 +1,14 @@ -from typing import Any, Dict, List, Type, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset +if TYPE_CHECKING: + from ..models.tag import Tag + + T = TypeVar("T", bound="ImportDataRequest") @@ -15,11 +19,13 @@ class ImportDataRequest: name (str): Name of the dataset public_ids (List[str]): description (Union[Unset, str]): Description of the dataset + tags (Union[List['Tag'], None, Unset]): List of tags to apply to the dataset """ name: str public_ids: List[str] description: Union[Unset, str] = UNSET + tags: Union[List["Tag"], None, Unset] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: @@ -29,6 +35,18 @@ def to_dict(self) -> Dict[str, Any]: description = self.description + tags: Union[List[Dict[str, Any]], None, Unset] + if isinstance(self.tags, Unset): + tags = UNSET + elif isinstance(self.tags, list): + tags = [] + for tags_type_0_item_data in self.tags: + tags_type_0_item = tags_type_0_item_data.to_dict() + tags.append(tags_type_0_item) + + else: + tags = self.tags + field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -39,11 +57,15 @@ def to_dict(self) -> Dict[str, Any]: ) if description is not UNSET: field_dict["description"] = description + if tags is not UNSET: + field_dict["tags"] = tags return field_dict @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.tag import Tag + d = src_dict.copy() name = d.pop("name") @@ -51,10 +73,33 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: description = d.pop("description", UNSET) + def _parse_tags(data: object) -> Union[List["Tag"], None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + tags_type_0 = [] + _tags_type_0 = data + for tags_type_0_item_data in _tags_type_0: + tags_type_0_item = Tag.from_dict(tags_type_0_item_data) + + tags_type_0.append(tags_type_0_item) + + return tags_type_0 + except: # noqa: E722 + pass + return cast(Union[List["Tag"], None, Unset], data) + + tags = _parse_tags(d.pop("tags", UNSET)) + import_data_request = cls( name=name, public_ids=public_ids, description=description, + tags=tags, ) import_data_request.additional_properties = d diff --git a/cirro_api_client/v1/models/upload_dataset_request.py b/cirro_api_client/v1/models/upload_dataset_request.py index 58a73f0..edce7fc 100644 --- a/cirro_api_client/v1/models/upload_dataset_request.py +++ b/cirro_api_client/v1/models/upload_dataset_request.py @@ -1,10 +1,14 @@ -from typing import Any, Dict, List, Type, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset +if TYPE_CHECKING: + from ..models.tag import Tag + + T = TypeVar("T", bound="UploadDatasetRequest") @@ -16,12 +20,14 @@ class UploadDatasetRequest: process_id (str): ID of the ingest process Example: paired_dnaseq. expected_files (List[str]): description (Union[Unset, str]): Description of the dataset + tags (Union[List['Tag'], None, Unset]): List of tags to apply to the dataset """ name: str process_id: str expected_files: List[str] description: Union[Unset, str] = UNSET + tags: Union[List["Tag"], None, Unset] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: @@ -33,6 +39,18 @@ def to_dict(self) -> Dict[str, Any]: description = self.description + tags: Union[List[Dict[str, Any]], None, Unset] + if isinstance(self.tags, Unset): + tags = UNSET + elif isinstance(self.tags, list): + tags = [] + for tags_type_0_item_data in self.tags: + tags_type_0_item = tags_type_0_item_data.to_dict() + tags.append(tags_type_0_item) + + else: + tags = self.tags + field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -44,11 +62,15 @@ def to_dict(self) -> Dict[str, Any]: ) if description is not UNSET: field_dict["description"] = description + if tags is not UNSET: + field_dict["tags"] = tags return field_dict @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.tag import Tag + d = src_dict.copy() name = d.pop("name") @@ -58,11 +80,34 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: description = d.pop("description", UNSET) + def _parse_tags(data: object) -> Union[List["Tag"], None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + tags_type_0 = [] + _tags_type_0 = data + for tags_type_0_item_data in _tags_type_0: + tags_type_0_item = Tag.from_dict(tags_type_0_item_data) + + tags_type_0.append(tags_type_0_item) + + return tags_type_0 + except: # noqa: E722 + pass + return cast(Union[List["Tag"], None, Unset], data) + + tags = _parse_tags(d.pop("tags", UNSET)) + upload_dataset_request = cls( name=name, process_id=process_id, expected_files=expected_files, description=description, + tags=tags, ) upload_dataset_request.additional_properties = d diff --git a/pyproject.toml b/pyproject.toml index a9023aa..9461b0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cirro_api_client" -version = "1.0.1" +version = "1.0.2" description = "A client library for accessing Cirro" authors = ["Cirro "] license = "MIT"