export type CreateApiApiLorawanDevicesDeviceIdCommandCommandIdArgs = {deviceId: string, commandId: string}; export type CreateApiApiLorawanDevicesDeviceIdCommandCommandIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Executes the command on the device.. * * POST /api/lorawan/devices/{deviceId}/_command/{commandId} */ export const createApiApiLorawanDevicesDeviceIdCommandCommandId = async (args: CreateApiApiLorawanDevicesDeviceIdCommandCommandIdArgs, options: CreateApiApiLorawanDevicesDeviceIdCommandCommandIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/api/lorawan/devices/${encodeURIComponent(String(args.deviceId))}/_command/${encodeURIComponent(String(args.commandId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };