Read the emails of all users who have access to the given document.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.client.documents.retrieve_permissions()
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
locale |
Optional[str] |
➖ |
The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en. |
document_id |
Optional[str] |
➖ |
The Glean Document ID to retrieve permissions for. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetDocPermissionsResponse
| Error Type |
Status Code |
Content Type |
| errors.GleanError |
4XX, 5XX |
*/* |
Read the documents including metadata (does not include enhanced metadata via /documentmetadata) for the given list of Glean Document IDs or URLs specified in the request.
from glean.api_client import Glean
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.client.documents.retrieve()
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
locale |
Optional[str] |
➖ |
The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en. |
get_documents_request |
Optional[models.GetDocumentsRequest] |
➖ |
Information about documents requested. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetDocumentsResponse
| Error Type |
Status Code |
Content Type |
| errors.GleanError |
4XX, 5XX |
*/* |
Read the documents including metadata (does not include enhanced metadata via /documentmetadata) macthing the given facet conditions.
from glean.api_client import Glean, models
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.client.documents.retrieve_by_facets(get_documents_by_facets_request={
"filter_sets": [
{
"filters": [
{
"field_name": "type",
"values": [
{
"value": "Spreadsheet",
"relation_type": models.RelationType.EQUALS,
},
{
"value": "Presentation",
"relation_type": models.RelationType.EQUALS,
},
],
},
],
},
],
})
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
locale |
Optional[str] |
➖ |
The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en. |
get_documents_by_facets_request |
Optional[models.GetDocumentsByFacetsRequest] |
➖ |
Information about facet conditions for documents to be retrieved. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetDocumentsByFacetsResponse
| Error Type |
Status Code |
Content Type |
| errors.GleanError |
4XX, 5XX |
*/* |
Generate an AI summary of the requested documents.
from glean.api_client import Glean, models
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.client.documents.summarize(document_specs=[
{
"ugc_type": models.DocumentSpecUgcType2.CHATS,
"ugc_id": "<id>",
},
])
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
document_specs |
List[models.DocumentSpecUnion] |
✔️ |
Specifications of documents to summarize |
locale |
Optional[str] |
➖ |
The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en. |
timestamp |
date |
➖ |
The ISO 8601 timestamp associated with the client request. |
query |
Optional[str] |
➖ |
Optional query that the summary should be about |
preferred_summary_length |
Optional[int] |
➖ |
Optional length of summary output. If not given, defaults to 500 chars. |
tracking_token |
Optional[str] |
➖ |
An opaque token that represents this particular result. To be used for /feedback reporting. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.SummarizeResponse
| Error Type |
Status Code |
Content Type |
| errors.GleanError |
4XX, 5XX |
*/* |