Skip to content

Commit 6e76310

Browse files
chore: regenerate models with split create/update version requests (#1152)
- Regenerates the Pydantic models, TypedDicts, and literal aliases from the [published OpenAPI specification](https://docs.apify.com/api/openapi.json), and records its version in `pyproject.toml`. - Specification version: `v2-2026-10-01T153946Z` -> `v2-2026-10-08T073338Z`. --------- Co-authored-by: Vlada Dusek <v.dusek96@gmail.com>
1 parent 40f4e65 commit 6e76310

6 files changed

Lines changed: 124 additions & 59 deletions

File tree

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ keep_model_order = true
251251
# workflow committing nothing unless the models changed. A local regeneration that only moves this line is that
252252
# same case - drop it rather than committing it alone.
253253
[tool.apify.openapi-spec]
254-
version = "v2-2026-10-01T153946Z"
254+
version = "v2-2026-10-08T073338Z"
255255

256256
[tool.uv]
257257
# Minimal defense against supply-chain atatcks.

‎src/apify_client/_literals.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,3 +538,15 @@
538538
| str
539539
)
540540
"""Type of event that triggers the webhook."""
541+
542+
543+
WritableVersionSourceType = (
544+
Literal[
545+
'SOURCE_FILES',
546+
'GIT_REPO',
547+
'TARBALL',
548+
'GITHUB_GIST',
549+
]
550+
| str
551+
)
552+
"""The version source types accepted in request bodies. Same as `VersionSourceType`, without `SOURCE_CODE`."""

‎src/apify_client/_models.py‎

Lines changed: 102 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
VersionSourceType,
2121
WebhookDispatchStatus,
2222
WebhookEventType,
23+
WritableVersionSourceType,
2324
)
2425

2526

@@ -780,8 +781,9 @@ class CreateActorRequest(BaseModel):
780781
"""
781782
is_public: Annotated[bool | None, Field(examples=[False])] = None
782783
"""
783-
Whether the Actor is available to users in Apify Store. If `false`, the Actor is private and only visible to you.
784+
Whether the Actor is available to users in Apify Store. A new Actor is always private. To publish it, build it first, then update it with `isPublic` set to `true`.
784785
"""
786+
actor_permission_level: ActorPermissionLevel | None = None
785787
seo_title: Annotated[str | None, Field(examples=['Free Instagram scraper'])] = None
786788
"""
787789
Name of the Actor to display by search engines such as Google. Can be different from the Actor's name displayed in Apify Store and Console. Recommended length is 40-50 characters.
@@ -791,7 +793,7 @@ class CreateActorRequest(BaseModel):
791793
Description of the Actor to display by search engines such as Google. Recommended length is 140-156 characters.
792794
"""
793795
restart_on_error: Annotated[bool | None, Field(deprecated=True, examples=[False])] = None
794-
versions: list[Version] | None = None
796+
versions: Annotated[list[CreateVersionRequest] | None, Field(min_length=1)] = None
795797
"""
796798
An array of `Version` objects. Each object represents a specific version of the Actor's source code: its location, builds, and environment configuration.
797799
"""
@@ -828,30 +830,51 @@ class CreateOrUpdateScheduleRequest(BaseModel):
828830
timezone: Annotated[str | None, Field(examples=['UTC'])] = None
829831
description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = None
830832
title: str | None = None
833+
notifications: ScheduleNotifications | None = None
831834
actions: (
832835
list[Annotated[ScheduleCreateActionRunActor | ScheduleCreateActionRunActorTask, Field(discriminator='type')]]
833836
| None
834837
) = None
835838

836839

837840
@docs_group('Models')
838-
class CreateOrUpdateVersionRequest(BaseModel):
841+
class CreateTaskRequest(BaseModel):
839842
model_config = ConfigDict(
840843
extra='allow',
841844
populate_by_name=True,
842845
alias_generator=to_camel,
843846
)
844-
version_number: Annotated[
845-
str | None, Field(examples=['1.6'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$')
846-
] = None
847+
act_id: Annotated[str, Field(examples=['asADASadYvn4mBZmm'])]
848+
name: Annotated[str | None, Field(examples=['my-task'])] = None
849+
options: TaskOptions | None = None
850+
input: TaskInput | list[TaskInput] | None = None
851+
title: str | None = None
852+
description: str | None = None
853+
actor_standby: ActorStandby | None = None
854+
public_config: TaskPublicConfig | None = None
855+
"""
856+
Configuration that controls how the published task appears on its public landing page.
857+
Editing this object requires write permission to the Actor that the task belongs to.
858+
859+
"""
860+
861+
862+
@docs_group('Models')
863+
class CreateVersionRequest(BaseModel):
864+
model_config = ConfigDict(
865+
extra='allow',
866+
populate_by_name=True,
867+
alias_generator=to_camel,
868+
)
869+
version_number: Annotated[str, Field(examples=['1.6'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$')]
847870
"""
848871
The version number of the Actor. Two numbers separated by a dot, that represent the `MAJOR.MINOR` part of the semantic versioning.
849872
"""
850-
source_type: VersionSourceType | None = None
873+
source_type: WritableVersionSourceType
851874
"""
852875
Where the source code of the version lives.
853876
"""
854-
env_vars: list[EnvVar] | None = None
877+
env_vars: list[EnvVarRequest] | None = None
855878
"""
856879
Environment variables for the version.
857880
"""
@@ -881,28 +904,6 @@ class CreateOrUpdateVersionRequest(BaseModel):
881904
"""
882905

883906

884-
@docs_group('Models')
885-
class CreateTaskRequest(BaseModel):
886-
model_config = ConfigDict(
887-
extra='allow',
888-
populate_by_name=True,
889-
alias_generator=to_camel,
890-
)
891-
act_id: Annotated[str, Field(examples=['asADASadYvn4mBZmm'])]
892-
name: Annotated[str | None, Field(examples=['my-task'])] = None
893-
options: TaskOptions | None = None
894-
input: TaskInput | list[TaskInput] | None = None
895-
title: str | None = None
896-
description: str | None = None
897-
actor_standby: ActorStandby | None = None
898-
public_config: TaskPublicConfig | None = None
899-
"""
900-
Configuration that controls how the published task appears on its public landing page.
901-
Editing this object requires write permission to the Actor that the task belongs to.
902-
903-
"""
904-
905-
906907
@docs_group('Models')
907908
class CreateWebhookRequest(BaseModel):
908909
model_config = ConfigDict(
@@ -1408,15 +1409,23 @@ class EnvVar(BaseModel):
14081409

14091410

14101411
@docs_group('Models')
1411-
class EnvVarRequest(EnvVar):
1412+
class EnvVarRequest(BaseModel):
14121413
model_config = ConfigDict(
14131414
extra='allow',
14141415
populate_by_name=True,
14151416
alias_generator=to_camel,
14161417
)
1418+
name: Annotated[str, Field(examples=['MY_ENV_VAR'])]
1419+
"""
1420+
The name of the environment variable. Can't contain `=`.
1421+
"""
14171422
value: Annotated[str, Field(examples=['my-value'])]
14181423
"""
1419-
The value of the environment variable. If `isSecret` is `true`, this value isn't returned by the API.
1424+
The value of the environment variable.
1425+
"""
1426+
is_secret: Annotated[bool | None, Field(examples=[False])] = None
1427+
"""
1428+
Whether the environment variable is encrypted. Secret values aren't returned by the API.
14201429
"""
14211430

14221431

@@ -1988,18 +1997,6 @@ class MonthlyUsageResponse(BaseModel):
19881997
data: MonthlyUsage
19891998

19901999

1991-
@docs_group('Models')
1992-
class Notifications(BaseModel):
1993-
"""Notification settings for this schedule."""
1994-
1995-
model_config = ConfigDict(
1996-
extra='allow',
1997-
populate_by_name=True,
1998-
alias_generator=to_camel,
1999-
)
2000-
email: Annotated[bool | None, Field(examples=[True])] = None
2001-
2002-
20032000
@docs_group('Models')
20042001
class PaginationResponse(BaseModel):
20052002
"""Common pagination fields for list responses."""
@@ -3173,10 +3170,7 @@ class Schedule(ScheduleBase):
31733170
)
31743171
description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = None
31753172
title: str | None = None
3176-
notifications: Annotated[Notifications | None, Field(title='ScheduleNotifications')] = None
3177-
"""
3178-
Notification settings for this schedule.
3179-
"""
3173+
notifications: ScheduleNotifications | None = None
31803174
actions: list[Annotated[ScheduleActionRunActor | ScheduleActionRunActorTask, Field(discriminator='type')]]
31813175

31823176

@@ -3263,6 +3257,18 @@ class ScheduleLogResponse(BaseModel):
32633257
data: list[ScheduleLogEntry]
32643258

32653259

3260+
@docs_group('Models')
3261+
class ScheduleNotifications(BaseModel):
3262+
"""Notification settings for this schedule."""
3263+
3264+
model_config = ConfigDict(
3265+
extra='allow',
3266+
populate_by_name=True,
3267+
alias_generator=to_camel,
3268+
)
3269+
email: Annotated[bool | None, Field(examples=[True])] = None
3270+
3271+
32663272
@docs_group('Models')
32673273
class ScheduleResponse(BaseModel):
32683274
model_config = ConfigDict(
@@ -3684,7 +3690,7 @@ class UpdateActorRequest(BaseModel):
36843690
Human-readable name of the Actor, displayed in Apify Store and Console. Can contain spaces and capital letters. Recommended length is 40-50 characters. You can change this title without affecting the Actor's URL or SEO.
36853691
"""
36863692
restart_on_error: Annotated[bool | None, Field(deprecated=True, examples=[False])] = None
3687-
versions: list[CreateOrUpdateVersionRequest] | None = None
3693+
versions: Annotated[list[CreateVersionRequest] | None, Field(min_length=1)] = None
36883694
"""
36893695
An array of `Version` objects. Each object represents a specific version of the Actor's source code: its location, builds, and environment configuration.
36903696
"""
@@ -3835,6 +3841,53 @@ class UpdateTaskRequest(BaseModel):
38353841
"""
38363842

38373843

3844+
@docs_group('Models')
3845+
class UpdateVersionRequest(BaseModel):
3846+
model_config = ConfigDict(
3847+
extra='allow',
3848+
populate_by_name=True,
3849+
alias_generator=to_camel,
3850+
)
3851+
version_number: Annotated[
3852+
str | None, Field(examples=['1.6'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$')
3853+
] = None
3854+
"""
3855+
The version number of the Actor. Two numbers separated by a dot, that represent the `MAJOR.MINOR` part of the semantic versioning.
3856+
"""
3857+
source_type: WritableVersionSourceType | None = None
3858+
"""
3859+
Where the source code of the version lives.
3860+
"""
3861+
env_vars: list[EnvVarRequest] | None = None
3862+
"""
3863+
Environment variables for the version.
3864+
"""
3865+
apply_env_vars_to_build: Annotated[bool | None, Field(examples=[False])] = None
3866+
"""
3867+
Whether to inject the environment variables at build time.
3868+
"""
3869+
build_tag: Annotated[str | None, Field(examples=['latest'])] = None
3870+
"""
3871+
The tag name to apply to a successful build of this version. Can be `null` when the version has no build tag.
3872+
"""
3873+
source_files: Annotated[list[SourceCodeFile | SourceCodeFolder] | None, Field(title='VersionSourceFiles')] = None
3874+
"""
3875+
Applies when the `sourceType` is `SOURCE_FILES`. Represents the Actor's file structure as an array of files and folders.
3876+
"""
3877+
git_repo_url: str | None = None
3878+
"""
3879+
URL of the Git repository to clone the source code from. Applies when the `sourceType` is `GIT_REPO`.
3880+
"""
3881+
tarball_url: str | None = None
3882+
"""
3883+
URL of the tarball to download the source code from. Applies when the `sourceType` is `TARBALL`.
3884+
"""
3885+
github_gist_url: Annotated[str | None, Field(alias='gitHubGistUrl')] = None
3886+
"""
3887+
URL of the GitHub Gist to clone the source code from. Applies when the `sourceType` is `GITHUB_GIST`.
3888+
"""
3889+
3890+
38383891
@docs_group('Models')
38393892
class UpdateWebhookRequest(BaseModel):
38403893
model_config = ConfigDict(

‎src/apify_client/_resource_clients/actor.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ActorStandby,
1313
Build,
1414
BuildResponse,
15-
CreateOrUpdateVersionRequest,
15+
CreateVersionRequest,
1616
DefaultRunOptions,
1717
ExampleRunInput,
1818
FlatPricePerMonthActorPricingInfo,
@@ -191,7 +191,7 @@ def update(
191191
description=description,
192192
seo_title=seo_title,
193193
seo_description=seo_description,
194-
versions=[CreateOrUpdateVersionRequest.model_validate(v) for v in versions] if versions else None,
194+
versions=[CreateVersionRequest.model_validate(v) for v in versions] if versions else None,
195195
is_public=is_public,
196196
is_deprecated=is_deprecated,
197197
categories=categories,
@@ -751,7 +751,7 @@ async def update(
751751
description=description,
752752
seo_title=seo_title,
753753
seo_description=seo_description,
754-
versions=[CreateOrUpdateVersionRequest.model_validate(v) for v in versions] if versions else None,
754+
versions=[CreateVersionRequest.model_validate(v) for v in versions] if versions else None,
755755
is_public=is_public,
756756
is_deprecated=is_deprecated,
757757
categories=categories,

‎src/apify_client/_resource_clients/actor_version.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
from apify_client._docs import docs_group
88
from apify_client._models import (
9-
CreateOrUpdateVersionRequest,
109
EnvVarRequest,
1110
SourceCodeFile,
1211
SourceCodeFolder,
12+
UpdateVersionRequest,
1313
Version,
1414
VersionResponse,
1515
)
@@ -102,7 +102,7 @@ def update(
102102
Returns:
103103
The updated Actor version.
104104
"""
105-
version_fields = CreateOrUpdateVersionRequest(
105+
version_fields = UpdateVersionRequest(
106106
build_tag=build_tag,
107107
env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None,
108108
apply_env_vars_to_build=apply_env_vars_to_build,
@@ -218,7 +218,7 @@ async def update(
218218
Returns:
219219
The updated Actor version.
220220
"""
221-
version_fields = CreateOrUpdateVersionRequest(
221+
version_fields = UpdateVersionRequest(
222222
build_tag=build_tag,
223223
env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None,
224224
apply_env_vars_to_build=apply_env_vars_to_build,

‎src/apify_client/_resource_clients/actor_version_collection.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from apify_client._docs import docs_group
88
from apify_client._models import (
9-
CreateOrUpdateVersionRequest,
9+
CreateVersionRequest,
1010
EnvVarRequest,
1111
ListOfVersions,
1212
ListOfVersionsResponse,
@@ -117,7 +117,7 @@ def create(
117117
Returns:
118118
The created Actor version.
119119
"""
120-
version_fields = CreateOrUpdateVersionRequest(
120+
version_fields = CreateVersionRequest(
121121
version_number=version_number,
122122
build_tag=build_tag,
123123
env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None,
@@ -223,7 +223,7 @@ async def create(
223223
Returns:
224224
The created Actor version.
225225
"""
226-
version_fields = CreateOrUpdateVersionRequest(
226+
version_fields = CreateVersionRequest(
227227
version_number=version_number,
228228
build_tag=build_tag,
229229
env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None,

0 commit comments

Comments
 (0)