export type ConfigItem = {name: string, dateCreation?: string | undefined, status?: (string | null) | undefined}; 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 LabelDto = {name: string, color: string}; export type IoTEdgeDevice = {deviceId?: (string | null) | undefined, deviceName: string, modelId: string, image?: (string | null) | undefined, connectionState?: (string | null) | undefined, scope?: (string | null) | undefined, status?: (string | null) | undefined, runtimeResponse?: (string | null) | undefined, nbDevices?: number | undefined, nbModules?: number | undefined, lastDeployment?: ConfigItem | undefined, modules?: (Array | null) | undefined, tags?: ({[key: string]: string | null} | null) | undefined, isEnabled?: boolean | undefined, labels?: (Array | null) | undefined}; export type CreateApiApiEdgeDevicesArgs = {body: IoTEdgeDevice}; export type CreateApiApiEdgeDevicesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Creates the IoT Edge device. * * POST /api/edge/devices */ export const createApiApiEdgeDevices = async (args: CreateApiApiEdgeDevicesArgs, options: CreateApiApiEdgeDevicesOptions) => { 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/devices${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 };