SDKs#

Antfly provides type-safe client libraries for Go, TypeScript, and Python. All SDKs are auto-generated from the OpenAPI specification and kept in sync with every release.

LanguagePackageRegistrySource
Gogithub.com/antflydb/antfly-go/antflypkg.go.devGitHub
TypeScript@antfly/sdknpmGitHub
Pythonantfly-sdkPyPIGitHub

Installation#

go get github.com/antflydb/antfly-go/antfly

Authentication#

All three authentication methods are supported across SDKs: basic auth, API key, and bearer token.

Basic Auth#

import "github.com/antflydb/antfly-go/antfly"

client, err := antfly.NewAntflyClientWithOptions(
	"http://localhost:8080",
	antfly.WithBasicAuth("admin", "password"),
)

API Key#

client, err := antfly.NewAntflyClientWithOptions(
	"http://localhost:8080",
	antfly.WithApiKey("key-id", "key-secret"),
)

Bearer Token#

client, err := antfly.NewAntflyClientWithOptions(
	"http://localhost:8080",
	antfly.WithBearerToken("your-token"),
)

Quick Start#

Insert Documents#

import (
	"context"
	"github.com/antflydb/antfly-go/antfly"
)

client, err := antfly.NewAntflyClientWithOptions(
	"http://localhost:8080",
	antfly.WithBasicAuth("admin", "password"),
)
if err != nil {
	log.Fatal(err)
}

// Batch insert documents
resp, err := client.BatchTableWithResponse(
	context.Background(),
	"products",
	antfly.BatchTableJSONRequestBody{
		Inserts: &map[string]interface{}{
			"prod:001": map[string]interface{}{
				"name":  "Laptop",
				"price": 1299.99,
			},
			"prod:002": map[string]interface{}{
				"name":  "Mouse",
				"price": 29.99,
			},
		},
	},
)

Query#

resp, err := client.QueryWithResponse(
	context.Background(),
	antfly.QueryJSONRequestBody{
		Table: strPtr("products"),
		FullTextSearch: &antfly.FullTextSearch{
			Query: strPtr("laptop"),
		},
		Limit: intPtr(10),
	},
)
if err != nil {
	log.Fatal(err)
}

for _, hit := range resp.JSON200.Hits {
	fmt.Printf("%s: %v\n", hit.Key, hit.Fields)
}

React Components#

For building search UIs, Antfly provides @antfly/components — a React component library with search boxes, facets, result lists, RAG answer boxes, and more. See the React Antfly documentation for details.

npm install @antfly/components @antfly/sdk