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:
Kurt Hutten
2022-08-12 19:25:16 +10:00
committed by GitHub
parent 092945ca49
commit adb5278325
148 changed files with 18681 additions and 14531 deletions

View File

@ -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;
}