Skip to content

Latest commit

 

History

History
735 lines (559 loc) · 37.8 KB

File metadata and controls

735 lines (559 loc) · 37.8 KB

Indexing.Permissions

Overview

Available Operations

UpdatePermissions

Updates the permissions for a given document without modifying document content.

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.Permissions.UpdatePermissions(ctx, components.UpdatePermissionsRequest{
        Datasource: "<value>",
        Permissions: components.DocumentPermissionsDefinition{},
    })
    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.UpdatePermissionsRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1UpdatepermissionsResponse, error

Errors

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

IndexUser

Adds a datasource user or updates an existing user.

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.Permissions.IndexUser(ctx, components.IndexUserRequest{
        Datasource: "<value>",
        User: components.DatasourceUserDefinition{
            Email: "Art.Schaden@hotmail.com",
            Name: "<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.IndexUserRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1IndexuserResponse, error

Errors

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

BulkIndexUsers

Replaces the users in a datasource using paginated batch API calls. Please refer to the bulk indexing documentation for an explanation of how to use bulk endpoints. Note: Any users deleted from the existing set will have their associated memberships deleted as well.

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.Permissions.BulkIndexUsers(ctx, components.BulkIndexUsersRequest{
        UploadID: "<id>",
        Datasource: "<value>",
        Users: []components.DatasourceUserDefinition{
            components.DatasourceUserDefinition{
                Email: "Ivory_Cummerata@hotmail.com",
                Name: "<value>",
            },
            components.DatasourceUserDefinition{
                Email: "Ivory_Cummerata@hotmail.com",
                Name: "<value>",
            },
            components.DatasourceUserDefinition{
                Email: "Ivory_Cummerata@hotmail.com",
                Name: "<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.BulkIndexUsersRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1BulkindexusersResponse, error

Errors

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

IndexGroup

Add or update a group in the datasource.

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.Permissions.IndexGroup(ctx, components.IndexGroupRequest{
        Datasource: "<value>",
        Group: components.DatasourceGroupDefinition{
            Name: "<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.IndexGroupRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1IndexgroupResponse, error

Errors

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

BulkIndexGroups

Replaces the groups in a datasource using paginated batch API calls. Please refer to the bulk indexing documentation for an explanation of how to use bulk endpoints. Note: Any groups deleted from the existing set will have their associated memberships deleted as well.

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.Permissions.BulkIndexGroups(ctx, components.BulkIndexGroupsRequest{
        UploadID: "<id>",
        Datasource: "<value>",
        Groups: []components.DatasourceGroupDefinition{
            components.DatasourceGroupDefinition{
                Name: "<value>",
            },
            components.DatasourceGroupDefinition{
                Name: "<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.BulkIndexGroupsRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1BulkindexgroupsResponse, error

Errors

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

IndexMembership

Add the memberships of a group in the datasource.

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.Permissions.IndexMembership(ctx, components.IndexMembershipRequest{
        Datasource: "<value>",
        Membership: components.DatasourceMembershipDefinition{
            GroupName: "<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.IndexMembershipRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1IndexmembershipResponse, error

Errors

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

BulkIndexMemberships

Replaces the memberships for a group in a datasource 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.Permissions.BulkIndexMemberships(ctx, components.BulkIndexMembershipsRequest{
        UploadID: "<id>",
        Datasource: "<value>",
        Memberships: []components.DatasourceBulkMembershipDefinition{
            components.DatasourceBulkMembershipDefinition{},
            components.DatasourceBulkMembershipDefinition{},
            components.DatasourceBulkMembershipDefinition{},
        },
    })
    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.BulkIndexMembershipsRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1BulkindexmembershipsResponse, error

Errors

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

ProcessMemberships

Schedules the immediate processing of all group memberships uploaded through the indexing API. By default the uploaded group memberships will be processed asynchronously but this API can be used to schedule processing of all memberships 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.Permissions.ProcessMemberships(ctx, nil)
    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.ProcessAllMembershipsRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1ProcessallmembershipsResponse, error

Errors

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

DeleteUser

Delete the user from the datasource. Silently succeeds if user is not present. Note: All memberships associated with the deleted user will also be deleted.

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.Permissions.DeleteUser(ctx, components.DeleteUserRequest{
        Datasource: "<value>",
        Email: "Ed.Johnston@gmail.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.DeleteUserRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1DeleteuserResponse, error

Errors

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

DeleteGroup

Delete group from the datasource. Silently succeeds if group is not present. Note: All memberships associated with the deleted group will also be deleted.

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.Permissions.DeleteGroup(ctx, components.DeleteGroupRequest{
        Datasource: "<value>",
        GroupName: "<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.DeleteGroupRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1DeletegroupResponse, error

Errors

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

DeleteMembership

Delete membership to a group in the specified datasource. Silently succeeds if membership 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.Permissions.DeleteMembership(ctx, components.DeleteMembershipRequest{
        Datasource: "<value>",
        Membership: components.DatasourceMembershipDefinition{
            GroupName: "<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.DeleteMembershipRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1DeletemembershipResponse, error

Errors

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

AuthorizeBetaUsers

Allow the datasource be visible to the specified beta users. The default behaviour is datasource being visible to all users if it is enabled and not visible to any user if it is not enabled.

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.Permissions.AuthorizeBetaUsers(ctx, components.GreenlistUsersRequest{
        Datasource: "<value>",
        Emails: []string{
            "Neil92@gmail.com",
            "Alejandrin_Boyer4@hotmail.com",
            "Shyanne_McLaughlin95@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.GreenlistUsersRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1BetausersResponse, error

Errors

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