-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathfile.py
More file actions
210 lines (143 loc) · 7.29 KB
/
file.py
File metadata and controls
210 lines (143 loc) · 7.29 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
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Dict, List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
from pydantic import Field as FieldInfo
from .._models import BaseModel
__all__ = ["File", "AITag", "SelectedFieldsSchema", "VersionInfo"]
class AITag(BaseModel):
confidence: Optional[float] = None
"""Confidence score of the tag."""
name: Optional[str] = None
"""Name of the tag."""
source: Optional[str] = None
"""Source of the tag.
Possible values are `google-auto-tagging` and `aws-auto-tagging`.
"""
class SelectedFieldsSchema(BaseModel):
type: Literal["Text", "Textarea", "Number", "Date", "Boolean", "SingleSelect", "MultiSelect"]
"""Type of the custom metadata field."""
default_value: Union[str, float, bool, List[Union[str, float, bool]], None] = FieldInfo(
alias="defaultValue", default=None
)
"""The default value for this custom metadata field.
The value should match the `type` of custom metadata field.
"""
is_value_required: Optional[bool] = FieldInfo(alias="isValueRequired", default=None)
"""Specifies if the custom metadata field is required or not."""
max_length: Optional[float] = FieldInfo(alias="maxLength", default=None)
"""Maximum length of string. Only set if `type` is set to `Text` or `Textarea`."""
max_value: Union[str, float, None] = FieldInfo(alias="maxValue", default=None)
"""Maximum value of the field.
Only set if field type is `Date` or `Number`. For `Date` type field, the value
will be in ISO8601 string format. For `Number` type field, it will be a numeric
value.
"""
min_length: Optional[float] = FieldInfo(alias="minLength", default=None)
"""Minimum length of string. Only set if `type` is set to `Text` or `Textarea`."""
min_value: Union[str, float, None] = FieldInfo(alias="minValue", default=None)
"""Minimum value of the field.
Only set if field type is `Date` or `Number`. For `Date` type field, the value
will be in ISO8601 string format. For `Number` type field, it will be a numeric
value.
"""
read_only: Optional[bool] = FieldInfo(alias="readOnly", default=None)
"""Indicates whether the custom metadata field is read only.
A read only field cannot be modified after being set. This field is configurable
only via the **Path policy** feature.
"""
select_options: Optional[List[Union[str, float, bool]]] = FieldInfo(alias="selectOptions", default=None)
"""An array of allowed values when field type is `SingleSelect` or `MultiSelect`."""
select_options_truncated: Optional[bool] = FieldInfo(alias="selectOptionsTruncated", default=None)
"""Specifies if the selectOptions array is truncated.
It is truncated when number of options are > 100.
"""
class VersionInfo(BaseModel):
"""An object with details of the file version."""
id: Optional[str] = None
"""Unique identifier of the file version."""
name: Optional[str] = None
"""Name of the file version."""
class File(BaseModel):
"""Object containing details of a file or file version."""
ai_tags: Optional[List[AITag]] = FieldInfo(alias="AITags", default=None)
"""An array of tags assigned to the file by auto tagging."""
audio_codec: Optional[str] = FieldInfo(alias="audioCodec", default=None)
"""The audio codec used in the video (only for video/audio)."""
bit_rate: Optional[int] = FieldInfo(alias="bitRate", default=None)
"""The bit rate of the video in kbps (only for video)."""
created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None)
"""Date and time when the file was uploaded.
The date and time is in ISO8601 format.
"""
custom_coordinates: Optional[str] = FieldInfo(alias="customCoordinates", default=None)
"""An string with custom coordinates of the file."""
custom_metadata: Optional[Dict[str, object]] = FieldInfo(alias="customMetadata", default=None)
"""An object with custom metadata for the file."""
description: Optional[str] = None
"""Optional text to describe the contents of the file.
Can be set by the user or the ai-auto-description extension.
"""
duration: Optional[int] = None
"""The duration of the video in seconds (only for video)."""
embedded_metadata: Optional[Dict[str, object]] = FieldInfo(alias="embeddedMetadata", default=None)
"""Consolidated embedded metadata associated with the file.
It includes exif, iptc, and xmp data.
"""
file_id: Optional[str] = FieldInfo(alias="fileId", default=None)
"""Unique identifier of the asset."""
file_path: Optional[str] = FieldInfo(alias="filePath", default=None)
"""Path of the file.
This is the path you would use in the URL to access the file. For example, if
the file is at the root of the media library, the path will be `/file.jpg`. If
the file is inside a folder named `images`, the path will be `/images/file.jpg`.
"""
file_type: Optional[str] = FieldInfo(alias="fileType", default=None)
"""Type of the file. Possible values are `image`, `non-image`."""
has_alpha: Optional[bool] = FieldInfo(alias="hasAlpha", default=None)
"""Specifies if the image has an alpha channel."""
height: Optional[float] = None
"""Height of the file."""
is_private_file: Optional[bool] = FieldInfo(alias="isPrivateFile", default=None)
"""Specifies if the file is private or not."""
is_published: Optional[bool] = FieldInfo(alias="isPublished", default=None)
"""Specifies if the file is published or not."""
mime: Optional[str] = None
"""MIME type of the file."""
name: Optional[str] = None
"""Name of the asset."""
selected_fields_schema: Optional[Dict[str, SelectedFieldsSchema]] = FieldInfo(
alias="selectedFieldsSchema", default=None
)
"""
This field is included in the response only if the Path policy feature is
available in the plan. It contains schema definitions for the custom metadata
fields selected for the specified file path. Field selection can only be done
when the Path policy feature is enabled.
Keys are the names of the custom metadata fields; the value object has details
about the custom metadata schema.
"""
size: Optional[float] = None
"""Size of the file in bytes."""
tags: Optional[List[str]] = None
"""An array of tags assigned to the file.
Tags are used to search files in the media library.
"""
thumbnail: Optional[str] = None
"""URL of the thumbnail image.
This URL is used to access the thumbnail image of the file in the media library.
"""
type: Optional[Literal["file", "file-version"]] = None
"""Type of the asset."""
updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None)
"""Date and time when the file was last updated.
The date and time is in ISO8601 format.
"""
url: Optional[str] = None
"""URL of the file."""
version_info: Optional[VersionInfo] = FieldInfo(alias="versionInfo", default=None)
"""An object with details of the file version."""
video_codec: Optional[str] = FieldInfo(alias="videoCodec", default=None)
"""The video codec used in the video (only for video)."""
width: Optional[float] = None
"""Width of the file."""