@kittycad/lib 0.0.16 → 0.0.17
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 +10 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
`Socials::` - [blog](https://kittycad.io/blog) • [twitter](http://twitter.com/kittycadinc) • [linkedin](https://linkedin.com/company/kittycad) • [instagram](http://instagram.com/kittycadinc) • [youtube](https://www.youtube.com/channel/UCe_nbF3CBjbQRZoH_4xuNJA) • [discord](https://discord.com/invite/Bee65eqawJ)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Fully typed js library, compatible with js and ts.
|
|
8
|
+
|
|
9
|
+
### [Full documentation here](https://kittycad.io/docs/api/authentication?lang=typescript)
|
|
10
|
+
|
|
11
|
+
Simple example below.
|
|
8
12
|
|
|
9
13
|
### Install
|
|
10
14
|
|
|
@@ -20,16 +24,17 @@ export KITTYCAD_TOKEN=<your token>
|
|
|
20
24
|
### Basic example
|
|
21
25
|
```typescript
|
|
22
26
|
import { file } from '@kittycad/lib';
|
|
23
|
-
import type { Models } from '@kittycad/lib';
|
|
24
27
|
import fsp from 'fs/promises';
|
|
25
28
|
|
|
26
29
|
async function main() {
|
|
27
|
-
|
|
30
|
+
// kittycad.io/docs/api/get-cad-file-mass?lang=typescript
|
|
31
|
+
const response = await file.create_file_mass({
|
|
28
32
|
src_format: 'obj',
|
|
29
33
|
material_density: '0.007',
|
|
30
34
|
body: await fsp.readFile('./example.obj', 'base64'),
|
|
31
|
-
})
|
|
32
|
-
|
|
35
|
+
})
|
|
36
|
+
if ('error_code' in response) throw response
|
|
37
|
+
const { status, mass } = response
|
|
33
38
|
console.log(status, mass);
|
|
34
39
|
}
|
|
35
40
|
|