export type LabelDto = {name: string, color: string}; export type IoTEdgeModuleEnvironmentVariable = {name?: (string | null) | undefined, value?: (string | null) | undefined}; export type IoTEdgeModuleTwinSetting = {name?: (string | null) | undefined, value?: (string | null) | undefined}; export type IoTEdgeModuleCommand = {name?: (string | null) | undefined, edgeDeviceModelId?: (string | null) | undefined, commandId?: (string | null) | undefined, moduleName?: (string | null) | undefined}; export type IoTEdgeModule = {id?: (string | null) | undefined, moduleName: string, image: string, containerCreateOptions?: (string | null) | undefined, startupOrder?: number | undefined, status?: (string | null) | undefined, environmentVariables?: (Array | null) | undefined, moduleIdentityTwinSettings?: (Array | null) | undefined, commands?: (Array | null) | undefined, version?: (string | null) | undefined}; export type IoTEdgeRoute = {name: string, value: string, priority?: (number | null) | undefined, timeToLive?: (number | null) | undefined}; export type EdgeModelSystemModule = {name?: (string | null) | undefined, imageUri?: (string | null) | undefined, containerCreateOptions?: (string | null) | undefined, startupOrder?: number | undefined, environmentVariables?: (Array | null) | undefined}; export type IoTEdgeModel = {modelId?: (string | null) | undefined, name: string, description?: (string | null) | undefined, imageUri?: (string | null) | undefined, externalIdentifier?: (string | null) | undefined, labels?: (Array | null) | undefined, edgeModules?: (Array | null) | undefined, edgeRoutes?: (Array | null) | undefined, systemModules?: (Array | null) | undefined}; export type CreateApiApiEdgeModelsArgs = {body: IoTEdgeModel}; export type CreateApiApiEdgeModelsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /api/edge/models */ export const createApiApiEdgeModels = async (args: CreateApiApiEdgeModelsArgs, options: CreateApiApiEdgeModelsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/edge/models${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };