arcade-google-docs 4.0.0__py3-none-any.whl → 4.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- arcade_google_docs/docmd.py +534 -0
- arcade_google_docs/enum.py +1 -0
- arcade_google_docs/models/document.py +953 -0
- arcade_google_docs/models/document_writables.py +735 -0
- arcade_google_docs/models/requests.py +1315 -0
- arcade_google_docs/tools/__init__.py +2 -0
- arcade_google_docs/tools/edit_agent/edit_agent.py +56 -0
- arcade_google_docs/tools/edit_agent/executor.py +103 -0
- arcade_google_docs/tools/edit_agent/models/planning.py +89 -0
- arcade_google_docs/tools/edit_agent/planner.py +130 -0
- arcade_google_docs/tools/edit_agent/progress_tracker.py +32 -0
- arcade_google_docs/tools/edit_agent/prompts.py +204 -0
- arcade_google_docs/tools/edit_agent/request_generator.py +150 -0
- arcade_google_docs/tools/edit_agent/utils.py +21 -0
- arcade_google_docs/tools/get.py +26 -0
- arcade_google_docs/tools/search.py +5 -1
- arcade_google_docs/tools/system_context.py +36 -0
- arcade_google_docs/who_am_i_util.py +86 -0
- {arcade_google_docs-4.0.0.dist-info → arcade_google_docs-4.2.0.dist-info}/METADATA +2 -1
- arcade_google_docs-4.2.0.dist-info/RECORD +30 -0
- arcade_google_docs-4.0.0.dist-info/RECORD +0 -16
- {arcade_google_docs-4.0.0.dist-info → arcade_google_docs-4.2.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
# ----------------------------------------------------------------------------
|
|
2
|
+
# Writable models that are used by batchUpdate requests.
|
|
3
|
+
# The purpose of these models is to prevent LLMs from 'seeing' readonly fields
|
|
4
|
+
# for types that are a part of the Document model AND the Request model.
|
|
5
|
+
#
|
|
6
|
+
# Writables are used by the batchUpdate request model and the optionality
|
|
7
|
+
# of fields may differ from the Document model. Addtionally, writables do not
|
|
8
|
+
# contain readonly fields.
|
|
9
|
+
#
|
|
10
|
+
# Enum writables have thier placeholder values removed.
|
|
11
|
+
# ----------------------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from collections.abc import Callable
|
|
16
|
+
from enum import Enum
|
|
17
|
+
from typing import Any
|
|
18
|
+
|
|
19
|
+
from pydantic import BaseModel, ConfigDict, Field, model_serializer
|
|
20
|
+
|
|
21
|
+
from arcade_google_docs.models.document import (
|
|
22
|
+
Alignment,
|
|
23
|
+
BaselineOffset,
|
|
24
|
+
ContentDirection,
|
|
25
|
+
NamedStyleType,
|
|
26
|
+
SpacingMode,
|
|
27
|
+
TabStopAlignment,
|
|
28
|
+
Unit,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class BookmarkLinkWritable(BaseModel):
|
|
33
|
+
model_config = ConfigDict(title="A reference to a bookmark in this document")
|
|
34
|
+
id: str = Field(..., title="The ID of a bookmark in this document")
|
|
35
|
+
tabId: str = Field(..., title="The ID of the tab in this document")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class HeadingLinkWritable(BaseModel):
|
|
39
|
+
model_config = ConfigDict(title="A reference to a heading in this document")
|
|
40
|
+
id: str = Field(..., title="The ID of a heading in this document")
|
|
41
|
+
tabId: str = Field(..., title="The ID of the tab in this document")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class LinkWritable(BaseModel):
|
|
45
|
+
class Url(BaseModel):
|
|
46
|
+
url: str = Field(..., title="An external URL")
|
|
47
|
+
|
|
48
|
+
class TabId(BaseModel):
|
|
49
|
+
tabId: str = Field(..., title="The ID of a tab in this document")
|
|
50
|
+
|
|
51
|
+
class BookmarkId(BaseModel):
|
|
52
|
+
bookmarkId: str = Field(..., title="The ID of a bookmark in this document")
|
|
53
|
+
|
|
54
|
+
class HeadingId(BaseModel):
|
|
55
|
+
headingId: str = Field(..., title="The ID of a heading in this document")
|
|
56
|
+
|
|
57
|
+
model_config = ConfigDict(
|
|
58
|
+
title="A reference to another portion of a document or an external URL resource."
|
|
59
|
+
)
|
|
60
|
+
destination: (
|
|
61
|
+
Url | TabId | BookmarkLinkWritable | HeadingLinkWritable | BookmarkId | HeadingId
|
|
62
|
+
) = Field(
|
|
63
|
+
...,
|
|
64
|
+
title="The link destination",
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
@model_serializer(mode="wrap")
|
|
68
|
+
def _resolve_union_field(self, handler: Callable[[Any], Any]) -> Any:
|
|
69
|
+
"""
|
|
70
|
+
Modify/wraps the result of the handler to resolve the union field destination
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
handler: The handler function that would normally return the model's data
|
|
74
|
+
such as `model_dump` or `model_json_schema`.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
The modified data with the union field resolved.
|
|
78
|
+
"""
|
|
79
|
+
data = handler(self)
|
|
80
|
+
data.pop("destination", None)
|
|
81
|
+
if isinstance(self.destination, LinkWritable.Url):
|
|
82
|
+
data["url"] = self.destination.url
|
|
83
|
+
elif isinstance(self.destination, LinkWritable.TabId):
|
|
84
|
+
data["tabId"] = self.destination.tabId
|
|
85
|
+
elif isinstance(self.destination, BookmarkLinkWritable):
|
|
86
|
+
data["bookmark"] = self.destination.model_dump(exclude_none=True)
|
|
87
|
+
elif isinstance(self.destination, HeadingLinkWritable):
|
|
88
|
+
data["heading"] = self.destination.model_dump(exclude_none=True)
|
|
89
|
+
elif isinstance(self.destination, LinkWritable.BookmarkId):
|
|
90
|
+
data["bookmarkId"] = self.destination.bookmarkId
|
|
91
|
+
elif isinstance(self.destination, LinkWritable.HeadingId):
|
|
92
|
+
data["headingId"] = self.destination.headingId
|
|
93
|
+
return data
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class WeightedFontFamilyWritable(BaseModel):
|
|
97
|
+
model_config = ConfigDict(
|
|
98
|
+
title="The font family and rendered weight of the text.",
|
|
99
|
+
)
|
|
100
|
+
fontFamily: str | None = Field(
|
|
101
|
+
None,
|
|
102
|
+
title=(
|
|
103
|
+
"The font family of the text. The font family can be any font from the Font menu "
|
|
104
|
+
"in Docs or from Google Fonts. If the font name is unrecognized, "
|
|
105
|
+
"the text is rendered in Arial."
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
weight: int | None = Field(
|
|
109
|
+
None,
|
|
110
|
+
title=(
|
|
111
|
+
"The weight of the font. This field can have any value that's a multiple of 100 "
|
|
112
|
+
"between 100 and 900, inclusive. The default value is 400 (normal)."
|
|
113
|
+
),
|
|
114
|
+
ge=100,
|
|
115
|
+
le=900,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class TextStyleWritable(BaseModel):
|
|
120
|
+
model_config = ConfigDict(
|
|
121
|
+
title=(
|
|
122
|
+
"Represents the styling that can be applied to text."
|
|
123
|
+
"Inherited text styles are represented as unset fields in this message. A text style's "
|
|
124
|
+
"parent depends on where the text style is defined:\n"
|
|
125
|
+
"- The TextStyle of text in a Paragraph inherits from the paragraph's corresponding "
|
|
126
|
+
"named style type.\n"
|
|
127
|
+
"- The TextStyle on a named style inherits from the normal text named style.\n"
|
|
128
|
+
"- The TextStyle of the normal text named style inherits from the default text style "
|
|
129
|
+
"in the Docs editor.\n"
|
|
130
|
+
"- The TextStyle on a Paragraph element that's contained in a table may inherit its "
|
|
131
|
+
"text style from the table style.\n"
|
|
132
|
+
"If the text style does not inherit from a parent, unsetting fields will revert the "
|
|
133
|
+
"style to a value matching the defaults in the Docs editor."
|
|
134
|
+
),
|
|
135
|
+
)
|
|
136
|
+
bold: bool | None = Field(None, title="Whether the text is rendered as bold")
|
|
137
|
+
italic: bool | None = Field(None, title="Whether the text is rendered as italic")
|
|
138
|
+
underline: bool | None = Field(None, title="Whether the text is rendered as underlined")
|
|
139
|
+
strikethrough: bool | None = Field(None, title="Whether the text is rendered as struck through")
|
|
140
|
+
smallCaps: bool | None = Field(
|
|
141
|
+
None, title="Whether or not the text is in small capital letters."
|
|
142
|
+
)
|
|
143
|
+
backgroundColor: OptionalColorWritable | None = Field(
|
|
144
|
+
None,
|
|
145
|
+
title=(
|
|
146
|
+
"The background color of the text. If set, the color is either an RGB color or "
|
|
147
|
+
"transparent, depending on the color field."
|
|
148
|
+
),
|
|
149
|
+
)
|
|
150
|
+
foregroundColor: OptionalColorWritable | None = Field(
|
|
151
|
+
None,
|
|
152
|
+
title=(
|
|
153
|
+
"The foreground color of the text. If set, the color is either an RGB color or "
|
|
154
|
+
"transparent, depending on the color field."
|
|
155
|
+
),
|
|
156
|
+
)
|
|
157
|
+
fontSize: DimensionWritable | None = Field(
|
|
158
|
+
None,
|
|
159
|
+
title="The size of the text's font.",
|
|
160
|
+
)
|
|
161
|
+
weightedFontFamily: WeightedFontFamilyWritable | None = Field(
|
|
162
|
+
None,
|
|
163
|
+
title="The font family and rendered weight of the text.",
|
|
164
|
+
description=(
|
|
165
|
+
"If an update request specifies values for both weightedFontFamily and bold, the "
|
|
166
|
+
"weightedFontFamily is applied first, then bold. If weightedFontFamily#weight is not "
|
|
167
|
+
"set, it defaults to 400. If weightedFontFamily is set, then "
|
|
168
|
+
"weightedFontFamily#fontFamily must also be set with a non-empty value. Otherwise, a "
|
|
169
|
+
"400 bad request error is returned."
|
|
170
|
+
),
|
|
171
|
+
)
|
|
172
|
+
baselineOffset: BaselineOffset | None = Field(
|
|
173
|
+
None,
|
|
174
|
+
title="The text's vertical offset from its normal position..",
|
|
175
|
+
)
|
|
176
|
+
link: LinkWritable | None = Field(
|
|
177
|
+
None,
|
|
178
|
+
title=(
|
|
179
|
+
"The hyperlink destination of the text. If unset, there's no link. Links are not "
|
|
180
|
+
"inherited from parent text."
|
|
181
|
+
),
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class TableRowStyleWritable(BaseModel):
|
|
186
|
+
model_config = ConfigDict(title="Styles that apply to a table row.")
|
|
187
|
+
minRowHeight: DimensionWritable | None = Field(
|
|
188
|
+
None,
|
|
189
|
+
title=(
|
|
190
|
+
"The minimum height of the row. The row will be rendered in the Docs editor at a "
|
|
191
|
+
"height equal to or greater than this value in order to show all the content in the "
|
|
192
|
+
"row's cells."
|
|
193
|
+
),
|
|
194
|
+
)
|
|
195
|
+
tableHeader: bool | None = Field(
|
|
196
|
+
None,
|
|
197
|
+
title="Whether the row is a table header",
|
|
198
|
+
)
|
|
199
|
+
preventOverflow: bool | None = Field(
|
|
200
|
+
None, title="Whether the row cannot overflow across page or column boundaries."
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
class TableColumnPropertiesWritable(BaseModel):
|
|
205
|
+
model_config = ConfigDict(title="The properties of a column in a table.")
|
|
206
|
+
widthType: WidthTypeWritable | None = Field(None, title="The width type of the column")
|
|
207
|
+
width: DimensionWritable | None = Field(
|
|
208
|
+
None,
|
|
209
|
+
title="The width of the column. Set when the column's widthType is FIXED_WIDTH.",
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
class WidthTypeWritable(str, Enum):
|
|
214
|
+
EVENLY_DISTRIBUTED = "EVENLY_DISTRIBUTED"
|
|
215
|
+
FIXED_WIDTH = "FIXED_WIDTH"
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class TableCellStyleWritable(BaseModel):
|
|
219
|
+
model_config = ConfigDict(
|
|
220
|
+
title=(
|
|
221
|
+
"The style of a TableCell. Inherited table cell styles are represented as unset fields "
|
|
222
|
+
"in this message. A table cell style can inherit from the table's style."
|
|
223
|
+
)
|
|
224
|
+
)
|
|
225
|
+
backgroundColor: OptionalColorWritable | None = Field(
|
|
226
|
+
None,
|
|
227
|
+
title="The background color of the table cell",
|
|
228
|
+
)
|
|
229
|
+
borderLeft: TableCellBorderWritable | None = Field(
|
|
230
|
+
None,
|
|
231
|
+
title="The border to the left of the table cell",
|
|
232
|
+
)
|
|
233
|
+
borderRight: TableCellBorderWritable | None = Field(
|
|
234
|
+
None,
|
|
235
|
+
title="The border to the right of the table cell",
|
|
236
|
+
)
|
|
237
|
+
borderTop: TableCellBorderWritable | None = Field(
|
|
238
|
+
None,
|
|
239
|
+
title="The border at the top of the table cell",
|
|
240
|
+
)
|
|
241
|
+
borderBottom: TableCellBorderWritable | None = Field(
|
|
242
|
+
None,
|
|
243
|
+
title="The border at the bottom of the table cell",
|
|
244
|
+
)
|
|
245
|
+
paddingLeft: DimensionWritable | None = Field(
|
|
246
|
+
None,
|
|
247
|
+
title="The padding at the left of the table cell",
|
|
248
|
+
)
|
|
249
|
+
paddingRight: DimensionWritable | None = Field(
|
|
250
|
+
None,
|
|
251
|
+
title="The padding at the right of the table cell",
|
|
252
|
+
)
|
|
253
|
+
paddingTop: DimensionWritable | None = Field(
|
|
254
|
+
None,
|
|
255
|
+
title="The padding at the top of the table cell",
|
|
256
|
+
)
|
|
257
|
+
paddingBottom: DimensionWritable | None = Field(
|
|
258
|
+
None,
|
|
259
|
+
title="The padding at the bottom of the table cell",
|
|
260
|
+
)
|
|
261
|
+
contentAlignment: ContentAlignmentWritable | None = Field(
|
|
262
|
+
None,
|
|
263
|
+
title=(
|
|
264
|
+
"The alignment of the content in the table cell. The default alignment matches the "
|
|
265
|
+
"alignment for newly created table cells in the Docs editor."
|
|
266
|
+
),
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
class ContentAlignmentWritable(str, Enum):
|
|
271
|
+
CONTENT_ALIGNMENT_UNSPECIFIED = "CONTENT_ALIGNMENT_UNSPECIFIED"
|
|
272
|
+
TOP = "TOP"
|
|
273
|
+
MIDDLE = "MIDDLE"
|
|
274
|
+
BOTTOM = "BOTTOM"
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
class TableCellBorderWritable(BaseModel):
|
|
278
|
+
model_config = ConfigDict(
|
|
279
|
+
title=(
|
|
280
|
+
"A border around a table cell. Table cell borders cannot be transparent. "
|
|
281
|
+
"To hide a table cell border, make its width 0."
|
|
282
|
+
)
|
|
283
|
+
)
|
|
284
|
+
color: OptionalColorWritable | None = Field(
|
|
285
|
+
None,
|
|
286
|
+
title="The color of the border. Table cell borders cannot be transparent",
|
|
287
|
+
)
|
|
288
|
+
width: DimensionWritable | None = Field(
|
|
289
|
+
None,
|
|
290
|
+
title="The width of the border. Table cell borders cannot be transparent",
|
|
291
|
+
)
|
|
292
|
+
dashStyle: DashStyleWritable | None = Field(None, title="The dash style of the border")
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
class DashStyleWritable(str, Enum):
|
|
296
|
+
SOLID = "SOLID"
|
|
297
|
+
DOT = "DOT"
|
|
298
|
+
DASH = "DASH"
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
class SectionStyleWritable(BaseModel):
|
|
302
|
+
model_config = ConfigDict(title="The styling that applies to a section.")
|
|
303
|
+
columnProperties: list[SectionColumnPropertiesWritable] | None = Field(
|
|
304
|
+
None,
|
|
305
|
+
title=(
|
|
306
|
+
"The section's columns properties. If empty, the section contains one column with "
|
|
307
|
+
"the default properties in the Docs editor. A section can be updated to have no more "
|
|
308
|
+
"than 3 columns."
|
|
309
|
+
),
|
|
310
|
+
)
|
|
311
|
+
columnSeparatorStyle: ColumnSeparatorStyleWritable | None = Field(
|
|
312
|
+
None,
|
|
313
|
+
title=(
|
|
314
|
+
"The style of column separators. "
|
|
315
|
+
"This style can be set even when there's one column in the section."
|
|
316
|
+
),
|
|
317
|
+
)
|
|
318
|
+
contentDirection: ContentDirectionWritable | None = Field(
|
|
319
|
+
None,
|
|
320
|
+
title=(
|
|
321
|
+
"The content direction of the section. If unset, the value defaults to LEFT_TO_RIGHT."
|
|
322
|
+
),
|
|
323
|
+
)
|
|
324
|
+
marginTop: DimensionWritable | None = Field(
|
|
325
|
+
None,
|
|
326
|
+
title=(
|
|
327
|
+
"The top margin of the section. "
|
|
328
|
+
"If unset, the value defaults to marginTop from DocumentStyle."
|
|
329
|
+
),
|
|
330
|
+
)
|
|
331
|
+
marginBottom: DimensionWritable | None = Field(
|
|
332
|
+
None,
|
|
333
|
+
title=(
|
|
334
|
+
"The bottom margin of the section. "
|
|
335
|
+
"If unset, the value defaults to marginBottom from DocumentStyle."
|
|
336
|
+
),
|
|
337
|
+
)
|
|
338
|
+
marginRight: DimensionWritable | None = Field(
|
|
339
|
+
None,
|
|
340
|
+
title=(
|
|
341
|
+
"The right margin of the section. "
|
|
342
|
+
"If unset, the value defaults to marginRight from DocumentStyle."
|
|
343
|
+
),
|
|
344
|
+
)
|
|
345
|
+
marginLeft: DimensionWritable | None = Field(
|
|
346
|
+
None,
|
|
347
|
+
title=(
|
|
348
|
+
"The left margin of the section. "
|
|
349
|
+
"If unset, the value defaults to marginLeft from DocumentStyle."
|
|
350
|
+
),
|
|
351
|
+
)
|
|
352
|
+
marginHeader: DimensionWritable | None = Field(
|
|
353
|
+
None,
|
|
354
|
+
title=(
|
|
355
|
+
"The header margin of the section. If unset, the value defaults to marginHeader "
|
|
356
|
+
"from DocumentStyle. If updated, useCustomHeaderFooterMargins is set to true on "
|
|
357
|
+
"DocumentStyle. The value of useCustomHeaderFooterMargins on DocumentStyle indicates "
|
|
358
|
+
"if a header margin is being respected for this section."
|
|
359
|
+
),
|
|
360
|
+
)
|
|
361
|
+
marginFooter: DimensionWritable | None = Field(
|
|
362
|
+
None,
|
|
363
|
+
title=(
|
|
364
|
+
"The footer margin of the section. If unset, the value defaults to marginFooter "
|
|
365
|
+
"from DocumentStyle. If updated, useCustomHeaderFooterMargins is set to true on "
|
|
366
|
+
"DocumentStyle. The value of useCustomHeaderFooterMargins on DocumentStyle indicates "
|
|
367
|
+
"if a footer margin is being respected for this section"
|
|
368
|
+
),
|
|
369
|
+
)
|
|
370
|
+
useFirstPageHeaderFooter: bool | None = Field(
|
|
371
|
+
None,
|
|
372
|
+
title=(
|
|
373
|
+
"Indicates whether to use the first page header / footer IDs for the first page of "
|
|
374
|
+
"the section. If unset, it inherits from DocumentStyle's useFirstPageHeaderFooter "
|
|
375
|
+
"for the first section. If the value is unset for subsequent sectors, "
|
|
376
|
+
"it should be interpreted as false."
|
|
377
|
+
),
|
|
378
|
+
)
|
|
379
|
+
pageNumberStart: int | None = Field(
|
|
380
|
+
None,
|
|
381
|
+
title=(
|
|
382
|
+
"The page number from which to start counting the number of pages for this section. "
|
|
383
|
+
"If unset, page numbering continues from the previous section. If the value is unset "
|
|
384
|
+
"in the first SectionBreak, refer to DocumentStyle's pageNumberStart."
|
|
385
|
+
),
|
|
386
|
+
)
|
|
387
|
+
flipPageOrientation: bool | None = Field(
|
|
388
|
+
None,
|
|
389
|
+
title=(
|
|
390
|
+
"Indicates whether to flip the dimensions of DocumentStyle's pageSize for this "
|
|
391
|
+
"section, which allows changing the page orientation between portrait and landscape. "
|
|
392
|
+
"If unset, the value inherits from DocumentStyle's flipPageOrientation."
|
|
393
|
+
),
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
class ColumnSeparatorStyleWritable(str, Enum):
|
|
398
|
+
NONE = "NONE"
|
|
399
|
+
BETWEEN_EACH_COLUMN = "BETWEEN_EACH_COLUMN"
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
class ContentDirectionWritable(str, Enum):
|
|
403
|
+
LEFT_TO_RIGHT = "LEFT_TO_RIGHT"
|
|
404
|
+
RIGHT_TO_LEFT = "RIGHT_TO_LEFT"
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
class SectionColumnPropertiesWritable(BaseModel):
|
|
408
|
+
model_config = ConfigDict(title="Properties that apply to a section's column.")
|
|
409
|
+
paddingEnd: DimensionWritable = Field(..., title="The padding at the end of the column")
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
class ParagraphStyleWritable(BaseModel):
|
|
413
|
+
model_config = ConfigDict(
|
|
414
|
+
title=(
|
|
415
|
+
"Styles that apply to a whole paragraph. "
|
|
416
|
+
"Inherited paragraph styles are represented as unset fields in this message. "
|
|
417
|
+
"A paragraph style's parent depends on where the paragraph style is defined:\n"
|
|
418
|
+
"- The ParagraphStyle on a Paragraph inherits from the paragraph's corresponding named style type.\n" # noqa: E501
|
|
419
|
+
"- The ParagraphStyle on a named style inherits from the normal text named style.\n"
|
|
420
|
+
"- The ParagraphStyle of the normal text named style inherits from the default paragraph style in the Docs editor.\n" # noqa: E501
|
|
421
|
+
"- The ParagraphStyle on a Paragraph element that's contained in a table may inherit its paragraph style from the table style.\n" # noqa: E501
|
|
422
|
+
"If the paragraph style does not inherit from a parent, unsetting fields will revert the style to a value matching the defaults in the Docs editor." # noqa: E501
|
|
423
|
+
)
|
|
424
|
+
)
|
|
425
|
+
|
|
426
|
+
namedStyleType: NamedStyleType | None = Field(
|
|
427
|
+
None,
|
|
428
|
+
title=("Named style type is applied before the other properties are updated."),
|
|
429
|
+
)
|
|
430
|
+
alignment: Alignment | None = Field(None, title="The text alignment for this paragraph.")
|
|
431
|
+
lineSpacing: float | None = Field(
|
|
432
|
+
None,
|
|
433
|
+
title=(
|
|
434
|
+
"The amount of space between lines, as a percentage of normal, where normal is "
|
|
435
|
+
"represented as 100.0. If unset, the value is inherited from the parent."
|
|
436
|
+
),
|
|
437
|
+
)
|
|
438
|
+
direction: ContentDirection = Field(
|
|
439
|
+
ContentDirection.LEFT_TO_RIGHT,
|
|
440
|
+
title=(
|
|
441
|
+
"The text direction of this paragraph. If unset, the value defaults to LEFT_TO_RIGHT"
|
|
442
|
+
),
|
|
443
|
+
)
|
|
444
|
+
spacingMode: SpacingMode | None = Field(None, title="The spacing mode for the paragraph.")
|
|
445
|
+
spaceAbove: DimensionWritable | None = Field(
|
|
446
|
+
None,
|
|
447
|
+
title=(
|
|
448
|
+
"The amount of extra space above the paragraph. "
|
|
449
|
+
"If unset, the value is inherited from the parent."
|
|
450
|
+
),
|
|
451
|
+
)
|
|
452
|
+
spaceBelow: DimensionWritable | None = Field(
|
|
453
|
+
None,
|
|
454
|
+
title=(
|
|
455
|
+
"The amount of extra space below the paragraph. "
|
|
456
|
+
"If unset, the value is inherited from the parent."
|
|
457
|
+
),
|
|
458
|
+
)
|
|
459
|
+
borderBetween: ParagraphBorderWritable | None = Field(
|
|
460
|
+
None,
|
|
461
|
+
title=(
|
|
462
|
+
"The border between this paragraph and the next and previous paragraphs. "
|
|
463
|
+
"If unset, the value is inherited from the parent."
|
|
464
|
+
),
|
|
465
|
+
)
|
|
466
|
+
borderTop: ParagraphBorderWritable | None = Field(
|
|
467
|
+
None,
|
|
468
|
+
title=(
|
|
469
|
+
"The border at the top of this paragraph. "
|
|
470
|
+
"If unset, the value is inherited from the parent."
|
|
471
|
+
),
|
|
472
|
+
)
|
|
473
|
+
borderBottom: ParagraphBorderWritable | None = Field(
|
|
474
|
+
None,
|
|
475
|
+
title=(
|
|
476
|
+
"The border at the bottom of this paragraph. "
|
|
477
|
+
"If unset, the value is inherited from the parent"
|
|
478
|
+
),
|
|
479
|
+
)
|
|
480
|
+
borderLeft: ParagraphBorderWritable | None = Field(
|
|
481
|
+
None,
|
|
482
|
+
title=(
|
|
483
|
+
"The border to the left of this paragraph. "
|
|
484
|
+
"If unset, the value is inherited from the parent"
|
|
485
|
+
),
|
|
486
|
+
)
|
|
487
|
+
borderRight: ParagraphBorderWritable | None = Field(
|
|
488
|
+
None,
|
|
489
|
+
title=(
|
|
490
|
+
"The border to the right of this paragraph. "
|
|
491
|
+
"If unset, the value is inherited from the parent."
|
|
492
|
+
),
|
|
493
|
+
)
|
|
494
|
+
indentFirstLine: DimensionWritable | None = Field(
|
|
495
|
+
None,
|
|
496
|
+
title=(
|
|
497
|
+
"The amount of indentation for the first line of the paragraph. "
|
|
498
|
+
"If unset, the value is inherited from the parent."
|
|
499
|
+
),
|
|
500
|
+
)
|
|
501
|
+
indentStart: DimensionWritable | None = Field(
|
|
502
|
+
None,
|
|
503
|
+
title=(
|
|
504
|
+
"The amount of indentation for the paragraph on the side that corresponds to the "
|
|
505
|
+
"start of the text, based on the current paragraph direction. "
|
|
506
|
+
"If unset, the value is inherited from the parent"
|
|
507
|
+
),
|
|
508
|
+
)
|
|
509
|
+
indentEnd: DimensionWritable | None = Field(
|
|
510
|
+
None,
|
|
511
|
+
title=(
|
|
512
|
+
"The amount of indentation for the paragraph on the side that corresponds to the "
|
|
513
|
+
"end of the text, based on the current paragraph direction. "
|
|
514
|
+
"If unset, the value is inherited from the parent"
|
|
515
|
+
),
|
|
516
|
+
)
|
|
517
|
+
keepLinesTogether: bool | None = Field(
|
|
518
|
+
None,
|
|
519
|
+
title=(
|
|
520
|
+
"Whether all lines of the paragraph should be laid out on the same page or column "
|
|
521
|
+
"if possible. If unset, the value is inherited from the parent."
|
|
522
|
+
),
|
|
523
|
+
)
|
|
524
|
+
keepWithNext: bool | None = Field(
|
|
525
|
+
None,
|
|
526
|
+
title=(
|
|
527
|
+
"Whether at least a part of this paragraph should be laid out on the same page or "
|
|
528
|
+
"column as the next paragraph if possible. "
|
|
529
|
+
"If unset, the value is inherited from the parent."
|
|
530
|
+
),
|
|
531
|
+
)
|
|
532
|
+
avoidWidowAndOrphan: bool | None = Field(
|
|
533
|
+
None,
|
|
534
|
+
title=(
|
|
535
|
+
"Whether to avoid widows and orphans for the paragraph. "
|
|
536
|
+
"If unset, the value is inherited from the parent."
|
|
537
|
+
),
|
|
538
|
+
)
|
|
539
|
+
shading: ShadingWritable | None = Field(
|
|
540
|
+
None,
|
|
541
|
+
title="The shading of the paragraph. If unset, the value is inherited from the parent.",
|
|
542
|
+
)
|
|
543
|
+
pageBreakBefore: bool | None = Field(
|
|
544
|
+
None,
|
|
545
|
+
title=(
|
|
546
|
+
"Whether the current paragraph should always start at the beginning of a page. If "
|
|
547
|
+
"unset, the value is inherited from the parent. Attempting to update pageBreakBefore "
|
|
548
|
+
"for paragraphs in unsupported regions, including Table, Header, Footer and Footnote, "
|
|
549
|
+
"can result in an invalid document state that returns a 400 bad request error."
|
|
550
|
+
),
|
|
551
|
+
)
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
class ParagraphBorderWritable(BaseModel):
|
|
555
|
+
model_config = ConfigDict(title="A border around a paragraph.")
|
|
556
|
+
color: OptionalColorWritable = Field(..., title="The color of the border.")
|
|
557
|
+
width: DimensionWritable = Field(..., title="The width of the border.")
|
|
558
|
+
padding: DimensionWritable = Field(..., title="The padding of the border.")
|
|
559
|
+
dashStyle: DashStyleWritable = Field(..., title="The dash style of the border.")
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
class TabStopWritable(BaseModel):
|
|
563
|
+
model_config = ConfigDict(title="A tab stop within a paragraph.")
|
|
564
|
+
offset: DimensionWritable = Field(..., title="The offset of the tab stop.")
|
|
565
|
+
alignment: TabStopAlignment = Field(
|
|
566
|
+
TabStopAlignment.START,
|
|
567
|
+
title="The alignment of this tab stop. If unset, the value defaults to START.",
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
class ShadingWritable(BaseModel):
|
|
572
|
+
model_config = ConfigDict(title="The shading of a paragraph.")
|
|
573
|
+
backgroundColor: OptionalColorWritable = Field(
|
|
574
|
+
..., title="The background color of this paragraph shading."
|
|
575
|
+
)
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
class RangeWritable(BaseModel):
|
|
579
|
+
segmentId: str | None = Field(
|
|
580
|
+
None,
|
|
581
|
+
title=(
|
|
582
|
+
"The ID of the header, footer, or footnote that this range is contained in. "
|
|
583
|
+
"An empty segment ID signifies the document's body."
|
|
584
|
+
),
|
|
585
|
+
)
|
|
586
|
+
startIndex: int = Field(
|
|
587
|
+
...,
|
|
588
|
+
title="The zero-based start index of this range, in UTF-16 code units.",
|
|
589
|
+
ge=0,
|
|
590
|
+
)
|
|
591
|
+
endIndex: int = Field(
|
|
592
|
+
...,
|
|
593
|
+
title="The zero-based end index of this range, in UTF-16 code units.",
|
|
594
|
+
ge=0,
|
|
595
|
+
)
|
|
596
|
+
tabId: str | None = Field(
|
|
597
|
+
None,
|
|
598
|
+
title=(
|
|
599
|
+
"The tab that contains this range. When omitted, the request applies to the first tab."
|
|
600
|
+
),
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
class OptionalColorWritable(BaseModel):
|
|
605
|
+
model_config = ConfigDict(title="The color of the text.")
|
|
606
|
+
color: ColorWritable | None = Field(
|
|
607
|
+
None,
|
|
608
|
+
title=(
|
|
609
|
+
"If set, this will be used as an opaque color. If unset, this represents a "
|
|
610
|
+
"transparent color."
|
|
611
|
+
),
|
|
612
|
+
)
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
class ColorWritable(BaseModel):
|
|
616
|
+
model_config = ConfigDict(title="A solid color.")
|
|
617
|
+
rgbColor: RgbColorWritable = Field(
|
|
618
|
+
...,
|
|
619
|
+
title="The RGB color value",
|
|
620
|
+
)
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
class RgbColorWritable(BaseModel):
|
|
624
|
+
model_config = ConfigDict(title="An RGB color.")
|
|
625
|
+
red: float = Field(
|
|
626
|
+
...,
|
|
627
|
+
title="The red component of the color, from 0.0 to 1.0.",
|
|
628
|
+
ge=0.0,
|
|
629
|
+
le=1.0,
|
|
630
|
+
)
|
|
631
|
+
green: float = Field(
|
|
632
|
+
...,
|
|
633
|
+
title="The green component of the color, from 0.0 to 1.0.",
|
|
634
|
+
ge=0.0,
|
|
635
|
+
le=1.0,
|
|
636
|
+
)
|
|
637
|
+
blue: float = Field(
|
|
638
|
+
...,
|
|
639
|
+
title="The blue component of the color, from 0.0 to 1.0.",
|
|
640
|
+
ge=0.0,
|
|
641
|
+
le=1.0,
|
|
642
|
+
)
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
class DimensionWritable(BaseModel):
|
|
646
|
+
model_config = ConfigDict(title="A magnitude in a single direction in the specified units.")
|
|
647
|
+
magnitude: float = Field(
|
|
648
|
+
...,
|
|
649
|
+
title="The magnitude.",
|
|
650
|
+
ge=5.0,
|
|
651
|
+
)
|
|
652
|
+
unit: Unit = Field(..., title="The units for magnitude. A PT is 1/72 of an inch.")
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
class BackgroundWritable(BaseModel):
|
|
656
|
+
model_config = ConfigDict(title="The background of the document.")
|
|
657
|
+
color: OptionalColorWritable = Field(..., title="The background color.")
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
class SizeWritable(BaseModel):
|
|
661
|
+
model_config = ConfigDict(title="A width and height")
|
|
662
|
+
height: DimensionWritable = Field(..., title="The height of the object.")
|
|
663
|
+
width: DimensionWritable = Field(..., title="The width of the object.")
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
class DocumentStyleWritable(BaseModel):
|
|
667
|
+
model_config = ConfigDict(title="The styles to set on the document.")
|
|
668
|
+
|
|
669
|
+
background: BackgroundWritable | None = Field(
|
|
670
|
+
None,
|
|
671
|
+
title=(
|
|
672
|
+
"The background of the document. Documents cannot have a transparent background color."
|
|
673
|
+
),
|
|
674
|
+
)
|
|
675
|
+
useFirstPageHeaderFooter: bool | None = Field(
|
|
676
|
+
None,
|
|
677
|
+
title="Indicates whether to use the first page header / footer IDs for the first page.",
|
|
678
|
+
)
|
|
679
|
+
useEvenPageHeaderFooter: bool | None = Field(
|
|
680
|
+
None,
|
|
681
|
+
title="Indicates whether to use the even page header / footer IDs for the even pages.",
|
|
682
|
+
)
|
|
683
|
+
pageNumberStart: int | None = Field(
|
|
684
|
+
None,
|
|
685
|
+
title="The page number from which to start counting the number of pages.",
|
|
686
|
+
)
|
|
687
|
+
marginTop: DimensionWritable | None = Field(
|
|
688
|
+
None,
|
|
689
|
+
title=(
|
|
690
|
+
"The top page margin. Updating the top page margin on the document style "
|
|
691
|
+
"clears the top page margin on all section styles."
|
|
692
|
+
),
|
|
693
|
+
)
|
|
694
|
+
marginBottom: DimensionWritable | None = Field(
|
|
695
|
+
None,
|
|
696
|
+
title=(
|
|
697
|
+
"The bottom page margin. Updating the bottom page margin on the document style "
|
|
698
|
+
"clears the bottom page margin on all section styles."
|
|
699
|
+
),
|
|
700
|
+
)
|
|
701
|
+
marginRight: DimensionWritable | None = Field(
|
|
702
|
+
None,
|
|
703
|
+
title=(
|
|
704
|
+
"The right page margin. Updating the right page margin on the document style "
|
|
705
|
+
"clears the right page margin on all section styles. It may also cause columns "
|
|
706
|
+
"to resize in all sections."
|
|
707
|
+
),
|
|
708
|
+
)
|
|
709
|
+
marginLeft: DimensionWritable | None = Field(
|
|
710
|
+
None,
|
|
711
|
+
title=(
|
|
712
|
+
"The left page margin. Updating the left page margin on the document style "
|
|
713
|
+
"clears the left page margin on all section styles. It may also cause columns "
|
|
714
|
+
"to resize in all sections."
|
|
715
|
+
),
|
|
716
|
+
)
|
|
717
|
+
pageSize: SizeWritable | None = Field(
|
|
718
|
+
None,
|
|
719
|
+
title="The size of a page in the document.",
|
|
720
|
+
)
|
|
721
|
+
marginHeader: DimensionWritable | None = Field(
|
|
722
|
+
None,
|
|
723
|
+
title="The amount of space between the top of the page and the contents of the header.",
|
|
724
|
+
)
|
|
725
|
+
marginFooter: DimensionWritable | None = Field(
|
|
726
|
+
None,
|
|
727
|
+
title="The amount of space between the bottom of the page and the contents of the footer.",
|
|
728
|
+
)
|
|
729
|
+
flipPageOrientation: bool | None = Field(
|
|
730
|
+
None,
|
|
731
|
+
title=(
|
|
732
|
+
"Optional. Indicates whether to flip the dimensions of the pageSize, "
|
|
733
|
+
"which allows changing the page orientation between portrait and landscape."
|
|
734
|
+
),
|
|
735
|
+
)
|