Skip to content

Latest commit

 

History

History
149 lines (118 loc) · 7.67 KB

File metadata and controls

149 lines (118 loc) · 7.67 KB

Indexing.Shortcuts

Overview

Available Operations

BulkIndex

Replaces all the currently indexed shortcuts using paginated batch API calls. Note that this endpoint is used for indexing shortcuts not hosted by Glean. If you want to upload shortcuts that would be hosted by Glean, please use the /uploadshortcuts endpoint. For information on what you can do with Golinks, which are Glean-hosted shortcuts, please refer to this page.

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.Shortcuts.BulkIndex(ctx, components.BulkIndexShortcutsRequest{
        UploadID: "<id>",
        Shortcuts: []components.ExternalShortcut{
            components.ExternalShortcut{
                InputAlias: "<value>",
                DestinationURL: "https://plump-tune-up.biz/",
                CreatedBy: "<value>",
                IntermediateURL: "https://lean-sightseeing.net",
            },
            components.ExternalShortcut{
                InputAlias: "<value>",
                DestinationURL: "https://plump-tune-up.biz/",
                CreatedBy: "<value>",
                IntermediateURL: "https://lean-sightseeing.net",
            },
        },
    })
    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.BulkIndexShortcutsRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1BulkindexshortcutsResponse, error

Errors

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

Upload

Creates glean shortcuts for uploaded shortcuts info. Glean would host the shortcuts, and they can be managed in the knowledge tab once uploaded.

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.Shortcuts.Upload(ctx, components.UploadShortcutsRequest{
        UploadID: "<id>",
        Shortcuts: []components.IndexingShortcut{
            components.IndexingShortcut{
                InputAlias: "<value>",
                DestinationURL: "https://majestic-pharmacopoeia.info/",
                CreatedBy: "<value>",
            },
            components.IndexingShortcut{
                InputAlias: "<value>",
                DestinationURL: "https://majestic-pharmacopoeia.info/",
                CreatedBy: "<value>",
            },
            components.IndexingShortcut{
                InputAlias: "<value>",
                DestinationURL: "https://majestic-pharmacopoeia.info/",
                CreatedBy: "<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.UploadShortcutsRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.PostAPIIndexV1UploadshortcutsResponse, error

Errors

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