benchling-sdk 1.23.0a2__py3-none-any.whl → 1.23.0a4__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.
@@ -13,6 +13,7 @@ from benchling_api_client.v2.stable.api.assay_results import (
13
13
  list_assay_results,
14
14
  unarchive_assay_results,
15
15
  )
16
+ from benchling_api_client.v2.stable.types import UNSET, Unset
16
17
  from benchling_api_client.v2.types import Response
17
18
 
18
19
  from benchling_sdk.errors import raise_for_status
@@ -33,6 +34,7 @@ from benchling_sdk.models import (
33
34
  AssayResultIdsRequest,
34
35
  AssayResultIdsResponse,
35
36
  AssayResultsArchive,
37
+ AssayResultsArchiveReason,
36
38
  AssayResultsBulkCreateInTableRequest,
37
39
  AssayResultsBulkCreateRequest,
38
40
  AssayResultsCreateResponse,
@@ -215,7 +217,11 @@ class AssayResultService(BaseService):
215
217
  return self._task_helper_from_response(response, AssayResultsCreateResponse)
216
218
 
217
219
  @api_method
218
- def archive(self, assay_result_ids: Iterable[str]) -> AssayResultIdsResponse:
220
+ def archive(
221
+ self,
222
+ assay_result_ids: Iterable[str],
223
+ reason: Union[Unset, AssayResultsArchiveReason] = UNSET,
224
+ ) -> AssayResultIdsResponse:
219
225
  """
220
226
  Archive assay results.
221
227
 
@@ -225,8 +231,10 @@ class AssayResultService(BaseService):
225
231
 
226
232
  See https://benchling.com/api/reference#/Assay%20Results/archiveAssayResults
227
233
  """
228
- archive_request = AssayResultsArchive(assay_result_ids=list(assay_result_ids))
229
- response = archive_assay_results.sync_detailed(client=self.client, json_body=archive_request)
234
+ archive_request = AssayResultsArchive(assay_result_ids=list(assay_result_ids), reason=reason)
235
+ response = archive_assay_results.sync_detailed(
236
+ client=self.client, json_body=archive_request
237
+ )
230
238
  return model_from_detailed(response)
231
239
 
232
240
  @api_method
@@ -51,10 +51,15 @@ from benchling_sdk.services.v2.base_service import BaseService
51
51
 
52
52
  class CustomEntityService(BaseService):
53
53
  """
54
- Custom Entities.
54
+ Service for managing custom entities in Benchling.
55
55
 
56
- Benchling supports custom entities for biological entities that are neither sequences or proteins. Custom
57
- entities must have an entity schema set and can have both schema fields and custom fields.
56
+ Custom entities are flexible biological entities that allow you to model
57
+ lab-specific objects like cell lines, reagents, samples, or any other
58
+ biological entity that doesn't fit standard sequence types.
59
+
60
+ All custom entities must have an entity schema that defines their structure,
61
+ validation rules, and field types. They support both schema fields (defined
62
+ by the schema) and custom fields (user-defined metadata).
58
63
 
59
64
  See https://benchling.com/api/reference#/Custom%20Entities
60
65
  """
@@ -64,7 +69,34 @@ class CustomEntityService(BaseService):
64
69
  """
65
70
  Get a custom entity.
66
71
 
67
- See https://benchling.com/api/reference#/Custom%20Entities/getCustomEntity
72
+ Args:
73
+ entity_id (str): The ID of the custom entity to get.
74
+ returning (Optional[Iterable[str]]): The fields to return.
75
+ See https://benchling.com/api/reference#/Custom%20Entities/getCustomEntity
76
+ for available fields. If not specified, returns all fields. Examples:
77
+ - ["id", "name", "fields"] for basic info only
78
+ - ["customEntities.fields.Status"] for specific field
79
+
80
+ Returns:
81
+ CustomEntity: The custom entity.
82
+
83
+ Example:
84
+ Get a custom entity with all fields:
85
+
86
+ .. code-block:: python
87
+
88
+ entity = custom_entities.get_by_id("bfi_abc123")
89
+ print(f"Entity: {entity.name} (Schema: {entity.schema_id})")
90
+
91
+ # Get only specific fields for performance
92
+ entity = custom_entities.get_by_id(
93
+ "bfi_abc123",
94
+ returning=["id", "name", "fields.Vendor"]
95
+ )
96
+
97
+ See Also:
98
+ https://benchling.com/api/reference#/Custom%20Entities/getCustomEntity
99
+
68
100
  """
69
101
  returning_string = optional_array_query_param(returning)
70
102
  response = get_custom_entity.sync_detailed(
@@ -151,9 +183,69 @@ class CustomEntityService(BaseService):
151
183
  returning: Optional[Iterable[str]] = None,
152
184
  ) -> PageIterator[CustomEntity]:
153
185
  """
154
- List custom entities.
186
+ List custom entities with flexible filtering and pagination.
187
+
188
+ This method supports comprehensive filtering options to find specific entities.
189
+ For performance on large datasets, always specify schema_id when possible.
190
+
191
+ Args:
192
+ schema_id (Optional[str]): Filter to entities of this schema type. Recommended
193
+ for performance on tenants with many entities.
194
+ modified_at (Optional[str]): Filter to entities modified after this date/time.
195
+ Format: ISO 8601 (e.g., "2024-01-15" or "2024-01-15T10:30:00Z").
196
+ created_at (Optional[str]): Filter to entities created after this date/time.
197
+ Same format as modified_at.
198
+ name (Optional[str]): Filter to entities with this exact name (case-sensitive).
199
+ name_includes (Optional[str]): Filter to entities whose name contains this substring
200
+ (case-insensitive).
201
+ folder_id (Optional[str]): Filter to entities in this folder.
202
+ mentioned_in (Optional[List[str]]): Filter to entities mentioned in these entries.
203
+ project_id (Optional[str]): Filter to entities in this project.
204
+ registry_id (Optional[str]): Filter to entities in this registry.
205
+ archive_reason (Optional[str]): Filter to entities archived for this reason.
206
+ mentions (Optional[List[str]]): Filter to entities that mention these items.
207
+ ids (Optional[Iterable[str]]): Filter to entities with these specific IDs.
208
+ entity_registry_ids_any_of (Optional[Iterable[str]]): Filter to entities with
209
+ any of these registry IDs.
210
+ names_any_of (Optional[Iterable[str]]): Filter to entities with any of these
211
+ names (case-insensitive).
212
+ names_any_of_case_sensitive (Optional[Iterable[str]]): Filter to entities with
213
+ any of these names (case-sensitive).
214
+ creator_ids (Optional[Iterable[str]]): Filter to entities created by these users.
215
+ schema_fields (Optional[Dict[str, Any]]): Filter by schema field values.
216
+ Example: {"Status": "Active", "Priority": "High"}.
217
+ sort (Optional[Union[str, ListCustomEntitiesSort]]): Sort order.
218
+ Examples: "name:asc", "modifiedAt:desc".
219
+ page_size (Optional[int]): Number of results per page (max 100).
220
+ author_idsany_of (Optional[Iterable[str]]): Filter to entities authored by these users.
221
+ returning (Optional[Iterable[str]]): Specify which fields to return for performance.
222
+ Examples: ["id", "name"], ["customEntities.fields.Status"].
223
+
224
+ Returns:
225
+ PageIterator[CustomEntity]: An iterator over pages of custom entities.
226
+
227
+ Example:
228
+ List entities with filtering and pagination:
229
+
230
+ .. code-block:: python
231
+
232
+ entities = custom_entities.list(
233
+ schema_id="ts_cellline_schema",
234
+ name_includes="HEK",
235
+ folder_id="lib_abc123",
236
+ modified_at="2024-01-01",
237
+ page_size=50,
238
+ sort="name:asc",
239
+ returning=["id", "name", "fields.Status"]
240
+ )
241
+
242
+ for page in entities:
243
+ for entity in page:
244
+ print(f"Entity: {entity.name} (ID: {entity.id})")
245
+
246
+ See Also:
247
+ https://benchling.com/api/reference#/Custom%20Entities/listCustomEntities
155
248
 
156
- See https://benchling.com/api/reference#/Custom%20Entities/listCustomEntities
157
249
  """
158
250
  check_for_csv_bug_fix("mentioned_in", mentioned_in)
159
251
  check_for_csv_bug_fix("mentions", mentions)
@@ -195,9 +287,74 @@ class CustomEntityService(BaseService):
195
287
  @api_method
196
288
  def create(self, entity: CustomEntityCreate) -> CustomEntity:
197
289
  """
198
- Create a custom entity.
290
+ Create a new custom entity.
291
+
292
+ Creates a single custom entity with the specified properties. The entity
293
+ must be associated with a valid schema and folder.
294
+
295
+ Args:
296
+ entity (CustomEntityCreate):
297
+ The custom entity to create. Contains the following fields:
298
+
299
+ **Required Fields:**
300
+
301
+ * **name** (str): The display name for the entity
302
+ * **schema_id** (str): The ID of the schema that defines this entity type
303
+ * **folder_id** (str): The ID of the folder where the entity will be stored
304
+
305
+ **Optional Fields:**
306
+
307
+ * **fields** (Optional[Fields]): Schema-defined field values created using the
308
+ fields() helper. Structure: ``{"field_name": {"value": field_value}}``
309
+ * **custom_fields** (Optional[CustomFields]): User-defined field values created
310
+ using custom_fields() helper
311
+ * **registry_id** (Optional[str]): The ID of the registry if the entity should
312
+ be registered
313
+ * **entity_registry_id** (Optional[str]): Custom identifier for the entity in
314
+ the registry
315
+ * **naming_strategy** (Optional[NamingStrategy]): Strategy for naming registered
316
+ entities (e.g., ``NamingStrategy.KEEP_NAMES``)
317
+ * **author_ids** (Optional[List[str]]): List of user IDs to set as authors
318
+ * **custom_notation_ids** (Optional[List[str]]): List of custom notation IDs
319
+
320
+ Returns:
321
+ CustomEntity: The newly created custom entity with generated ID and server-populated fields.
322
+
323
+ Note:
324
+ For registry entities, provide either:
325
+
326
+ * ``registry_id`` + ``entity_registry_id`` OR
327
+ * ``registry_id`` + ``naming_strategy``
328
+
329
+ You cannot specify both ``entity_registry_id`` and ``naming_strategy``.
330
+
331
+ Example:
332
+ Create a custom entity with schema and custom fields:
333
+
334
+ .. code-block:: python
335
+
336
+ from benchling_sdk.models import CustomEntityCreate, NamingStrategy
337
+ from benchling_sdk.helpers.serialization_helpers import fields, custom_fields
338
+
339
+ entity = CustomEntityCreate(
340
+ name="Cell Line HEK293",
341
+ schema_id="ts_rbQWr8Pf",
342
+ folder_id="lib_TL5mqoz9",
343
+ registry_id="src_LbZzJIke",
344
+ naming_strategy=NamingStrategy.NEW_IDS,
345
+ fields=fields({
346
+ "Vendor": {"value": "Vendor Name"},
347
+ "Passage Number": {"value": 15}
348
+ }),
349
+ custom_fields=custom_fields({
350
+ "Notes": {"value": "Created via API"}
351
+ })
352
+ )
353
+ created_entity = custom_entities.create(entity)
354
+
355
+ See Also:
356
+ https://benchling.com/api/reference#/Custom%20Entities/createCustomEntity
199
357
 
200
- See https://benchling.com/api/reference#/Custom%20Entities/createCustomEntity
201
358
  """
202
359
  response = create_custom_entity.sync_detailed(client=self.client, json_body=entity)
203
360
  return model_from_detailed(response)
@@ -205,9 +362,47 @@ class CustomEntityService(BaseService):
205
362
  @api_method
206
363
  def update(self, entity_id: str, entity: CustomEntityUpdate) -> CustomEntity:
207
364
  """
208
- Update a custom entity.
365
+ Update an existing custom entity.
366
+
367
+ Updates the specified fields of a custom entity. Only provided fields will be
368
+ updated; omitted fields remain unchanged.
369
+
370
+ Args:
371
+ entity_id (str):
372
+ The ID of the custom entity to update.
373
+
374
+ entity (CustomEntityUpdate):
375
+ The update data containing:
376
+
377
+ * **fields** (Optional[Fields]): Schema-defined field values to update using
378
+ fields() helper. Only specified fields will be updated.
379
+ * **custom_fields** (Optional[CustomFields]): User-defined field values to
380
+ update using custom_fields() helper.
381
+ * **author_ids** (Optional[List[str]]): List of user IDs to set as authors.
382
+ * **custom_notation_ids** (Optional[List[str]]): List of custom notation IDs.
383
+
384
+ Returns:
385
+ CustomEntity: The updated custom entity with new field values.
386
+
387
+ Example:
388
+ Update custom fields on an entity:
389
+
390
+ .. code-block:: python
391
+
392
+ from benchling_sdk.models import CustomEntityUpdate
393
+ from benchling_sdk.helpers.serialization_helpers import custom_fields
394
+
395
+ update = CustomEntityUpdate(
396
+ custom_fields=custom_fields({
397
+ "Notes": {"value": "Updated via API"},
398
+ "Priority": {"value": "High"}
399
+ })
400
+ )
401
+ updated_entity = custom_entities.update("ent_abc123", update)
402
+
403
+ See Also:
404
+ https://benchling.com/api/reference#/Custom%20Entities/updateCustomEntity
209
405
 
210
- See https://benchling.com/api/reference#/Custom%20Entities/updateCustomEntity
211
406
  """
212
407
  response = update_custom_entity.sync_detailed(
213
408
  client=self.client, custom_entity_id=entity_id, json_body=entity
@@ -219,7 +414,42 @@ class CustomEntityService(BaseService):
219
414
  """
220
415
  Archive custom entities.
221
416
 
222
- See https://benchling.com/api/reference#/Custom%20Entities/archiveCustomEntities
417
+ Archives multiple custom entities with a specified reason. Archived entities
418
+ are hidden from normal views but can be restored using unarchive().
419
+
420
+ Args:
421
+ entity_ids (Iterable[str]):
422
+ The IDs of custom entities to archive. Can be a list, tuple, or any iterable of string IDs.
423
+
424
+ reason (EntityArchiveReason):
425
+ The reason for archiving. Valid values:
426
+
427
+ * **EntityArchiveReason.MADE_IN_ERROR**: Entity was created by mistake
428
+ * **EntityArchiveReason.RETIRED**: Entity is no longer in use
429
+ * **EntityArchiveReason.SHIPPED_TO_COLLABORATOR**: Entity sent externally
430
+ * **EntityArchiveReason.OTHER**: Other reason not listed
431
+
432
+ Returns:
433
+ CustomEntitiesArchivalChange: Archive operation result containing the list of successfully archived entity IDs
434
+ and any errors that occurred during archival.
435
+
436
+ Example:
437
+ Archive entities with a specific reason:
438
+
439
+ .. code-block:: python
440
+
441
+ from benchling_sdk.models import EntityArchiveReason
442
+
443
+ entity_ids = ["ent_abc123", "ent_def456", "ent_ghi789"]
444
+ result = custom_entities.archive(
445
+ entity_ids,
446
+ reason=EntityArchiveReason.MADE_IN_ERROR
447
+ )
448
+ print(f"Archived {len(result.custom_entity_ids)} entities")
449
+
450
+ See Also:
451
+ https://benchling.com/api/reference#/Custom%20Entities/archiveCustomEntities
452
+
223
453
  """
224
454
  archive_request = CustomEntitiesArchive(reason=reason, custom_entity_ids=list(entity_ids))
225
455
  response = archive_custom_entities.sync_detailed(client=self.client, json_body=archive_request)
@@ -228,9 +458,30 @@ class CustomEntityService(BaseService):
228
458
  @api_method
229
459
  def unarchive(self, entity_ids: Iterable[str]) -> CustomEntitiesArchivalChange:
230
460
  """
231
- Unarchive custom entities.
461
+ Unarchive (restore) previously archived custom entities.
462
+
463
+ Restores archived custom entities, making them visible in normal views again.
464
+
465
+ Args:
466
+ entity_ids (Iterable[str]): The IDs of archived custom entities to restore.
467
+ Can be a list, tuple, or any iterable of string IDs.
468
+
469
+ Returns:
470
+ CustomEntitiesArchivalChange: Unarchive operation result containing the list of successfully unarchived entity IDs
471
+ and any errors that occurred during unarchival.
472
+
473
+ Example:
474
+ Unarchive multiple entities:
475
+
476
+ .. code-block:: python
477
+
478
+ entity_ids = ["ent_abc123", "ent_def456"]
479
+ result = custom_entities.unarchive(entity_ids)
480
+ print(f"Unarchived {len(result.custom_entity_ids)} entities")
481
+
482
+ See Also:
483
+ https://benchling.com/api/reference#/Custom%20Entities/unarchiveCustomEntities
232
484
 
233
- See https://benchling.com/api/reference#/Custom%20Entities/unarchiveCustomEntities
234
485
  """
235
486
  unarchive_request = CustomEntitiesUnarchive(custom_entity_ids=list(entity_ids))
236
487
  response = unarchive_custom_entities.sync_detailed(client=self.client, json_body=unarchive_request)
@@ -241,9 +492,40 @@ class CustomEntityService(BaseService):
241
492
  self, entity_ids: Iterable[str], returning: Optional[Iterable[str]] = None
242
493
  ) -> Optional[List[CustomEntity]]:
243
494
  """
244
- Bulk get custom entities.
495
+ Retrieve multiple custom entities by ID in a single request.
496
+
497
+ Efficiently fetches multiple custom entities by their IDs. More performant
498
+ than calling get_by_id() multiple times.
499
+
500
+ Args:
501
+ entity_ids (Iterable[str]): The IDs of custom entities to retrieve.
502
+ Can be a list, tuple, or any iterable of string IDs.
503
+ returning (Optional[Iterable[str]]): Fields to return for performance
504
+ optimization. If not specified, returns all fields. Examples:
505
+ - ["id", "name", "fields"] for basic info only
506
+ - ["customEntities.fields.Status"] for specific fields
507
+
508
+ Returns:
509
+ Optional[List[CustomEntity]]: List of retrieved custom entities, or None if no entities found.
510
+ Order may not match input order.
511
+
512
+ Example:
513
+ Get multiple entities with specific fields:
514
+
515
+ .. code-block:: python
516
+
517
+ entity_ids = ["ent_abc123", "ent_def456", "ent_ghi789"]
518
+ entities = custom_entities.bulk_get(
519
+ entity_ids,
520
+ returning=["id", "name", "fields.Status"]
521
+ )
522
+
523
+ for entity in entities:
524
+ print(f"Entity: {entity.name} (Status: {entity.fields.get('Status')})")
525
+
526
+ See Also:
527
+ https://benchling.com/api/reference#/Custom%20Entities/bulkGetCustomEntities
245
528
 
246
- See https://benchling.com/api/reference#/Custom%20Entities/bulkGetCustomEntities
247
529
  """
248
530
  entity_id_string = ",".join(entity_ids)
249
531
  returning_string = optional_array_query_param(returning)
@@ -260,9 +542,43 @@ class CustomEntityService(BaseService):
260
542
  self, entities: Iterable[CustomEntityBulkCreate]
261
543
  ) -> TaskHelper[BulkCreateCustomEntitiesAsyncTaskResponse]:
262
544
  """
263
- Bulk create custom entities.
545
+ Create multiple custom entities in a single asynchronous operation.
546
+
547
+ Efficiently creates many custom entities at once. Returns a task that runs
548
+ asynchronously - use the TaskHelper to monitor progress and get results.
549
+
550
+ Args:
551
+ entities (Iterable[CustomEntityBulkCreate]):
552
+ The custom entities to create. Each entity should have the same structure as
553
+ CustomEntityCreate with name, schema_id, folder_id, fields, and optional custom_fields.
554
+
555
+ Returns:
556
+ TaskHelper[BulkCreateCustomEntitiesAsyncTaskResponse]: Async task helper for monitoring the bulk creation operation. Use ``wait_for_completion()``
557
+ or check task status to get results.
558
+
559
+ Example:
560
+ Create multiple entities and wait for completion:
561
+
562
+ .. code-block:: python
563
+
564
+ from benchling_sdk.models import CustomEntityBulkCreate
565
+ from benchling_sdk.helpers.serialization_helpers import fields
566
+
567
+ entities = [
568
+ CustomEntityBulkCreate(
569
+ name=f"Sample {i}",
570
+ schema_id="ts_sample_schema",
571
+ folder_id="lib_samples",
572
+ fields=fields({"Index": {"value": i}})
573
+ ) for i in range(10)
574
+ ]
575
+
576
+ task_helper = custom_entities.bulk_create(entities)
577
+ task = benchling.tasks.wait_for_task(task_helper.task_id)
578
+
579
+ See Also:
580
+ https://benchling.com/api/reference#/Custom%20Entities/bulkCreateCustomEntities
264
581
 
265
- See https://benchling.com/api/reference#/Custom%20Entities/bulkCreateCustomEntities
266
582
  """
267
583
  body = CustomEntitiesBulkCreateRequest(list(entities))
268
584
  response = bulk_create_custom_entities.sync_detailed(client=self.client, json_body=body)
@@ -273,9 +589,44 @@ class CustomEntityService(BaseService):
273
589
  self, entities: Iterable[CustomEntityBulkUpdate]
274
590
  ) -> TaskHelper[BulkUpdateCustomEntitiesAsyncTaskResponse]:
275
591
  """
276
- Bulk update custom entities.
592
+ Update multiple custom entities in a single asynchronous operation.
593
+
594
+ Efficiently updates many custom entities at once. Returns a task that runs
595
+ asynchronously - use the TaskHelper to monitor progress and get results.
596
+
597
+ Args:
598
+ entities (Iterable[CustomEntityBulkUpdate]): The entity updates to apply.
599
+ Each update should contain the entity ID and the fields to update.
600
+
601
+ Returns:
602
+ TaskHelper[BulkUpdateCustomEntitiesAsyncTaskResponse]: Async task helper for monitoring the bulk update operation. Use ``wait_for_completion()``
603
+ or check task status to get results.
604
+
605
+ Example:
606
+ Update multiple entities with new field values:
607
+
608
+ .. code-block:: python
609
+
610
+ from benchling_sdk.models import CustomEntityBulkUpdate
611
+ from benchling_sdk.helpers.serialization_helpers import fields
612
+
613
+ updates = [
614
+ CustomEntityBulkUpdate(
615
+ id="ent_abc123",
616
+ fields=fields({"Status": {"value": "Complete"}})
617
+ ),
618
+ CustomEntityBulkUpdate(
619
+ id="ent_def456",
620
+ fields=fields({"Status": {"value": "In Progress"}})
621
+ )
622
+ ]
623
+
624
+ task_helper = custom_entities.bulk_update(updates)
625
+ task = benchling.tasks.wait_for_task(task_helper.task_id)
626
+
627
+ See Also:
628
+ https://benchling.com/api/reference#/Custom%20Entities/bulkUpdateCustomEntities
277
629
 
278
- See https://benchling.com/api/reference#/Custom%20Entities/bulkUpdateCustomEntities
279
630
  """
280
631
  body = CustomEntitiesBulkUpdateRequest(list(entities))
281
632
  response = bulk_update_custom_entities.sync_detailed(client=self.client, json_body=body)
@@ -284,9 +635,45 @@ class CustomEntityService(BaseService):
284
635
  @api_method
285
636
  def upsert(self, entity_registry_id: str, entity: CustomEntityUpsertRequest) -> CustomEntity:
286
637
  """
287
- Create or modify a custom entity.
638
+ Create or update a custom entity based on registry ID.
639
+
640
+ Creates a new entity if none exists with the given registry ID, or updates
641
+ the existing entity if found. Useful for synchronizing with external systems.
642
+
643
+ Args:
644
+ entity_registry_id (str): The registry ID to use for lookup/creation.
645
+ This should be a unique identifier from your external system.
646
+ entity (CustomEntityUpsertRequest): The entity data containing name,
647
+ schema_id, folder_id, registry_id, fields, and optional custom_fields.
648
+
649
+ Returns:
650
+ CustomEntity: The created or updated custom entity.
651
+
652
+ Example:
653
+ Upsert entity from external system:
654
+
655
+ .. code-block:: python
656
+
657
+ from benchling_sdk.models import CustomEntityUpsertRequest
658
+ from benchling_sdk.helpers.serialization_helpers import fields
659
+
660
+ external_id = "EXT_SAMPLE_001"
661
+ upsert_request = CustomEntityUpsertRequest(
662
+ name="External Sample 001",
663
+ schema_id="ts_sample_schema",
664
+ folder_id="lib_external_samples",
665
+ registry_id="sample_registry",
666
+ fields=fields({
667
+ "External ID": {"value": external_id},
668
+ "Status": {"value": "Active"}
669
+ })
670
+ )
671
+
672
+ entity = custom_entities.upsert(external_id, upsert_request)
673
+
674
+ See Also:
675
+ https://benchling.com/api/reference#/Custom%20Entities/upsertCustomEntity
288
676
 
289
- See https://benchling.com/api/reference#/Custom%20Entities/upsertCustomEntity
290
677
  """
291
678
  response = upsert_custom_entity.sync_detailed(
292
679
  client=self.client, entity_registry_id=entity_registry_id, json_body=entity
@@ -298,9 +685,39 @@ class CustomEntityService(BaseService):
298
685
  self, body: CustomEntitiesBulkUpsertRequest
299
686
  ) -> TaskHelper[BulkUpdateCustomEntitiesAsyncTaskResponse]:
300
687
  """
301
- Bulk update custom entities.
688
+ Create or update multiple custom entities based on registry IDs.
689
+
690
+ Efficiently performs upsert operations on many entities at once. Each entity
691
+ is created if its registry ID doesn't exist, or updated if found.
692
+
693
+ Args:
694
+ body (CustomEntitiesBulkUpsertRequest): Bulk upsert request containing
695
+ the list of entities to upsert, each with registry ID and entity data.
696
+
697
+ Returns:
698
+ TaskHelper[BulkUpdateCustomEntitiesAsyncTaskResponse]: Async task helper for monitoring the bulk upsert operation. Use ``wait_for_completion()``
699
+ to get the final results.
700
+
701
+ Example:
702
+ Bulk upsert multiple entities:
703
+
704
+ .. code-block:: python
705
+
706
+ from benchling_sdk.models import CustomEntitiesBulkUpsertRequest
707
+
708
+ upsert_request = CustomEntitiesBulkUpsertRequest(
709
+ custom_entities=[
710
+ {"registry_id": "REG_001", "name": "Entity 1", "schema_id": "ts_abc123"},
711
+ {"registry_id": "REG_002", "name": "Entity 2", "schema_id": "ts_abc123"}
712
+ ]
713
+ )
714
+
715
+ task_helper = custom_entities.bulk_upsert(upsert_request)
716
+ task = benchling.tasks.wait_for_task(task_helper.task_id)
717
+
718
+ See Also:
719
+ https://benchling.com/api/reference#/Custom%20Entities/bulkUpsertCustomEntities
302
720
 
303
- See https://benchling.com/api/reference#/Custom%20Entities/bulkUpsertCustomEntities
304
721
  """
305
722
  response = bulk_upsert_custom_entities.sync_detailed(client=self.client, json_body=body)
306
723
  return self._task_helper_from_response(response, BulkUpdateCustomEntitiesAsyncTaskResponse)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: benchling-sdk
3
- Version: 1.23.0a2
3
+ Version: 1.23.0a4
4
4
  Summary: SDK for interacting with the Benchling Platform.
5
5
  License: Apache-2.0
6
6
  Author: Benchling Support
@@ -23,9 +23,9 @@ Requires-Dist: dataclasses-json (>=0.5.2,<0.6.0)
23
23
  Requires-Dist: httpx (>=0.23.0)
24
24
  Requires-Dist: jwcrypto (>=1.5.1,<2.0.0)
25
25
  Requires-Dist: ordered-set (>=4.1.0,<5.0.0)
26
- Requires-Dist: psutil (>=5.9.4,<6.0.0) ; python_version >= "3.11" and python_version < "4.0"
27
26
  Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
28
27
  Requires-Dist: python-jose[cryptography] (>=3.3.0,<4.0.0) ; extra == "python-jose"
28
+ Requires-Dist: tzdata (>=2025.2,<2026.0)
29
29
  Description-Content-Type: text/markdown
30
30
 
31
31
  # Benchling SDK
@@ -68,7 +68,7 @@ benchling_sdk/services/v2/stable/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
68
68
  benchling_sdk/services/v2/stable/aa_sequence_service.py,sha256=1lj610UU_1S7tvq_pGAd8WTHraNmGkE4wXAPqQaCRCg,16650
69
69
  benchling_sdk/services/v2/stable/api_service.py,sha256=e0RNp4Jne9UTaHOYMOxxXJpsyUO3WMSFPzN7hB8iliU,12371
70
70
  benchling_sdk/services/v2/stable/app_service.py,sha256=8G81xfmnb6VM22XlO19lC5rmXHuNsORsWc46tJRAais,23376
71
- benchling_sdk/services/v2/stable/assay_result_service.py,sha256=ArDAe7kScS1KZAXGH68hQ_ngjNdMYEAJc4pT5BDHRFA,13476
71
+ benchling_sdk/services/v2/stable/assay_result_service.py,sha256=inU02C4blmhLmYLm-jsDO7XFpkyOtFtvgfekFkKyybk,13694
72
72
  benchling_sdk/services/v2/stable/assay_run_service.py,sha256=_GLp0_Kp6kcPpTt4BT19-REDRrJ2laXVfOXbFZmnp3k,9053
73
73
  benchling_sdk/services/v2/stable/audit_service.py,sha256=aSYzjJsimXZTRX3t4Mk-Ay_J5mKxRoGzZgLIqNvs1Qw,1983
74
74
  benchling_sdk/services/v2/stable/blob_service.py,sha256=Hv5UuJ683jNIvffZDXGYsvLMATwjweEEnzP0SWOzLds,17138
@@ -76,7 +76,7 @@ benchling_sdk/services/v2/stable/box_service.py,sha256=DQOaojhpA-MeCKNsRPjzLfFKB
76
76
  benchling_sdk/services/v2/stable/codon_usage_table_service.py,sha256=qQdn98s9kzb-YSPdVDrizfqbbugslPdMTykrHSRHtQU,2830
77
77
  benchling_sdk/services/v2/stable/connect_service.py,sha256=06MzI77NNOlciQPNxNA3zxdFxSOO94XaGbcjIQrhTDQ,3498
78
78
  benchling_sdk/services/v2/stable/container_service.py,sha256=GC2v2J3XC12650AytQSUmLI4kzNSBnDxTKQqudsepuk,19236
79
- benchling_sdk/services/v2/stable/custom_entity_service.py,sha256=BT1MD7PwyABZEUfOxVzcFKjqRNwDuw_4HDPjUAQZ6wk,12831
79
+ benchling_sdk/services/v2/stable/custom_entity_service.py,sha256=zky1HSbQ6ie8-RsaoI7EWyWcnJizBUGBEV3FugclOtE,31467
80
80
  benchling_sdk/services/v2/stable/custom_notation_service.py,sha256=LCnt8hoCkkSRbz-bXUaYbuMaE-1XdYmXB0MgeQ30POc,2141
81
81
  benchling_sdk/services/v2/stable/data_frame_service.py,sha256=1hKFlZhEyTmzrUzUI_uxu2fkjamQpOxoKF5ZVTC4knM,15376
82
82
  benchling_sdk/services/v2/stable/dataset_service.py,sha256=Agu55ZEQiyqOS2QQaXsO4I2WvCypMBeHeKtrJ4v9W5Q,7693
@@ -125,7 +125,7 @@ benchling_sdk/services/v2/v2_alpha_service.py,sha256=5lbUv8r_6bRIrV32ZaD8UsZ7xGJ
125
125
  benchling_sdk/services/v2/v2_beta_service.py,sha256=DjmOIZSURH1Q3oAGWnXgQohEiHOOLek3mIoS-wE9YnY,5664
126
126
  benchling_sdk/services/v2/v2_stable_service.py,sha256=X6S55gZJpWSdYZp7vDszanv-r6jDGtPHMV-uJFsn4tc,31365
127
127
  benchling_sdk/services/v2_service.py,sha256=77N3-9YYrgjMUmEQviwPav_nrrUjg7AJppuQmwI5JoM,3092
128
- benchling_sdk-1.23.0a2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
129
- benchling_sdk-1.23.0a2.dist-info/METADATA,sha256=87sK88bw9JUZ3pwO4wYyGa1ZOt4UqaLGBYk-QJgZZGE,2060
130
- benchling_sdk-1.23.0a2.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
131
- benchling_sdk-1.23.0a2.dist-info/RECORD,,
128
+ benchling_sdk-1.23.0a4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
129
+ benchling_sdk-1.23.0a4.dist-info/METADATA,sha256=Sk7FnnL-P9Tgb3xQAN7FJxx_xYlColkJ31QdPaSqbUw,2008
130
+ benchling_sdk-1.23.0a4.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
131
+ benchling_sdk-1.23.0a4.dist-info/RECORD,,