@codize/sdk 0.0.0 → 0.1.0
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 +53 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @codize/sdk
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@codize/sdk)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
|
|
6
|
+
Official TypeScript SDK for the Codize API.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```console
|
|
11
|
+
$ npm install @codize/sdk
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { CodizeClient } from "@codize/sdk";
|
|
18
|
+
|
|
19
|
+
// Get your API key from the Codize: https://codize.dev/settings/api-keys
|
|
20
|
+
const apiKey = "cdz_****";
|
|
21
|
+
|
|
22
|
+
const client = new CodizeClient({ apiKey });
|
|
23
|
+
|
|
24
|
+
const result = await client.sandbox.execute({
|
|
25
|
+
language: "typescript",
|
|
26
|
+
files: [
|
|
27
|
+
{
|
|
28
|
+
name: "index.ts",
|
|
29
|
+
content: `console.log("Hello, World!");`,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
console.log(result.data);
|
|
35
|
+
// => {
|
|
36
|
+
// compile: {
|
|
37
|
+
// stdout: "",
|
|
38
|
+
// stderr: "",
|
|
39
|
+
// output: "",
|
|
40
|
+
// exit_code: 0,
|
|
41
|
+
// },
|
|
42
|
+
// run: {
|
|
43
|
+
// stdout: "Hello, World!\n",
|
|
44
|
+
// stderr: "",
|
|
45
|
+
// output: "Hello, World!\n",
|
|
46
|
+
// exit_code: 0,
|
|
47
|
+
// },
|
|
48
|
+
// }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
[MIT](../LICENSE)
|