Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/apify_client/_literals.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,3 +538,15 @@
| str
)
"""Type of event that triggers the webhook."""


WritableVersionSourceType = (
Literal[
'SOURCE_FILES',
'GIT_REPO',
'TARBALL',
'GITHUB_GIST',
]
| str
)
"""The version source types accepted in request bodies. Same as `VersionSourceType`, without `SOURCE_CODE`."""
151 changes: 102 additions & 49 deletions src/apify_client/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
VersionSourceType,
WebhookDispatchStatus,
WebhookEventType,
WritableVersionSourceType,
)


Expand Down Expand Up @@ -780,8 +781,9 @@ class CreateActorRequest(BaseModel):
"""
is_public: Annotated[bool | None, Field(examples=[False])] = None
"""
Whether the Actor is available to users in Apify Store. If `false`, the Actor is private and only visible to you.
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`.
"""
actor_permission_level: ActorPermissionLevel | None = None
seo_title: Annotated[str | None, Field(examples=['Free Instagram scraper'])] = None
"""
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.
Expand All @@ -791,7 +793,7 @@ class CreateActorRequest(BaseModel):
Description of the Actor to display by search engines such as Google. Recommended length is 140-156 characters.
"""
restart_on_error: Annotated[bool | None, Field(deprecated=True, examples=[False])] = None
versions: list[Version] | None = None
versions: Annotated[list[CreateVersionRequest] | None, Field(min_length=1)] = None
"""
An array of `Version` objects. Each object represents a specific version of the Actor's source code: its location, builds, and environment configuration.
"""
Expand Down Expand Up @@ -828,30 +830,51 @@ class CreateOrUpdateScheduleRequest(BaseModel):
timezone: Annotated[str | None, Field(examples=['UTC'])] = None
description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = None
title: str | None = None
notifications: ScheduleNotifications | None = None
actions: (
list[Annotated[ScheduleCreateActionRunActor | ScheduleCreateActionRunActorTask, Field(discriminator='type')]]
| None
) = None


@docs_group('Models')
class CreateOrUpdateVersionRequest(BaseModel):
class CreateTaskRequest(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
version_number: Annotated[
str | None, Field(examples=['1.6'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$')
] = None
act_id: Annotated[str, Field(examples=['asADASadYvn4mBZmm'])]
name: Annotated[str | None, Field(examples=['my-task'])] = None
options: TaskOptions | None = None
input: TaskInput | list[TaskInput] | None = None
title: str | None = None
description: str | None = None
actor_standby: ActorStandby | None = None
public_config: TaskPublicConfig | None = None
"""
Configuration that controls how the published task appears on its public landing page.
Editing this object requires write permission to the Actor that the task belongs to.

"""


@docs_group('Models')
class CreateVersionRequest(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
version_number: Annotated[str, Field(examples=['1.6'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$')]
"""
The version number of the Actor. Two numbers separated by a dot, that represent the `MAJOR.MINOR` part of the semantic versioning.
"""
source_type: VersionSourceType | None = None
source_type: WritableVersionSourceType
"""
Where the source code of the version lives.
"""
env_vars: list[EnvVar] | None = None
env_vars: list[EnvVarRequest] | None = None
"""
Environment variables for the version.
"""
Expand Down Expand Up @@ -881,28 +904,6 @@ class CreateOrUpdateVersionRequest(BaseModel):
"""


@docs_group('Models')
class CreateTaskRequest(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
act_id: Annotated[str, Field(examples=['asADASadYvn4mBZmm'])]
name: Annotated[str | None, Field(examples=['my-task'])] = None
options: TaskOptions | None = None
input: TaskInput | list[TaskInput] | None = None
title: str | None = None
description: str | None = None
actor_standby: ActorStandby | None = None
public_config: TaskPublicConfig | None = None
"""
Configuration that controls how the published task appears on its public landing page.
Editing this object requires write permission to the Actor that the task belongs to.

"""


@docs_group('Models')
class CreateWebhookRequest(BaseModel):
model_config = ConfigDict(
Expand Down Expand Up @@ -1408,15 +1409,23 @@ class EnvVar(BaseModel):


@docs_group('Models')
class EnvVarRequest(EnvVar):
class EnvVarRequest(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
name: Annotated[str, Field(examples=['MY_ENV_VAR'])]
"""
The name of the environment variable. Can't contain `=`.
"""
value: Annotated[str, Field(examples=['my-value'])]
"""
The value of the environment variable. If `isSecret` is `true`, this value isn't returned by the API.
The value of the environment variable.
"""
is_secret: Annotated[bool | None, Field(examples=[False])] = None
"""
Whether the environment variable is encrypted. Secret values aren't returned by the API.
"""


Expand Down Expand Up @@ -1988,18 +1997,6 @@ class MonthlyUsageResponse(BaseModel):
data: MonthlyUsage


@docs_group('Models')
class Notifications(BaseModel):
"""Notification settings for this schedule."""

model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
email: Annotated[bool | None, Field(examples=[True])] = None


@docs_group('Models')
class PaginationResponse(BaseModel):
"""Common pagination fields for list responses."""
Expand Down Expand Up @@ -3173,10 +3170,7 @@ class Schedule(ScheduleBase):
)
description: Annotated[str | None, Field(examples=['Schedule of actor ...'])] = None
title: str | None = None
notifications: Annotated[Notifications | None, Field(title='ScheduleNotifications')] = None
"""
Notification settings for this schedule.
"""
notifications: ScheduleNotifications | None = None
actions: list[Annotated[ScheduleActionRunActor | ScheduleActionRunActorTask, Field(discriminator='type')]]


Expand Down Expand Up @@ -3263,6 +3257,18 @@ class ScheduleLogResponse(BaseModel):
data: list[ScheduleLogEntry]


@docs_group('Models')
class ScheduleNotifications(BaseModel):
"""Notification settings for this schedule."""

model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
email: Annotated[bool | None, Field(examples=[True])] = None


@docs_group('Models')
class ScheduleResponse(BaseModel):
model_config = ConfigDict(
Expand Down Expand Up @@ -3684,7 +3690,7 @@ class UpdateActorRequest(BaseModel):
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.
"""
restart_on_error: Annotated[bool | None, Field(deprecated=True, examples=[False])] = None
versions: list[CreateOrUpdateVersionRequest] | None = None
versions: Annotated[list[CreateVersionRequest] | None, Field(min_length=1)] = None
"""
An array of `Version` objects. Each object represents a specific version of the Actor's source code: its location, builds, and environment configuration.
"""
Expand Down Expand Up @@ -3835,6 +3841,53 @@ class UpdateTaskRequest(BaseModel):
"""


@docs_group('Models')
class UpdateVersionRequest(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
version_number: Annotated[
str | None, Field(examples=['1.6'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$')
] = None
"""
The version number of the Actor. Two numbers separated by a dot, that represent the `MAJOR.MINOR` part of the semantic versioning.
"""
source_type: WritableVersionSourceType | None = None
"""
Where the source code of the version lives.
"""
env_vars: list[EnvVarRequest] | None = None
"""
Environment variables for the version.
"""
apply_env_vars_to_build: Annotated[bool | None, Field(examples=[False])] = None
"""
Whether to inject the environment variables at build time.
"""
build_tag: Annotated[str | None, Field(examples=['latest'])] = None
"""
The tag name to apply to a successful build of this version. Can be `null` when the version has no build tag.
"""
source_files: Annotated[list[SourceCodeFile | SourceCodeFolder] | None, Field(title='VersionSourceFiles')] = None
"""
Applies when the `sourceType` is `SOURCE_FILES`. Represents the Actor's file structure as an array of files and folders.
"""
git_repo_url: str | None = None
"""
URL of the Git repository to clone the source code from. Applies when the `sourceType` is `GIT_REPO`.
"""
tarball_url: str | None = None
"""
URL of the tarball to download the source code from. Applies when the `sourceType` is `TARBALL`.
"""
github_gist_url: Annotated[str | None, Field(alias='gitHubGistUrl')] = None
"""
URL of the GitHub Gist to clone the source code from. Applies when the `sourceType` is `GITHUB_GIST`.
"""


@docs_group('Models')
class UpdateWebhookRequest(BaseModel):
model_config = ConfigDict(
Expand Down
6 changes: 3 additions & 3 deletions src/apify_client/_resource_clients/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ActorStandby,
Build,
BuildResponse,
CreateOrUpdateVersionRequest,
CreateVersionRequest,
DefaultRunOptions,
ExampleRunInput,
FlatPricePerMonthActorPricingInfo,
Expand Down Expand Up @@ -191,7 +191,7 @@ def update(
description=description,
seo_title=seo_title,
seo_description=seo_description,
versions=[CreateOrUpdateVersionRequest.model_validate(v) for v in versions] if versions else None,
versions=[CreateVersionRequest.model_validate(v) for v in versions] if versions else None,
is_public=is_public,
is_deprecated=is_deprecated,
categories=categories,
Expand Down Expand Up @@ -751,7 +751,7 @@ async def update(
description=description,
seo_title=seo_title,
seo_description=seo_description,
versions=[CreateOrUpdateVersionRequest.model_validate(v) for v in versions] if versions else None,
versions=[CreateVersionRequest.model_validate(v) for v in versions] if versions else None,
is_public=is_public,
is_deprecated=is_deprecated,
categories=categories,
Expand Down
6 changes: 3 additions & 3 deletions src/apify_client/_resource_clients/actor_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

from apify_client._docs import docs_group
from apify_client._models import (
CreateOrUpdateVersionRequest,
EnvVarRequest,
SourceCodeFile,
SourceCodeFolder,
UpdateVersionRequest,
Version,
VersionResponse,
)
Expand Down Expand Up @@ -102,7 +102,7 @@ def update(
Returns:
The updated Actor version.
"""
version_fields = CreateOrUpdateVersionRequest(
version_fields = UpdateVersionRequest(
build_tag=build_tag,
env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None,
apply_env_vars_to_build=apply_env_vars_to_build,
Expand Down Expand Up @@ -218,7 +218,7 @@ async def update(
Returns:
The updated Actor version.
"""
version_fields = CreateOrUpdateVersionRequest(
version_fields = UpdateVersionRequest(
build_tag=build_tag,
env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None,
apply_env_vars_to_build=apply_env_vars_to_build,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from apify_client._docs import docs_group
from apify_client._models import (
CreateOrUpdateVersionRequest,
CreateVersionRequest,
EnvVarRequest,
ListOfVersions,
ListOfVersionsResponse,
Expand Down Expand Up @@ -117,7 +117,7 @@ def create(
Returns:
The created Actor version.
"""
version_fields = CreateOrUpdateVersionRequest(
version_fields = CreateVersionRequest(
version_number=version_number,
build_tag=build_tag,
env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None,
Expand Down Expand Up @@ -223,7 +223,7 @@ async def create(
Returns:
The created Actor version.
"""
version_fields = CreateOrUpdateVersionRequest(
version_fields = CreateVersionRequest(
version_number=version_number,
build_tag=build_tag,
env_vars=[EnvVarRequest.model_validate(v) for v in env_vars] if env_vars else None,
Expand Down
Loading