export type GetApiV1WorkspacesWorkspaceIdArtifactsContentArgs = {workspace_id: string, path: string, Range?: (string | null) | undefined}; export type GetApiV1WorkspacesWorkspaceIdArtifactsContentOptions = {baseUrl: string, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * get_artifact_content * * GET /v1/workspaces/{workspace_id}/artifacts/content */ export const getApiV1WorkspacesWorkspaceIdArtifactsContent = async (args: GetApiV1WorkspacesWorkspaceIdArtifactsContentArgs, options: GetApiV1WorkspacesWorkspaceIdArtifactsContentOptions) => { const {baseUrl, fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.path != null) query.append("path", String(args.path)) if (args.Range != null) headers.set("Range", String(args.Range)) if (APIKeyHeader !== undefined) headers.set("X-API-Key", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v1/workspaces/${encodeURIComponent(String(args.workspace_id))}/artifacts/content${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };