benchling-sdk 1.21.2__py3-none-any.whl → 1.22.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- benchling_sdk/apps/canvas/types.py +8 -0
- benchling_sdk/benchling.py +88 -12
- benchling_sdk/helpers/task_helpers.py +5 -5
- benchling_sdk/models/__init__.py +1335 -329
- benchling_sdk/models/webhooks/v0/__init__.py +24 -4
- benchling_sdk/services/v2/stable/aa_sequence_service.py +4 -0
- benchling_sdk/services/v2/{beta/v2_beta_audit_service.py → stable/audit_service.py} +6 -6
- benchling_sdk/services/v2/stable/box_service.py +4 -0
- benchling_sdk/services/v2/stable/connect_service.py +79 -0
- benchling_sdk/services/v2/stable/container_service.py +4 -0
- benchling_sdk/services/v2/stable/custom_entity_service.py +4 -0
- benchling_sdk/services/v2/stable/data_frame_service.py +323 -0
- benchling_sdk/services/v2/stable/dataset_service.py +192 -0
- benchling_sdk/services/v2/stable/dna_oligo_service.py +4 -0
- benchling_sdk/services/v2/stable/dna_sequence_service.py +4 -0
- benchling_sdk/services/v2/stable/file_service.py +191 -0
- benchling_sdk/services/v2/stable/{request_service.py → legacy_request_service.py} +25 -25
- benchling_sdk/services/v2/stable/location_service.py +4 -0
- benchling_sdk/services/v2/stable/mixture_service.py +4 -0
- benchling_sdk/services/v2/stable/molecule_service.py +4 -0
- benchling_sdk/services/v2/stable/nucleotide_alignments_service.py +4 -0
- benchling_sdk/services/v2/stable/plate_service.py +4 -0
- benchling_sdk/services/v2/stable/rna_oligo_service.py +4 -0
- benchling_sdk/services/v2/stable/rna_sequence_service.py +4 -0
- benchling_sdk/services/v2/stable/task_service.py +1 -7
- benchling_sdk/services/v2/stable/test_order_service.py +145 -0
- benchling_sdk/services/v2/v2_beta_service.py +0 -14
- benchling_sdk/services/v2/v2_stable_service.py +101 -14
- {benchling_sdk-1.21.2.dist-info → benchling_sdk-1.22.0.dist-info}/METADATA +2 -2
- {benchling_sdk-1.21.2.dist-info → benchling_sdk-1.22.0.dist-info}/RECORD +32 -27
- {benchling_sdk-1.21.2.dist-info → benchling_sdk-1.22.0.dist-info}/LICENSE +0 -0
- {benchling_sdk-1.21.2.dist-info → benchling_sdk-1.22.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,192 @@
|
|
1
|
+
from typing import Iterable, List, Optional
|
2
|
+
|
3
|
+
from benchling_api_client.v2.stable.api.datasets import (
|
4
|
+
archive_datasets as api_client_archive_datasets,
|
5
|
+
create_dataset,
|
6
|
+
get_dataset,
|
7
|
+
list_datasets,
|
8
|
+
unarchive_datasets,
|
9
|
+
update_dataset,
|
10
|
+
)
|
11
|
+
from benchling_api_client.v2.stable.models.dataset import Dataset
|
12
|
+
from benchling_api_client.v2.stable.models.dataset_create import DatasetCreate
|
13
|
+
from benchling_api_client.v2.stable.models.dataset_update import DatasetUpdate
|
14
|
+
from benchling_api_client.v2.stable.models.datasets_archival_change import DatasetsArchivalChange
|
15
|
+
from benchling_api_client.v2.stable.models.datasets_archive import DatasetsArchive
|
16
|
+
from benchling_api_client.v2.stable.models.datasets_archive_reason import DatasetsArchiveReason
|
17
|
+
from benchling_api_client.v2.stable.models.datasets_paginated_list import DatasetsPaginatedList
|
18
|
+
from benchling_api_client.v2.stable.models.datasets_unarchive import DatasetsUnarchive
|
19
|
+
from benchling_api_client.v2.types import Response
|
20
|
+
|
21
|
+
from benchling_sdk.errors import raise_for_status
|
22
|
+
from benchling_sdk.helpers.decorators import api_method
|
23
|
+
from benchling_sdk.helpers.pagination_helpers import NextToken, PageIterator
|
24
|
+
from benchling_sdk.helpers.response_helpers import model_from_detailed
|
25
|
+
from benchling_sdk.helpers.serialization_helpers import none_as_unset
|
26
|
+
from benchling_sdk.models import ListDatasetsSort
|
27
|
+
from benchling_sdk.services.v2.base_service import BaseService
|
28
|
+
|
29
|
+
|
30
|
+
class DatasetService(BaseService):
|
31
|
+
"""
|
32
|
+
Datasets.
|
33
|
+
|
34
|
+
Similar to Data frames, datasets in Benchling represent tabular data that is not schematized. Datasets are
|
35
|
+
saved to folders within Benchling with additional metadata, making them accessible and searchable within
|
36
|
+
Benchling. Each dataset actually contains a data frame, and a data frame is required to create a dataset.
|
37
|
+
|
38
|
+
See https://benchling.com/api/v2/reference#/Datasets
|
39
|
+
"""
|
40
|
+
|
41
|
+
@api_method
|
42
|
+
def get_by_id(self, dataset_id: str) -> Dataset:
|
43
|
+
"""
|
44
|
+
Get a dataset.
|
45
|
+
|
46
|
+
See https://benchling.com/api/v2/reference#/Datasets/getDataset
|
47
|
+
"""
|
48
|
+
response = get_dataset.sync_detailed(client=self.client, dataset_id=dataset_id)
|
49
|
+
return model_from_detailed(response)
|
50
|
+
|
51
|
+
@api_method
|
52
|
+
def archive_datasets(
|
53
|
+
self, dataset_ids: Iterable[str], reason: DatasetsArchiveReason
|
54
|
+
) -> DatasetsArchivalChange:
|
55
|
+
"""
|
56
|
+
Archive Datasets.
|
57
|
+
|
58
|
+
See https://benchling.com/api/reference#/Datasets/archiveDatasets
|
59
|
+
"""
|
60
|
+
archive_request = DatasetsArchive(reason=reason, dataset_ids=list(dataset_ids))
|
61
|
+
response = api_client_archive_datasets.sync_detailed(
|
62
|
+
client=self.client,
|
63
|
+
json_body=archive_request,
|
64
|
+
)
|
65
|
+
return model_from_detailed(response)
|
66
|
+
|
67
|
+
@api_method
|
68
|
+
def create(self, dataset: DatasetCreate) -> Dataset:
|
69
|
+
"""
|
70
|
+
Create a dataset.
|
71
|
+
|
72
|
+
See https://benchling.com/api/v2/reference#/Datasets/createDataset
|
73
|
+
"""
|
74
|
+
response = create_dataset.sync_detailed(client=self.client, json_body=dataset)
|
75
|
+
return model_from_detailed(response)
|
76
|
+
|
77
|
+
@api_method
|
78
|
+
def _datasets_page(
|
79
|
+
self,
|
80
|
+
page_size: Optional[int] = 50,
|
81
|
+
next_token: Optional[str] = None,
|
82
|
+
sort: Optional[ListDatasetsSort] = ListDatasetsSort.MODIFIEDAT,
|
83
|
+
archive_reason: Optional[str] = None,
|
84
|
+
created_at: Optional[str] = None,
|
85
|
+
creator_ids: Optional[str] = None,
|
86
|
+
folder_id: Optional[str] = None,
|
87
|
+
mentioned_in: Optional[str] = None,
|
88
|
+
modified_at: Optional[str] = None,
|
89
|
+
name: Optional[str] = None,
|
90
|
+
name_includes: Optional[str] = None,
|
91
|
+
namesany_ofcase_sensitive: Optional[str] = None,
|
92
|
+
namesany_of: Optional[str] = None,
|
93
|
+
origin_ids: Optional[str] = None,
|
94
|
+
ids: Optional[str] = None,
|
95
|
+
display_ids: Optional[str] = None,
|
96
|
+
returning: Optional[str] = None,
|
97
|
+
) -> Response[DatasetsPaginatedList]:
|
98
|
+
response = list_datasets.sync_detailed(
|
99
|
+
client=self.client,
|
100
|
+
page_size=none_as_unset(page_size),
|
101
|
+
next_token=none_as_unset(next_token),
|
102
|
+
sort=none_as_unset(sort),
|
103
|
+
archive_reason=none_as_unset(archive_reason),
|
104
|
+
created_at=none_as_unset(created_at),
|
105
|
+
creator_ids=none_as_unset(creator_ids),
|
106
|
+
folder_id=none_as_unset(folder_id),
|
107
|
+
mentioned_in=none_as_unset(mentioned_in),
|
108
|
+
modified_at=none_as_unset(modified_at),
|
109
|
+
name=none_as_unset(name),
|
110
|
+
name_includes=none_as_unset(name_includes),
|
111
|
+
namesany_ofcase_sensitive=none_as_unset(namesany_ofcase_sensitive),
|
112
|
+
namesany_of=none_as_unset(namesany_of),
|
113
|
+
origin_ids=none_as_unset(origin_ids),
|
114
|
+
ids=none_as_unset(ids),
|
115
|
+
display_ids=none_as_unset(display_ids),
|
116
|
+
returning=none_as_unset(returning),
|
117
|
+
)
|
118
|
+
raise_for_status(response)
|
119
|
+
return response # type: ignore
|
120
|
+
|
121
|
+
def list(
|
122
|
+
self,
|
123
|
+
*,
|
124
|
+
page_size: Optional[int] = 50,
|
125
|
+
sort: Optional[ListDatasetsSort] = ListDatasetsSort.MODIFIEDAT,
|
126
|
+
archive_reason: Optional[str] = None,
|
127
|
+
created_at: Optional[str] = None,
|
128
|
+
creator_ids: Optional[str] = None,
|
129
|
+
folder_id: Optional[str] = None,
|
130
|
+
mentioned_in: Optional[str] = None,
|
131
|
+
modified_at: Optional[str] = None,
|
132
|
+
name: Optional[str] = None,
|
133
|
+
name_includes: Optional[str] = None,
|
134
|
+
namesany_ofcase_sensitive: Optional[str] = None,
|
135
|
+
namesany_of: Optional[str] = None,
|
136
|
+
origin_ids: Optional[str] = None,
|
137
|
+
ids: Optional[str] = None,
|
138
|
+
display_ids: Optional[str] = None,
|
139
|
+
returning: Optional[str] = None,
|
140
|
+
) -> PageIterator[Dataset]:
|
141
|
+
"""
|
142
|
+
List Datasets.
|
143
|
+
|
144
|
+
See https://benchling.com/api/v2/reference#/Datasets/listDatasets
|
145
|
+
"""
|
146
|
+
|
147
|
+
def api_call(next_token: NextToken) -> Response[DatasetsPaginatedList]:
|
148
|
+
return self._datasets_page(
|
149
|
+
page_size=page_size,
|
150
|
+
next_token=next_token,
|
151
|
+
sort=sort,
|
152
|
+
archive_reason=archive_reason,
|
153
|
+
created_at=created_at,
|
154
|
+
creator_ids=creator_ids,
|
155
|
+
folder_id=folder_id,
|
156
|
+
mentioned_in=mentioned_in,
|
157
|
+
modified_at=modified_at,
|
158
|
+
name=name,
|
159
|
+
name_includes=name_includes,
|
160
|
+
namesany_ofcase_sensitive=namesany_ofcase_sensitive,
|
161
|
+
namesany_of=namesany_of,
|
162
|
+
origin_ids=origin_ids,
|
163
|
+
ids=ids,
|
164
|
+
display_ids=display_ids,
|
165
|
+
returning=returning,
|
166
|
+
)
|
167
|
+
|
168
|
+
def results_extractor(body: DatasetsPaginatedList) -> Optional[List[Dataset]]:
|
169
|
+
return body.datasets
|
170
|
+
|
171
|
+
return PageIterator(api_call, results_extractor)
|
172
|
+
|
173
|
+
@api_method
|
174
|
+
def unarchive(self, dataset_ids: Iterable[str]) -> DatasetsArchivalChange:
|
175
|
+
"""
|
176
|
+
Unarchive one or more Datasets.
|
177
|
+
|
178
|
+
See https://benchling.com/api/reference#/Datasets/unarchiveDatasets
|
179
|
+
"""
|
180
|
+
unarchive_request = DatasetsUnarchive(dataset_ids=list(dataset_ids))
|
181
|
+
response = unarchive_datasets.sync_detailed(client=self.client, json_body=unarchive_request)
|
182
|
+
return model_from_detailed(response)
|
183
|
+
|
184
|
+
@api_method
|
185
|
+
def update(self, dataset_id: str, dataset: DatasetUpdate) -> Dataset:
|
186
|
+
"""
|
187
|
+
Update a Dataset.
|
188
|
+
|
189
|
+
See https://benchling.com/api/reference#/Datasets/updateDataset
|
190
|
+
"""
|
191
|
+
response = update_dataset.sync_detailed(client=self.client, dataset_id=dataset_id, json_body=dataset)
|
192
|
+
return model_from_detailed(response)
|
@@ -71,6 +71,7 @@ class DnaOligoService(BaseService):
|
|
71
71
|
def _dna_oligos_page(
|
72
72
|
self,
|
73
73
|
modified_at: Optional[str] = None,
|
74
|
+
created_at: Optional[str] = None,
|
74
75
|
name: Optional[str] = None,
|
75
76
|
bases: Optional[str] = None,
|
76
77
|
folder_id: Optional[str] = None,
|
@@ -97,6 +98,7 @@ class DnaOligoService(BaseService):
|
|
97
98
|
response = list_dna_oligos.sync_detailed(
|
98
99
|
client=self.client,
|
99
100
|
modified_at=none_as_unset(modified_at),
|
101
|
+
created_at=none_as_unset(created_at),
|
100
102
|
name=none_as_unset(name),
|
101
103
|
bases=none_as_unset(bases),
|
102
104
|
folder_id=none_as_unset(folder_id),
|
@@ -126,6 +128,7 @@ class DnaOligoService(BaseService):
|
|
126
128
|
def list(
|
127
129
|
self,
|
128
130
|
modified_at: Optional[str] = None,
|
131
|
+
created_at: Optional[str] = None,
|
129
132
|
name: Optional[str] = None,
|
130
133
|
bases: Optional[str] = None,
|
131
134
|
folder_id: Optional[str] = None,
|
@@ -157,6 +160,7 @@ class DnaOligoService(BaseService):
|
|
157
160
|
def api_call(next_token: NextToken) -> Response[DnaOligosPaginatedList]:
|
158
161
|
return self._dna_oligos_page(
|
159
162
|
modified_at=modified_at,
|
163
|
+
created_at=created_at,
|
160
164
|
name=name,
|
161
165
|
bases=bases,
|
162
166
|
folder_id=folder_id,
|
@@ -91,6 +91,7 @@ class DnaSequenceService(BaseService):
|
|
91
91
|
def _dna_sequences_page(
|
92
92
|
self,
|
93
93
|
modified_at: Optional[str] = None,
|
94
|
+
created_at: Optional[str] = None,
|
94
95
|
name: Optional[str] = None,
|
95
96
|
bases: Optional[str] = None,
|
96
97
|
folder_id: Optional[str] = None,
|
@@ -116,6 +117,7 @@ class DnaSequenceService(BaseService):
|
|
116
117
|
response = list_dna_sequences.sync_detailed(
|
117
118
|
client=self.client,
|
118
119
|
modified_at=none_as_unset(modified_at),
|
120
|
+
created_at=none_as_unset(created_at),
|
119
121
|
name=none_as_unset(name),
|
120
122
|
bases=none_as_unset(bases),
|
121
123
|
folder_id=none_as_unset(folder_id),
|
@@ -144,6 +146,7 @@ class DnaSequenceService(BaseService):
|
|
144
146
|
def list(
|
145
147
|
self,
|
146
148
|
modified_at: Optional[str] = None,
|
149
|
+
created_at: Optional[str] = None,
|
147
150
|
name: Optional[str] = None,
|
148
151
|
bases: Optional[str] = None,
|
149
152
|
folder_id: Optional[str] = None,
|
@@ -176,6 +179,7 @@ class DnaSequenceService(BaseService):
|
|
176
179
|
def api_call(next_token: NextToken) -> Response[DnaSequencesPaginatedList]:
|
177
180
|
return self._dna_sequences_page(
|
178
181
|
modified_at=modified_at,
|
182
|
+
created_at=created_at,
|
179
183
|
name=name,
|
180
184
|
bases=bases,
|
181
185
|
folder_id=folder_id,
|
@@ -0,0 +1,191 @@
|
|
1
|
+
from typing import Iterable, List, Optional
|
2
|
+
|
3
|
+
from benchling_api_client.v2.stable.api.files import (
|
4
|
+
archive_files as api_client_archive_files,
|
5
|
+
create_file,
|
6
|
+
get_file,
|
7
|
+
list_files,
|
8
|
+
patch_file,
|
9
|
+
unarchive_files,
|
10
|
+
)
|
11
|
+
from benchling_api_client.v2.stable.models.file import File
|
12
|
+
from benchling_api_client.v2.stable.models.file_create import FileCreate
|
13
|
+
from benchling_api_client.v2.stable.models.file_update import FileUpdate
|
14
|
+
from benchling_api_client.v2.stable.models.files_archival_change import FilesArchivalChange
|
15
|
+
from benchling_api_client.v2.stable.models.files_archive import FilesArchive
|
16
|
+
from benchling_api_client.v2.stable.models.files_archive_reason import FilesArchiveReason
|
17
|
+
from benchling_api_client.v2.stable.models.files_paginated_list import FilesPaginatedList
|
18
|
+
from benchling_api_client.v2.stable.models.files_unarchive import FilesUnarchive
|
19
|
+
from benchling_api_client.v2.types import Response
|
20
|
+
|
21
|
+
from benchling_sdk.errors import raise_for_status
|
22
|
+
from benchling_sdk.helpers.decorators import api_method
|
23
|
+
from benchling_sdk.helpers.pagination_helpers import NextToken, PageIterator
|
24
|
+
from benchling_sdk.helpers.response_helpers import model_from_detailed
|
25
|
+
from benchling_sdk.helpers.serialization_helpers import none_as_unset
|
26
|
+
from benchling_sdk.models import ListFilesSort
|
27
|
+
from benchling_sdk.services.v2.base_service import BaseService
|
28
|
+
|
29
|
+
|
30
|
+
class FileService(BaseService):
|
31
|
+
"""
|
32
|
+
Files.
|
33
|
+
|
34
|
+
Files are Benchling objects that represent files and their metadata. Compared to Blobs, which are used by
|
35
|
+
most Benchling products for attachments, Files are primarily used in the Analysis and Connect product.
|
36
|
+
|
37
|
+
See https://benchling.com/api/v2/reference#/Files
|
38
|
+
"""
|
39
|
+
|
40
|
+
@api_method
|
41
|
+
def archive_files(
|
42
|
+
self, file_ids: Iterable[str], reason: FilesArchiveReason
|
43
|
+
) -> FilesArchivalChange:
|
44
|
+
"""
|
45
|
+
Archive Files.
|
46
|
+
|
47
|
+
See https://benchling.com/api/reference#/Files/archiveFiles
|
48
|
+
"""
|
49
|
+
archive_request = FilesArchive(reason=reason, file_ids=list(file_ids))
|
50
|
+
response = api_client_archive_files.sync_detailed(
|
51
|
+
client=self.client,
|
52
|
+
json_body=archive_request,
|
53
|
+
)
|
54
|
+
return model_from_detailed(response)
|
55
|
+
|
56
|
+
@api_method
|
57
|
+
def create(self, file: FileCreate) -> File:
|
58
|
+
"""
|
59
|
+
Create a file.
|
60
|
+
|
61
|
+
See https://benchling.com/api/v2/reference#/Files/createFile
|
62
|
+
"""
|
63
|
+
response = create_file.sync_detailed(client=self.client, json_body=file)
|
64
|
+
return model_from_detailed(response)
|
65
|
+
|
66
|
+
@api_method
|
67
|
+
def get_by_id(self, file_id: str) -> File:
|
68
|
+
"""
|
69
|
+
Get a file.
|
70
|
+
|
71
|
+
See https://benchling.com/api/v2/reference#/Files/getFile
|
72
|
+
"""
|
73
|
+
response = get_file.sync_detailed(client=self.client, file_id=file_id)
|
74
|
+
return model_from_detailed(response)
|
75
|
+
|
76
|
+
@api_method
|
77
|
+
def _files_page(
|
78
|
+
self,
|
79
|
+
page_size: Optional[int] = 50,
|
80
|
+
next_token: Optional[str] = None,
|
81
|
+
sort: Optional[ListFilesSort] = ListFilesSort.MODIFIEDAT,
|
82
|
+
archive_reason: Optional[str] = None,
|
83
|
+
created_at: Optional[str] = None,
|
84
|
+
creator_ids: Optional[str] = None,
|
85
|
+
folder_id: Optional[str] = None,
|
86
|
+
mentioned_in: Optional[str] = None,
|
87
|
+
modified_at: Optional[str] = None,
|
88
|
+
name: Optional[str] = None,
|
89
|
+
name_includes: Optional[str] = None,
|
90
|
+
namesany_ofcase_sensitive: Optional[str] = None,
|
91
|
+
namesany_of: Optional[str] = None,
|
92
|
+
origin_ids: Optional[str] = None,
|
93
|
+
ids: Optional[str] = None,
|
94
|
+
display_ids: Optional[str] = None,
|
95
|
+
returning: Optional[str] = None,
|
96
|
+
) -> Response[FilesPaginatedList]:
|
97
|
+
response = list_files.sync_detailed(
|
98
|
+
client=self.client,
|
99
|
+
page_size=none_as_unset(page_size),
|
100
|
+
next_token=none_as_unset(next_token),
|
101
|
+
sort=none_as_unset(sort),
|
102
|
+
archive_reason=none_as_unset(archive_reason),
|
103
|
+
created_at=none_as_unset(created_at),
|
104
|
+
creator_ids=none_as_unset(creator_ids),
|
105
|
+
folder_id=none_as_unset(folder_id),
|
106
|
+
mentioned_in=none_as_unset(mentioned_in),
|
107
|
+
modified_at=none_as_unset(modified_at),
|
108
|
+
name=none_as_unset(name),
|
109
|
+
name_includes=none_as_unset(name_includes),
|
110
|
+
namesany_ofcase_sensitive=none_as_unset(namesany_ofcase_sensitive),
|
111
|
+
namesany_of=none_as_unset(namesany_of),
|
112
|
+
origin_ids=none_as_unset(origin_ids),
|
113
|
+
ids=none_as_unset(ids),
|
114
|
+
display_ids=none_as_unset(display_ids),
|
115
|
+
returning=none_as_unset(returning),
|
116
|
+
)
|
117
|
+
raise_for_status(response)
|
118
|
+
return response # type: ignore
|
119
|
+
|
120
|
+
def list(
|
121
|
+
self,
|
122
|
+
*,
|
123
|
+
page_size: Optional[int] = 50,
|
124
|
+
sort: Optional[ListFilesSort] = ListFilesSort.MODIFIEDAT,
|
125
|
+
archive_reason: Optional[str] = None,
|
126
|
+
created_at: Optional[str] = None,
|
127
|
+
creator_ids: Optional[str] = None,
|
128
|
+
folder_id: Optional[str] = None,
|
129
|
+
mentioned_in: Optional[str] = None,
|
130
|
+
modified_at: Optional[str] = None,
|
131
|
+
name: Optional[str] = None,
|
132
|
+
name_includes: Optional[str] = None,
|
133
|
+
namesany_ofcase_sensitive: Optional[str] = None,
|
134
|
+
namesany_of: Optional[str] = None,
|
135
|
+
origin_ids: Optional[str] = None,
|
136
|
+
ids: Optional[str] = None,
|
137
|
+
display_ids: Optional[str] = None,
|
138
|
+
returning: Optional[str] = None,
|
139
|
+
) -> PageIterator[File]:
|
140
|
+
"""
|
141
|
+
List Files.
|
142
|
+
|
143
|
+
See https://benchling.com/api/v2/reference#/Files/listFiles
|
144
|
+
"""
|
145
|
+
|
146
|
+
def api_call(next_token: NextToken) -> Response[FilesPaginatedList]:
|
147
|
+
return self._files_page(
|
148
|
+
page_size=page_size,
|
149
|
+
next_token=next_token,
|
150
|
+
sort=sort,
|
151
|
+
archive_reason=archive_reason,
|
152
|
+
created_at=created_at,
|
153
|
+
creator_ids=creator_ids,
|
154
|
+
folder_id=folder_id,
|
155
|
+
mentioned_in=mentioned_in,
|
156
|
+
modified_at=modified_at,
|
157
|
+
name=name,
|
158
|
+
name_includes=name_includes,
|
159
|
+
namesany_ofcase_sensitive=namesany_ofcase_sensitive,
|
160
|
+
namesany_of=namesany_of,
|
161
|
+
origin_ids=origin_ids,
|
162
|
+
ids=ids,
|
163
|
+
display_ids=display_ids,
|
164
|
+
returning=returning,
|
165
|
+
)
|
166
|
+
|
167
|
+
def results_extractor(body: FilesPaginatedList) -> Optional[List[File]]:
|
168
|
+
return body.files
|
169
|
+
|
170
|
+
return PageIterator(api_call, results_extractor)
|
171
|
+
|
172
|
+
@api_method
|
173
|
+
def update(self, file_id: str, file: FileUpdate) -> File:
|
174
|
+
"""
|
175
|
+
Update a File.
|
176
|
+
|
177
|
+
See https://benchling.com/api/reference#/Files/updateFile
|
178
|
+
"""
|
179
|
+
response = patch_file.sync_detailed(client=self.client, file_id=file_id, json_body=file)
|
180
|
+
return model_from_detailed(response)
|
181
|
+
|
182
|
+
@api_method
|
183
|
+
def unarchive(self, file_ids: Iterable[str]) -> FilesArchivalChange:
|
184
|
+
"""
|
185
|
+
Unarchive one or more Files.
|
186
|
+
|
187
|
+
See https://benchling.com/api/reference#/Files/unarchiveFiles
|
188
|
+
"""
|
189
|
+
unarchive_request = FilesUnarchive(file_ids=list(file_ids))
|
190
|
+
response = unarchive_files.sync_detailed(client=self.client, json_body=unarchive_request)
|
191
|
+
return model_from_detailed(response)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Iterable, List, Optional
|
2
2
|
|
3
|
-
from benchling_api_client.v2.stable.api.
|
3
|
+
from benchling_api_client.v2.stable.api.legacy_requests import (
|
4
4
|
bulk_create_request_tasks,
|
5
5
|
bulk_get_requests,
|
6
6
|
bulk_update_request_tasks,
|
@@ -40,21 +40,21 @@ from benchling_sdk.models import (
|
|
40
40
|
from benchling_sdk.services.v2.base_service import BaseService
|
41
41
|
|
42
42
|
|
43
|
-
class
|
43
|
+
class LegacyRequestService(BaseService):
|
44
44
|
"""
|
45
|
-
Requests.
|
45
|
+
Legacy Requests.
|
46
46
|
|
47
|
-
Requests allow scientists and teams to collaborate around experimental assays and workflows.
|
47
|
+
Legacy Requests allow scientists and teams to collaborate around experimental assays and workflows.
|
48
48
|
|
49
|
-
See https://benchling.com/api/reference#/
|
49
|
+
See https://benchling.com/api/reference#/Legacy%20Requests
|
50
50
|
"""
|
51
51
|
|
52
52
|
@api_method
|
53
53
|
def get_by_id(self, request_id: str, returning: Optional[Iterable[str]] = None) -> Request:
|
54
54
|
"""
|
55
|
-
Get a Request by ID.
|
55
|
+
Get a Legacy Request by ID.
|
56
56
|
|
57
|
-
See https://benchling.com/api/reference#/
|
57
|
+
See https://benchling.com/api/reference#/Legacy%20Requests/getRequest
|
58
58
|
"""
|
59
59
|
returning_string = optional_array_query_param(returning)
|
60
60
|
response = get_request.sync_detailed(
|
@@ -98,7 +98,7 @@ class RequestService(BaseService):
|
|
98
98
|
"""
|
99
99
|
List Requests.
|
100
100
|
|
101
|
-
See https://benchling.com/api/reference#/
|
101
|
+
See https://benchling.com/api/reference#/Legacy%20Requests/listRequests
|
102
102
|
"""
|
103
103
|
|
104
104
|
def api_call(next_token: NextToken) -> Response[RequestsPaginatedList]:
|
@@ -128,7 +128,7 @@ class RequestService(BaseService):
|
|
128
128
|
"""
|
129
129
|
Bulk get Requests.
|
130
130
|
|
131
|
-
See https://benchling.com/api/reference#/
|
131
|
+
See https://benchling.com/api/reference#/Legacy%20Requests/bulkGetRequests
|
132
132
|
"""
|
133
133
|
request_id_string = optional_array_query_param(request_ids)
|
134
134
|
display_id_string = optional_array_query_param(display_ids)
|
@@ -145,9 +145,9 @@ class RequestService(BaseService):
|
|
145
145
|
@api_method
|
146
146
|
def request_response(self, request_id: str) -> RequestResponse:
|
147
147
|
"""
|
148
|
-
Get a Request's response.
|
148
|
+
Get a Legacy Request's response.
|
149
149
|
|
150
|
-
See https://benchling.com/api/reference#/
|
150
|
+
See https://benchling.com/api/reference#/Legacy%20Requests/getRequestResponse
|
151
151
|
"""
|
152
152
|
response = get_request_response.sync_detailed(client=self.client, request_id=request_id)
|
153
153
|
return model_from_detailed(response)
|
@@ -155,9 +155,9 @@ class RequestService(BaseService):
|
|
155
155
|
@api_method
|
156
156
|
def create(self, request: RequestCreate) -> Request:
|
157
157
|
"""
|
158
|
-
Create a Request.
|
158
|
+
Create a Legacy Request.
|
159
159
|
|
160
|
-
See https://benchling.com/api/reference#/
|
160
|
+
See https://benchling.com/api/reference#/Legacy%20Requests/createRequest
|
161
161
|
"""
|
162
162
|
response = create_request.sync_detailed(client=self.client, json_body=request)
|
163
163
|
return model_from_detailed(response)
|
@@ -165,9 +165,9 @@ class RequestService(BaseService):
|
|
165
165
|
@api_method
|
166
166
|
def update(self, request_id: str, request: RequestUpdate) -> Request:
|
167
167
|
"""
|
168
|
-
Update a Request.
|
168
|
+
Update a Legacy Request.
|
169
169
|
|
170
|
-
See https://benchling.com/api/reference#/
|
170
|
+
See https://benchling.com/api/reference#/Legacy%20Requests/patchRequest
|
171
171
|
"""
|
172
172
|
response = patch_request.sync_detailed(client=self.client, request_id=request_id, json_body=request)
|
173
173
|
return model_from_detailed(response)
|
@@ -175,9 +175,9 @@ class RequestService(BaseService):
|
|
175
175
|
@api_method
|
176
176
|
def execute_sample_groups(self, request_id: str, sample_groups: SampleGroupsStatusUpdate) -> None:
|
177
177
|
"""
|
178
|
-
Update the status of sample groups in a Request.
|
178
|
+
Update the status of sample groups in a Legacy Request.
|
179
179
|
|
180
|
-
See https://benchling.com/api/reference#/
|
180
|
+
See https://benchling.com/api/reference#/Legacy%20Requests/executeRequestsSampleGroups
|
181
181
|
"""
|
182
182
|
response = execute_requests_sample_groups.sync_detailed(
|
183
183
|
client=self.client, request_id=request_id, json_body=sample_groups
|
@@ -187,9 +187,9 @@ class RequestService(BaseService):
|
|
187
187
|
@api_method
|
188
188
|
def request_fulfillment(self, request_fulfillment_id: str) -> RequestFulfillment:
|
189
189
|
"""
|
190
|
-
Get a Request's fulfillment.
|
190
|
+
Get a Legacy Request's fulfillment.
|
191
191
|
|
192
|
-
See https://benchling.com/api/reference#/
|
192
|
+
See https://benchling.com/api/reference#/Legacy%20Requests/getRequestFulfillment
|
193
193
|
"""
|
194
194
|
response = get_request_fulfillment.sync_detailed(
|
195
195
|
client=self.client, request_fulfillment_id=request_fulfillment_id
|
@@ -218,9 +218,9 @@ class RequestService(BaseService):
|
|
218
218
|
self, entry_id: str, modified_at: Optional[str] = None, page_size: Optional[int] = None
|
219
219
|
) -> PageIterator[RequestFulfillment]:
|
220
220
|
"""
|
221
|
-
List Request Fulfillments.
|
221
|
+
List Legacy Request Fulfillments.
|
222
222
|
|
223
|
-
See https://benchling.com/api/reference#/
|
223
|
+
See https://benchling.com/api/reference#/Legacy%20Requests/listRequestFulfillments
|
224
224
|
"""
|
225
225
|
|
226
226
|
def api_call(next_token: NextToken) -> Response[RequestFulfillmentsPaginatedList]:
|
@@ -241,9 +241,9 @@ class RequestService(BaseService):
|
|
241
241
|
self, request_id: str, tasks: Iterable[RequestTasksBulkCreate]
|
242
242
|
) -> RequestTasksBulkCreateResponse:
|
243
243
|
"""
|
244
|
-
Create tasks for a Request.
|
244
|
+
Create tasks for a Legacy Request.
|
245
245
|
|
246
|
-
See https://benchling.com/api/reference#/
|
246
|
+
See https://benchling.com/api/reference#/Legacy%20Requests/bulkCreateRequestTasks
|
247
247
|
"""
|
248
248
|
create = RequestTasksBulkCreateRequest(tasks=list(tasks))
|
249
249
|
response = bulk_create_request_tasks.sync_detailed(
|
@@ -256,9 +256,9 @@ class RequestService(BaseService):
|
|
256
256
|
self, request_id: str, tasks: Iterable[RequestTaskBase]
|
257
257
|
) -> RequestTasksBulkUpdateResponse:
|
258
258
|
"""
|
259
|
-
Update tasks for a Request.
|
259
|
+
Update tasks for a Legacy Request.
|
260
260
|
|
261
|
-
See https://benchling.com/api/reference#/
|
261
|
+
See https://benchling.com/api/reference#/Legacy%20Requests/bulkUpdateRequestTasks
|
262
262
|
"""
|
263
263
|
update = RequestTasksBulkUpdateRequest(tasks=list(tasks))
|
264
264
|
response = bulk_update_request_tasks.sync_detailed(
|
@@ -63,6 +63,7 @@ class LocationService(BaseService):
|
|
63
63
|
sort: Optional[ListLocationsSort] = None,
|
64
64
|
schema_id: Optional[str] = None,
|
65
65
|
modified_at: Optional[str] = None,
|
66
|
+
created_at: Optional[str] = None,
|
66
67
|
name: Optional[str] = None,
|
67
68
|
name_includes: Optional[str] = None,
|
68
69
|
ancestor_storage_id: Optional[str] = None,
|
@@ -79,6 +80,7 @@ class LocationService(BaseService):
|
|
79
80
|
sort=none_as_unset(sort),
|
80
81
|
schema_id=none_as_unset(schema_id),
|
81
82
|
modified_at=none_as_unset(modified_at),
|
83
|
+
created_at=none_as_unset(created_at),
|
82
84
|
name=none_as_unset(name),
|
83
85
|
name_includes=none_as_unset(name_includes),
|
84
86
|
ancestor_storage_id=none_as_unset(ancestor_storage_id),
|
@@ -101,6 +103,7 @@ class LocationService(BaseService):
|
|
101
103
|
sort: Optional[Union[str, ListLocationsSort]] = None,
|
102
104
|
schema_id: Optional[str] = None,
|
103
105
|
modified_at: Optional[str] = None,
|
106
|
+
created_at: Optional[str] = None,
|
104
107
|
name: Optional[str] = None,
|
105
108
|
name_includes: Optional[str] = None,
|
106
109
|
ancestor_storage_id: Optional[str] = None,
|
@@ -124,6 +127,7 @@ class LocationService(BaseService):
|
|
124
127
|
sort=_translate_to_string_enum(ListLocationsSort, sort),
|
125
128
|
schema_id=schema_id,
|
126
129
|
modified_at=modified_at,
|
130
|
+
created_at=created_at,
|
127
131
|
name=name,
|
128
132
|
name_includes=name_includes,
|
129
133
|
ancestor_storage_id=ancestor_storage_id,
|
@@ -65,6 +65,7 @@ class MixtureService(BaseService):
|
|
65
65
|
def _mixtures_page(
|
66
66
|
self,
|
67
67
|
modified_at: Optional[str] = None,
|
68
|
+
created_at: Optional[str] = None,
|
68
69
|
name: Optional[str] = None,
|
69
70
|
name_includes: Optional[str] = None,
|
70
71
|
folder_id: Optional[str] = None,
|
@@ -89,6 +90,7 @@ class MixtureService(BaseService):
|
|
89
90
|
response = list_mixtures.sync_detailed(
|
90
91
|
client=self.client,
|
91
92
|
modified_at=none_as_unset(modified_at),
|
93
|
+
created_at=none_as_unset(created_at),
|
92
94
|
name=none_as_unset(name),
|
93
95
|
name_includes=none_as_unset(name_includes),
|
94
96
|
folder_id=none_as_unset(folder_id),
|
@@ -120,6 +122,7 @@ class MixtureService(BaseService):
|
|
120
122
|
def list(
|
121
123
|
self,
|
122
124
|
modified_at: Optional[str] = None,
|
125
|
+
created_at: Optional[str] = None,
|
123
126
|
name: Optional[str] = None,
|
124
127
|
name_includes: Optional[str] = None,
|
125
128
|
folder_id: Optional[str] = None,
|
@@ -151,6 +154,7 @@ class MixtureService(BaseService):
|
|
151
154
|
def api_call(next_token: NextToken) -> Response[MixturesPaginatedList]:
|
152
155
|
return self._mixtures_page(
|
153
156
|
modified_at=modified_at,
|
157
|
+
created_at=created_at,
|
154
158
|
name=name,
|
155
159
|
name_includes=name_includes,
|
156
160
|
folder_id=folder_id,
|