typesense-rest-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- typesense_rest_cli-0.1.0/PKG-INFO +170 -0
- typesense_rest_cli-0.1.0/README.md +142 -0
- typesense_rest_cli-0.1.0/pyproject.toml +45 -0
- typesense_rest_cli-0.1.0/src/typesense_rest_cli/__init__.py +1 -0
- typesense_rest_cli-0.1.0/src/typesense_rest_cli/cli.py +20 -0
- typesense_rest_cli-0.1.0/src/typesense_rest_cli/spec.yaml +4638 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: typesense-rest-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A full-coverage CLI for the Typesense search engine REST API, generated from the official OpenAPI spec
|
|
5
|
+
Project-URL: Homepage, https://github.com/shivaam/openapi-cli-gen
|
|
6
|
+
Project-URL: Source, https://github.com/shivaam/openapi-cli-gen/tree/main/wrappers/typesense-rest-cli
|
|
7
|
+
Project-URL: Issues, https://github.com/shivaam/openapi-cli-gen/issues
|
|
8
|
+
Project-URL: Generator, https://github.com/shivaam/openapi-cli-gen
|
|
9
|
+
Author: Shivam Rastogi
|
|
10
|
+
License: MIT
|
|
11
|
+
Keywords: api,cli,generated,openapi,rest
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Software Development
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Requires-Dist: openapi-cli-gen>=0.0.14
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# typesense-rest-cli
|
|
30
|
+
|
|
31
|
+
**A full-coverage CLI for the [Typesense](https://typesense.org) search engine REST API.** Every endpoint in Typesense's OpenAPI spec, exposed as a typed command. Generated from [Typesense's official OpenAPI spec](https://github.com/typesense/typesense-api-spec) using [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen).
|
|
32
|
+
|
|
33
|
+
## Why
|
|
34
|
+
|
|
35
|
+
Typesense has client libraries for most popular languages, but no REST CLI. For shell scripts, CI automation, index bootstrapping, and ad-hoc admin tasks, most people hand-roll `curl` with their API key in a header and hope they spelled the JSON right.
|
|
36
|
+
|
|
37
|
+
This CLI gives you the entire Typesense REST surface as typed shell commands — collections, documents, searches, aliases, keys, stopwords, analytics, conversations — no SDK, no boilerplate. When Typesense adds endpoints, a regeneration picks them up.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pipx install typesense-rest-cli
|
|
43
|
+
|
|
44
|
+
# Or with uv
|
|
45
|
+
uv tool install typesense-rest-cli
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Setup
|
|
49
|
+
|
|
50
|
+
Point it at your Typesense instance (default is `http://localhost:8108`):
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
export TYPESENSE_REST_CLI_BASE_URL=http://localhost:8108
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Authentication — important
|
|
57
|
+
|
|
58
|
+
Typesense uses an API key header (`X-TYPESENSE-API-KEY`), which this CLI maps to:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
export TYPESENSE_REST_CLI_API_KEY=your-api-key
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Note the env var name — it's `_API_KEY`, not `_TOKEN`.** Typesense's spec uses an `apiKey` security scheme (not bearer), so the convention matches.
|
|
65
|
+
|
|
66
|
+
## Quick Start
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Server health
|
|
70
|
+
typesense-rest-cli health health
|
|
71
|
+
|
|
72
|
+
# Create a collection (schema-driven)
|
|
73
|
+
typesense-rest-cli collections create \
|
|
74
|
+
--name books \
|
|
75
|
+
--fields '[
|
|
76
|
+
{"name": "title", "type": "string"},
|
|
77
|
+
{"name": "author", "type": "string", "facet": true},
|
|
78
|
+
{"name": "year", "type": "int32"}
|
|
79
|
+
]' \
|
|
80
|
+
--default-sorting-field year
|
|
81
|
+
|
|
82
|
+
# List all collections
|
|
83
|
+
typesense-rest-cli collections get-collections
|
|
84
|
+
|
|
85
|
+
# Get a specific collection's schema + doc count
|
|
86
|
+
typesense-rest-cli collections get-collection --collection-name books
|
|
87
|
+
|
|
88
|
+
# Upsert a document
|
|
89
|
+
typesense-rest-cli documents index --collection-name books --root '{
|
|
90
|
+
"id": "1",
|
|
91
|
+
"title": "The Pragmatic Programmer",
|
|
92
|
+
"author": "Hunt & Thomas",
|
|
93
|
+
"year": 1999
|
|
94
|
+
}'
|
|
95
|
+
|
|
96
|
+
# Search the collection
|
|
97
|
+
typesense-rest-cli documents search-collection \
|
|
98
|
+
--collection-name books \
|
|
99
|
+
--q programmer \
|
|
100
|
+
--query-by title,author
|
|
101
|
+
|
|
102
|
+
# Delete a collection
|
|
103
|
+
typesense-rest-cli collections delete --collection-name books
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Discover All Commands
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Top-level groups
|
|
110
|
+
typesense-rest-cli --help
|
|
111
|
+
|
|
112
|
+
# Commands in a group
|
|
113
|
+
typesense-rest-cli collections --help
|
|
114
|
+
|
|
115
|
+
# Flags for a specific command
|
|
116
|
+
typesense-rest-cli documents search-collection --help
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Output Formats
|
|
120
|
+
|
|
121
|
+
Every command accepts `--output-format`:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
typesense-rest-cli collections get-collections --output-format table
|
|
125
|
+
typesense-rest-cli collections get-collections --output-format yaml
|
|
126
|
+
typesense-rest-cli collections get-collections --output-format raw
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Command Groups
|
|
130
|
+
|
|
131
|
+
| Group | What it covers |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `health` | Liveness probe |
|
|
134
|
+
| `collections` | Full CRUD for collections + schema |
|
|
135
|
+
| `documents` | Index, upsert, get, delete, search, import |
|
|
136
|
+
| `curation` | Override search results |
|
|
137
|
+
| `aliases` | Collection aliases (blue/green indexing) |
|
|
138
|
+
| `synonyms` | Per-collection synonym sets |
|
|
139
|
+
| `stopwords` | Stopword management |
|
|
140
|
+
| `keys` | API key creation + scoping |
|
|
141
|
+
| `multi-search` | Federated search across collections |
|
|
142
|
+
| `analytics` | Analytics rules (click / search events) |
|
|
143
|
+
| `presets` | Reusable search parameter presets |
|
|
144
|
+
| `conversations` | Conversational search models |
|
|
145
|
+
| `debug` | Debug, metrics, stats |
|
|
146
|
+
| `operations` | Snapshot, vote, re-elect leader |
|
|
147
|
+
| `cluster` | Cluster-wide health + vote |
|
|
148
|
+
|
|
149
|
+
## Passing Complex JSON Bodies
|
|
150
|
+
|
|
151
|
+
Document imports and search parameter objects with nested schemas accept a JSON string via `--root`:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
typesense-rest-cli documents index --collection-name books --root '{"id": "1", ...}'
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Flat endpoints (like `collections create`) take typed flags directly.
|
|
158
|
+
|
|
159
|
+
## How It Works
|
|
160
|
+
|
|
161
|
+
This package is a thin wrapper:
|
|
162
|
+
- Embeds the Typesense OpenAPI spec (`spec.yaml`)
|
|
163
|
+
- Delegates CLI generation to [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen) at runtime
|
|
164
|
+
- Default base URL: `http://localhost:8108`
|
|
165
|
+
|
|
166
|
+
Since it's spec-driven, new Typesense endpoints show up automatically on regeneration.
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
MIT. Not affiliated with Typesense — this is an unofficial community CLI built on top of their public OpenAPI spec.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# typesense-rest-cli
|
|
2
|
+
|
|
3
|
+
**A full-coverage CLI for the [Typesense](https://typesense.org) search engine REST API.** Every endpoint in Typesense's OpenAPI spec, exposed as a typed command. Generated from [Typesense's official OpenAPI spec](https://github.com/typesense/typesense-api-spec) using [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen).
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
Typesense has client libraries for most popular languages, but no REST CLI. For shell scripts, CI automation, index bootstrapping, and ad-hoc admin tasks, most people hand-roll `curl` with their API key in a header and hope they spelled the JSON right.
|
|
8
|
+
|
|
9
|
+
This CLI gives you the entire Typesense REST surface as typed shell commands — collections, documents, searches, aliases, keys, stopwords, analytics, conversations — no SDK, no boilerplate. When Typesense adds endpoints, a regeneration picks them up.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pipx install typesense-rest-cli
|
|
15
|
+
|
|
16
|
+
# Or with uv
|
|
17
|
+
uv tool install typesense-rest-cli
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
Point it at your Typesense instance (default is `http://localhost:8108`):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
export TYPESENSE_REST_CLI_BASE_URL=http://localhost:8108
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Authentication — important
|
|
29
|
+
|
|
30
|
+
Typesense uses an API key header (`X-TYPESENSE-API-KEY`), which this CLI maps to:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
export TYPESENSE_REST_CLI_API_KEY=your-api-key
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Note the env var name — it's `_API_KEY`, not `_TOKEN`.** Typesense's spec uses an `apiKey` security scheme (not bearer), so the convention matches.
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Server health
|
|
42
|
+
typesense-rest-cli health health
|
|
43
|
+
|
|
44
|
+
# Create a collection (schema-driven)
|
|
45
|
+
typesense-rest-cli collections create \
|
|
46
|
+
--name books \
|
|
47
|
+
--fields '[
|
|
48
|
+
{"name": "title", "type": "string"},
|
|
49
|
+
{"name": "author", "type": "string", "facet": true},
|
|
50
|
+
{"name": "year", "type": "int32"}
|
|
51
|
+
]' \
|
|
52
|
+
--default-sorting-field year
|
|
53
|
+
|
|
54
|
+
# List all collections
|
|
55
|
+
typesense-rest-cli collections get-collections
|
|
56
|
+
|
|
57
|
+
# Get a specific collection's schema + doc count
|
|
58
|
+
typesense-rest-cli collections get-collection --collection-name books
|
|
59
|
+
|
|
60
|
+
# Upsert a document
|
|
61
|
+
typesense-rest-cli documents index --collection-name books --root '{
|
|
62
|
+
"id": "1",
|
|
63
|
+
"title": "The Pragmatic Programmer",
|
|
64
|
+
"author": "Hunt & Thomas",
|
|
65
|
+
"year": 1999
|
|
66
|
+
}'
|
|
67
|
+
|
|
68
|
+
# Search the collection
|
|
69
|
+
typesense-rest-cli documents search-collection \
|
|
70
|
+
--collection-name books \
|
|
71
|
+
--q programmer \
|
|
72
|
+
--query-by title,author
|
|
73
|
+
|
|
74
|
+
# Delete a collection
|
|
75
|
+
typesense-rest-cli collections delete --collection-name books
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Discover All Commands
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Top-level groups
|
|
82
|
+
typesense-rest-cli --help
|
|
83
|
+
|
|
84
|
+
# Commands in a group
|
|
85
|
+
typesense-rest-cli collections --help
|
|
86
|
+
|
|
87
|
+
# Flags for a specific command
|
|
88
|
+
typesense-rest-cli documents search-collection --help
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Output Formats
|
|
92
|
+
|
|
93
|
+
Every command accepts `--output-format`:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
typesense-rest-cli collections get-collections --output-format table
|
|
97
|
+
typesense-rest-cli collections get-collections --output-format yaml
|
|
98
|
+
typesense-rest-cli collections get-collections --output-format raw
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Command Groups
|
|
102
|
+
|
|
103
|
+
| Group | What it covers |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `health` | Liveness probe |
|
|
106
|
+
| `collections` | Full CRUD for collections + schema |
|
|
107
|
+
| `documents` | Index, upsert, get, delete, search, import |
|
|
108
|
+
| `curation` | Override search results |
|
|
109
|
+
| `aliases` | Collection aliases (blue/green indexing) |
|
|
110
|
+
| `synonyms` | Per-collection synonym sets |
|
|
111
|
+
| `stopwords` | Stopword management |
|
|
112
|
+
| `keys` | API key creation + scoping |
|
|
113
|
+
| `multi-search` | Federated search across collections |
|
|
114
|
+
| `analytics` | Analytics rules (click / search events) |
|
|
115
|
+
| `presets` | Reusable search parameter presets |
|
|
116
|
+
| `conversations` | Conversational search models |
|
|
117
|
+
| `debug` | Debug, metrics, stats |
|
|
118
|
+
| `operations` | Snapshot, vote, re-elect leader |
|
|
119
|
+
| `cluster` | Cluster-wide health + vote |
|
|
120
|
+
|
|
121
|
+
## Passing Complex JSON Bodies
|
|
122
|
+
|
|
123
|
+
Document imports and search parameter objects with nested schemas accept a JSON string via `--root`:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
typesense-rest-cli documents index --collection-name books --root '{"id": "1", ...}'
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Flat endpoints (like `collections create`) take typed flags directly.
|
|
130
|
+
|
|
131
|
+
## How It Works
|
|
132
|
+
|
|
133
|
+
This package is a thin wrapper:
|
|
134
|
+
- Embeds the Typesense OpenAPI spec (`spec.yaml`)
|
|
135
|
+
- Delegates CLI generation to [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen) at runtime
|
|
136
|
+
- Default base URL: `http://localhost:8108`
|
|
137
|
+
|
|
138
|
+
Since it's spec-driven, new Typesense endpoints show up automatically on regeneration.
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
MIT. Not affiliated with Typesense — this is an unofficial community CLI built on top of their public OpenAPI spec.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "typesense-rest-cli"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A full-coverage CLI for the Typesense search engine REST API, generated from the official OpenAPI spec"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Shivam Rastogi" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["cli", "openapi", "rest", "api", "generated"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: Software Development",
|
|
29
|
+
"Topic :: Utilities",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"openapi-cli-gen>=0.0.14",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/shivaam/openapi-cli-gen"
|
|
37
|
+
Source = "https://github.com/shivaam/openapi-cli-gen/tree/main/wrappers/typesense-rest-cli"
|
|
38
|
+
Issues = "https://github.com/shivaam/openapi-cli-gen/issues"
|
|
39
|
+
Generator = "https://github.com/shivaam/openapi-cli-gen"
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
typesense-rest-cli = "typesense_rest_cli.cli:main"
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.wheel]
|
|
45
|
+
packages = ["src/typesense_rest_cli"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""typesense-rest-cli CLI — generated by openapi-cli-gen."""
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from openapi_cli_gen import build_cli
|
|
4
|
+
|
|
5
|
+
# Base URL: override via TYPESENSE_REST_CLI_BASE_URL env var, fall back to spec default
|
|
6
|
+
_base_url = os.environ.get("TYPESENSE_REST_CLI_BASE_URL") or "http://localhost:8108"
|
|
7
|
+
|
|
8
|
+
app = build_cli(
|
|
9
|
+
spec=Path(__file__).parent / "spec.yaml",
|
|
10
|
+
name="typesense-rest-cli",
|
|
11
|
+
base_url=_base_url,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
app()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if __name__ == "__main__":
|
|
20
|
+
main()
|