Skip to content

Latest commit

 

History

History
183 lines (131 loc) · 15.7 KB

File metadata and controls

183 lines (131 loc) · 15.7 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

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.*;
import com.glean.api_client.glean_api_client.models.operations.ListentitiesResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        ListentitiesResponse res = sdk.client().entities().list()
                .listEntitiesRequest(ListEntitiesRequest.builder()
                    .filter(List.of(
                        FacetFilter.builder()
                            .fieldName("type")
                            .values(List.of(
                                FacetFilterValue.builder()
                                    .value("Spreadsheet")
                                    .relationType(RelationType.EQUALS)
                                    .build(),
                                FacetFilterValue.builder()
                                    .value("Presentation")
                                    .relationType(RelationType.EQUALS)
                                    .build()))
                            .build()))
                    .pageSize(100L)
                    .build())
                .call();

        if (res.listEntitiesResponse().isPresent()) {
            System.out.println(res.listEntitiesResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
locale Optional<String> 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.
listEntitiesRequest ListEntitiesRequest ✔️ List people request

Response

ListentitiesResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

readPeople

Read people details for the given IDs.

Example Usage

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.PeopleRequest;
import com.glean.api_client.glean_api_client.models.operations.PeopleResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        PeopleResponse res = sdk.client().entities().readPeople()
                .peopleRequest(PeopleRequest.builder()
                    .obfuscatedIds(List.of(
                        "abc123",
                        "abc456"))
                    .build())
                .call();

        if (res.peopleResponse().isPresent()) {
            System.out.println(res.peopleResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description Example
locale Optional<String> 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.
peopleRequest PeopleRequest ✔️ People request {
"obfuscatedIds": [
"abc123",
"abc456"
]
}

Response

PeopleResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

retrievePersonPhoto

Returns the profile photo bytes for a person whose photo is stored in Glean (crawled from an identity source or user-uploaded via admin console). Photos hosted externally (e.g. Slack CDN) are not served by this endpoint; callers should follow the photoUrl from /people or /listentities directly. Responses include a Cache-Control header (max-age=3600) to reduce redundant fetches.

Example Usage

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.operations.GetPersonPhotoResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        GetPersonPhotoResponse res = sdk.client().entities().retrievePersonPhoto()
                .personId("<id>")
                .call();

        if (res.twoHundredImagePngResponseStream().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
personId String ✔️ The obfuscated ID of the person whose photo to retrieve.
ds Optional<String> Optional datasource override for crawled photos (e.g. AZURE, GDRIVE, OKTA). When omitted, the datasource is derived from the person's stored photo URL or the deployment's primary person datasource.

Response

GetPersonPhotoResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*