-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy path_models.py
More file actions
4019 lines (3513 loc) · 135 KB
/
Copy path_models.py
File metadata and controls
4019 lines (3513 loc) · 135 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# generated by datamodel-codegen
from __future__ import annotations
from typing import Annotated, Any, Literal
from pydantic import AnyUrl, AwareDatetime, BaseModel, ConfigDict, EmailStr, Field, RootModel
from pydantic.alias_generators import to_camel
from apify_client._docs import docs_group
from apify_client._literals import (
ActorJobStatus,
ActorPermissionLevel,
ErrorType,
GeneralAccess,
HttpMethod,
RunOrigin,
SourceCodeFileFormat,
VersionSourceType,
WebhookDispatchStatus,
WebhookEventType,
)
@docs_group('Models')
class AccountLimits(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
monthly_usage_cycle: UsageCycle
limits: Limits
current: Current
@docs_group('Models')
class ActVersion(BaseModel):
"""Snapshot of the Actor version that this build was created from."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
source_type: VersionSourceType | None = None
build_tag: Annotated[str | None, Field(examples=['experimental'])] = None
version_number: Annotated[
str | None, Field(examples=['0.0'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])$')
] = None
git_repo_url: Annotated[
str | None, Field(examples=['https://github.com/apifytech/actor-crawler.git#experimental:web-scraper'])
] = None
"""
URL of the git repository, present when sourceType is GIT_REPO.
"""
source_files: list[SourceCodeFile] | None = None
"""
Inline source files, present when sourceType is SOURCE_FILES.
"""
@docs_group('Models')
class Actor(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
id: Annotated[str, Field(examples=['zdc3Pyhyz3m8vjDeM'])]
user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])]
name: Annotated[str, Field(examples=['MyActor'])]
username: Annotated[str, Field(examples=['jane35'])]
description: Annotated[str | None, Field(examples=['My favourite actor!'])] = None
restart_on_error: Annotated[bool | None, Field(deprecated=True, examples=[False])] = None
is_public: Annotated[bool, Field(examples=[False])]
actor_permission_level: ActorPermissionLevel | None = None
created_at: Annotated[AwareDatetime, Field(examples=['2019-07-08T11:27:57.401Z'])]
modified_at: Annotated[AwareDatetime, Field(examples=['2019-07-08T14:01:05.546Z'])]
stats: ActorStats
versions: list[Version]
pricing_infos: (
list[
Annotated[
PayPerEventActorPricingInfo
| PricePerDatasetItemActorPricingInfo
| FlatPricePerMonthActorPricingInfo
| FreeActorPricingInfo,
Field(discriminator='pricing_model'),
]
]
| None
) = None
default_run_options: DefaultRunOptions
example_run_input: ExampleRunInput | None = None
is_deprecated: Annotated[bool | None, Field(examples=[False])] = None
deployment_key: Annotated[str | None, Field(examples=['ssh-rsa AAAA ...'])] = None
title: Annotated[str | None, Field(examples=['My Actor'])] = None
tagged_builds: dict[str, TaggedBuildInfo | None] | None = None
actor_standby: ActorStandby | None = None
readme_summary: str | None = None
"""
A brief, LLM-generated readme summary
"""
seo_title: Annotated[str | None, Field(examples=['Web Scraper'])] = None
seo_description: Annotated[
str | None, Field(examples=['Crawls websites using Chrome and extracts data from pages using JavaScript.'])
] = None
picture_url: Annotated[
str | None, Field(examples=['https://apify-image-uploads-prod.s3.amazonaws.com/.../actor-picture.png'])
] = None
standby_url: Annotated[str | None, Field(examples=['https://my-actor.apify.actor'])] = None
notice: Annotated[str | None, Field(examples=['NONE'])] = None
categories: Annotated[list[str] | None, Field(examples=[['DEVELOPER_TOOLS', 'OPEN_SOURCE']])] = None
is_critical: Annotated[bool | None, Field(examples=[False])] = None
is_generic: Annotated[bool | None, Field(examples=[False])] = None
is_source_code_hidden: Annotated[bool | None, Field(examples=[False])] = None
has_no_dataset: Annotated[bool | None, Field(examples=[False])] = None
@docs_group('Models')
class ActorChargeEvent(BaseModel):
"""Definition of a single chargeable event for a pay-per-event Actor. Each event is either flat-priced
(`eventPriceUsd` is set) or tier-priced (`eventTieredPricingUsd` is set); the two are mutually exclusive.
"""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
event_title: str
"""
Human-readable title shown to users in the billing UI.
"""
event_description: str
"""
Human-readable description of what triggers this event.
"""
event_price_usd: float | None = None
"""
Flat price per event in USD. Present only for non-tiered events. Mutually exclusive with `eventTieredPricingUsd`.
"""
event_tiered_pricing_usd: dict[str, TieredPricingPerEventEntry] | None = None
is_primary_event: bool | None = None
"""
Whether this event is the Actor's primary chargeable event.
"""
is_one_time_event: bool | None = None
"""
Whether this event can only be charged once per Actor run.
"""
@docs_group('Models')
class ActorDefinition(BaseModel):
"""The definition of the Actor, the full specification of this field can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/actor-json)."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
actor_specification: Literal[1] | None = None
"""
The Actor specification version that this Actor follows. This property must be set to 1.
"""
name: str | None = None
"""
The name of the Actor.
"""
version: Annotated[str | None, Field(pattern='^[0-9]+(\\.[0-9]+)+$')] = None
"""
The version of the Actor, typically a dot-separated sequence of numbers (e.g., `0.1`, `1.0`, or `0.0.1`).
"""
build_tag: str | None = None
"""
The tag name to be applied to a successful build of the Actor. Defaults to 'latest' if not specified.
"""
environment_variables: dict[str, str] | None = None
"""
A map of environment variables to be used during local development and deployment.
"""
dockerfile: str | None = None
"""
The path to the Dockerfile used for building the Actor on the platform.
"""
docker_context_dir: str | None = None
"""
The path to the directory used as the Docker context when building the Actor.
"""
readme: str | None = None
"""
The path to the README file for the Actor.
"""
input: dict[str, Any] | None = None
"""
The input schema object, the full specification can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/input-schema)
"""
changelog: str | None = None
"""
The path to the CHANGELOG file displayed in the Actor's information tab.
"""
storages: Storages | None = None
default_memory_mbytes: str | int | None = None
"""
Specifies the default amount of memory in megabytes to be used when the Actor is started. Can be an integer or a [dynamic memory expression](https://docs.apify.com/platform/actors/development/actor-definition/dynamic-actor-memory).
"""
min_memory_mbytes: Annotated[int | None, Field(ge=128)] = None
"""
Specifies the minimum amount of memory in megabytes required by the Actor.
"""
max_memory_mbytes: Annotated[int | None, Field(ge=128)] = None
"""
Specifies the maximum amount of memory in megabytes required by the Actor.
"""
uses_standby_mode: bool | None = None
"""
Specifies whether Standby mode is enabled for the Actor.
"""
@docs_group('Models')
class ActorResponse(BaseModel):
"""Response containing Actor data."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
data: Actor
@docs_group('Models')
class ActorShort(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
id: Annotated[str, Field(examples=['br9CKmk457'])]
created_at: Annotated[AwareDatetime, Field(examples=['2019-10-29T07:34:24.202Z'])]
modified_at: Annotated[AwareDatetime, Field(examples=['2019-10-30T07:34:24.202Z'])]
name: Annotated[str, Field(examples=['MyAct'])]
username: Annotated[str, Field(examples=['janedoe'])]
title: Annotated[str | None, Field(examples=['Hello World Example'])] = None
stats: ActorStats | None = None
@docs_group('Models')
class ActorStandby(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
is_enabled: bool | None = None
"""
Whether standby mode is enabled for the Actor.
"""
desired_requests_per_actor_run: int | None = None
"""
Target number of concurrent HTTP requests a single run is configured to handle.
"""
max_requests_per_actor_run: int | None = None
"""
Maximum number of concurrent HTTP requests that can be routed to a single run.
"""
idle_timeout_secs: int | None = None
"""
In seconds, how long a run can stay idle without incoming requests before it's terminated.
"""
build: str | None = None
"""
Which build to run in standby mode. Either a build tag or a version number.
"""
memory_mbytes: int | None = None
"""
In MB, the amount of memory allocated to the run.
"""
disable_standby_fields_override: bool | None = None
"""
If `true`, prevents the standby mode configuration from being overridden elsewhere.
"""
should_pass_actor_input: bool | None = None
"""
Whether to pass the Actor's input to the standby run. If `false`, the standby runs start with no input.
"""
@docs_group('Models')
class ActorStats(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
total_builds: Annotated[int | None, Field(examples=[9])] = None
total_runs: Annotated[int | None, Field(examples=[16])] = None
total_users: Annotated[int | None, Field(examples=[6])] = None
total_users7_days: Annotated[int | None, Field(examples=[2])] = None
total_users30_days: Annotated[int | None, Field(examples=[6])] = None
total_users90_days: Annotated[int | None, Field(examples=[6])] = None
total_metamorphs: Annotated[int | None, Field(examples=[2])] = None
last_run_started_at: Annotated[AwareDatetime | None, Field(examples=['2019-07-08T14:01:05.546Z'])] = None
actor_review_count: Annotated[int | None, Field(examples=[69])] = None
actor_review_rating: Annotated[float | None, Field(examples=[4.7])] = None
bookmark_count: Annotated[int | None, Field(examples=[1269])] = None
public_actor_run_stats30_days: PublicActorRunStats30Days | None = None
"""
Run status counts over the past 30 days.
"""
@docs_group('Models')
class AddRequestResponse(BaseModel):
"""Response containing the result of adding a request to the request queue."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
data: RequestRegistration
@docs_group('Models')
class AddedRequest(BaseModel):
"""Information about a request that was successfully added to a request queue."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
request_id: Annotated[str, Field(examples=['sbJ7klsdf7ujN9l'])]
"""
A unique identifier assigned to the request.
"""
unique_key: Annotated[str, Field(examples=['GET|60d83e70|e3b0c442|https://apify.com'])]
"""
A unique key used for request de-duplication. Requests with the same unique key are considered identical.
"""
was_already_present: Annotated[bool, Field(examples=[False])]
"""
Indicates whether a request with the same unique key already existed in the request queue. If true, no new request was created.
"""
was_already_handled: Annotated[bool, Field(examples=[False])]
"""
Indicates whether a request with the same unique key has already been processed by the request queue.
"""
@docs_group('Models')
class BatchAddResponse(BaseModel):
"""Response containing the result of a batch add operation."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
data: BatchAddResult
@docs_group('Models')
class BatchAddResult(BaseModel):
"""Result of a batch add operation containing successfully processed and failed requests."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
processed_requests: list[AddedRequest]
"""
Requests that were successfully added to the request queue.
"""
unprocessed_requests: list[RequestDraft]
"""
Requests that failed to be added and can be retried.
"""
@docs_group('Models')
class BatchDeleteResponse(BaseModel):
"""Response containing the result of a batch delete operation."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
data: BatchDeleteResult
@docs_group('Models')
class BatchDeleteResult(BaseModel):
"""Result of a batch delete operation containing successfully deleted and failed requests."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
processed_requests: list[DeletedRequestById | DeletedRequestByUniqueKey]
"""
Requests that were successfully deleted from the request queue.
"""
unprocessed_requests: list[RequestDraft]
"""
Requests that failed to be deleted and can be retried.
"""
@docs_group('Models')
class BrowserInfoResponse(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
method: Annotated[str, Field(examples=['GET'])]
"""
HTTP method of the request.
"""
client_ip: Annotated[str | None, Field(examples=['1.2.3.4'])]
"""
IP address of the client.
"""
country_code: Annotated[str | None, Field(examples=['US'])]
"""
Two-letter country code resolved from the client IP address.
"""
body_length: Annotated[int, Field(examples=[0])]
"""
Length of the request body in bytes.
"""
headers: dict[str, str | list[str]] | None = None
"""
Request headers. Omitted when `skipHeaders=true`.
"""
raw_headers: list[str] | None = None
"""
Raw request headers as a flat list of alternating name/value strings.
Included only when `rawHeaders=true`.
"""
@docs_group('Models')
class Build(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])]
act_id: Annotated[str, Field(examples=['janedoe~my-actor'])]
user_id: Annotated[str, Field(examples=['klmdEpoiojmdEMlk3'])]
started_at: Annotated[AwareDatetime, Field(examples=['2019-11-30T07:34:24.202Z'])]
finished_at: Annotated[AwareDatetime | None, Field(examples=['2019-12-12T09:30:12.202Z'])] = None
status: ActorJobStatus
meta: BuildsMeta
stats: BuildStats | None = None
options: BuildOptions | None = None
usage: BuildUsage | None = None
usage_total_usd: Annotated[float | None, Field(examples=[0.02])] = None
"""
Total cost in USD for this build. Requires authentication token to access.
"""
usage_usd: BuildUsage | None = None
"""
Platform usage costs breakdown in USD for this build. Requires authentication token to access.
"""
input_schema: Annotated[str | None, Field(deprecated=True, examples=['{\\n "title": "Schema for ... }'])] = None
readme: Annotated[str | None, Field(deprecated=True, examples=['# Magic Actor\\nThis Actor is magic.'])] = None
build_number: Annotated[
str, Field(examples=['0.1.1'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$')
]
act_version: Annotated[ActVersion | None, Field(title='BuildActVersion')] = None
"""
Snapshot of the Actor version that this build was created from.
"""
actor_definition: ActorDefinition | None = None
@docs_group('Models')
class BuildOptions(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
use_cache: Annotated[bool | None, Field(examples=[False])] = None
beta_packages: Annotated[bool | None, Field(examples=[False])] = None
memory_mbytes: Annotated[int | None, Field(examples=[1024])] = None
disk_mbytes: Annotated[int | None, Field(examples=[2048])] = None
@docs_group('Models')
class BuildResponse(BaseModel):
"""Response containing Actor build data."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
data: Build
@docs_group('Models')
class BuildShort(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
id: Annotated[str, Field(examples=['HG7ML7M8z78YcAPEB'])]
act_id: Annotated[str | None, Field(examples=['janedoe~my-actor'])] = None
user_id: Annotated[str | None, Field(examples=['klmdEpoiojmdEMlk3'])] = None
status: ActorJobStatus
started_at: Annotated[AwareDatetime, Field(examples=['2019-11-30T07:34:24.202Z'])]
finished_at: Annotated[AwareDatetime | None, Field(examples=['2019-12-12T09:30:12.202Z'])] = None
usage_total_usd: Annotated[float, Field(examples=[0.02])]
build_number: Annotated[
str, Field(examples=['0.1.1'], pattern='^([0-9]|[1-9][0-9])\\.([0-9]|[1-9][0-9])(\\.[1-9][0-9]{0,4})$')
]
build_number_int: Annotated[int | None, Field(examples=[10000])] = None
meta: BuildsMeta | None = None
@docs_group('Models')
class BuildStats(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
duration_millis: Annotated[int | None, Field(examples=[1000])] = None
run_time_secs: Annotated[float | None, Field(examples=[45.718])] = None
compute_units: Annotated[float, Field(examples=[0.0126994444444444])]
image_size_bytes: Annotated[int | None, Field(examples=[975770223])] = None
@docs_group('Models')
class BuildTag(BaseModel):
"""The name of the build tag."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
build_id: str
"""
The ID of the build to assign to the tag.
"""
@docs_group('Models')
class BuildUsage(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
actor_compute_units: Annotated[float | None, Field(alias='ACTOR_COMPUTE_UNITS', examples=[0.08])] = None
@docs_group('Models')
class BuildsMeta(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
origin: RunOrigin
client_ip: Annotated[str | None, Field(examples=['172.234.12.34'])] = None
"""
IP address of the client that started the build.
"""
user_agent: Annotated[str | None, Field(examples=['Mozilla/5.0 (iPad)'])] = None
"""
User agent of the client that started the build.
"""
@docs_group('Models')
class Call(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
started_at: Annotated[AwareDatetime | None, Field(examples=['2019-12-12T07:34:14.202Z'])] = None
finished_at: Annotated[AwareDatetime | None, Field(examples=['2019-12-12T07:34:14.202Z'])] = None
error_message: Annotated[str | None, Field(examples=['Cannot send request'])] = None
response_status: Annotated[int | None, Field(examples=[200])] = None
response_body: Annotated[str | None, Field(examples=['{"foo": "bar"}'])] = None
@docs_group('Models')
class ChargeRunRequest(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
event_name: Annotated[str, Field(examples=['ANALYZE_PAGE'])]
count: Annotated[int, Field(examples=[1])]
@docs_group('Models')
class CommonActorPricingInfo(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
apify_margin_percentage: float
"""
In [0, 1], fraction of pricePerUnitUsd that goes to Apify
"""
created_at: AwareDatetime
"""
When this pricing info record has been created
"""
started_at: AwareDatetime
"""
Since when is this pricing info record effective for a given Actor
"""
notified_about_future_change_at: AwareDatetime | None = None
notified_about_change_at: AwareDatetime | None = None
reason_for_change: str | None = None
is_price_change_notification_suppressed: bool | None = None
force_contains_significant_price_change: bool | None = None
@docs_group('Models')
class CreateActorRequest(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
name: Annotated[str | None, Field(examples=['instagram-scraper'])] = None
"""
The identifier of the Actor. Use lowercase letters, numbers, and hyphens. Spaces or special characters aren't allowed. Must be unique across your account.
"""
description: Annotated[str | None, Field(examples=['This scraper extracts posts and comments from Instagram.'])] = (
None
)
"""
Short description of the Actor, displayed in Apify Store and Console.
"""
title: Annotated[str | None, Field(examples=['Instagram scraper'])] = None
"""
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.
"""
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.
"""
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.
"""
seo_description: Annotated[str | None, Field(examples=['The best scraper for Instagram'])] = None
"""
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
"""
An array of `Version` objects. Each object represents a specific version of the Actor's source code: its location, builds, and environment configuration.
"""
pricing_infos: (
list[
Annotated[
PayPerEventActorPricingInfo
| PricePerDatasetItemActorPricingInfo
| FlatPricePerMonthActorPricingInfo
| FreeActorPricingInfo,
Field(discriminator='pricing_model'),
]
]
| None
) = None
categories: Annotated[list[str] | None, Field(examples=[['SOCIAL_MEDIA']])] = None
"""
A list of categories that best define the Actor. Reflected in Apify Store's search and filtering options.
"""
default_run_options: DefaultRunOptions | None = None
actor_standby: ActorStandby | None = None
"""
The configuration of the Actor's standby mode. For details, see [Standby mode](https://docs.apify.com/platform/actors/development/programming-interface/standby).
"""
example_run_input: ExampleRunInput | None = None
"""
Sample input payload that demonstrates what a typical run input for an Actor looks like. Used when no explicit input for a run is provided.
"""
is_deprecated: bool | None = None
"""
Whether the Actor is deprecated.
"""
@docs_group('Models')
class CreateOrUpdateVersionRequest(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: VersionSourceType | None = None
"""
Where the source code of the version lives.
"""
env_vars: list[EnvVar] | 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 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 | None = None
title: str | None = None
actor_standby: ActorStandby | None = None
@docs_group('Models')
class Current(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
monthly_usage_usd: Annotated[float, Field(examples=[43])]
monthly_actor_compute_units: Annotated[float, Field(examples=[500.784475])]
monthly_external_data_transfer_gbytes: Annotated[float, Field(examples=[3.00861903931946])]
monthly_proxy_serps: Annotated[int, Field(examples=[34])]
monthly_residential_proxy_gbytes: Annotated[float, Field(examples=[0.4])]
actor_memory_gbytes: Annotated[float, Field(examples=[8])]
actor_count: Annotated[int, Field(examples=[31])]
actor_task_count: Annotated[int, Field(examples=[130])]
active_actor_job_count: Annotated[int, Field(examples=[0])]
team_account_seat_count: Annotated[int, Field(examples=[5])]
schedule_count: Annotated[int | None, Field(examples=[77])] = None
@docs_group('Models')
class CurrentPricingInfo(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
pricing_model: Annotated[str, Field(examples=['FREE'])]
apify_margin_percentage: Annotated[float | None, Field(examples=[0.2])] = None
created_at: Annotated[AwareDatetime | None, Field(examples=['2023-01-01T00:00:00.000Z'])] = None
started_at: Annotated[AwareDatetime | None, Field(examples=['2023-01-01T00:00:00.000Z'])] = None
notified_about_change_at: Annotated[AwareDatetime | None, Field(examples=[None])] = None
notified_about_future_change_at: Annotated[AwareDatetime | None, Field(examples=[None])] = None
is_price_change_notification_suppressed: Annotated[bool | None, Field(examples=[False])] = None
force_contains_significant_price_change: Annotated[bool | None, Field(examples=[False])] = None
is_ppe_platform_usage_paid_by_user: Annotated[
bool | None, Field(alias='isPPEPlatformUsagePaidByUser', examples=[False])
] = None
reason_for_change: Annotated[str | None, Field(examples=[None])] = None
trial_minutes: Annotated[int | None, Field(examples=[None])] = None
unit_name: Annotated[str | None, Field(examples=[None])] = None
price_per_unit_usd: Annotated[float | None, Field(examples=[None])] = None
minimal_max_total_charge_usd: Annotated[float | None, Field(examples=[0.5])] = None
pricing_per_event: dict[str, Any] | None = None
"""
Per-event pricing configuration for pay-per-event Actors.
"""
@docs_group('Models')
class DailyServiceUsages(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
date: Annotated[str, Field(examples=['2022-10-02T00:00:00.000Z'])]
service_usage: dict[str, UsageItem]
total_usage_credits_usd: Annotated[float, Field(examples=[0.0474385791970591])]
@docs_group('Models')
class Dataset(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])]
name: Annotated[str | None, Field(examples=['d7b9MDYsbtX5L7XAj'])] = None
user_id: Annotated[str, Field(examples=['wRsJZtadYvn4mBZmm'])]
created_at: Annotated[AwareDatetime, Field(examples=['2019-12-12T07:34:14.202Z'])]
modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-13T08:36:13.202Z'])]
accessed_at: Annotated[AwareDatetime, Field(examples=['2019-12-14T08:36:13.202Z'])]
item_count: Annotated[int, Field(examples=[7], ge=0)]
clean_item_count: Annotated[int, Field(examples=[5], ge=0)]
act_id: str | None = None
act_run_id: str | None = None
fields: list[str] | None = None
schema_: Annotated[
dict[str, Any] | None,
Field(
alias='schema',
examples=[
{
'actorSpecification': 1,
'title': 'My dataset',
'views': {
'overview': {
'title': 'Overview',
'transformation': {'fields': ['linkUrl']},
'display': {
'component': 'table',
'properties': {'linkUrl': {'label': 'Link URL', 'format': 'link'}},
},
}
},
}
],
),
] = None
"""
Defines the schema of items in your dataset, the full specification can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema)
"""
console_url: Annotated[AnyUrl, Field(examples=['https://console.apify.com/storage/datasets/27TmTznX9YPeAYhkC'])]
items_public_url: Annotated[
AnyUrl | None, Field(examples=['https://api.apify.com/v2/datasets/WkzbQMuFYuamGv3YF/items?signature=abc123'])
] = None
"""
A public link to access the dataset items directly.
"""
url_signing_secret_key: str | None = None
"""
A secret key for generating signed public URLs. It is only provided to clients with WRITE permission for the dataset.
"""
general_access: GeneralAccess | None = None
stats: DatasetStats | None = None
@docs_group('Models')
class DatasetFieldStatistics(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
min: float | None = None
"""
Minimum value of the field. For numbers, this is calculated directly. For strings, this is the length of the shortest string. For arrays, this is the length of the shortest array. For objects, this is the number of keys in the smallest object.
"""
max: float | None = None
"""
Maximum value of the field. For numbers, this is calculated directly. For strings, this is the length of the longest string. For arrays, this is the length of the longest array. For objects, this is the number of keys in the largest object.
"""
null_count: int | None = None
"""
How many items in the dataset have a null value for this field.
"""
empty_count: int | None = None
"""
How many items in the dataset are `undefined`, meaning that for example empty string is not considered empty.
"""
@docs_group('Models')
class DatasetListItem(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
id: Annotated[str, Field(examples=['WkzbQMuFYuamGv3YF'])]
name: Annotated[str, Field(examples=['d7b9MDYsbtX5L7XAj'])]
user_id: Annotated[str, Field(examples=['tbXmWu7GCxnyYtSiL'])]
created_at: Annotated[AwareDatetime, Field(examples=['2019-12-12T07:34:14.202Z'])]
modified_at: Annotated[AwareDatetime, Field(examples=['2019-12-13T08:36:13.202Z'])]
accessed_at: Annotated[AwareDatetime, Field(examples=['2019-12-14T08:36:13.202Z'])]
item_count: Annotated[int, Field(examples=[7])]
clean_item_count: Annotated[int, Field(examples=[5])]
act_id: Annotated[str | None, Field(examples=['zdc3Pyhyz3m8vjDeM'])] = None
act_run_id: Annotated[str | None, Field(examples=['HG7ML7M8z78YcAPEB'])] = None
title: Annotated[str | None, Field(examples=['My Dataset'])] = None
username: Annotated[str | None, Field(examples=['janedoe'])] = None
general_access: GeneralAccess | None = None
stats: DatasetStats | None = None
@docs_group('Models')
class DatasetResponse(BaseModel):
"""Response containing dataset metadata."""
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
data: Dataset
@docs_group('Models')
class DatasetSchemaValidationError(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
type: Annotated[str | None, Field(examples=['schema-validation-error'])] = None
"""
The type of the error.
"""
message: Annotated[str | None, Field(examples=['Schema validation failed'])] = None
"""
A human-readable message describing the error.
"""
data: SchemaValidationErrorData | None = None
@docs_group('Models')
class DatasetStatistics(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
field_statistics: dict[str, Any] | None = None
"""
When you configure the dataset [fields schema](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation), we measure the statistics such as `min`, `max`, `nullCount` and `emptyCount` for each field. This property provides statistics for each field from dataset fields schema. <br/></br>See dataset field statistics [documentation](https://docs.apify.com/platform/actors/development/actor-definition/dataset-schema/validation#dataset-field-statistics) for more information.
"""
@docs_group('Models')
class DatasetStatisticsResponse(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,
alias_generator=to_camel,
)
data: DatasetStatistics
@docs_group('Models')
class DatasetStats(BaseModel):
model_config = ConfigDict(
extra='allow',
populate_by_name=True,