export type CreateApiDesignImportsPlaywrightProjectIdArgs = {projectId: string, name?: string | undefined, files?: Array | undefined}; export type CreateApiDesignImportsPlaywrightProjectIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Virtual user from Playwright sources * * POST /design/imports/playwright/{projectId} */ export const createApiDesignImportsPlaywrightProjectId = async (args: CreateApiDesignImportsPlaywrightProjectIdArgs, options?: CreateApiDesignImportsPlaywrightProjectIdOptions) => { const {baseUrl = "https://api.octoperf.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.name != null) query.append("name", String(args.name)) for (const item of args.files ?? []) query.append("files", String(item)) const url = `${baseUrl.replace(/\/+$/, '')}/design/imports/playwright/${encodeURIComponent(String(args.projectId))}${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 res.blob() };