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.
| Language | Package | Registry | Source |
|---|---|---|---|
| Go | github.com/antflydb/antfly-go/antfly | pkg.go.dev | GitHub |
| TypeScript | @antfly/sdk | npm | GitHub |
| Python | antfly-sdk | PyPI | GitHub |
Installation
go get github.com/antflydb/antfly-go/antflynpm install @antfly/sdkpip install antfly-sdkAuthentication
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"),
)import { AntflyClient } from '@antfly/sdk';
const client = new AntflyClient({
baseUrl: 'http://localhost:8080',
auth: {
username: 'admin',
password: 'password',
},
});from antfly import AntflyClient
client = AntflyClient(
base_url='http://localhost:8080',
username='admin',
password='password',
)API Key
client, err := antfly.NewAntflyClientWithOptions(
"http://localhost:8080",
antfly.WithApiKey("key-id", "key-secret"),
)const client = new AntflyClient({
baseUrl: 'http://localhost:8080',
auth: {
type: 'apiKey',
keyId: 'key-id',
keySecret: 'key-secret',
},
});client = AntflyClient(
base_url='http://localhost:8080',
api_key=('key-id', 'key-secret'),
)Bearer Token
client, err := antfly.NewAntflyClientWithOptions(
"http://localhost:8080",
antfly.WithBearerToken("your-token"),
)const client = new AntflyClient({
baseUrl: 'http://localhost:8080',
auth: {
type: 'bearer',
token: 'your-token',
},
});client = AntflyClient(
base_url='http://localhost:8080',
bearer_token='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,
},
},
},
)import { AntflyClient } from '@antfly/sdk';
const client = new AntflyClient({
baseUrl: 'http://localhost:8080',
auth: { username: 'admin', password: 'password' },
});
// Batch insert documents
await client.tables.batch('products', {
inserts: {
'prod:001': { name: 'Laptop', price: 1299.99 },
'prod:002': { name: 'Mouse', price: 29.99 },
},
});from antfly import AntflyClient
client = AntflyClient(
base_url='http://localhost:8080',
username='admin',
password='password',
)
# Batch insert documents
client.batch(
table='products',
inserts={
'prod:001': {'name': 'Laptop', 'price': 1299.99},
'prod:002': {'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)
}const results = await client.query({
table: 'products',
full_text_search: { query: 'laptop' },
limit: 10,
});
for (const hit of results.hits) {
console.log(hit.key, hit.fields);
}results = client.query(
table='products',
full_text_search={'query': 'laptop'},
limit=10,
)
for hit in results.hits:
print(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