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:
@ -1,22 +1,31 @@
|
||||
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 {
|
||||
material_mass: string;
|
||||
src_format: string;
|
||||
client?: Client;
|
||||
material_mass: number;
|
||||
src_format: FileSourceFormat_type;
|
||||
body: string;
|
||||
}
|
||||
|
||||
type Create_file_density_return = FileDensity_type | Error_type;
|
||||
|
||||
export default async function create_file_density({
|
||||
client,
|
||||
material_mass,
|
||||
src_format,
|
||||
body,
|
||||
}: Create_file_density_params): Promise<Create_file_density_return> {
|
||||
const url = `/file/density?material_mass=${material_mass}&src_format=${src_format}`;
|
||||
const fullUrl = 'https://api.kittycad.io' + url;
|
||||
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
|
||||
const kittycadToken = client
|
||||
? client.token
|
||||
: process.env.KITTYCAD_TOKEN || '';
|
||||
const headers = {
|
||||
Authorization: `Bearer ${kittycadToken}`,
|
||||
};
|
||||
|
Reference in New Issue
Block a user