-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdocumentdefinition.py
More file actions
160 lines (127 loc) · 8.08 KB
/
documentdefinition.py
File metadata and controls
160 lines (127 loc) · 8.08 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
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .commentdefinition import CommentDefinition, CommentDefinitionTypedDict
from .contentdefinition import ContentDefinition, ContentDefinitionTypedDict
from .customproperty import CustomProperty, CustomPropertyTypedDict
from .documentinteractionsdefinition import (
DocumentInteractionsDefinition,
DocumentInteractionsDefinitionTypedDict,
)
from .documentpermissionsdefinition import (
DocumentPermissionsDefinition,
DocumentPermissionsDefinitionTypedDict,
)
from .userreferencedefinition import (
UserReferenceDefinition,
UserReferenceDefinitionTypedDict,
)
from glean.api_client.types import BaseModel
import pydantic
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class DocumentDefinitionTypedDict(TypedDict):
r"""Indexable document structure"""
datasource: str
title: NotRequired[str]
r"""Document title, in plain text, if present. If not present, the title would be attempted to be extracted from the content."""
filename: NotRequired[str]
r"""Source filename, in plain text, for the document. May be used as a fallback title for the document, if the title is not provided and cannot be extracted from the content. Populate this if there is no explicit title for the document and the content is sourced from a file."""
container: NotRequired[str]
r"""The container name for the content (Folder for example for file content)."""
container_datasource_id: NotRequired[str]
r"""This represents the datasource sepcific id of the container."""
container_object_type: NotRequired[str]
r"""This represents the object type of the container. It cannot have spaces or _"""
object_type: NotRequired[str]
r"""The type of the document (Case, KnowledgeArticle for Salesforce for example). It cannot have spaces or _"""
view_url: NotRequired[str]
r"""The permalink for viewing the document. **Note: viewURL is a required field for non-entity datasources, but not required if the datasource is used to push custom entities (ie. datasources where isEntityDatasource is false).**'
"""
id: NotRequired[str]
r"""The datasource specific id for the document. This field is case insensitive and should not be more than 200 characters in length. Note: id is a required field for datasources created after 1st March 2025
"""
summary: NotRequired[ContentDefinitionTypedDict]
r"""Describes text content or base64 encoded binary content"""
body: NotRequired[ContentDefinitionTypedDict]
r"""Describes text content or base64 encoded binary content"""
author: NotRequired[UserReferenceDefinitionTypedDict]
r"""Describes how a user is referenced in a document. The user can be referenced by email or by a datasource specific id."""
owner: NotRequired[UserReferenceDefinitionTypedDict]
r"""Describes how a user is referenced in a document. The user can be referenced by email or by a datasource specific id."""
permissions: NotRequired[DocumentPermissionsDefinitionTypedDict]
r"""describes the access control details of the document"""
created_at: NotRequired[int]
r"""The creation time, in epoch seconds."""
updated_at: NotRequired[int]
r"""The last update time, in epoch seconds."""
updated_by: NotRequired[UserReferenceDefinitionTypedDict]
r"""Describes how a user is referenced in a document. The user can be referenced by email or by a datasource specific id."""
tags: NotRequired[List[str]]
r"""Labels associated with the document."""
interactions: NotRequired[DocumentInteractionsDefinitionTypedDict]
r"""describes the interactions on the document"""
status: NotRequired[str]
additional_urls: NotRequired[List[str]]
r"""Additional variations of the URL that this document points to."""
comments: NotRequired[List[CommentDefinitionTypedDict]]
r"""Comments associated with the document."""
custom_properties: NotRequired[List[CustomPropertyTypedDict]]
r"""Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/indexing/datasource/custom-properties/operators_and_facets)."""
class DocumentDefinition(BaseModel):
r"""Indexable document structure"""
datasource: str
title: Optional[str] = None
r"""Document title, in plain text, if present. If not present, the title would be attempted to be extracted from the content."""
filename: Optional[str] = None
r"""Source filename, in plain text, for the document. May be used as a fallback title for the document, if the title is not provided and cannot be extracted from the content. Populate this if there is no explicit title for the document and the content is sourced from a file."""
container: Optional[str] = None
r"""The container name for the content (Folder for example for file content)."""
container_datasource_id: Annotated[
Optional[str], pydantic.Field(alias="containerDatasourceId")
] = None
r"""This represents the datasource sepcific id of the container."""
container_object_type: Annotated[
Optional[str], pydantic.Field(alias="containerObjectType")
] = None
r"""This represents the object type of the container. It cannot have spaces or _"""
object_type: Annotated[Optional[str], pydantic.Field(alias="objectType")] = None
r"""The type of the document (Case, KnowledgeArticle for Salesforce for example). It cannot have spaces or _"""
view_url: Annotated[Optional[str], pydantic.Field(alias="viewURL")] = None
r"""The permalink for viewing the document. **Note: viewURL is a required field for non-entity datasources, but not required if the datasource is used to push custom entities (ie. datasources where isEntityDatasource is false).**'
"""
id: Optional[str] = None
r"""The datasource specific id for the document. This field is case insensitive and should not be more than 200 characters in length. Note: id is a required field for datasources created after 1st March 2025
"""
summary: Optional[ContentDefinition] = None
r"""Describes text content or base64 encoded binary content"""
body: Optional[ContentDefinition] = None
r"""Describes text content or base64 encoded binary content"""
author: Optional[UserReferenceDefinition] = None
r"""Describes how a user is referenced in a document. The user can be referenced by email or by a datasource specific id."""
owner: Optional[UserReferenceDefinition] = None
r"""Describes how a user is referenced in a document. The user can be referenced by email or by a datasource specific id."""
permissions: Optional[DocumentPermissionsDefinition] = None
r"""describes the access control details of the document"""
created_at: Annotated[Optional[int], pydantic.Field(alias="createdAt")] = None
r"""The creation time, in epoch seconds."""
updated_at: Annotated[Optional[int], pydantic.Field(alias="updatedAt")] = None
r"""The last update time, in epoch seconds."""
updated_by: Annotated[
Optional[UserReferenceDefinition], pydantic.Field(alias="updatedBy")
] = None
r"""Describes how a user is referenced in a document. The user can be referenced by email or by a datasource specific id."""
tags: Optional[List[str]] = None
r"""Labels associated with the document."""
interactions: Optional[DocumentInteractionsDefinition] = None
r"""describes the interactions on the document"""
status: Optional[str] = None
additional_urls: Annotated[
Optional[List[str]], pydantic.Field(alias="additionalUrls")
] = None
r"""Additional variations of the URL that this document points to."""
comments: Optional[List[CommentDefinition]] = None
r"""Comments associated with the document."""
custom_properties: Annotated[
Optional[List[CustomProperty]], pydantic.Field(alias="customProperties")
] = None
r"""Additional metadata properties of the document. These can surface as [facets and operators](https://developers.glean.com/indexing/datasource/custom-properties/operators_and_facets)."""