generate examples (#5)
* update types * more type improvements * fix some gen test types * add body to file gen tests * enable error tests to pass * forget gen tests * split gen tests into throwing and not throwing * remove log noise from gen tests * generate tests and examples patch.json * format examples * add action for updating spec in docs * fmt * tweak token * formating examples * more formatting * update spec.json * add optional client * fix test methods and add client example * re-generate with new spec * fix dir removal
This commit is contained in:
65
.github/workflows/update-spec-for-docs.yml
vendored
Normal file
65
.github/workflows/update-spec-for-docs.yml
vendored
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- .github/workflows/update-spec-for-docs.yml
|
||||||
|
workflow_dispatch:
|
||||||
|
name: update spec for docs
|
||||||
|
concurrency:
|
||||||
|
group: docs-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
jobs:
|
||||||
|
update-spec:
|
||||||
|
name: update-spec
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3.4.0
|
||||||
|
with:
|
||||||
|
node-version: '16'
|
||||||
|
cache: 'yarn'
|
||||||
|
- run: yarn install
|
||||||
|
- run: yarn gen
|
||||||
|
# Ensure no files changed.
|
||||||
|
- name: Ensure no files changed
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ `git status --porcelain` ]]; then
|
||||||
|
echo "Files changed, exiting";
|
||||||
|
exit 1;
|
||||||
|
else
|
||||||
|
# No changes
|
||||||
|
echo "No files changed, proceeding";
|
||||||
|
fi
|
||||||
|
# Checkout the docs repo since we will want to update the files there.
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: 'kittycad/website'
|
||||||
|
path: 'docs'
|
||||||
|
token: ${{secrets.KITTYCAD_TS_PAT}}
|
||||||
|
- name: move spec to docs
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
rm docs/kittycad.ts.patch.json || true
|
||||||
|
cp kittycad.ts.patch.json docs/kittycad.ts.patch.json
|
||||||
|
- name: commit the changes in the docs repo
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd docs
|
||||||
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
git add .
|
||||||
|
git commit -am "YOYO NEW SPEC TYPESCRIPT DOCS!" || exit 0
|
||||||
|
git fetch origin
|
||||||
|
git rebase origin/main || exit 0
|
||||||
|
export NEW_BRANCH="update-spec-typescript"
|
||||||
|
git checkout -b "$NEW_BRANCH"
|
||||||
|
git push -f origin "$NEW_BRANCH"
|
||||||
|
gh pr create --title "Update lang spec docs for typescript" \
|
||||||
|
--body "Updating the generated docs for typescript" \
|
||||||
|
--head "$NEW_BRANCH" \
|
||||||
|
--base main || true
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{secrets.KITTYCAD_TS_PAT}}
|
18
__tests__/gen/api-calls-get_api_call_for_user.test.ts
Normal file
18
__tests__/gen/api-calls-get_api_call_for_user.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { api_calls } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await api_calls.get_api_call_for_user({ id: 'string' });
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing api_calls.get_api_call_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
try {
|
||||||
|
await example();
|
||||||
|
} catch (err) {
|
||||||
|
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/api-calls-get_async_operation.test.ts
Normal file
18
__tests__/gen/api-calls-get_async_operation.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { api_calls } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await api_calls.get_async_operation({ id: 'string' });
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing api_calls.get_async_operation', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
try {
|
||||||
|
await example();
|
||||||
|
} catch (err) {
|
||||||
|
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/api-calls-user_list_api_calls.test.ts
Normal file
18
__tests__/gen/api-calls-user_list_api_calls.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { api_calls } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await api_calls.user_list_api_calls({
|
||||||
|
limit: 7,
|
||||||
|
page_token: 'string',
|
||||||
|
sort_by: 'created-at-descending',
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing api_calls.user_list_api_calls', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/api-tokens-create_api_token_for_user.test.ts
Normal file
14
__tests__/gen/api-tokens-create_api_token_for_user.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { api_tokens } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await api_tokens.create_api_token_for_user();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing api_tokens.create_api_token_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
16
__tests__/gen/api-tokens-delete_api_token_for_user.test.ts
Normal file
16
__tests__/gen/api-tokens-delete_api_token_for_user.test.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { api_tokens } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await api_tokens.delete_api_token_for_user({
|
||||||
|
token: 'string',
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing api_tokens.delete_api_token_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/api-tokens-get_api_token_for_user.test.ts
Normal file
14
__tests__/gen/api-tokens-get_api_token_for_user.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { api_tokens } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await api_tokens.get_api_token_for_user({ token: 'string' });
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing api_tokens.get_api_token_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/api-tokens-list_api_tokens_for_user.test.ts
Normal file
18
__tests__/gen/api-tokens-list_api_tokens_for_user.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { api_tokens } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await api_tokens.list_api_tokens_for_user({
|
||||||
|
limit: 7,
|
||||||
|
page_token: 'string',
|
||||||
|
sort_by: 'created-at-descending',
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing api_tokens.list_api_tokens_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/constant-get_physics_constant.test.ts
Normal file
14
__tests__/gen/constant-get_physics_constant.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { constant } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await constant.get_physics_constant({ constant: 'c' });
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing constant.get_physics_constant', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
19
__tests__/gen/file-create_file_conversion.test.ts
Normal file
19
__tests__/gen/file-create_file_conversion.test.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import fsp from 'fs/promises';
|
||||||
|
import { file } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await file.create_file_conversion({
|
||||||
|
output_format: 'stl',
|
||||||
|
src_format: 'obj',
|
||||||
|
body: await fsp.readFile('./example.obj', 'base64'),
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing file.create_file_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
19
__tests__/gen/file-create_file_density.test.ts
Normal file
19
__tests__/gen/file-create_file_density.test.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import fsp from 'fs/promises';
|
||||||
|
import { file } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await file.create_file_density({
|
||||||
|
material_mass: 7,
|
||||||
|
src_format: 'obj',
|
||||||
|
body: await fsp.readFile('./example.obj', 'base64'),
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing file.create_file_density', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
19
__tests__/gen/file-create_file_mass.test.ts
Normal file
19
__tests__/gen/file-create_file_mass.test.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import fsp from 'fs/promises';
|
||||||
|
import { file } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await file.create_file_mass({
|
||||||
|
material_density: 7,
|
||||||
|
src_format: 'obj',
|
||||||
|
body: await fsp.readFile('./example.obj', 'base64'),
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing file.create_file_mass', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/file-create_file_surface_area.test.ts
Normal file
18
__tests__/gen/file-create_file_surface_area.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import fsp from 'fs/promises';
|
||||||
|
import { file } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await file.create_file_surface_area({
|
||||||
|
src_format: 'obj',
|
||||||
|
body: await fsp.readFile('./example.obj', 'base64'),
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing file.create_file_surface_area', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/file-create_file_volume.test.ts
Normal file
18
__tests__/gen/file-create_file_volume.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import fsp from 'fs/promises';
|
||||||
|
import { file } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await file.create_file_volume({
|
||||||
|
src_format: 'obj',
|
||||||
|
body: await fsp.readFile('./example.obj', 'base64'),
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing file.create_file_volume', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/file-get_file_conversion.test.ts
Normal file
18
__tests__/gen/file-get_file_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { file } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await file.get_file_conversion({ id: 'string' });
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing file.get_file_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
try {
|
||||||
|
await example();
|
||||||
|
} catch (err) {
|
||||||
|
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/file-get_file_conversion_for_user.test.ts
Normal file
18
__tests__/gen/file-get_file_conversion_for_user.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { file } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await file.get_file_conversion_for_user({ id: 'string' });
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing file.get_file_conversion_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
try {
|
||||||
|
await example();
|
||||||
|
} catch (err) {
|
||||||
|
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/meta-get_schema.test.ts
Normal file
14
__tests__/gen/meta-get_schema.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { meta } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await meta.get_schema();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing meta.get_schema', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/meta-ping.test.ts
Normal file
14
__tests__/gen/meta-ping.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { meta } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await meta.ping();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing meta.ping', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,14 @@
|
|||||||
|
import { payments } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await payments.create_payment_information_for_user();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing payments.create_payment_information_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,18 @@
|
|||||||
|
import { payments } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await payments.delete_payment_information_for_user();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing payments.delete_payment_information_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
try {
|
||||||
|
await example();
|
||||||
|
} catch (err) {
|
||||||
|
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/payments-get_payment_balance_for_user.test.ts
Normal file
14
__tests__/gen/payments-get_payment_balance_for_user.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { payments } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await payments.get_payment_balance_for_user();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing payments.get_payment_balance_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,14 @@
|
|||||||
|
import { payments } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await payments.get_payment_information_for_user();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing payments.get_payment_information_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/payments-list_invoices_for_user.test.ts
Normal file
14
__tests__/gen/payments-list_invoices_for_user.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { payments } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await payments.list_invoices_for_user();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing payments.list_invoices_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/payments-list_payment_methods_for_user.test.ts
Normal file
14
__tests__/gen/payments-list_payment_methods_for_user.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { payments } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await payments.list_payment_methods_for_user();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing payments.list_payment_methods_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,14 @@
|
|||||||
|
import { payments } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await payments.update_payment_information_for_user();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing payments.update_payment_information_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/sessions-get_session_for_user.test.ts
Normal file
14
__tests__/gen/sessions-get_session_for_user.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { sessions } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await sessions.get_session_for_user({ token: 'string' });
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing sessions.get_session_for_user', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_acceleration_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_acceleration_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_acceleration_unit_conversion({
|
||||||
|
output_format: 'meters_per_second_squared',
|
||||||
|
src_format: 'feet_per_second_squared',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_acceleration_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_angle_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_angle_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_angle_unit_conversion({
|
||||||
|
output_format: 'radian',
|
||||||
|
src_format: 'degree',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_angle_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_angular_velocity_unit_conversion({
|
||||||
|
output_format: 'radians_per_second',
|
||||||
|
src_format: 'degrees_per_second',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_angular_velocity_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_area_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_area_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_area_unit_conversion({
|
||||||
|
output_format: 'square_meter',
|
||||||
|
src_format: 'square_foot',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_area_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_charge_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_charge_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_charge_unit_conversion({
|
||||||
|
output_format: 'coulomb',
|
||||||
|
src_format: 'ampere_hour',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_charge_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_concentration_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_concentration_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_concentration_unit_conversion({
|
||||||
|
output_format: 'parts_per_million',
|
||||||
|
src_format: 'parts_per_billion',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_concentration_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_data_transfer_rate_unit_conversion({
|
||||||
|
output_format: 'bytes_per_second',
|
||||||
|
src_format: 'exabytes_per_second',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_data_transfer_rate_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_data_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_data_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_data_unit_conversion({
|
||||||
|
output_format: 'byte',
|
||||||
|
src_format: 'exabyte',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_data_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_density_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_density_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_density_unit_conversion({
|
||||||
|
output_format: 'kilograms_per_cubic_meter',
|
||||||
|
src_format: 'grams_per_milliliter',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_density_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_energy_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_energy_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_energy_unit_conversion({
|
||||||
|
output_format: 'joule',
|
||||||
|
src_format: 'calorie',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_energy_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_force_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_force_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_force_unit_conversion({
|
||||||
|
output_format: 'newton',
|
||||||
|
src_format: 'pound',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_force_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_illuminance_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_illuminance_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_illuminance_unit_conversion({
|
||||||
|
output_format: 'lux',
|
||||||
|
src_format: 'footcandle',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_illuminance_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_length_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_length_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_length_unit_conversion({
|
||||||
|
output_format: 'millimeter',
|
||||||
|
src_format: 'centimeter',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_length_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_magnetic_field_strength_unit_conversion({
|
||||||
|
output_format: 'tesla',
|
||||||
|
src_format: 'gauss',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_magnetic_field_strength_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_magnetic_flux_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_magnetic_flux_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_magnetic_flux_unit_conversion({
|
||||||
|
output_format: 'weber',
|
||||||
|
src_format: 'maxwell',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_magnetic_flux_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_mass_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_mass_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_mass_unit_conversion({
|
||||||
|
output_format: 'gram',
|
||||||
|
src_format: 'kilogram',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_mass_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_metric_power_cubed_unit_conversion({
|
||||||
|
output_format: 'atto',
|
||||||
|
src_format: 'femto',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_metric_power_cubed_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_metric_power_squared_unit_conversion({
|
||||||
|
output_format: 'atto',
|
||||||
|
src_format: 'femto',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_metric_power_squared_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_metric_power_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_metric_power_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_metric_power_unit_conversion({
|
||||||
|
output_format: 'atto',
|
||||||
|
src_format: 'femto',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_metric_power_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_power_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_power_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_power_unit_conversion({
|
||||||
|
output_format: 'watt',
|
||||||
|
src_format: 'horsepower',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_power_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_pressure_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_pressure_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_pressure_unit_conversion({
|
||||||
|
output_format: 'pascal',
|
||||||
|
src_format: 'bar',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_pressure_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_radiation_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_radiation_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_radiation_unit_conversion({
|
||||||
|
output_format: 'gray',
|
||||||
|
src_format: 'sievert',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_radiation_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_solid_angle_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_solid_angle_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_solid_angle_unit_conversion({
|
||||||
|
output_format: 'steradian',
|
||||||
|
src_format: 'degree_squared',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_solid_angle_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_temperature_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_temperature_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_temperature_unit_conversion({
|
||||||
|
output_format: 'kelvin',
|
||||||
|
src_format: 'celsius',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_temperature_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_time_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_time_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_time_unit_conversion({
|
||||||
|
output_format: 'second',
|
||||||
|
src_format: 'minute',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_time_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_velocity_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_velocity_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_velocity_unit_conversion({
|
||||||
|
output_format: 'meters_per_second',
|
||||||
|
src_format: 'feet_per_second',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_velocity_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_voltage_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_voltage_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_voltage_unit_conversion({
|
||||||
|
output_format: 'volt',
|
||||||
|
src_format: 'statvolt',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_voltage_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/unit-get_volume_unit_conversion.test.ts
Normal file
18
__tests__/gen/unit-get_volume_unit_conversion.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { unit } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await unit.get_volume_unit_conversion({
|
||||||
|
output_format: 'cubic_millimeter',
|
||||||
|
src_format: 'cubic_centimeter',
|
||||||
|
value: 7,
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing unit.get_volume_unit_conversion', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
__tests__/gen/users-delete_user_self.test.ts
Normal file
18
__tests__/gen/users-delete_user_self.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { users } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await users.delete_user_self();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing users.delete_user_self', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
try {
|
||||||
|
await example();
|
||||||
|
} catch (err) {
|
||||||
|
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/users-get_user_self.test.ts
Normal file
14
__tests__/gen/users-get_user_self.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { users } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await users.get_user_self();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing users.get_user_self', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/users-get_user_self_extended.test.ts
Normal file
14
__tests__/gen/users-get_user_self_extended.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { users } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await users.get_user_self_extended();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing users.get_user_self_extended', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
14
__tests__/gen/users-update_user_self.test.ts
Normal file
14
__tests__/gen/users-update_user_self.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { users } from '../../src/index.js';
|
||||||
|
|
||||||
|
async function example() {
|
||||||
|
const response = await users.update_user_self();
|
||||||
|
if ('error_code' in response) throw response;
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing users.update_user_self', () => {
|
||||||
|
it('should be truthy or throw', async () => {
|
||||||
|
expect(await example()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -1,37 +1,32 @@
|
|||||||
import { file } from '../src/index.js';
|
import { file, Client } from '../src/index.js';
|
||||||
import type { Models } from '../src/index.js';
|
|
||||||
import fsp from 'fs/promises';
|
import fsp from 'fs/promises';
|
||||||
|
|
||||||
describe('Testing create_file_execution', () => {
|
const client = new Client(process.env.KITTYCAD_TOKEN || '');
|
||||||
it("shouldn't throw", async () => {
|
|
||||||
const { stderr, stdout, output_files } = (await file.create_file_execution({
|
|
||||||
lang: 'go',
|
|
||||||
output: 'output.stl',
|
|
||||||
body: await fsp.readFile('./exampleGoScript.go', 'base64'),
|
|
||||||
})) as Models['CodeOutput_type'];
|
|
||||||
expect(stderr).toBe('');
|
|
||||||
expect(stdout).toBe(
|
|
||||||
[
|
|
||||||
'File conversion id: bdbf2969-8015-448b-a237-841d421fd1fe',
|
|
||||||
'File conversion status: Completed',
|
|
||||||
'Saving output to ./output.stl\n',
|
|
||||||
].join('\n'),
|
|
||||||
);
|
|
||||||
expect(output_files[0].contents).toHaveLength(191308);
|
|
||||||
|
|
||||||
expect(true).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('Testing create_file_mass', () => {
|
describe('Testing create_file_mass', () => {
|
||||||
it("shouldn't throw", async () => {
|
it("shouldn't throw", async () => {
|
||||||
const { status, mass } = (await file.create_file_mass({
|
const response = await file.create_file_mass({
|
||||||
src_format: 'obj',
|
src_format: 'obj',
|
||||||
material_density: '0.007',
|
material_density: 0.007,
|
||||||
body: await fsp.readFile('./example.obj', 'base64'),
|
body: await fsp.readFile('./example.obj', 'base64'),
|
||||||
})) as Models['FileMass_type'];
|
});
|
||||||
|
if ('error_code' in response) throw 'error';
|
||||||
|
|
||||||
|
const { status, mass } = response;
|
||||||
expect(mass).toBe(0.7063786);
|
expect(mass).toBe(0.7063786);
|
||||||
expect(status).toBe('Completed');
|
expect(status).toBe('Completed');
|
||||||
|
});
|
||||||
|
it("shouldn't throw when using a client", async () => {
|
||||||
|
const response = await file.create_file_mass({
|
||||||
|
client,
|
||||||
|
src_format: 'obj',
|
||||||
|
material_density: 0.007,
|
||||||
|
body: await fsp.readFile('./example.obj', 'base64'),
|
||||||
|
});
|
||||||
|
if ('error_code' in response) throw 'error';
|
||||||
|
|
||||||
expect(true).toBe(true);
|
const { status, mass } = response;
|
||||||
|
expect(mass).toBe(0.7063786);
|
||||||
|
expect(status).toBe('Completed');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
32
__tests__/meta-ping.test.ts
Normal file
32
__tests__/meta-ping.test.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { meta, Client } from '../src/index.js';
|
||||||
|
|
||||||
|
// Create a client with your token.
|
||||||
|
async function ExampleWithClient() {
|
||||||
|
const client = new Client(process.env.KITTYCAD_TOKEN || '');
|
||||||
|
const response = await meta.ping({ client });
|
||||||
|
if ('error_code' in response) throw 'error';
|
||||||
|
// console.log(response.message); // 'pong'
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - OR -
|
||||||
|
|
||||||
|
// Your token will be parsed from the environment
|
||||||
|
// variable: 'KITTYCAD_TOKEN'.
|
||||||
|
async function ExampleWithOutClient() {
|
||||||
|
const response = await meta.ping();
|
||||||
|
if ('error_code' in response) throw 'error';
|
||||||
|
// console.log(response.message); // 'pong'
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Testing meta.ping', () => {
|
||||||
|
it('should work with Client', async () => {
|
||||||
|
const response = await ExampleWithClient();
|
||||||
|
expect(response.message).toBe('pong');
|
||||||
|
});
|
||||||
|
it('should work without Client', async () => {
|
||||||
|
const response = await ExampleWithOutClient();
|
||||||
|
expect(response.message).toBe('pong');
|
||||||
|
});
|
||||||
|
});
|
466
kittycad.ts.patch.json
Normal file
466
kittycad.ts.patch.json
Normal file
@ -0,0 +1,466 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1session~1{token}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { sessions } from '@kittycad/lib'\n\nasync function example() {\n const response = await sessions.get_session_for_user({ token: 'string' })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1payment~1methods/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.list_payment_methods_for_user()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1payment~1invoices/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.list_invoices_for_user()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1payment~1balance/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.get_payment_balance_for_user()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1payment/put/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.update_payment_information_for_user()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1payment/post/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.create_payment_information_for_user()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1payment/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.get_payment_information_for_user()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1payment/delete/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.delete_payment_information_for_user()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1file~1conversions~1{id}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.get_file_conversion_for_user({ id: 'string' })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1extended/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { users } from '@kittycad/lib'\n\nasync function example() {\n const response = await users.get_user_self_extended()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1api-tokens~1{token}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { api_tokens } from '@kittycad/lib'\n\nasync function example() {\n const response = await api_tokens.get_api_token_for_user({\n token: 'string',\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1api-tokens~1{token}/delete/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { api_tokens } from '@kittycad/lib'\n\nasync function example() {\n const response = await api_tokens.delete_api_token_for_user({\n token: 'string',\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1api-tokens/post/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { api_tokens } from '@kittycad/lib'\n\nasync function example() {\n const response = await api_tokens.create_api_token_for_user()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1api-tokens/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { api_tokens } from '@kittycad/lib'\n\nasync function example() {\n const response = await api_tokens.list_api_tokens_for_user({\n limit: 7,\n page_token: 'string',\n sort_by: 'created-at-descending',\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1api-calls~1{id}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { api_calls } from '@kittycad/lib'\n\nasync function example() {\n const response = await api_calls.get_api_call_for_user({ id: 'string' })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user~1api-calls/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { api_calls } from '@kittycad/lib'\n\nasync function example() {\n const response = await api_calls.user_list_api_calls({\n limit: 7,\n page_token: 'string',\n sort_by: 'created-at-descending',\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user/put/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { users } from '@kittycad/lib'\n\nasync function example() {\n const response = await users.update_user_self()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { users } from '@kittycad/lib'\n\nasync function example() {\n const response = await users.get_user_self()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1user/delete/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { users } from '@kittycad/lib'\n\nasync function example() {\n const response = await users.delete_user_self()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1volume~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_volume_unit_conversion({\n output_format: 'cubic_millimeter',\n src_format: 'cubic_centimeter',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1voltage~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_voltage_unit_conversion({\n output_format: 'volt',\n src_format: 'statvolt',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1velocity~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_velocity_unit_conversion({\n output_format: 'meters_per_second',\n src_format: 'feet_per_second',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1time~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_time_unit_conversion({\n output_format: 'second',\n src_format: 'minute',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1temperature~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_temperature_unit_conversion({\n output_format: 'kelvin',\n src_format: 'celsius',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1solid-angle~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_solid_angle_unit_conversion({\n output_format: 'steradian',\n src_format: 'degree_squared',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1radiation~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_radiation_unit_conversion({\n output_format: 'gray',\n src_format: 'sievert',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1pressure~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_pressure_unit_conversion({\n output_format: 'pascal',\n src_format: 'bar',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1power~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_power_unit_conversion({\n output_format: 'watt',\n src_format: 'horsepower',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1metric~1squared~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_metric_power_squared_unit_conversion({\n output_format: 'atto',\n src_format: 'femto',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1metric~1power~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_metric_power_unit_conversion({\n output_format: 'atto',\n src_format: 'femto',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1metric~1cubed~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_metric_power_cubed_unit_conversion({\n output_format: 'atto',\n src_format: 'femto',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1mass~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_mass_unit_conversion({\n output_format: 'gram',\n src_format: 'kilogram',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1magnetic-flux~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_magnetic_flux_unit_conversion({\n output_format: 'weber',\n src_format: 'maxwell',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1magnetic-field-strength~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_magnetic_field_strength_unit_conversion({\n output_format: 'tesla',\n src_format: 'gauss',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1length~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_length_unit_conversion({\n output_format: 'millimeter',\n src_format: 'centimeter',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1illuminance~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_illuminance_unit_conversion({\n output_format: 'lux',\n src_format: 'footcandle',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1force~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_force_unit_conversion({\n output_format: 'newton',\n src_format: 'pound',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1energy~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_energy_unit_conversion({\n output_format: 'joule',\n src_format: 'calorie',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1density~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_density_unit_conversion({\n output_format: 'kilograms_per_cubic_meter',\n src_format: 'grams_per_milliliter',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1data~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_data_unit_conversion({\n output_format: 'byte',\n src_format: 'exabyte',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1data-transfer-rate~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_data_transfer_rate_unit_conversion({\n output_format: 'bytes_per_second',\n src_format: 'exabytes_per_second',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1concentration~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_concentration_unit_conversion({\n output_format: 'parts_per_million',\n src_format: 'parts_per_billion',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1charge~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_charge_unit_conversion({\n output_format: 'coulomb',\n src_format: 'ampere_hour',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1area~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_area_unit_conversion({\n output_format: 'square_meter',\n src_format: 'square_foot',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1angular-velocity~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_angular_velocity_unit_conversion({\n output_format: 'radians_per_second',\n src_format: 'degrees_per_second',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1angle~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_angle_unit_conversion({\n output_format: 'radian',\n src_format: 'degree',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1unit~1conversion~1acceleration~1{src_format}~1{output_format}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { unit } from '@kittycad/lib'\n\nasync function example() {\n const response = await unit.get_acceleration_unit_conversion({\n output_format: 'meters_per_second_squared',\n src_format: 'feet_per_second_squared',\n value: 7,\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1ping/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { meta } from '@kittycad/lib'\n\nasync function example() {\n const response = await meta.ping()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1file~1volume/post/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_volume({\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1file~1surface-area/post/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_surface_area({\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1file~1mass/post/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_mass({\n material_density: 7,\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1file~1density/post/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_density({\n material_mass: 7,\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1file~1conversions~1{id}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.get_file_conversion({ id: 'string' })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1file~1conversion~1{src_format}~1{output_format}/post/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import fsp from 'fs/promises'\nimport { file } from '@kittycad/lib'\n\nasync function example() {\n const response = await file.create_file_conversion({\n output_format: 'stl',\n src_format: 'obj',\n body: await fsp.readFile('./example.obj', 'base64'),\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1constant~1physics~1{constant}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { constant } from '@kittycad/lib'\n\nasync function example() {\n const response = await constant.get_physics_constant({ constant: 'c' })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1async~1operations~1{id}/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { api_calls } from '@kittycad/lib'\n\nasync function example() {\n const response = await api_calls.get_async_operation({ id: 'string' })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/paths/~1/get/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"example": "import { meta } from '@kittycad/lib'\n\nasync function example() {\n const response = await meta.get_schema()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
|
||||||
|
"libDocsLink": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/info/x-typescript",
|
||||||
|
"value": {
|
||||||
|
"client": "// Create a client with your token.\nasync function ExampleWithClient() {\n const client = new Client(process.env.KITTYCAD_TOKEN || '');\n const response = await meta.ping({ client });\n if ('error_code' in response) throw 'error';\n console.log(response.message); // 'pong'\n}\n\n// - OR -\n\n// Your token will be parsed from the environment\n// variable: 'KITTYCAD_TOKEN'.\nasync function ExampleWithOutClient() {\n const response = await meta.ping();\n if ('error_code' in response) throw 'error';\n console.log(response.message); // 'pong'\n}",
|
||||||
|
"install": "npm install @kittycad/lib\n# or \n$ yarn add @kittycad/lib"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -49,6 +49,7 @@
|
|||||||
"eslint": "~8.16",
|
"eslint": "~8.16",
|
||||||
"eslint-config-prettier": "~8.5",
|
"eslint-config-prettier": "~8.5",
|
||||||
"eslint-plugin-jest": "~26.2",
|
"eslint-plugin-jest": "~26.2",
|
||||||
|
"fast-json-patch": "^3.1.1",
|
||||||
"jest": "~28.1",
|
"jest": "~28.1",
|
||||||
"prettier": "~2.6",
|
"prettier": "~2.6",
|
||||||
"rimraf": "~3.0",
|
"rimraf": "~3.0",
|
||||||
@ -64,7 +65,7 @@
|
|||||||
"build:js": "rollup -c",
|
"build:js": "rollup -c",
|
||||||
"build:types": "tsc --emitDeclarationOnly",
|
"build:types": "tsc --emitDeclarationOnly",
|
||||||
"build": "rimraf dist && npm run build:types && npm run build:js",
|
"build": "rimraf dist && npm run build:types && npm run build:js",
|
||||||
"gen": "ts-node --project ./tsconfig.gen.json ./src/modelsGen.ts && prettier --config .prettierrc --write ./src",
|
"gen": "ts-node --project ./tsconfig.gen.json ./src/modelsGen.ts && prettier --config .prettierrc --write ./src && prettier --config .prettierrc --write ./__tests__ && prettier --config .prettierrc --write ./kittycad.ts.patch.json",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { ApiCallWithPrice_type, Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
interface Get_api_call_params {
|
|
||||||
id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Get_api_call_return = ApiCallWithPrice_type | Error_type;
|
|
||||||
|
|
||||||
export default async function get_api_call({
|
|
||||||
id,
|
|
||||||
}: Get_api_call_params): Promise<Get_api_call_return> {
|
|
||||||
const url = `/api-calls/${id}`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result = (await response.json()) as Get_api_call_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,23 +1,28 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { ApiCallWithPrice_type, Error_type } from '../../models.js';
|
import { ApiCallWithPrice_type, Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface Get_api_call_for_user_params {
|
interface Get_api_call_for_user_params {
|
||||||
|
client?: Client;
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Get_api_call_for_user_return = ApiCallWithPrice_type | Error_type;
|
type Get_api_call_for_user_return = ApiCallWithPrice_type | Error_type;
|
||||||
|
|
||||||
export default async function get_api_call_for_user({
|
export default async function get_api_call_for_user({
|
||||||
|
client,
|
||||||
id,
|
id,
|
||||||
}: Get_api_call_for_user_params): Promise<Get_api_call_for_user_return> {
|
}: Get_api_call_for_user_params): Promise<Get_api_call_for_user_return> {
|
||||||
const url = `/user/api-calls/${id}`;
|
const url = `/user/api-calls/${id}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { ApiCallQueryGroup_type, Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
interface Get_api_call_metrics_params {
|
|
||||||
group_by: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Get_api_call_metrics_return = ApiCallQueryGroup_type[] | Error_type;
|
|
||||||
|
|
||||||
export default async function get_api_call_metrics({
|
|
||||||
group_by,
|
|
||||||
}: Get_api_call_metrics_params): Promise<Get_api_call_metrics_return> {
|
|
||||||
const url = `/api-call-metrics?group_by=${group_by}`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result = (await response.json()) as Get_api_call_metrics_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,23 +1,28 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { AsyncApiCallOutput_type, Error_type } from '../../models.js';
|
import { AsyncApiCallOutput_type, Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface Get_async_operation_params {
|
interface Get_async_operation_params {
|
||||||
|
client?: Client;
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Get_async_operation_return = AsyncApiCallOutput_type | Error_type;
|
type Get_async_operation_return = AsyncApiCallOutput_type | Error_type;
|
||||||
|
|
||||||
export default async function get_async_operation({
|
export default async function get_async_operation({
|
||||||
|
client,
|
||||||
id,
|
id,
|
||||||
}: Get_async_operation_params): Promise<Get_async_operation_return> {
|
}: Get_async_operation_params): Promise<Get_async_operation_return> {
|
||||||
const url = `/async/operations/${id}`;
|
const url = `/async/operations/${id}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { ApiCallWithPriceResultsPage_type, Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
interface List_api_calls_params {
|
|
||||||
limit: string;
|
|
||||||
page_token: string;
|
|
||||||
sort_by: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type List_api_calls_return = ApiCallWithPriceResultsPage_type | Error_type;
|
|
||||||
|
|
||||||
export default async function list_api_calls({
|
|
||||||
limit,
|
|
||||||
page_token,
|
|
||||||
sort_by,
|
|
||||||
}: List_api_calls_params): Promise<List_api_calls_return> {
|
|
||||||
const url = `/api-calls?limit=${limit}&page_token=${page_token}&sort_by=${sort_by}`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result = (await response.json()) as List_api_calls_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { ApiCallWithPriceResultsPage_type, Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
interface List_api_calls_for_user_params {
|
|
||||||
id: string;
|
|
||||||
limit: string;
|
|
||||||
page_token: string;
|
|
||||||
sort_by: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type List_api_calls_for_user_return =
|
|
||||||
| ApiCallWithPriceResultsPage_type
|
|
||||||
| Error_type;
|
|
||||||
|
|
||||||
export default async function list_api_calls_for_user({
|
|
||||||
id,
|
|
||||||
limit,
|
|
||||||
page_token,
|
|
||||||
sort_by,
|
|
||||||
}: List_api_calls_for_user_params): Promise<List_api_calls_for_user_return> {
|
|
||||||
const url = `/users/${id}/api-calls?limit=${limit}&page_token=${page_token}&sort_by=${sort_by}`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result = (await response.json()) as List_api_calls_for_user_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { AsyncApiCallResultsPage_type, Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
interface List_async_operations_params {
|
|
||||||
limit: string;
|
|
||||||
page_token: string;
|
|
||||||
sort_by: string;
|
|
||||||
status: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type List_async_operations_return = AsyncApiCallResultsPage_type | Error_type;
|
|
||||||
|
|
||||||
export default async function list_async_operations({
|
|
||||||
limit,
|
|
||||||
page_token,
|
|
||||||
sort_by,
|
|
||||||
status,
|
|
||||||
}: List_async_operations_params): Promise<List_async_operations_return> {
|
|
||||||
const url = `/async/operations?limit=${limit}&page_token=${page_token}&sort_by=${sort_by}&status=${status}`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result = (await response.json()) as List_async_operations_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,27 +1,36 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { ApiCallWithPriceResultsPage_type, Error_type } from '../../models.js';
|
import {
|
||||||
|
ApiCallWithPriceResultsPage_type,
|
||||||
|
Error_type,
|
||||||
|
CreatedAtSortMode_type,
|
||||||
|
} from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface User_list_api_calls_params {
|
interface User_list_api_calls_params {
|
||||||
limit: string;
|
client?: Client;
|
||||||
|
limit: number;
|
||||||
page_token: string;
|
page_token: string;
|
||||||
sort_by: string;
|
sort_by: CreatedAtSortMode_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
type User_list_api_calls_return = ApiCallWithPriceResultsPage_type | Error_type;
|
type User_list_api_calls_return = ApiCallWithPriceResultsPage_type | Error_type;
|
||||||
|
|
||||||
export default async function user_list_api_calls({
|
export default async function user_list_api_calls({
|
||||||
|
client,
|
||||||
limit,
|
limit,
|
||||||
page_token,
|
page_token,
|
||||||
sort_by,
|
sort_by,
|
||||||
}: User_list_api_calls_params): Promise<User_list_api_calls_return> {
|
}: User_list_api_calls_params): Promise<User_list_api_calls_return> {
|
||||||
const url = `/user/api-calls?limit=${limit}&page_token=${page_token}&sort_by=${sort_by}`;
|
const url = `/user/api-calls?limit=${limit}&page_token=${page_token}&sort_by=${sort_by}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { ApiToken_type, Error_type } from '../../models.js';
|
import { ApiToken_type, Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
|
interface Create_api_token_for_user_params {
|
||||||
|
client?: Client;
|
||||||
|
}
|
||||||
|
|
||||||
type Create_api_token_for_user_return = ApiToken_type | Error_type;
|
type Create_api_token_for_user_return = ApiToken_type | Error_type;
|
||||||
|
|
||||||
export default async function create_api_token_for_user(): Promise<Create_api_token_for_user_return> {
|
export default async function create_api_token_for_user({
|
||||||
|
client,
|
||||||
|
}: Create_api_token_for_user_params = {}): Promise<Create_api_token_for_user_return> {
|
||||||
const url = `/user/api-tokens`;
|
const url = `/user/api-tokens`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
|
@ -1,23 +1,28 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { Error_type } from '../../models.js';
|
import { Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface Delete_api_token_for_user_params {
|
interface Delete_api_token_for_user_params {
|
||||||
|
client?: Client;
|
||||||
token: string;
|
token: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Delete_api_token_for_user_return = Error_type;
|
type Delete_api_token_for_user_return = Error_type;
|
||||||
|
|
||||||
export default async function delete_api_token_for_user({
|
export default async function delete_api_token_for_user({
|
||||||
|
client,
|
||||||
token,
|
token,
|
||||||
}: Delete_api_token_for_user_params): Promise<Delete_api_token_for_user_return> {
|
}: Delete_api_token_for_user_params): Promise<Delete_api_token_for_user_return> {
|
||||||
const url = `/user/api-tokens/${token}`;
|
const url = `/user/api-tokens/${token}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'DELETE',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,23 +1,28 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { ApiToken_type, Error_type } from '../../models.js';
|
import { ApiToken_type, Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface Get_api_token_for_user_params {
|
interface Get_api_token_for_user_params {
|
||||||
|
client?: Client;
|
||||||
token: string;
|
token: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Get_api_token_for_user_return = ApiToken_type | Error_type;
|
type Get_api_token_for_user_return = ApiToken_type | Error_type;
|
||||||
|
|
||||||
export default async function get_api_token_for_user({
|
export default async function get_api_token_for_user({
|
||||||
|
client,
|
||||||
token,
|
token,
|
||||||
}: Get_api_token_for_user_params): Promise<Get_api_token_for_user_return> {
|
}: Get_api_token_for_user_params): Promise<Get_api_token_for_user_return> {
|
||||||
const url = `/user/api-tokens/${token}`;
|
const url = `/user/api-tokens/${token}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,27 +1,36 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { ApiTokenResultsPage_type, Error_type } from '../../models.js';
|
import {
|
||||||
|
ApiTokenResultsPage_type,
|
||||||
|
Error_type,
|
||||||
|
CreatedAtSortMode_type,
|
||||||
|
} from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface List_api_tokens_for_user_params {
|
interface List_api_tokens_for_user_params {
|
||||||
limit: string;
|
client?: Client;
|
||||||
|
limit: number;
|
||||||
page_token: string;
|
page_token: string;
|
||||||
sort_by: string;
|
sort_by: CreatedAtSortMode_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
type List_api_tokens_for_user_return = ApiTokenResultsPage_type | Error_type;
|
type List_api_tokens_for_user_return = ApiTokenResultsPage_type | Error_type;
|
||||||
|
|
||||||
export default async function list_api_tokens_for_user({
|
export default async function list_api_tokens_for_user({
|
||||||
|
client,
|
||||||
limit,
|
limit,
|
||||||
page_token,
|
page_token,
|
||||||
sort_by,
|
sort_by,
|
||||||
}: List_api_tokens_for_user_params): Promise<List_api_tokens_for_user_return> {
|
}: List_api_tokens_for_user_params): Promise<List_api_tokens_for_user_return> {
|
||||||
const url = `/user/api-tokens?limit=${limit}&page_token=${page_token}&sort_by=${sort_by}`;
|
const url = `/user/api-tokens?limit=${limit}&page_token=${page_token}&sort_by=${sort_by}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
35
src/api/constant/get_physics_constant.ts
Normal file
35
src/api/constant/get_physics_constant.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import fetch from 'node-fetch';
|
||||||
|
import {
|
||||||
|
PhysicsConstant_type,
|
||||||
|
Error_type,
|
||||||
|
PhysicsConstantName_type,
|
||||||
|
} from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
|
interface Get_physics_constant_params {
|
||||||
|
client?: Client;
|
||||||
|
constant: PhysicsConstantName_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
type Get_physics_constant_return = PhysicsConstant_type | Error_type;
|
||||||
|
|
||||||
|
export default async function get_physics_constant({
|
||||||
|
client,
|
||||||
|
constant,
|
||||||
|
}: Get_physics_constant_params): Promise<Get_physics_constant_return> {
|
||||||
|
const url = `/constant/physics/${constant}`;
|
||||||
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
|
const headers = {
|
||||||
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
|
};
|
||||||
|
const fetchOptions = {
|
||||||
|
method: 'GET',
|
||||||
|
headers,
|
||||||
|
};
|
||||||
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
const result = (await response.json()) as Get_physics_constant_return;
|
||||||
|
return result;
|
||||||
|
}
|
@ -1,22 +1,32 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { FileConversion_type, Error_type } from '../../models.js';
|
import {
|
||||||
|
FileConversion_type,
|
||||||
|
Error_type,
|
||||||
|
FileOutputFormat_type,
|
||||||
|
FileSourceFormat_type,
|
||||||
|
} from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface Create_file_conversion_params {
|
interface Create_file_conversion_params {
|
||||||
output_format: string;
|
client?: Client;
|
||||||
src_format: string;
|
output_format: FileOutputFormat_type;
|
||||||
|
src_format: FileSourceFormat_type;
|
||||||
body: string;
|
body: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Create_file_conversion_return = FileConversion_type | Error_type;
|
type Create_file_conversion_return = FileConversion_type | Error_type;
|
||||||
|
|
||||||
export default async function create_file_conversion({
|
export default async function create_file_conversion({
|
||||||
|
client,
|
||||||
output_format,
|
output_format,
|
||||||
src_format,
|
src_format,
|
||||||
body,
|
body,
|
||||||
}: Create_file_conversion_params): Promise<Create_file_conversion_return> {
|
}: Create_file_conversion_params): Promise<Create_file_conversion_return> {
|
||||||
const url = `/file/conversion/${src_format}/${output_format}`;
|
const url = `/file/conversion/${src_format}/${output_format}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
|
@ -1,22 +1,31 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { FileDensity_type, Error_type } from '../../models.js';
|
import {
|
||||||
|
FileDensity_type,
|
||||||
|
Error_type,
|
||||||
|
FileSourceFormat_type,
|
||||||
|
} from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface Create_file_density_params {
|
interface Create_file_density_params {
|
||||||
material_mass: string;
|
client?: Client;
|
||||||
src_format: string;
|
material_mass: number;
|
||||||
|
src_format: FileSourceFormat_type;
|
||||||
body: string;
|
body: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Create_file_density_return = FileDensity_type | Error_type;
|
type Create_file_density_return = FileDensity_type | Error_type;
|
||||||
|
|
||||||
export default async function create_file_density({
|
export default async function create_file_density({
|
||||||
|
client,
|
||||||
material_mass,
|
material_mass,
|
||||||
src_format,
|
src_format,
|
||||||
body,
|
body,
|
||||||
}: Create_file_density_params): Promise<Create_file_density_return> {
|
}: Create_file_density_params): Promise<Create_file_density_return> {
|
||||||
const url = `/file/density?material_mass=${material_mass}&src_format=${src_format}`;
|
const url = `/file/density?material_mass=${material_mass}&src_format=${src_format}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { CodeOutput_type, Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
interface Create_file_execution_params {
|
|
||||||
lang: string;
|
|
||||||
output: string;
|
|
||||||
body: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Create_file_execution_return = CodeOutput_type | Error_type;
|
|
||||||
|
|
||||||
export default async function create_file_execution({
|
|
||||||
lang,
|
|
||||||
output,
|
|
||||||
body,
|
|
||||||
}: Create_file_execution_params): Promise<Create_file_execution_return> {
|
|
||||||
const url = `/file/execute/${lang}?output=${output}`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
body,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result = (await response.json()) as Create_file_execution_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,22 +1,31 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { FileMass_type, Error_type } from '../../models.js';
|
import {
|
||||||
|
FileMass_type,
|
||||||
|
Error_type,
|
||||||
|
FileSourceFormat_type,
|
||||||
|
} from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface Create_file_mass_params {
|
interface Create_file_mass_params {
|
||||||
material_density: string;
|
client?: Client;
|
||||||
src_format: string;
|
material_density: number;
|
||||||
|
src_format: FileSourceFormat_type;
|
||||||
body: string;
|
body: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Create_file_mass_return = FileMass_type | Error_type;
|
type Create_file_mass_return = FileMass_type | Error_type;
|
||||||
|
|
||||||
export default async function create_file_mass({
|
export default async function create_file_mass({
|
||||||
|
client,
|
||||||
material_density,
|
material_density,
|
||||||
src_format,
|
src_format,
|
||||||
body,
|
body,
|
||||||
}: Create_file_mass_params): Promise<Create_file_mass_return> {
|
}: Create_file_mass_params): Promise<Create_file_mass_return> {
|
||||||
const url = `/file/mass?material_density=${material_density}&src_format=${src_format}`;
|
const url = `/file/mass?material_density=${material_density}&src_format=${src_format}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
|
38
src/api/file/create_file_surface_area.ts
Normal file
38
src/api/file/create_file_surface_area.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import fetch from 'node-fetch';
|
||||||
|
import {
|
||||||
|
FileSurfaceArea_type,
|
||||||
|
Error_type,
|
||||||
|
FileSourceFormat_type,
|
||||||
|
} from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
|
interface Create_file_surface_area_params {
|
||||||
|
client?: Client;
|
||||||
|
src_format: FileSourceFormat_type;
|
||||||
|
body: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type Create_file_surface_area_return = FileSurfaceArea_type | Error_type;
|
||||||
|
|
||||||
|
export default async function create_file_surface_area({
|
||||||
|
client,
|
||||||
|
src_format,
|
||||||
|
body,
|
||||||
|
}: Create_file_surface_area_params): Promise<Create_file_surface_area_return> {
|
||||||
|
const url = `/file/surface-area?src_format=${src_format}`;
|
||||||
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
|
const headers = {
|
||||||
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
|
};
|
||||||
|
const fetchOptions = {
|
||||||
|
method: 'POST',
|
||||||
|
headers,
|
||||||
|
body,
|
||||||
|
};
|
||||||
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
const result = (await response.json()) as Create_file_surface_area_return;
|
||||||
|
return result;
|
||||||
|
}
|
@ -1,20 +1,29 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { FileVolume_type, Error_type } from '../../models.js';
|
import {
|
||||||
|
FileVolume_type,
|
||||||
|
Error_type,
|
||||||
|
FileSourceFormat_type,
|
||||||
|
} from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface Create_file_volume_params {
|
interface Create_file_volume_params {
|
||||||
src_format: string;
|
client?: Client;
|
||||||
|
src_format: FileSourceFormat_type;
|
||||||
body: string;
|
body: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Create_file_volume_return = FileVolume_type | Error_type;
|
type Create_file_volume_return = FileVolume_type | Error_type;
|
||||||
|
|
||||||
export default async function create_file_volume({
|
export default async function create_file_volume({
|
||||||
|
client,
|
||||||
src_format,
|
src_format,
|
||||||
body,
|
body,
|
||||||
}: Create_file_volume_params): Promise<Create_file_volume_return> {
|
}: Create_file_volume_params): Promise<Create_file_volume_return> {
|
||||||
const url = `/file/volume?src_format=${src_format}`;
|
const url = `/file/volume?src_format=${src_format}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
|
@ -1,23 +1,28 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { AsyncApiCallOutput_type, Error_type } from '../../models.js';
|
import { AsyncApiCallOutput_type, Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface Get_file_conversion_params {
|
interface Get_file_conversion_params {
|
||||||
|
client?: Client;
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Get_file_conversion_return = AsyncApiCallOutput_type | Error_type;
|
type Get_file_conversion_return = AsyncApiCallOutput_type | Error_type;
|
||||||
|
|
||||||
export default async function get_file_conversion({
|
export default async function get_file_conversion({
|
||||||
|
client,
|
||||||
id,
|
id,
|
||||||
}: Get_file_conversion_params): Promise<Get_file_conversion_return> {
|
}: Get_file_conversion_params): Promise<Get_file_conversion_return> {
|
||||||
const url = `/file/conversions/${id}`;
|
const url = `/file/conversions/${id}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,23 +1,28 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { AsyncApiCallOutput_type, Error_type } from '../../models.js';
|
import { AsyncApiCallOutput_type, Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
interface Get_file_conversion_for_user_params {
|
interface Get_file_conversion_for_user_params {
|
||||||
|
client?: Client;
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Get_file_conversion_for_user_return = AsyncApiCallOutput_type | Error_type;
|
type Get_file_conversion_for_user_return = AsyncApiCallOutput_type | Error_type;
|
||||||
|
|
||||||
export default async function get_file_conversion_for_user({
|
export default async function get_file_conversion_for_user({
|
||||||
|
client,
|
||||||
id,
|
id,
|
||||||
}: Get_file_conversion_for_user_params): Promise<Get_file_conversion_for_user_return> {
|
}: Get_file_conversion_for_user_params): Promise<Get_file_conversion_for_user_return> {
|
||||||
const url = `/user/file/conversions/${id}`;
|
const url = `/user/file/conversions/${id}`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { Metadata_type, Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
type Get_metadata_return = Metadata_type | Error_type;
|
|
||||||
|
|
||||||
export default async function get_metadata(): Promise<Get_metadata_return> {
|
|
||||||
const url = `/_meta/info`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result = (await response.json()) as Get_metadata_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,17 +1,26 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { Error_type } from '../../models.js';
|
import { Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
|
interface Get_schema_params {
|
||||||
|
client?: Client;
|
||||||
|
}
|
||||||
|
|
||||||
type Get_schema_return = Error_type;
|
type Get_schema_return = Error_type;
|
||||||
|
|
||||||
export default async function get_schema(): Promise<Get_schema_return> {
|
export default async function get_schema({
|
||||||
|
client,
|
||||||
|
}: Get_schema_params = {}): Promise<Get_schema_return> {
|
||||||
const url = `/`;
|
const url = `/`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,17 +1,26 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { Pong_type, Error_type } from '../../models.js';
|
import { Pong_type, Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
|
interface Ping_params {
|
||||||
|
client?: Client;
|
||||||
|
}
|
||||||
|
|
||||||
type Ping_return = Pong_type | Error_type;
|
type Ping_return = Pong_type | Error_type;
|
||||||
|
|
||||||
export default async function ping(): Promise<Ping_return> {
|
export default async function ping({
|
||||||
|
client,
|
||||||
|
}: Ping_params = {}): Promise<Ping_return> {
|
||||||
const url = `/ping`;
|
const url = `/ping`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import {} from '../../models.js';
|
|
||||||
|
|
||||||
type Device_access_token_return = any;
|
|
||||||
|
|
||||||
export default async function device_access_token(): Promise<Device_access_token_return> {
|
|
||||||
const url = `/oauth2/device/token`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result = (await response.json()) as Device_access_token_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
type Device_auth_confirm_return = Error_type;
|
|
||||||
|
|
||||||
export default async function device_auth_confirm(): Promise<Device_auth_confirm_return> {
|
|
||||||
const url = `/oauth2/device/confirm`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result = (await response.json()) as Device_auth_confirm_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import {} from '../../models.js';
|
|
||||||
|
|
||||||
type Device_auth_request_return = any;
|
|
||||||
|
|
||||||
export default async function device_auth_request(): Promise<Device_auth_request_return> {
|
|
||||||
const url = `/oauth2/device/auth`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result = (await response.json()) as Device_auth_request_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
interface Device_auth_verify_params {
|
|
||||||
user_code: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Device_auth_verify_return = Error_type;
|
|
||||||
|
|
||||||
export default async function device_auth_verify({
|
|
||||||
user_code,
|
|
||||||
}: Device_auth_verify_params): Promise<Device_auth_verify_return> {
|
|
||||||
const url = `/oauth2/device/verify?user_code=${user_code}`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result = (await response.json()) as Device_auth_verify_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
interface Listen_oauth2_provider_callback_params {
|
|
||||||
provider: string;
|
|
||||||
code: string;
|
|
||||||
state: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Listen_oauth2_provider_callback_return = Error_type;
|
|
||||||
|
|
||||||
export default async function listen_oauth2_provider_callback({
|
|
||||||
provider,
|
|
||||||
code,
|
|
||||||
state,
|
|
||||||
}: Listen_oauth2_provider_callback_params): Promise<Listen_oauth2_provider_callback_return> {
|
|
||||||
const url = `/oauth2/provider/${provider}/callback?code=${code}&state=${state}`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result =
|
|
||||||
(await response.json()) as Listen_oauth2_provider_callback_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { OAuth2ClientInfo_type, Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
interface Listen_oauth2_provider_consent_params {
|
|
||||||
provider: string;
|
|
||||||
callback_url: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Listen_oauth2_provider_consent_return = OAuth2ClientInfo_type | Error_type;
|
|
||||||
|
|
||||||
export default async function listen_oauth2_provider_consent({
|
|
||||||
provider,
|
|
||||||
callback_url,
|
|
||||||
}: Listen_oauth2_provider_consent_params): Promise<Listen_oauth2_provider_consent_return> {
|
|
||||||
const url = `/oauth2/provider/${provider}/consent?callback_url=${callback_url}`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result =
|
|
||||||
(await response.json()) as Listen_oauth2_provider_consent_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,12 +1,21 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { Customer_type, Error_type } from '../../models.js';
|
import { Customer_type, Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
|
interface Create_payment_information_for_user_params {
|
||||||
|
client?: Client;
|
||||||
|
}
|
||||||
|
|
||||||
type Create_payment_information_for_user_return = Customer_type | Error_type;
|
type Create_payment_information_for_user_return = Customer_type | Error_type;
|
||||||
|
|
||||||
export default async function create_payment_information_for_user(): Promise<Create_payment_information_for_user_return> {
|
export default async function create_payment_information_for_user({
|
||||||
|
client,
|
||||||
|
}: Create_payment_information_for_user_params = {}): Promise<Create_payment_information_for_user_return> {
|
||||||
const url = `/user/payment`;
|
const url = `/user/payment`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { PaymentIntent_type, Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
type Create_payment_intent_for_user_return = PaymentIntent_type | Error_type;
|
|
||||||
|
|
||||||
export default async function create_payment_intent_for_user(): Promise<Create_payment_intent_for_user_return> {
|
|
||||||
const url = `/user/payment/intent`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result =
|
|
||||||
(await response.json()) as Create_payment_intent_for_user_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,17 +1,26 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { Error_type } from '../../models.js';
|
import { Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
|
interface Delete_payment_information_for_user_params {
|
||||||
|
client?: Client;
|
||||||
|
}
|
||||||
|
|
||||||
type Delete_payment_information_for_user_return = Error_type;
|
type Delete_payment_information_for_user_return = Error_type;
|
||||||
|
|
||||||
export default async function delete_payment_information_for_user(): Promise<Delete_payment_information_for_user_return> {
|
export default async function delete_payment_information_for_user({
|
||||||
|
client,
|
||||||
|
}: Delete_payment_information_for_user_params = {}): Promise<Delete_payment_information_for_user_return> {
|
||||||
const url = `/user/payment`;
|
const url = `/user/payment`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'DELETE',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import { Error_type } from '../../models.js';
|
|
||||||
|
|
||||||
interface Delete_payment_method_for_user_params {
|
|
||||||
id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Delete_payment_method_for_user_return = Error_type;
|
|
||||||
|
|
||||||
export default async function delete_payment_method_for_user({
|
|
||||||
id,
|
|
||||||
}: Delete_payment_method_for_user_params): Promise<Delete_payment_method_for_user_return> {
|
|
||||||
const url = `/user/payment/methods/${id}`;
|
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
|
||||||
const headers = {
|
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
|
||||||
};
|
|
||||||
const fetchOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
headers,
|
|
||||||
};
|
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
|
||||||
const result =
|
|
||||||
(await response.json()) as Delete_payment_method_for_user_return;
|
|
||||||
return result;
|
|
||||||
}
|
|
@ -1,17 +1,26 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { CustomerBalance_type, Error_type } from '../../models.js';
|
import { CustomerBalance_type, Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
|
interface Get_payment_balance_for_user_params {
|
||||||
|
client?: Client;
|
||||||
|
}
|
||||||
|
|
||||||
type Get_payment_balance_for_user_return = CustomerBalance_type | Error_type;
|
type Get_payment_balance_for_user_return = CustomerBalance_type | Error_type;
|
||||||
|
|
||||||
export default async function get_payment_balance_for_user(): Promise<Get_payment_balance_for_user_return> {
|
export default async function get_payment_balance_for_user({
|
||||||
|
client,
|
||||||
|
}: Get_payment_balance_for_user_params = {}): Promise<Get_payment_balance_for_user_return> {
|
||||||
const url = `/user/payment/balance`;
|
const url = `/user/payment/balance`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,17 +1,26 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { Customer_type, Error_type } from '../../models.js';
|
import { Customer_type, Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
|
interface Get_payment_information_for_user_params {
|
||||||
|
client?: Client;
|
||||||
|
}
|
||||||
|
|
||||||
type Get_payment_information_for_user_return = Customer_type | Error_type;
|
type Get_payment_information_for_user_return = Customer_type | Error_type;
|
||||||
|
|
||||||
export default async function get_payment_information_for_user(): Promise<Get_payment_information_for_user_return> {
|
export default async function get_payment_information_for_user({
|
||||||
|
client,
|
||||||
|
}: Get_payment_information_for_user_params = {}): Promise<Get_payment_information_for_user_return> {
|
||||||
const url = `/user/payment`;
|
const url = `/user/payment`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
@ -1,17 +1,26 @@
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { Invoice_type, Error_type } from '../../models.js';
|
import { Invoice_type, Error_type } from '../../models.js';
|
||||||
|
import { Client } from '../../client.js';
|
||||||
|
|
||||||
|
interface List_invoices_for_user_params {
|
||||||
|
client?: Client;
|
||||||
|
}
|
||||||
|
|
||||||
type List_invoices_for_user_return = Invoice_type[] | Error_type;
|
type List_invoices_for_user_return = Invoice_type[] | Error_type;
|
||||||
|
|
||||||
export default async function list_invoices_for_user(): Promise<List_invoices_for_user_return> {
|
export default async function list_invoices_for_user({
|
||||||
|
client,
|
||||||
|
}: List_invoices_for_user_params = {}): Promise<List_invoices_for_user_return> {
|
||||||
const url = `/user/payment/invoices`;
|
const url = `/user/payment/invoices`;
|
||||||
const fullUrl = 'https://api.kittycad.io' + url;
|
const fullUrl = 'https://api.kittycad.io' + url;
|
||||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
const kittycadToken = client
|
||||||
|
? client.token
|
||||||
|
: process.env.KITTYCAD_TOKEN || '';
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${kittycadToken}`,
|
Authorization: `Bearer ${kittycadToken}`,
|
||||||
};
|
};
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
headers,
|
headers,
|
||||||
};
|
};
|
||||||
const response = await fetch(fullUrl, fetchOptions);
|
const response = await fetch(fullUrl, fetchOptions);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user