Update api spec (#218)

* YOYO NEW API SPEC!

* fix

* update test ignore list

* Generated new lib

* bump v

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
This commit is contained in:
zoo-github-actions-auth[bot]
2024-02-29 11:34:48 +11:00
committed by GitHub
parent e39fc8bd99
commit cd8b791b49
58 changed files with 6479 additions and 720 deletions

View File

@ -0,0 +1,33 @@
import { ai } from '../../src/index.js';
async function example() {
const response = await ai.create_kcl_code_completions({
body: {
extra: {
language: 'The language of the code.',
next_indent: 7,
prompt_tokens: 7,
suffix_tokens: 7,
trim_by_indentation: true,
},
max_tokens: 7,
n: 7,
nwo: 'For GitHub copilot this is the `{org}/{repo}`. This does not do anything yet. But we wanted the same API as GitHub Copilot. It might be used in the future.',
prompt: 'The prompt for the model.',
stop: ['string'],
stream: true,
suffix: 'The suffix for the model.',
temperature: 7,
top_p: 7,
},
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing ai.create_kcl_code_completions', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,14 @@
import { meta } from '../../src/index.js';
async function example() {
const response = await meta.create_event();
if ('error_code' in response) throw response;
return response;
}
describe('Testing meta.create_event', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,14 @@
import { meta } from '../../src/index.js';
async function example() {
const response = await meta.get_pricing_subscriptions();
if ('error_code' in response) throw response;
return response;
}
describe('Testing meta.get_pricing_subscriptions', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,20 @@
import { orgs } from '../../src/index.js';
async function example() {
const response = await orgs.get_any_org({
id: '00000000-0000-0000-0000-000000000000',
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing orgs.get_any_org', () => {
it('should be truthy or throw', async () => {
try {
await example();
} catch (err) {
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
}
});
});

View File

@ -0,0 +1,18 @@
import { orgs } from '../../src/index.js';
async function example() {
const response = await orgs.get_org_privacy_settings();
if ('error_code' in response) throw response;
return response;
}
describe('Testing orgs.get_org_privacy_settings', () => {
it('should be truthy or throw', async () => {
try {
await example();
} catch (err) {
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
}
});
});

View File

@ -0,0 +1,18 @@
import { orgs } from '../../src/index.js';
async function example() {
const response = await orgs.list_orgs({
limit: 7,
page_token: 'string',
sort_by: 'created_at_ascending',
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing orgs.list_orgs', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,17 @@
import { orgs } from '../../src/index.js';
async function example() {
const response = await orgs.update_enterprise_pricing_for_org({
id: '00000000-0000-0000-0000-000000000000',
body: { interval: 'day', price: 7, type: 'flat' },
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing orgs.update_enterprise_pricing_for_org', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,16 @@
import { orgs } from '../../src/index.js';
async function example() {
const response = await orgs.update_org_privacy_settings({
body: { can_train_on_data: true },
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing orgs.update_org_privacy_settings', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,16 @@
import { payments } from '../../src/index.js';
async function example() {
const response = await payments.create_org_subscription({
body: { modeling_app: 'team' },
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing payments.create_org_subscription', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,16 @@
import { payments } from '../../src/index.js';
async function example() {
const response = await payments.create_user_subscription({
body: { modeling_app: 'free' },
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing payments.create_user_subscription', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,18 @@
import { payments } from '../../src/index.js';
async function example() {
const response = await payments.get_org_subscription();
if ('error_code' in response) throw response;
return response;
}
describe('Testing payments.get_org_subscription', () => {
it('should be truthy or throw', async () => {
try {
await example();
} catch (err) {
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
}
});
});

View File

@ -0,0 +1,20 @@
import { payments } from '../../src/index.js';
async function example() {
const response = await payments.get_payment_balance_for_any_org({
id: '00000000-0000-0000-0000-000000000000',
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing payments.get_payment_balance_for_any_org', () => {
it('should be truthy or throw', async () => {
try {
await example();
} catch (err) {
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
}
});
});

View File

@ -0,0 +1,20 @@
import { payments } from '../../src/index.js';
async function example() {
const response = await payments.get_payment_balance_for_any_user({
id: '00000000-0000-0000-0000-000000000000',
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing payments.get_payment_balance_for_any_user', () => {
it('should be truthy or throw', async () => {
try {
await example();
} catch (err) {
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
}
});
});

View File

@ -0,0 +1,18 @@
import { payments } from '../../src/index.js';
async function example() {
const response = await payments.get_user_subscription();
if ('error_code' in response) throw response;
return response;
}
describe('Testing payments.get_user_subscription', () => {
it('should be truthy or throw', async () => {
try {
await example();
} catch (err) {
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
}
});
});

View File

@ -0,0 +1,16 @@
import { payments } from '../../src/index.js';
async function example() {
const response = await payments.update_org_subscription({
body: { modeling_app: 'team' },
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing payments.update_org_subscription', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,21 @@
import { payments } from '../../src/index.js';
async function example() {
const response = await payments.update_payment_balance_for_any_org({
id: '00000000-0000-0000-0000-000000000000',
body: {
monthly_credits_remaining: 7,
pre_pay_cash_remaining: 7,
pre_pay_credits_remaining: 7,
},
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing payments.update_payment_balance_for_any_org', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,21 @@
import { payments } from '../../src/index.js';
async function example() {
const response = await payments.update_payment_balance_for_any_user({
id: '00000000-0000-0000-0000-000000000000',
body: {
monthly_credits_remaining: 7,
pre_pay_cash_remaining: 7,
pre_pay_credits_remaining: 7,
},
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing payments.update_payment_balance_for_any_user', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,16 @@
import { payments } from '../../src/index.js';
async function example() {
const response = await payments.update_user_subscription({
body: { modeling_app: 'free' },
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing payments.update_user_subscription', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,20 @@
import { service_accounts } from '../../src/index.js';
async function example() {
const response = await service_accounts.create_service_account_for_org({
label: 'string',
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing service_accounts.create_service_account_for_org', () => {
it('should be truthy or throw', async () => {
try {
await example();
} catch (err) {
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
}
});
});

View File

@ -0,0 +1,16 @@
import { service_accounts } from '../../src/index.js';
async function example() {
const response = await service_accounts.delete_service_account_for_org({
token: 'string',
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing service_accounts.delete_service_account_for_org', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,16 @@
import { service_accounts } from '../../src/index.js';
async function example() {
const response = await service_accounts.get_service_account_for_org({
token: 'string',
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing service_accounts.get_service_account_for_org', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,18 @@
import { service_accounts } from '../../src/index.js';
async function example() {
const response = await service_accounts.list_service_accounts_for_org({
limit: 7,
page_token: 'string',
sort_by: 'created_at_ascending',
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing service_accounts.list_service_accounts_for_org', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,16 @@
import { store } from '../../src/index.js';
async function example() {
const response = await store.create_store_coupon({
body: { percent_off: 7 },
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing store.create_store_coupon', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -0,0 +1,18 @@
import { users } from '../../src/index.js';
async function example() {
const response = await users.get_user_privacy_settings();
if ('error_code' in response) throw response;
return response;
}
describe('Testing users.get_user_privacy_settings', () => {
it('should be truthy or throw', async () => {
try {
await example();
} catch (err) {
expect(err).toBeTruthy(); // eslint-disable-line jest/no-conditional-expect
}
});
});

View File

@ -0,0 +1,16 @@
import { users } from '../../src/index.js';
async function example() {
const response = await users.update_user_privacy_settings({
body: { can_train_on_data: true },
});
if ('error_code' in response) throw response;
return response;
}
describe('Testing users.update_user_privacy_settings', () => {
it('should be truthy or throw', async () => {
expect(await example()).toBeTruthy();
});
});

View File

@ -15,6 +15,22 @@
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1users~1{id}~1payment~1balance/put/x-typescript",
"value": {
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.update_payment_balance_for_any_user({\n id: '00000000-0000-0000-0000-000000000000',\n body: {\n monthly_credits_remaining: 7,\n pre_pay_cash_remaining: 7,\n pre_pay_credits_remaining: 7,\n },\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1users~1{id}~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_any_user({\n id: '00000000-0000-0000-0000-000000000000',\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1users~1{id}~1api-calls/get/x-typescript",
@ -87,6 +103,22 @@
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1user~1privacy/put/x-typescript",
"value": {
"example": "import { users } from '@kittycad/lib'\n\nasync function example() {\n const response = await users.update_user_privacy_settings({\n body: { can_train_on_data: true },\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~1privacy/get/x-typescript",
"value": {
"example": "import { users } from '@kittycad/lib'\n\nasync function example() {\n const response = await users.get_user_privacy_settings()\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~1tax/get/x-typescript",
@ -95,6 +127,30 @@
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1user~1payment~1subscriptions/post/x-typescript",
"value": {
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.create_user_subscription({\n body: { modeling_app: 'free' },\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~1payment~1subscriptions/put/x-typescript",
"value": {
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.update_user_subscription({\n body: { modeling_app: 'free' },\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~1payment~1subscriptions/get/x-typescript",
"value": {
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.get_user_subscription()\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~1{id}/delete/x-typescript",
@ -375,6 +431,22 @@
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1store~1coupon/post/x-typescript",
"value": {
"example": "import { store } from '@kittycad/lib'\n\nasync function example() {\n const response = await store.create_store_coupon({\n body: { percent_off: 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/~1pricing~1subscriptions/get/x-typescript",
"value": {
"example": "import { meta } from '@kittycad/lib'\n\nasync function example() {\n const response = await meta.get_pricing_subscriptions()\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",
@ -383,6 +455,78 @@
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1orgs~1{id}~1payment~1balance/put/x-typescript",
"value": {
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.update_payment_balance_for_any_org({\n id: '00000000-0000-0000-0000-000000000000',\n body: {\n monthly_credits_remaining: 7,\n pre_pay_cash_remaining: 7,\n pre_pay_credits_remaining: 7,\n },\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1orgs~1{id}~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_any_org({\n id: '00000000-0000-0000-0000-000000000000',\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1orgs~1{id}~1enterprise~1pricing/put/x-typescript",
"value": {
"example": "import { orgs } from '@kittycad/lib'\n\nasync function example() {\n const response = await orgs.update_enterprise_pricing_for_org({\n id: '00000000-0000-0000-0000-000000000000',\n body: { interval: 'day', price: 7, type: 'flat' },\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1orgs~1{id}/get/x-typescript",
"value": {
"example": "import { orgs } from '@kittycad/lib'\n\nasync function example() {\n const response = await orgs.get_any_org({\n id: '00000000-0000-0000-0000-000000000000',\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1orgs/get/x-typescript",
"value": {
"example": "import { orgs } from '@kittycad/lib'\n\nasync function example() {\n const response = await orgs.list_orgs({\n limit: 7,\n page_token: 'string',\n sort_by: 'created_at_ascending',\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1org~1service-accounts~1{token}/delete/x-typescript",
"value": {
"example": "import { service_accounts } from '@kittycad/lib'\n\nasync function example() {\n const response = await service_accounts.delete_service_account_for_org({\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/~1org~1service-accounts~1{token}/get/x-typescript",
"value": {
"example": "import { service_accounts } from '@kittycad/lib'\n\nasync function example() {\n const response = await service_accounts.get_service_account_for_org({\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/~1org~1service-accounts/post/x-typescript",
"value": {
"example": "import { service_accounts } from '@kittycad/lib'\n\nasync function example() {\n const response = await service_accounts.create_service_account_for_org({\n label: '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/~1org~1service-accounts/get/x-typescript",
"value": {
"example": "import { service_accounts } from '@kittycad/lib'\n\nasync function example() {\n const response = await service_accounts.list_service_accounts_for_org({\n limit: 7,\n page_token: 'string',\n sort_by: 'created_at_ascending',\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1org~1saml~1idp/delete/x-typescript",
@ -415,6 +559,22 @@
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1org~1privacy/put/x-typescript",
"value": {
"example": "import { orgs } from '@kittycad/lib'\n\nasync function example() {\n const response = await orgs.update_org_privacy_settings({\n body: { can_train_on_data: true },\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1org~1privacy/get/x-typescript",
"value": {
"example": "import { orgs } from '@kittycad/lib'\n\nasync function example() {\n const response = await orgs.get_org_privacy_settings()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1org~1payment~1tax/get/x-typescript",
@ -423,6 +583,30 @@
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1org~1payment~1subscriptions/post/x-typescript",
"value": {
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.create_org_subscription({\n body: { modeling_app: 'team' },\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1org~1payment~1subscriptions/put/x-typescript",
"value": {
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.update_org_subscription({\n body: { modeling_app: 'team' },\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1org~1payment~1subscriptions/get/x-typescript",
"value": {
"example": "import { payments } from '@kittycad/lib'\n\nasync function example() {\n const response = await payments.get_org_subscription()\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1org~1payment~1methods~1{id}/delete/x-typescript",
@ -703,6 +887,14 @@
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1events/post/x-typescript",
"value": {
"example": "import { meta } from '@kittycad/lib'\n\nasync function example() {\n const response = await meta.create_event()\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",
@ -775,6 +967,14 @@
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1ai~1kcl~1completions/post/x-typescript",
"value": {
"example": "import { ai } from '@kittycad/lib'\n\nasync function example() {\n const response = await ai.create_kcl_code_completions({\n body: {\n extra: {\n language: 'The language of the code.',\n next_indent: 7,\n prompt_tokens: 7,\n suffix_tokens: 7,\n trim_by_indentation: true,\n },\n max_tokens: 7,\n n: 7,\n nwo: 'For GitHub copilot this is the `{org}/{repo}`. This does not do anything yet. But we wanted the same API as GitHub Copilot. It might be used in the future.',\n prompt: 'The prompt for the model.',\n stop: ['string'],\n stream: true,\n suffix: 'The suffix for the model.',\n temperature: 7,\n top_p: 7,\n },\n })\n if ('error_code' in response) throw response\n console.log(JSON.stringify(response, null, 2))\n}\n",
"libDocsLink": ""
}
},
{
"op": "add",
"path": "/paths/~1ai-prompts~1{id}/get/x-typescript",

View File

@ -1,6 +1,6 @@
{
"name": "@kittycad/lib",
"version": "0.0.53",
"version": "0.0.54",
"description": "Javascript library for KittyCAD API",
"type": "module",
"keywords": [

4875
spec.json

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
import fetch from 'node-fetch';
import {
KclCodeCompletionResponse_type,
Error_type,
KclCodeCompletionRequest_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Create_kcl_code_completions_params {
client?: Client;
body: KclCodeCompletionRequest_type;
}
type Create_kcl_code_completions_return =
| KclCodeCompletionResponse_type
| Error_type;
export default async function create_kcl_code_completions({
client,
body,
}: Create_kcl_code_completions_params): Promise<Create_kcl_code_completions_return> {
const url = `/ai/kcl/completions`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'POST',
headers,
body: JSON.stringify(body),
};
const response = await fetch(fullUrl, fetchOptions);
const result = (await response.json()) as Create_kcl_code_completions_return;
return result;
}

View File

@ -0,0 +1,30 @@
import fetch from 'node-fetch';
import { Error_type } from '../../models.js';
import { Client } from '../../client.js';
interface Create_event_params {
client?: Client;
}
type Create_event_return = Error_type;
export default async function create_event({
client,
}: Create_event_params = {}): Promise<Create_event_return> {
const url = `/events`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: 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_event_return;
return result;
}

View File

@ -0,0 +1,32 @@
import fetch from 'node-fetch';
import { ZooProductSubscription_type, Error_type } from '../../models.js';
import { Client } from '../../client.js';
interface Get_pricing_subscriptions_params {
client?: Client;
}
type Get_pricing_subscriptions_return =
| ZooProductSubscription_type[]
| Error_type;
export default async function get_pricing_subscriptions({
client,
}: Get_pricing_subscriptions_params = {}): Promise<Get_pricing_subscriptions_return> {
const url = `/pricing/subscriptions`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + 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_pricing_subscriptions_return;
return result;
}

View File

@ -0,0 +1,32 @@
import fetch from 'node-fetch';
import { Org_type, Error_type, Uuid_type } from '../../models.js';
import { Client } from '../../client.js';
interface Get_any_org_params {
client?: Client;
id: Uuid_type;
}
type Get_any_org_return = Org_type | Error_type;
export default async function get_any_org({
client,
id,
}: Get_any_org_params): Promise<Get_any_org_return> {
const url = `/orgs/${id}`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + 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_any_org_return;
return result;
}

View File

@ -0,0 +1,30 @@
import fetch from 'node-fetch';
import { PrivacySettings_type, Error_type } from '../../models.js';
import { Client } from '../../client.js';
interface Get_org_privacy_settings_params {
client?: Client;
}
type Get_org_privacy_settings_return = PrivacySettings_type | Error_type;
export default async function get_org_privacy_settings({
client,
}: Get_org_privacy_settings_params = {}): Promise<Get_org_privacy_settings_return> {
const url = `/org/privacy`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + 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_org_privacy_settings_return;
return result;
}

View File

@ -3,7 +3,7 @@ import {
OrgMemberResultsPage_type,
Error_type,
CreatedAtSortMode_type,
OrgRole_type,
UserOrgRole_type,
} from '../../models.js';
import { Client } from '../../client.js';
@ -12,7 +12,7 @@ interface List_org_members_params {
limit: number;
page_token: string;
sort_by: CreatedAtSortMode_type;
role: OrgRole_type;
role: UserOrgRole_type;
}
type List_org_members_return = OrgMemberResultsPage_type | Error_type;

40
src/api/orgs/list_orgs.ts Normal file
View File

@ -0,0 +1,40 @@
import fetch from 'node-fetch';
import {
OrgResultsPage_type,
Error_type,
CreatedAtSortMode_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface List_orgs_params {
client?: Client;
limit: number;
page_token: string;
sort_by: CreatedAtSortMode_type;
}
type List_orgs_return = OrgResultsPage_type | Error_type;
export default async function list_orgs({
client,
limit,
page_token,
sort_by,
}: List_orgs_params): Promise<List_orgs_return> {
const url = `/orgs?limit=${limit}&page_token=${page_token}&sort_by=${sort_by}`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + 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 List_orgs_return;
return result;
}

View File

@ -0,0 +1,43 @@
import fetch from 'node-fetch';
import {
ZooProductSubscriptions_type,
Error_type,
Uuid_type,
SubscriptionTierPrice_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Update_enterprise_pricing_for_org_params {
client?: Client;
id: Uuid_type;
body: SubscriptionTierPrice_type;
}
type Update_enterprise_pricing_for_org_return =
| ZooProductSubscriptions_type
| Error_type;
export default async function update_enterprise_pricing_for_org({
client,
id,
body,
}: Update_enterprise_pricing_for_org_params): Promise<Update_enterprise_pricing_for_org_return> {
const url = `/orgs/${id}/enterprise/pricing`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'PUT',
headers,
body: JSON.stringify(body),
};
const response = await fetch(fullUrl, fetchOptions);
const result =
(await response.json()) as Update_enterprise_pricing_for_org_return;
return result;
}

View File

@ -0,0 +1,33 @@
import fetch from 'node-fetch';
import { PrivacySettings_type, Error_type } from '../../models.js';
import { Client } from '../../client.js';
interface Update_org_privacy_settings_params {
client?: Client;
body: PrivacySettings_type;
}
type Update_org_privacy_settings_return = PrivacySettings_type | Error_type;
export default async function update_org_privacy_settings({
client,
body,
}: Update_org_privacy_settings_params): Promise<Update_org_privacy_settings_return> {
const url = `/org/privacy`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'PUT',
headers,
body: JSON.stringify(body),
};
const response = await fetch(fullUrl, fetchOptions);
const result = (await response.json()) as Update_org_privacy_settings_return;
return result;
}

View File

@ -0,0 +1,37 @@
import fetch from 'node-fetch';
import {
ZooProductSubscriptions_type,
Error_type,
ZooProductSubscriptionsOrgRequest_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Create_org_subscription_params {
client?: Client;
body: ZooProductSubscriptionsOrgRequest_type;
}
type Create_org_subscription_return = ZooProductSubscriptions_type | Error_type;
export default async function create_org_subscription({
client,
body,
}: Create_org_subscription_params): Promise<Create_org_subscription_return> {
const url = `/org/payment/subscriptions`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'POST',
headers,
body: JSON.stringify(body),
};
const response = await fetch(fullUrl, fetchOptions);
const result = (await response.json()) as Create_org_subscription_return;
return result;
}

View File

@ -0,0 +1,39 @@
import fetch from 'node-fetch';
import {
ZooProductSubscriptions_type,
Error_type,
ZooProductSubscriptionsUserRequest_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Create_user_subscription_params {
client?: Client;
body: ZooProductSubscriptionsUserRequest_type;
}
type Create_user_subscription_return =
| ZooProductSubscriptions_type
| Error_type;
export default async function create_user_subscription({
client,
body,
}: Create_user_subscription_params): Promise<Create_user_subscription_return> {
const url = `/user/payment/subscriptions`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'POST',
headers,
body: JSON.stringify(body),
};
const response = await fetch(fullUrl, fetchOptions);
const result = (await response.json()) as Create_user_subscription_return;
return result;
}

View File

@ -0,0 +1,30 @@
import fetch from 'node-fetch';
import { ZooProductSubscriptions_type, Error_type } from '../../models.js';
import { Client } from '../../client.js';
interface Get_org_subscription_params {
client?: Client;
}
type Get_org_subscription_return = ZooProductSubscriptions_type | Error_type;
export default async function get_org_subscription({
client,
}: Get_org_subscription_params = {}): Promise<Get_org_subscription_return> {
const url = `/org/payment/subscriptions`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + 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_org_subscription_return;
return result;
}

View File

@ -0,0 +1,33 @@
import fetch from 'node-fetch';
import { CustomerBalance_type, Error_type, Uuid_type } from '../../models.js';
import { Client } from '../../client.js';
interface Get_payment_balance_for_any_org_params {
client?: Client;
id: Uuid_type;
}
type Get_payment_balance_for_any_org_return = CustomerBalance_type | Error_type;
export default async function get_payment_balance_for_any_org({
client,
id,
}: Get_payment_balance_for_any_org_params): Promise<Get_payment_balance_for_any_org_return> {
const url = `/orgs/${id}/payment/balance`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + 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_payment_balance_for_any_org_return;
return result;
}

View File

@ -0,0 +1,35 @@
import fetch from 'node-fetch';
import { CustomerBalance_type, Error_type, Uuid_type } from '../../models.js';
import { Client } from '../../client.js';
interface Get_payment_balance_for_any_user_params {
client?: Client;
id: Uuid_type;
}
type Get_payment_balance_for_any_user_return =
| CustomerBalance_type
| Error_type;
export default async function get_payment_balance_for_any_user({
client,
id,
}: Get_payment_balance_for_any_user_params): Promise<Get_payment_balance_for_any_user_return> {
const url = `/users/${id}/payment/balance`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + 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_payment_balance_for_any_user_return;
return result;
}

View File

@ -0,0 +1,30 @@
import fetch from 'node-fetch';
import { ZooProductSubscriptions_type, Error_type } from '../../models.js';
import { Client } from '../../client.js';
interface Get_user_subscription_params {
client?: Client;
}
type Get_user_subscription_return = ZooProductSubscriptions_type | Error_type;
export default async function get_user_subscription({
client,
}: Get_user_subscription_params = {}): Promise<Get_user_subscription_return> {
const url = `/user/payment/subscriptions`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + 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_user_subscription_return;
return result;
}

View File

@ -0,0 +1,37 @@
import fetch from 'node-fetch';
import {
ZooProductSubscriptions_type,
Error_type,
ZooProductSubscriptionsOrgRequest_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Update_org_subscription_params {
client?: Client;
body: ZooProductSubscriptionsOrgRequest_type;
}
type Update_org_subscription_return = ZooProductSubscriptions_type | Error_type;
export default async function update_org_subscription({
client,
body,
}: Update_org_subscription_params): Promise<Update_org_subscription_return> {
const url = `/org/payment/subscriptions`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'PUT',
headers,
body: JSON.stringify(body),
};
const response = await fetch(fullUrl, fetchOptions);
const result = (await response.json()) as Update_org_subscription_return;
return result;
}

View File

@ -0,0 +1,43 @@
import fetch from 'node-fetch';
import {
CustomerBalance_type,
Error_type,
Uuid_type,
UpdatePaymentBalance_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Update_payment_balance_for_any_org_params {
client?: Client;
id: Uuid_type;
body: UpdatePaymentBalance_type;
}
type Update_payment_balance_for_any_org_return =
| CustomerBalance_type
| Error_type;
export default async function update_payment_balance_for_any_org({
client,
id,
body,
}: Update_payment_balance_for_any_org_params): Promise<Update_payment_balance_for_any_org_return> {
const url = `/orgs/${id}/payment/balance`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'PUT',
headers,
body: JSON.stringify(body),
};
const response = await fetch(fullUrl, fetchOptions);
const result =
(await response.json()) as Update_payment_balance_for_any_org_return;
return result;
}

View File

@ -0,0 +1,43 @@
import fetch from 'node-fetch';
import {
CustomerBalance_type,
Error_type,
Uuid_type,
UpdatePaymentBalance_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Update_payment_balance_for_any_user_params {
client?: Client;
id: Uuid_type;
body: UpdatePaymentBalance_type;
}
type Update_payment_balance_for_any_user_return =
| CustomerBalance_type
| Error_type;
export default async function update_payment_balance_for_any_user({
client,
id,
body,
}: Update_payment_balance_for_any_user_params): Promise<Update_payment_balance_for_any_user_return> {
const url = `/users/${id}/payment/balance`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'PUT',
headers,
body: JSON.stringify(body),
};
const response = await fetch(fullUrl, fetchOptions);
const result =
(await response.json()) as Update_payment_balance_for_any_user_return;
return result;
}

View File

@ -0,0 +1,39 @@
import fetch from 'node-fetch';
import {
ZooProductSubscriptions_type,
Error_type,
ZooProductSubscriptionsUserRequest_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Update_user_subscription_params {
client?: Client;
body: ZooProductSubscriptionsUserRequest_type;
}
type Update_user_subscription_return =
| ZooProductSubscriptions_type
| Error_type;
export default async function update_user_subscription({
client,
body,
}: Update_user_subscription_params): Promise<Update_user_subscription_return> {
const url = `/user/payment/subscriptions`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'PUT',
headers,
body: JSON.stringify(body),
};
const response = await fetch(fullUrl, fetchOptions);
const result = (await response.json()) as Update_user_subscription_return;
return result;
}

View File

@ -0,0 +1,33 @@
import fetch from 'node-fetch';
import { ServiceAccount_type, Error_type } from '../../models.js';
import { Client } from '../../client.js';
interface Create_service_account_for_org_params {
client?: Client;
label: string;
}
type Create_service_account_for_org_return = ServiceAccount_type | Error_type;
export default async function create_service_account_for_org({
client,
label,
}: Create_service_account_for_org_params): Promise<Create_service_account_for_org_return> {
const url = `/org/service-accounts?label=${label}`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: 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_service_account_for_org_return;
return result;
}

View File

@ -0,0 +1,33 @@
import fetch from 'node-fetch';
import { Error_type } from '../../models.js';
import { Client } from '../../client.js';
interface Delete_service_account_for_org_params {
client?: Client;
token: string;
}
type Delete_service_account_for_org_return = Error_type;
export default async function delete_service_account_for_org({
client,
token,
}: Delete_service_account_for_org_params): Promise<Delete_service_account_for_org_return> {
const url = `/org/service-accounts/${token}`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'DELETE',
headers,
};
const response = await fetch(fullUrl, fetchOptions);
const result =
(await response.json()) as Delete_service_account_for_org_return;
return result;
}

View File

@ -0,0 +1,32 @@
import fetch from 'node-fetch';
import { ServiceAccount_type, Error_type } from '../../models.js';
import { Client } from '../../client.js';
interface Get_service_account_for_org_params {
client?: Client;
token: string;
}
type Get_service_account_for_org_return = ServiceAccount_type | Error_type;
export default async function get_service_account_for_org({
client,
token,
}: Get_service_account_for_org_params): Promise<Get_service_account_for_org_return> {
const url = `/org/service-accounts/${token}`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + 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_service_account_for_org_return;
return result;
}

View File

@ -0,0 +1,43 @@
import fetch from 'node-fetch';
import {
ServiceAccountResultsPage_type,
Error_type,
CreatedAtSortMode_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface List_service_accounts_for_org_params {
client?: Client;
limit: number;
page_token: string;
sort_by: CreatedAtSortMode_type;
}
type List_service_accounts_for_org_return =
| ServiceAccountResultsPage_type
| Error_type;
export default async function list_service_accounts_for_org({
client,
limit,
page_token,
sort_by,
}: List_service_accounts_for_org_params): Promise<List_service_accounts_for_org_return> {
const url = `/org/service-accounts?limit=${limit}&page_token=${page_token}&sort_by=${sort_by}`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + 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 List_service_accounts_for_org_return;
return result;
}

View File

@ -0,0 +1,37 @@
import fetch from 'node-fetch';
import {
DiscountCode_type,
Error_type,
StoreCouponParams_type,
} from '../../models.js';
import { Client } from '../../client.js';
interface Create_store_coupon_params {
client?: Client;
body: StoreCouponParams_type;
}
type Create_store_coupon_return = DiscountCode_type | Error_type;
export default async function create_store_coupon({
client,
body,
}: Create_store_coupon_params): Promise<Create_store_coupon_return> {
const url = `/store/coupon`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'POST',
headers,
body: JSON.stringify(body),
};
const response = await fetch(fullUrl, fetchOptions);
const result = (await response.json()) as Create_store_coupon_return;
return result;
}

View File

@ -0,0 +1,30 @@
import fetch from 'node-fetch';
import { PrivacySettings_type, Error_type } from '../../models.js';
import { Client } from '../../client.js';
interface Get_user_privacy_settings_params {
client?: Client;
}
type Get_user_privacy_settings_return = PrivacySettings_type | Error_type;
export default async function get_user_privacy_settings({
client,
}: Get_user_privacy_settings_params = {}): Promise<Get_user_privacy_settings_return> {
const url = `/user/privacy`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + 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_user_privacy_settings_return;
return result;
}

View File

@ -0,0 +1,33 @@
import fetch from 'node-fetch';
import { PrivacySettings_type, Error_type } from '../../models.js';
import { Client } from '../../client.js';
interface Update_user_privacy_settings_params {
client?: Client;
body: PrivacySettings_type;
}
type Update_user_privacy_settings_return = PrivacySettings_type | Error_type;
export default async function update_user_privacy_settings({
client,
body,
}: Update_user_privacy_settings_params): Promise<Update_user_privacy_settings_return> {
const url = `/user/privacy`;
const urlBase = process?.env?.BASE_URL || 'https://api.kittycad.io';
const fullUrl = urlBase + url;
const kittycadToken = client
? client.token
: process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'PUT',
headers,
body: JSON.stringify(body),
};
const response = await fetch(fullUrl, fetchOptions);
const result = (await response.json()) as Update_user_privacy_settings_return;
return result;
}

View File

@ -220,7 +220,13 @@ export default async function apiGen(lookup: any) {
const ref = value.allOf[0].$ref;
return `${key}: ${mapOverProperties(ref)}`;
}
console.log('yoyoy', value);
if (
value.type === 'array' &&
'type' in value.items &&
value.items.type === 'string'
) {
return `${key}: ['string']`;
}
return '';
})
.filter(Boolean)
@ -309,6 +315,19 @@ export default async function apiGen(lookup: any) {
} else {
throw 'only ref arrays implemented';
}
} else if (
schema.type === 'object' &&
'additionalProperties' in schema
) {
schema.additionalProperties;
const addProps =
schema.additionalProperties as OpenAPIV3.SchemaObject;
if (addProps.type === 'array' && '$ref' in addProps.items) {
const typeReference = lookup[addProps.items.$ref];
if (!importedTypes.includes(typeReference + '[]')) {
importedTypes.push(typeReference + '[]');
}
}
} else {
console.log('apiGen', schema);
throw 'not implemented';
@ -389,6 +408,14 @@ export default async function apiGen(lookup: any) {
'orgs.delete_org',
'orgs.delete_org_saml_idp',
'orgs.get_org_saml_idp',
'payments.get_payment_balance_for_any_user',
'payments.get_payment_balance_for_any_org',
'service-accounts.create_service_account_for_org',
'orgs.get_any_org',
'payments.get_user_subscription',
'users.get_user_privacy_settings',
'payments.get_org_subscription',
'orgs.get_org_privacy_settings',
].includes(`${tag.trim()}.${operationId.trim()}`)
) {
// these test are expected to fail

View File

@ -1,3 +1,4 @@
import create_kcl_code_completions from './api/ai/create_kcl_code_completions.js';
import create_text_to_cad from './api/ai/create_text_to_cad.js';
import create_text_to_cad_model_feedback from './api/ai/create_text_to_cad_model_feedback.js';
import get_ai_prompt from './api/ai/get_ai_prompt.js';
@ -5,6 +6,7 @@ import get_text_to_cad_model_for_user from './api/ai/get_text_to_cad_model_for_u
import list_ai_prompts from './api/ai/list_ai_prompts.js';
import list_text_to_cad_models_for_user from './api/ai/list_text_to_cad_models_for_user.js';
export const ai = {
create_kcl_code_completions,
create_text_to_cad,
create_text_to_cad_model_feedback,
get_ai_prompt,
@ -75,14 +77,18 @@ export const file = {
create_file_volume,
};
import create_event from './api/meta/create_event.js';
import get_ipinfo from './api/meta/get_ipinfo.js';
import get_metadata from './api/meta/get_metadata.js';
import get_pricing_subscriptions from './api/meta/get_pricing_subscriptions.js';
import get_schema from './api/meta/get_schema.js';
import internal_get_api_token_for_discord_user from './api/meta/internal_get_api_token_for_discord_user.js';
import ping from './api/meta/ping.js';
export const meta = {
create_event,
get_ipinfo,
get_metadata,
get_pricing_subscriptions,
get_schema,
internal_get_api_token_for_discord_user,
ping,
@ -111,13 +117,18 @@ import create_org_saml_idp from './api/orgs/create_org_saml_idp.js';
import delete_org from './api/orgs/delete_org.js';
import delete_org_member from './api/orgs/delete_org_member.js';
import delete_org_saml_idp from './api/orgs/delete_org_saml_idp.js';
import get_any_org from './api/orgs/get_any_org.js';
import get_org from './api/orgs/get_org.js';
import get_org_member from './api/orgs/get_org_member.js';
import get_org_privacy_settings from './api/orgs/get_org_privacy_settings.js';
import get_org_saml_idp from './api/orgs/get_org_saml_idp.js';
import get_user_org from './api/orgs/get_user_org.js';
import list_org_members from './api/orgs/list_org_members.js';
import list_orgs from './api/orgs/list_orgs.js';
import update_enterprise_pricing_for_org from './api/orgs/update_enterprise_pricing_for_org.js';
import update_org from './api/orgs/update_org.js';
import update_org_member from './api/orgs/update_org_member.js';
import update_org_privacy_settings from './api/orgs/update_org_privacy_settings.js';
import update_org_saml_idp from './api/orgs/update_org_saml_idp.js';
export const orgs = {
create_org,
@ -126,59 +137,98 @@ export const orgs = {
delete_org,
delete_org_member,
delete_org_saml_idp,
get_any_org,
get_org,
get_org_member,
get_org_privacy_settings,
get_org_saml_idp,
get_user_org,
list_org_members,
list_orgs,
update_enterprise_pricing_for_org,
update_org,
update_org_member,
update_org_privacy_settings,
update_org_saml_idp,
};
import create_org_subscription from './api/payments/create_org_subscription.js';
import create_payment_information_for_org from './api/payments/create_payment_information_for_org.js';
import create_payment_information_for_user from './api/payments/create_payment_information_for_user.js';
import create_payment_intent_for_org from './api/payments/create_payment_intent_for_org.js';
import create_payment_intent_for_user from './api/payments/create_payment_intent_for_user.js';
import create_user_subscription from './api/payments/create_user_subscription.js';
import delete_payment_information_for_org from './api/payments/delete_payment_information_for_org.js';
import delete_payment_information_for_user from './api/payments/delete_payment_information_for_user.js';
import delete_payment_method_for_org from './api/payments/delete_payment_method_for_org.js';
import delete_payment_method_for_user from './api/payments/delete_payment_method_for_user.js';
import get_org_subscription from './api/payments/get_org_subscription.js';
import get_payment_balance_for_any_org from './api/payments/get_payment_balance_for_any_org.js';
import get_payment_balance_for_any_user from './api/payments/get_payment_balance_for_any_user.js';
import get_payment_balance_for_org from './api/payments/get_payment_balance_for_org.js';
import get_payment_balance_for_user from './api/payments/get_payment_balance_for_user.js';
import get_payment_information_for_org from './api/payments/get_payment_information_for_org.js';
import get_payment_information_for_user from './api/payments/get_payment_information_for_user.js';
import get_user_subscription from './api/payments/get_user_subscription.js';
import list_invoices_for_org from './api/payments/list_invoices_for_org.js';
import list_invoices_for_user from './api/payments/list_invoices_for_user.js';
import list_payment_methods_for_org from './api/payments/list_payment_methods_for_org.js';
import list_payment_methods_for_user from './api/payments/list_payment_methods_for_user.js';
import update_org_subscription from './api/payments/update_org_subscription.js';
import update_payment_balance_for_any_org from './api/payments/update_payment_balance_for_any_org.js';
import update_payment_balance_for_any_user from './api/payments/update_payment_balance_for_any_user.js';
import update_payment_information_for_org from './api/payments/update_payment_information_for_org.js';
import update_payment_information_for_user from './api/payments/update_payment_information_for_user.js';
import update_user_subscription from './api/payments/update_user_subscription.js';
import validate_customer_tax_information_for_org from './api/payments/validate_customer_tax_information_for_org.js';
import validate_customer_tax_information_for_user from './api/payments/validate_customer_tax_information_for_user.js';
export const payments = {
create_org_subscription,
create_payment_information_for_org,
create_payment_information_for_user,
create_payment_intent_for_org,
create_payment_intent_for_user,
create_user_subscription,
delete_payment_information_for_org,
delete_payment_information_for_user,
delete_payment_method_for_org,
delete_payment_method_for_user,
get_org_subscription,
get_payment_balance_for_any_org,
get_payment_balance_for_any_user,
get_payment_balance_for_org,
get_payment_balance_for_user,
get_payment_information_for_org,
get_payment_information_for_user,
get_user_subscription,
list_invoices_for_org,
list_invoices_for_user,
list_payment_methods_for_org,
list_payment_methods_for_user,
update_org_subscription,
update_payment_balance_for_any_org,
update_payment_balance_for_any_user,
update_payment_information_for_org,
update_payment_information_for_user,
update_user_subscription,
validate_customer_tax_information_for_org,
validate_customer_tax_information_for_user,
};
import create_service_account_for_org from './api/service-accounts/create_service_account_for_org.js';
import delete_service_account_for_org from './api/service-accounts/delete_service_account_for_org.js';
import get_service_account_for_org from './api/service-accounts/get_service_account_for_org.js';
import list_service_accounts_for_org from './api/service-accounts/list_service_accounts_for_org.js';
export const service_accounts = {
create_service_account_for_org,
delete_service_account_for_org,
get_service_account_for_org,
list_service_accounts_for_org,
};
import create_store_coupon from './api/store/create_store_coupon.js';
export const store = { create_store_coupon };
import get_angle_unit_conversion from './api/unit/get_angle_unit_conversion.js';
import get_area_unit_conversion from './api/unit/get_area_unit_conversion.js';
import get_current_unit_conversion from './api/unit/get_current_unit_conversion.js';
@ -214,10 +264,12 @@ import get_session_for_user from './api/users/get_session_for_user.js';
import get_user from './api/users/get_user.js';
import get_user_extended from './api/users/get_user_extended.js';
import get_user_onboarding_self from './api/users/get_user_onboarding_self.js';
import get_user_privacy_settings from './api/users/get_user_privacy_settings.js';
import get_user_self from './api/users/get_user_self.js';
import get_user_self_extended from './api/users/get_user_self_extended.js';
import list_users from './api/users/list_users.js';
import list_users_extended from './api/users/list_users_extended.js';
import update_user_privacy_settings from './api/users/update_user_privacy_settings.js';
import update_user_self from './api/users/update_user_self.js';
export const users = {
delete_user_self,
@ -226,10 +278,12 @@ export const users = {
get_user,
get_user_extended,
get_user_onboarding_self,
get_user_privacy_settings,
get_user_self,
get_user_self_extended,
list_users,
list_users_extended,
update_user_privacy_settings,
update_user_self,
};

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,9 @@ async function main() {
): string => {
const separator = schema.nullable ? '?:' : ':';
const namePart = name ? `${name}${separator}` : '';
if (schema.type === 'number' && schema.format === 'double' && isRoot) {
return `${namePart} number /* use-type */`;
}
if (schema.type === 'string' && schema.enum) {
return [
addCommentInfo(