Skip to content

Commit 8b3c6f4

Browse files
authored
feat: add missing optional parameters to resource clients (#1144)
Adds optional parameters that the API accepts and the JS client already exposes: - Task `create()` / `update()`: `description`, `max_total_charge_usd` - Webhook `create()` / `update()`: `description`, `should_interpolate_strings` - Schedule `create()` / `update()`: `notifications_email` (sent as `notifications.email`) - Store `list()` / `iterate()`: `include_unrunnable_actors` - Actor `create()`: `actor_permission_level` - Dataset, key-value store and request queue `update()`: `title` - Dataset: `flatten` and `view` on `iterate_items()`, `view` and `attachment` on `get_items_as_bytes()` and `stream_items()`, `item_format` on `create_items_public_url()` `notifications` and `actor_permission_level` go through the generated request models, which got these fields in #1152 (from apify/apify-docs#3087). Task input stays dict-only: the spec allows a list, but the API rejects anything other than an object. Closes: #1147 *✍️ Drafted by Claude Code*
1 parent 304c8e9 commit 8b3c6f4

19 files changed

Lines changed: 850 additions & 4 deletions

‎src/apify_client/_resource_clients/actor_collection.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def create(
137137
actor_standby_memory_mbytes: int | None = None,
138138
actor_standby_disable_standby_fields_override: bool | None = None,
139139
actor_standby_should_pass_actor_input: bool | None = None,
140+
actor_permission_level: ActorPermissionLevel | None = None,
140141
timeout: Timeout = 'medium',
141142
) -> ActorResource:
142143
"""Create a new Actor.
@@ -178,6 +179,7 @@ def create(
178179
overridden elsewhere.
179180
actor_standby_should_pass_actor_input: Whether to pass the Actor input to the Standby runs. If false,
180181
the Standby runs start with no input.
182+
actor_permission_level: The permission level of the Actor on Apify platform.
181183
timeout: Timeout for the API HTTP request.
182184
183185
Returns:
@@ -191,6 +193,7 @@ def create(
191193
seo_description=seo_description,
192194
versions=versions,
193195
is_public=is_public,
196+
actor_permission_level=actor_permission_level,
194197
is_deprecated=is_deprecated,
195198
categories=categories,
196199
default_run_options=DefaultRunOptions(
@@ -331,6 +334,7 @@ async def create(
331334
actor_standby_memory_mbytes: int | None = None,
332335
actor_standby_disable_standby_fields_override: bool | None = None,
333336
actor_standby_should_pass_actor_input: bool | None = None,
337+
actor_permission_level: ActorPermissionLevel | None = None,
334338
timeout: Timeout = 'medium',
335339
) -> ActorResource:
336340
"""Create a new Actor.
@@ -372,6 +376,7 @@ async def create(
372376
overridden elsewhere.
373377
actor_standby_should_pass_actor_input: Whether to pass the Actor input to the Standby runs. If false,
374378
the Standby runs start with no input.
379+
actor_permission_level: The permission level of the Actor on Apify platform.
375380
timeout: Timeout for the API HTTP request.
376381
377382
Returns:
@@ -385,6 +390,7 @@ async def create(
385390
seo_description=seo_description,
386391
versions=versions,
387392
is_public=is_public,
393+
actor_permission_level=actor_permission_level,
388394
is_deprecated=is_deprecated,
389395
categories=categories,
390396
default_run_options=DefaultRunOptions(

‎src/apify_client/_resource_clients/dataset.py‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def update(
9090
self,
9191
*,
9292
name: str | None = None,
93+
title: str | None = None,
9394
general_access: GeneralAccess | None = None,
9495
timeout: Timeout = 'short',
9596
) -> DatasetResource:
@@ -99,6 +100,7 @@ def update(
99100
100101
Args:
101102
name: The new name for the dataset.
103+
title: The new title for the dataset.
102104
general_access: Determines how others can access the dataset.
103105
timeout: Timeout for the API HTTP request.
104106
@@ -108,6 +110,7 @@ def update(
108110
result = self._update(
109111
timeout=timeout,
110112
name=name,
113+
title=title,
111114
generalAccess=general_access,
112115
)
113116
return DatasetResponse.model_validate(result).data
@@ -224,6 +227,8 @@ def iterate_items(
224227
unwind: list[str] | None = None,
225228
skip_empty: bool | None = None,
226229
skip_hidden: bool | None = None,
230+
flatten: list[str] | None = None,
231+
view: str | None = None,
227232
signature: str | None = None,
228233
chunk_size: int | None = None,
229234
timeout: Timeout = 'long',
@@ -260,6 +265,8 @@ def iterate_items(
260265
contain less items than the limit value.
261266
skip_hidden: If True, then hidden fields are skipped from the output, i.e. fields starting with
262267
the # character.
268+
flatten: A list of fields that should be flattened.
269+
view: Name of the dataset view to be used.
263270
signature: Signature used to access the items.
264271
chunk_size: Maximum number of dataset rows requested per API call when iterating across pages.
265272
timeout: Timeout for the API HTTP request.
@@ -279,6 +286,8 @@ def _callback(*, limit: int | None = None, offset: int | None = None) -> Dataset
279286
unwind=unwind,
280287
skip_empty=skip_empty,
281288
skip_hidden=skip_hidden,
289+
flatten=flatten,
290+
view=view,
282291
signature=signature,
283292
timeout=timeout,
284293
)
@@ -304,6 +313,8 @@ def get_items_as_bytes(
304313
xml_root: str | None = None,
305314
xml_row: str | None = None,
306315
flatten: list[str] | None = None,
316+
view: str | None = None,
317+
attachment: bool | None = None,
307318
signature: str | None = None,
308319
timeout: Timeout = 'long',
309320
) -> bytes:
@@ -348,6 +359,9 @@ def get_items_as_bytes(
348359
xml_row: Overrides default element name that wraps each page or page function result object in xml output.
349360
By default the element name is item.
350361
flatten: A list of fields that should be flattened.
362+
view: Name of the dataset view to be used.
363+
attachment: If True, the response defines the `Content-Disposition: attachment` header, which makes a web
364+
browser download the file without displaying it.
351365
signature: Signature used to access the items.
352366
timeout: Timeout for the API HTTP request.
353367
@@ -371,6 +385,8 @@ def get_items_as_bytes(
371385
xmlRoot=xml_root,
372386
xmlRow=xml_row,
373387
flatten=flatten,
388+
view=view,
389+
attachment=attachment,
374390
signature=signature,
375391
)
376392

@@ -403,6 +419,8 @@ def stream_items(
403419
xml_root: str | None = None,
404420
xml_row: str | None = None,
405421
flatten: list[str] | None = None,
422+
view: str | None = None,
423+
attachment: bool | None = None,
406424
signature: str | None = None,
407425
timeout: Timeout = 'long',
408426
) -> Generator[HttpResponse]:
@@ -447,6 +465,9 @@ def stream_items(
447465
xml_row: Overrides default element name that wraps each page or page function result object in xml output.
448466
By default the element name is item.
449467
flatten: A list of fields that should be flattened.
468+
view: Name of the dataset view to be used.
469+
attachment: If True, the response defines the `Content-Disposition: attachment` header, which makes a web
470+
browser download the file without displaying it.
450471
signature: Signature used to access the items.
451472
timeout: Timeout for the API HTTP request.
452473
@@ -472,6 +493,8 @@ def stream_items(
472493
xmlRoot=xml_root,
473494
xmlRow=xml_row,
474495
flatten=flatten,
496+
view=view,
497+
attachment=attachment,
475498
signature=signature,
476499
)
477500

@@ -541,6 +564,7 @@ def get_statistics(self, *, timeout: Timeout = 'short') -> DatasetStatistics:
541564
def create_items_public_url(
542565
self,
543566
*,
567+
item_format: str | None = None,
544568
offset: int | None = None,
545569
limit: int | None = None,
546570
clean: bool | None = None,
@@ -567,6 +591,8 @@ def create_items_public_url(
567591
Any other options (like `limit` or `offset`) will be included as query parameters in the URL.
568592
569593
Args:
594+
item_format: Format of the results, possible values are: json, jsonl, csv, html, xlsx, xml and rss.
595+
By default, the URL serves JSON.
570596
offset: Number of items that should be skipped at the start. The default value is 0.
571597
limit: Maximum number of items to return. By default there is no limit.
572598
clean: If True, returns only non-empty items and skips hidden fields.
@@ -588,6 +614,7 @@ def create_items_public_url(
588614
dataset = self.get(timeout=timeout)
589615

590616
request_params = self._build_params(
617+
format=item_format,
591618
offset=offset,
592619
limit=limit,
593620
desc=desc,
@@ -653,6 +680,7 @@ async def update(
653680
self,
654681
*,
655682
name: str | None = None,
683+
title: str | None = None,
656684
general_access: GeneralAccess | None = None,
657685
timeout: Timeout = 'short',
658686
) -> DatasetResource:
@@ -662,6 +690,7 @@ async def update(
662690
663691
Args:
664692
name: The new name for the dataset.
693+
title: The new title for the dataset.
665694
general_access: Determines how others can access the dataset.
666695
timeout: Timeout for the API HTTP request.
667696
@@ -671,6 +700,7 @@ async def update(
671700
result = await self._update(
672701
timeout=timeout,
673702
name=name,
703+
title=title,
674704
generalAccess=general_access,
675705
)
676706
return DatasetResponse.model_validate(result).data
@@ -787,6 +817,8 @@ def iterate_items(
787817
unwind: list[str] | None = None,
788818
skip_empty: bool | None = None,
789819
skip_hidden: bool | None = None,
820+
flatten: list[str] | None = None,
821+
view: str | None = None,
790822
signature: str | None = None,
791823
chunk_size: int | None = None,
792824
timeout: Timeout = 'long',
@@ -823,6 +855,8 @@ def iterate_items(
823855
contain less items than the limit value.
824856
skip_hidden: If True, then hidden fields are skipped from the output, i.e. fields starting with
825857
the # character.
858+
flatten: A list of fields that should be flattened.
859+
view: Name of the dataset view to be used.
826860
signature: Signature used to access the items.
827861
chunk_size: Maximum number of dataset rows requested per API call when iterating across pages.
828862
timeout: Timeout for the API HTTP request.
@@ -842,6 +876,8 @@ async def _callback(*, limit: int | None = None, offset: int | None = None) -> D
842876
unwind=unwind,
843877
skip_empty=skip_empty,
844878
skip_hidden=skip_hidden,
879+
flatten=flatten,
880+
view=view,
845881
signature=signature,
846882
timeout=timeout,
847883
)
@@ -869,6 +905,8 @@ async def get_items_as_bytes(
869905
xml_root: str | None = None,
870906
xml_row: str | None = None,
871907
flatten: list[str] | None = None,
908+
view: str | None = None,
909+
attachment: bool | None = None,
872910
signature: str | None = None,
873911
timeout: Timeout = 'long',
874912
) -> bytes:
@@ -913,6 +951,9 @@ async def get_items_as_bytes(
913951
xml_row: Overrides default element name that wraps each page or page function result object in xml output.
914952
By default the element name is item.
915953
flatten: A list of fields that should be flattened.
954+
view: Name of the dataset view to be used.
955+
attachment: If True, the response defines the `Content-Disposition: attachment` header, which makes a web
956+
browser download the file without displaying it.
916957
signature: Signature used to access the items.
917958
timeout: Timeout for the API HTTP request.
918959
@@ -936,6 +977,8 @@ async def get_items_as_bytes(
936977
xmlRoot=xml_root,
937978
xmlRow=xml_row,
938979
flatten=flatten,
980+
view=view,
981+
attachment=attachment,
939982
signature=signature,
940983
)
941984

@@ -968,6 +1011,8 @@ async def stream_items(
9681011
xml_root: str | None = None,
9691012
xml_row: str | None = None,
9701013
flatten: list[str] | None = None,
1014+
view: str | None = None,
1015+
attachment: bool | None = None,
9711016
signature: str | None = None,
9721017
timeout: Timeout = 'long',
9731018
) -> AsyncGenerator[HttpResponse]:
@@ -1012,6 +1057,9 @@ async def stream_items(
10121057
xml_row: Overrides default element name that wraps each page or page function result object in xml output.
10131058
By default the element name is item.
10141059
flatten: A list of fields that should be flattened.
1060+
view: Name of the dataset view to be used.
1061+
attachment: If True, the response defines the `Content-Disposition: attachment` header, which makes a web
1062+
browser download the file without displaying it.
10151063
signature: Signature used to access the items.
10161064
timeout: Timeout for the API HTTP request.
10171065
@@ -1037,6 +1085,8 @@ async def stream_items(
10371085
xmlRoot=xml_root,
10381086
xmlRow=xml_row,
10391087
flatten=flatten,
1088+
view=view,
1089+
attachment=attachment,
10401090
signature=signature,
10411091
)
10421092

@@ -1106,6 +1156,7 @@ async def get_statistics(self, *, timeout: Timeout = 'short') -> DatasetStatisti
11061156
async def create_items_public_url(
11071157
self,
11081158
*,
1159+
item_format: str | None = None,
11091160
offset: int | None = None,
11101161
limit: int | None = None,
11111162
clean: bool | None = None,
@@ -1132,6 +1183,8 @@ async def create_items_public_url(
11321183
Any other options (like `limit` or `offset`) will be included as query parameters in the URL.
11331184
11341185
Args:
1186+
item_format: Format of the results, possible values are: json, jsonl, csv, html, xlsx, xml and rss.
1187+
By default, the URL serves JSON.
11351188
offset: Number of items that should be skipped at the start. The default value is 0.
11361189
limit: Maximum number of items to return. By default there is no limit.
11371190
clean: If True, returns only non-empty items and skips hidden fields.
@@ -1153,6 +1206,7 @@ async def create_items_public_url(
11531206
dataset = await self.get(timeout=timeout)
11541207

11551208
request_params = self._build_params(
1209+
format=item_format,
11561210
offset=offset,
11571211
limit=limit,
11581212
desc=desc,

‎src/apify_client/_resource_clients/key_value_store.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def update(
105105
self,
106106
*,
107107
name: str | None = None,
108+
title: str | None = None,
108109
general_access: GeneralAccess | None = None,
109110
timeout: Timeout = 'long',
110111
) -> KeyValueStoreResource:
@@ -114,13 +115,14 @@ def update(
114115
115116
Args:
116117
name: The new name for key-value store.
118+
title: The new title for the key-value store.
117119
general_access: Determines how others can access the key-value store.
118120
timeout: Timeout for the API HTTP request.
119121
120122
Returns:
121123
The updated key-value store.
122124
"""
123-
result = self._update(timeout=timeout, name=name, generalAccess=general_access)
125+
result = self._update(timeout=timeout, name=name, title=title, generalAccess=general_access)
124126
return KeyValueStoreResponse.model_validate(result).data
125127

126128
def delete(self, *, timeout: Timeout = 'short') -> None:
@@ -541,6 +543,7 @@ async def update(
541543
self,
542544
*,
543545
name: str | None = None,
546+
title: str | None = None,
544547
general_access: GeneralAccess | None = None,
545548
timeout: Timeout = 'long',
546549
) -> KeyValueStoreResource:
@@ -550,13 +553,14 @@ async def update(
550553
551554
Args:
552555
name: The new name for key-value store.
556+
title: The new title for the key-value store.
553557
general_access: Determines how others can access the key-value store.
554558
timeout: Timeout for the API HTTP request.
555559
556560
Returns:
557561
The updated key-value store.
558562
"""
559-
result = await self._update(timeout=timeout, name=name, generalAccess=general_access)
563+
result = await self._update(timeout=timeout, name=name, title=title, generalAccess=general_access)
560564
return KeyValueStoreResponse.model_validate(result).data
561565

562566
async def delete(self, *, timeout: Timeout = 'short') -> None:

0 commit comments

Comments
 (0)