@init.computer/sdk 0.1.0 → 0.1.1
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.
- package/README.md +83 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Init SDK
|
|
2
|
+
|
|
3
|
+
Official SDK for init. Generate fully deployed API endpoints in seconds, with compute, storage, and database included.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @init.computer/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import { createClient } from "@init.computer/sdk";
|
|
15
|
+
|
|
16
|
+
const init = createClient({
|
|
17
|
+
apiKey: process.env.INIT_API_KEY,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const api = await init.generate({
|
|
21
|
+
prompt: "Create an API that finds 10 SaaS leads and returns company, website, contact, and reason.",
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const result = await init.run(api.result.route, {
|
|
25
|
+
category: "fintech",
|
|
26
|
+
count: 10,
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## What It Does
|
|
31
|
+
|
|
32
|
+
- Generate deployed API endpoints from natural language.
|
|
33
|
+
- Run generated endpoints by route, path, or URL.
|
|
34
|
+
- Manage generated resources and versions.
|
|
35
|
+
- Organize APIs into directories.
|
|
36
|
+
- Create and control recurring daemon workflows.
|
|
37
|
+
- Discover available compute, storage, database, and integration packages.
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
await init.generate(request);
|
|
43
|
+
await init.run(route, input, options);
|
|
44
|
+
|
|
45
|
+
await init.resource.list();
|
|
46
|
+
await init.resource.get(id);
|
|
47
|
+
await init.resource.update(id, patch);
|
|
48
|
+
await init.resource.edit(id, request);
|
|
49
|
+
await init.resource.versions(id);
|
|
50
|
+
await init.resource.activateVersion(id, versionId);
|
|
51
|
+
|
|
52
|
+
await init.directory.list();
|
|
53
|
+
await init.directory.create(input);
|
|
54
|
+
await init.directory.get(id);
|
|
55
|
+
await init.directory.update(id, patch);
|
|
56
|
+
await init.directory.delete(id);
|
|
57
|
+
await init.directory.addResources(id, resourceIds);
|
|
58
|
+
await init.directory.removeResource(id, resourceId);
|
|
59
|
+
|
|
60
|
+
await init.daemon.list();
|
|
61
|
+
await init.daemon.create(input);
|
|
62
|
+
await init.daemon.get(id);
|
|
63
|
+
await init.daemon.pause(id);
|
|
64
|
+
await init.daemon.resume(id);
|
|
65
|
+
await init.daemon.stop(id);
|
|
66
|
+
await init.daemon.run(id);
|
|
67
|
+
|
|
68
|
+
await init.pkg.list();
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Auth
|
|
72
|
+
|
|
73
|
+
Pass an API key directly or set `INIT_API_KEY`.
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
const init = createClient({ apiKey: "init_sk_..." });
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For CLI usage, run `init login` instead.
|
|
80
|
+
|
|
81
|
+
## Errors
|
|
82
|
+
|
|
83
|
+
Failed requests throw `InitApiError` with `status`, `response`, and `details`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@init.computer/sdk",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Official
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Official SDK for init. Generate fully deployed API endpoints in seconds, with compute, storage, and database included.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|