export type CreateApiImportsJmxProjectIdArgs = {projectId: string, body: BodyInit}; export type CreateApiImportsJmxProjectIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Virtual User with Scenario (optional) from JMeter JMX * * POST /imports/jmx/{projectId} */ export const createApiImportsJmxProjectId = async (args: CreateApiImportsJmxProjectIdArgs, options?: CreateApiImportsJmxProjectIdOptions) => { const {baseUrl = "https://api.octoperf.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/imports/jmx/${encodeURIComponent(String(args.projectId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };