Skip to content

Latest commit

 

History

History
138 lines (107 loc) · 13.7 KB

File metadata and controls

138 lines (107 loc) · 13.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 main

import(
	"context"
	"os"
	apiclientgo "github.com/gleanwork/api-client-go"
	"github.com/gleanwork/api-client-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := apiclientgo.New(
        apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
    )

    res, err := s.Client.Entities.List(ctx, components.ListEntitiesRequest{
        Filter: []components.FacetFilter{
            components.FacetFilter{
                FieldName: apiclientgo.Pointer("type"),
                Values: []components.FacetFilterValue{
                    components.FacetFilterValue{
                        Value: apiclientgo.Pointer("Spreadsheet"),
                        RelationType: components.RelationTypeEquals.ToPointer(),
                    },
                    components.FacetFilterValue{
                        Value: apiclientgo.Pointer("Presentation"),
                        RelationType: components.RelationTypeEquals.ToPointer(),
                    },
                },
            },
        },
        PageSize: apiclientgo.Pointer[int64](100),
    }, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.ListEntitiesResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
listEntitiesRequest components.ListEntitiesRequest ✔️ List people request
locale *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.
opts []operations.Option The options for this request.

Response

*operations.ListentitiesResponse, error

Errors

Error Type Status Code Content Type
apierrors.APIError 4XX, 5XX */*

ReadPeople

Read people details for the given IDs.

Example Usage

package main

import(
	"context"
	"os"
	apiclientgo "github.com/gleanwork/api-client-go"
	"github.com/gleanwork/api-client-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := apiclientgo.New(
        apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
    )

    res, err := s.Client.Entities.ReadPeople(ctx, components.PeopleRequest{
        ObfuscatedIds: []string{
            "abc123",
            "abc456",
        },
    }, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.PeopleResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
peopleRequest components.PeopleRequest ✔️ People request {
"obfuscatedIds": [
"abc123",
"abc456"
]
}
locale *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.
opts []operations.Option The options for this request.

Response

*operations.PeopleResponse, error

Errors

Error Type Status Code Content Type
apierrors.APIError 4XX, 5XX */*