Skip to content
Merged
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
205 changes: 29 additions & 176 deletions src/apify_client/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,38 @@ class ListOfActorsResponse(BaseModel):


@docs_group('Models')
class Error(BaseModel):
class ErrorType(StrEnum):
"""Machine-processable error type identifier."""

ACTOR_MEMORY_LIMIT_EXCEEDED = 'actor-memory-limit-exceeded'
ACTOR_NOT_FOUND = 'actor-not-found'
INVALID_INPUT = 'invalid-input'
METHOD_NOT_ALLOWED = 'method-not-allowed'
PAGE_NOT_FOUND = 'page-not-found'
PERMISSION_DENIED = 'permission-denied'
RATE_LIMIT_EXCEEDED = 'rate-limit-exceeded'
RECORD_NOT_FOUND = 'record-not-found'
RECORD_NOT_UNIQUE = 'record-not-unique'
RECORD_OR_TOKEN_NOT_FOUND = 'record-or-token-not-found'
REQUEST_ID_INVALID = 'request-id-invalid'
REQUEST_TOO_LARGE = 'request-too-large'
RUN_FAILED = 'run-failed'
RUN_TIMEOUT_EXCEEDED = 'run-timeout-exceeded'
SCHEDULE_ACTOR_NOT_FOUND = 'schedule-actor-not-found'
SCHEDULE_ACTOR_TASK_NOT_FOUND = 'schedule-actor-task-not-found'
TOKEN_NOT_VALID = 'token-not-valid'
UNKNOWN_BUILD_TAG = 'unknown-build-tag'
UNSUPPORTED_CONTENT_ENCODING = 'unsupported-content-encoding'
USER_NOT_FOUND = 'user-not-found'


@docs_group('Models')
class ErrorDetail(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
type: Annotated[ErrorType | None, Field(title='ErrorType')] = None
"""
Machine-processable error type identifier.
"""
type: ErrorType | None = None
message: str | None = None
"""
Human-readable error message describing what went wrong.
Expand All @@ -113,7 +136,7 @@ class ErrorResponse(BaseModel):
extra='allow',
populate_by_name=True,
)
error: Annotated[Error, Field(title='ErrorDetail')]
error: ErrorDetail


@docs_group('Models')
Expand Down Expand Up @@ -612,104 +635,6 @@ class VersionResponse(BaseModel):
data: Version


@docs_group('Models')
class ErrorType(StrEnum):
"""Machine-processable error type identifier."""

ACTOR_MEMORY_LIMIT_EXCEEDED = 'actor-memory-limit-exceeded'
ACTOR_NOT_FOUND = 'actor-not-found'
INVALID_INPUT = 'invalid-input'
METHOD_NOT_ALLOWED = 'method-not-allowed'
PERMISSION_DENIED = 'permission-denied'
RATE_LIMIT_EXCEEDED = 'rate-limit-exceeded'
RECORD_NOT_FOUND = 'record-not-found'
RECORD_NOT_UNIQUE = 'record-not-unique'
RECORD_OR_TOKEN_NOT_FOUND = 'record-or-token-not-found'
REQUEST_ID_INVALID = 'request-id-invalid'
REQUEST_TOO_LARGE = 'request-too-large'
RUN_FAILED = 'run-failed'
RUN_TIMEOUT_EXCEEDED = 'run-timeout-exceeded'
TOKEN_NOT_VALID = 'token-not-valid'
UNKNOWN_BUILD_TAG = 'unknown-build-tag'
UNSUPPORTED_CONTENT_ENCODING = 'unsupported-content-encoding'


@docs_group('Models')
class ErrorDetail(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
type: ErrorType | None = None
message: str | None = None
"""
Human-readable error message describing what went wrong.
"""


@docs_group('Models')
class ActorNotFoundErrorDetail(ErrorDetail):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
type: Annotated[Literal['actor-not-found'], Field(title='ErrorType')] = 'actor-not-found'
"""
Machine-processable error type identifier.
"""


@docs_group('Models')
class ActorNotFoundError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
error: ActorNotFoundErrorDetail | None = None


@docs_group('Models')
class RecordOrTokenNotFoundErrorDetail(ErrorDetail):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
type: Annotated[Literal['record-or-token-not-found'], Field(title='ErrorType')] = 'record-or-token-not-found'
"""
Machine-processable error type identifier.
"""


@docs_group('Models')
class RecordOrTokenNotFoundError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
error: RecordOrTokenNotFoundErrorDetail | None = None


@docs_group('Models')
class RecordNotFoundErrorDetail(ErrorDetail):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
type: Annotated[Literal['record-not-found'], Field(title='ErrorType')] = 'record-not-found'
"""
Machine-processable error type identifier.
"""


@docs_group('Models')
class ActorVersionNotFoundError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
error: RecordNotFoundErrorDetail | None = None


@docs_group('Models')
class ListOfEnvVars(BaseModel):
model_config = ConfigDict(
Expand Down Expand Up @@ -738,15 +663,6 @@ class EnvVarResponse(BaseModel):
data: EnvVar


@docs_group('Models')
class EnvironmentVariableNotFoundError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
error: RecordNotFoundErrorDetail | None = None


@docs_group('Models')
class WebhookEventType(StrEnum):
"""Type of event that triggers the webhook."""
Expand Down Expand Up @@ -1095,15 +1011,6 @@ class UnknownBuildTagError(BaseModel):
error: UnknownBuildTagErrorDetail | None = None


@docs_group('Models')
class ActorBuildNotFoundError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
error: RecordNotFoundErrorDetail | None = None


@docs_group('Models')
class RunMeta(BaseModel):
model_config = ConfigDict(
Expand Down Expand Up @@ -1554,15 +1461,6 @@ class ActorRunTimeoutExceededError(BaseModel):
error: RunTimeoutExceededErrorDetail | None = None


@docs_group('Models')
class ActorRunNotFoundError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
error: RecordNotFoundErrorDetail | None = None


@docs_group('Models')
class TaskStats(BaseModel):
model_config = ConfigDict(
Expand Down Expand Up @@ -1830,15 +1728,6 @@ class KeyValueStoreResponse(BaseModel):
data: KeyValueStore


@docs_group('Models')
class KeyValueStoreNotFoundError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
error: RecordNotFoundErrorDetail | None = None


@docs_group('Models')
class UpdateStoreRequest(BaseModel):
model_config = ConfigDict(
Expand Down Expand Up @@ -1905,15 +1794,6 @@ class RecordResponse(BaseModel):
)


@docs_group('Models')
class RecordNotFoundError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
error: RecordNotFoundErrorDetail | None = None


@docs_group('Models')
class PutRecordRequest(BaseModel):
"""The request body contains the value to store in the record. The content type
Expand Down Expand Up @@ -2048,15 +1928,6 @@ class DatasetResponse(BaseModel):
data: Dataset


@docs_group('Models')
class DatasetNotFoundError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
error: RecordNotFoundErrorDetail | None = None


@docs_group('Models')
class UpdateDatasetRequest(BaseModel):
model_config = ConfigDict(
Expand Down Expand Up @@ -2397,15 +2268,6 @@ class RequestQueueResponse(BaseModel):
data: RequestQueue


@docs_group('Models')
class RequestQueueNotFoundError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
error: RecordNotFoundErrorDetail | None = None


@docs_group('Models')
class UpdateRequestQueueRequest(BaseModel):
"""Request object for updating a request queue."""
Expand Down Expand Up @@ -2825,15 +2687,6 @@ class RequestResponse(BaseModel):
data: Request


@docs_group('Models')
class RequestNotFoundError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
)
error: RecordNotFoundErrorDetail | None = None


@docs_group('Models')
class UpdateRequestResponse(BaseModel):
"""Response containing the result of updating a request in the request queue."""
Expand Down