Skip to content

Latest commit

 

History

History
121 lines (88 loc) · 23.6 KB

File metadata and controls

121 lines (88 loc) · 23.6 KB

Client.Entities

Overview

Available Operations

list

List some set of details for all entities that fit the given criteria and return in the requested order. Does not support negation in filters, assumes relation type EQUALS. There is a limit of 10000 entities that can be retrieved via this endpoint, except when using FULL_DIRECTORY request type for people entities.

Example Usage

from glean.api_client import Glean, models
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    res = glean.client.entities.list(filter_=[
        {
            "field_name": "type",
            "values": [
                {
                    "value": "Spreadsheet",
                    "relation_type": models.RelationType.EQUALS,
                },
                {
                    "value": "Presentation",
                    "relation_type": models.RelationType.EQUALS,
                },
            ],
        },
    ], entity_type=models.ListEntitiesRequestEntityType.PEOPLE, page_size=100, request_type=models.RequestType.STANDARD)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
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.
filter_ List[models.FacetFilter] N/A
sort List[models.SortOptions] Use EntitiesSortOrder enum for SortOptions.sortBy
entity_type Optional[models.ListEntitiesRequestEntityType] N/A
datasource Optional[str] The datasource associated with the entity type, most commonly used with CUSTOM_ENTITIES
query Optional[str] A query string to search for entities that each entity in the response must conform to. An empty query does not filter any entities.
include_fields List[models.ListEntitiesRequestIncludeField] List of entity fields to return (that aren't returned by default)
page_size Optional[int] Hint to the server about how many results to send back. Server may return less. 100
cursor Optional[str] Pagination cursor. A previously received opaque token representing the position in the overall results at which to start.
source Optional[str] A string denoting the search surface from which the endpoint is called.
request_type Optional[models.RequestType] The type of request being made.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ListEntitiesResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

read_people

Read people details for the given IDs.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    res = glean.client.entities.read_people(obfuscated_ids=[
        "abc123",
        "abc456",
    ])

    # Handle response
    print(res)

Parameters

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.
timezone_offset Optional[int] The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC.
obfuscated_ids List[str] The Person IDs to retrieve. If no IDs are requested, the current user's details are returned.
email_ids List[str] The email IDs to retrieve. The result is the deduplicated union of emailIds and obfuscatedIds.
include_fields List[models.PeopleRequestIncludeField] List of PersonMetadata fields to return (that aren't returned by default)
include_types List[models.IncludeType] The types of people entities to include in the response in addition to those returned by default.
source Optional[str] A string denoting the search surface from which the endpoint is called.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.PeopleResponse

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*