Skip to content

Latest commit

 

History

History
629 lines (492 loc) · 30 KB

File metadata and controls

629 lines (492 loc) · 30 KB

Indexing.People

Overview

Available Operations

Debug

Gives various information that would help in debugging related to a particular user. Currently in beta, might undergo breaking changes without prior notice.

Tip: Refer to the Troubleshooting tutorial for more information.

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.Indexing.People.Debug(ctx, "<value>", components.DebugUserRequest{
        Email: "u1@foo.com",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.DebugUserResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
datasource string ✔️ The datasource to which the user belongs
debugUserRequest components.DebugUserRequest ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1DebugDatasourceUserResponse, error

Errors

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

Count

Fetches user count for the specified custom datasource.

Tip: Use /debug/{datasource}/status for richer information.

⚠️ DEPRECATED: Deprecated on 2026-02-03, removal scheduled for 2026-10-15: Endpoint is deprecated.

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.Indexing.People.Count(ctx, components.GetUserCountRequest{
        Datasource: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.GetUserCountResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.GetUserCountRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1GetusercountResponse, error

Errors

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

Index

Adds an employee or replaces the existing information about an employee.

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.Indexing.People.Index(ctx, components.IndexEmployeeRequest{
        Employee: components.EmployeeInfoDefinition{
            Email: "Jerrold_Hermann@hotmail.com",
            Department: "<value>",
            DatasourceProfiles: []components.DatasourceProfile{
                components.DatasourceProfile{
                    Datasource: "github",
                    Handle: "<value>",
                },
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.IndexEmployeeRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1IndexemployeeResponse, error

Errors

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

BulkIndex

Replaces all the currently indexed employees using paginated batch API calls. Please refer to the bulk indexing documentation for an explanation of how to use bulk endpoints.

⚠️ DEPRECATED: Deprecated on 2026-02-03, removal scheduled for 2026-10-15: Endpoint is deprecated.

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.Indexing.People.BulkIndex(ctx, components.BulkIndexEmployeesRequest{
        UploadID: "<id>",
        Employees: []components.EmployeeInfoDefinition{
            components.EmployeeInfoDefinition{
                Email: "Robin.Stoltenberg@yahoo.com",
                Department: "<value>",
                DatasourceProfiles: []components.DatasourceProfile{
                    components.DatasourceProfile{
                        Datasource: "github",
                        Handle: "<value>",
                    },
                },
            },
            components.EmployeeInfoDefinition{
                Email: "Robin.Stoltenberg@yahoo.com",
                Department: "<value>",
                DatasourceProfiles: []components.DatasourceProfile{
                    components.DatasourceProfile{
                        Datasource: "github",
                        Handle: "<value>",
                    },
                },
            },
            components.EmployeeInfoDefinition{
                Email: "Robin.Stoltenberg@yahoo.com",
                Department: "<value>",
                DatasourceProfiles: []components.DatasourceProfile{
                    components.DatasourceProfile{
                        Datasource: "github",
                        Handle: "<value>",
                    },
                },
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.BulkIndexEmployeesRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1BulkindexemployeesResponse, error

Errors

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

ProcessAllEmployeesAndTeams

Schedules the immediate processing of employees and teams uploaded through the indexing API. By default all uploaded people data will be processed asynchronously but this API can be used to schedule its processing on demand.

Example Usage

package main

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

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

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

    res, err := s.Indexing.People.ProcessAllEmployeesAndTeams(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1ProcessallemployeesandteamsResponse, error

Errors

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

Delete

Delete an employee. Silently succeeds if employee is not present.

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.Indexing.People.Delete(ctx, components.DeleteEmployeeRequest{
        EmployeeEmail: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.DeleteEmployeeRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1DeleteemployeeResponse, error

Errors

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

IndexTeam

Adds a team or updates information about a team

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.Indexing.People.IndexTeam(ctx, components.IndexTeamRequest{
        Team: components.TeamInfoDefinition{
            ID: "<id>",
            Name: "<value>",
            DatasourceProfiles: []components.DatasourceProfile{
                components.DatasourceProfile{
                    Datasource: "github",
                    Handle: "<value>",
                },
                components.DatasourceProfile{
                    Datasource: "github",
                    Handle: "<value>",
                },
                components.DatasourceProfile{
                    Datasource: "github",
                    Handle: "<value>",
                },
            },
            Members: []components.TeamMember{
                components.TeamMember{
                    Email: "Nasir.Hilll73@hotmail.com",
                },
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.IndexTeamRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1IndexteamResponse, error

Errors

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

DeleteTeam

Delete a team based on provided id.

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.Indexing.People.DeleteTeam(ctx, components.DeleteTeamRequest{
        ID: "<id>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.DeleteTeamRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1DeleteteamResponse, error

Errors

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

BulkIndexTeams

Replaces all the currently indexed teams using paginated batch API calls. Please refer to the bulk indexing documentation for an explanation of how to use bulk endpoints.

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.Indexing.People.BulkIndexTeams(ctx, components.BulkIndexTeamsRequest{
        UploadID: "<id>",
        Teams: []components.TeamInfoDefinition{
            components.TeamInfoDefinition{
                ID: "<id>",
                Name: "<value>",
                DatasourceProfiles: []components.DatasourceProfile{
                    components.DatasourceProfile{
                        Datasource: "github",
                        Handle: "<value>",
                    },
                    components.DatasourceProfile{
                        Datasource: "github",
                        Handle: "<value>",
                    },
                },
                Members: []components.TeamMember{},
            },
            components.TeamInfoDefinition{
                ID: "<id>",
                Name: "<value>",
                DatasourceProfiles: []components.DatasourceProfile{
                    components.DatasourceProfile{
                        Datasource: "github",
                        Handle: "<value>",
                    },
                    components.DatasourceProfile{
                        Datasource: "github",
                        Handle: "<value>",
                    },
                },
                Members: []components.TeamMember{},
            },
            components.TeamInfoDefinition{
                ID: "<id>",
                Name: "<value>",
                DatasourceProfiles: []components.DatasourceProfile{
                    components.DatasourceProfile{
                        Datasource: "github",
                        Handle: "<value>",
                    },
                    components.DatasourceProfile{
                        Datasource: "github",
                        Handle: "<value>",
                    },
                },
                Members: []components.TeamMember{},
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.BulkIndexTeamsRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1BulkindexteamsResponse, error

Errors

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