### Add and Run an Example Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/CONTRIBUTING.md Add new example files to the examples/ directory and run them using the provided command. Ensure the example file is executable. ```ts // add an example to examples/.ts #!/usr/bin/env -S npm run tsn -T … ``` ```sh $ chmod +x examples/.ts # run the example against your api $ yarn tsn -T examples/.ts ``` -------------------------------- ### Install Dependencies and Build Project Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/CONTRIBUTING.md Run these commands to install all necessary dependencies and build the project output files. ```sh $ yarn $ yarn build ``` -------------------------------- ### Install SDK via Git Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/CONTRIBUTING.md Use this command to install the SDK directly from its Git repository. ```sh $ npm install git+ssh://git@github.com:parallel-web/parallel-sdk-typescript.git ``` -------------------------------- ### Install Parallel TypeScript API Library Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Install the library using npm. ```sh npm install parallel-web ``` -------------------------------- ### Start Mock Server Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/CONTRIBUTING.md Run this script to set up a mock server required for running tests against the OpenAPI spec. ```sh $ ./scripts/mock ``` -------------------------------- ### Polyfill Global Fetch Client Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Replace the global `fetch` function with a custom implementation if needed, for example, by importing and assigning it. ```typescript import fetch from 'my-fetch'; globalThis.fetch = fetch; ``` -------------------------------- ### Retrieve Task Run Input Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/api.md Gets the input parameters used for a specific task run. ```APIDOC ## GET /v1/tasks/runs/{run_id}/input ### Description Retrieves the input used for a specific task run. ### Method GET ### Endpoint /v1/tasks/runs/{run_id}/input ### Parameters #### Path Parameters - **run_id** (string) - Required - The ID of the task run. ### Response #### Success Response (200) - **RunInput** - The input object for the task run. ``` -------------------------------- ### Get FindAll Run Schema Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Retrieves the schema associated with a specific FindAll run. ```APIDOC ## GET /v1beta/findall/runs/{findall_id}/schema ### Description Retrieves the schema for a specific FindAll run. ### Method GET ### Endpoint /v1beta/findall/runs/{findall_id}/schema ### Parameters #### Path Parameters - **findall_id** (string) - Required - The ID of the FindAll run. #### Query Parameters - **params** (object) - Optional - Additional parameters for retrieving the schema. ### Request Example ```json { "example": "client.beta.findall.schema(findallID, { ...params })" } ``` ### Response #### Success Response (200) - **FindAllSchema** (object) - The schema of the FindAll run. ### Response Example ```json { "example": "FindAllSchema" } ``` ``` -------------------------------- ### Get FindAll Run Events Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Retrieves events associated with a specific FindAll run. ```APIDOC ## GET /v1beta/findall/runs/{findall_id}/events ### Description Fetches events related to a specific FindAll run. ### Method GET ### Endpoint /v1beta/findall/runs/{findall_id}/events ### Parameters #### Path Parameters - **findall_id** (string) - Required - The ID of the FindAll run. #### Query Parameters - **params** (object) - Optional - Additional parameters for fetching events. ### Request Example ```json { "example": "client.beta.findall.events(findallID, { ...params })" } ``` ### Response #### Success Response (200) - **FindAllEventsResponse** (object) - The response containing the events. ### Response Example ```json { "example": "FindAllEventsResponse" } ``` ``` -------------------------------- ### Retrieve Task Run Events Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/api.md Gets all events associated with a specific task run. ```APIDOC ## GET /v1/tasks/runs/{run_id}/events ### Description Retrieves all events for a given task run ID. ### Method GET ### Endpoint /v1/tasks/runs/{run_id}/events ### Parameters #### Path Parameters - **run_id** (string) - Required - The ID of the task run. ### Response #### Success Response (200) - **TaskRunEventsResponse** - A response object containing task run events. ``` -------------------------------- ### Access Raw Response Data with .asResponse() Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Use `.asResponse()` to get the raw `Response` object. This method returns immediately after headers are received and does not consume the body, allowing for custom parsing or streaming. ```typescript const client = new Parallel(); const response = await client.taskRun .create({ input: 'What was the GDP of France in 2023?', processor: 'base' }) .asResponse(); console.log(response.headers.get('X-My-Header')); console.log(response.statusText); // access the underlying Response object ``` -------------------------------- ### Get FindAll Run Result Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Retrieves the final result of a completed FindAll run. ```APIDOC ## GET /v1beta/findall/runs/{findall_id}/result ### Description Retrieves the result of a completed FindAll run. ### Method GET ### Endpoint /v1beta/findall/runs/{findall_id}/result ### Parameters #### Path Parameters - **findall_id** (string) - Required - The ID of the FindAll run. #### Query Parameters - **params** (object) - Optional - Additional parameters for retrieving the result. ### Request Example ```json { "example": "client.beta.findall.result(findallID, { ...params })" } ``` ### Response #### Success Response (200) - **FindAllRunResult** (object) - The result of the FindAll run. ### Response Example ```json { "example": "FindAllRunResult" } ``` ``` -------------------------------- ### Add Undocumented Request Parameter Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Use `// @ts-expect-error` to add undocumented parameters to requests. For GET requests, extra parameters go to the query; for others, they go to the body. ```typescript client.taskRun.create({ // ... // @ts-expect-error baz is not yet public baz: 'undocumented option', }); ``` -------------------------------- ### Initialize Parallel Client and Create Task Run Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Initialize the Parallel client with an API key and create a task run. The API key is read from the environment variable PARALLEL_API_KEY by default. ```js import Parallel from 'parallel-web'; const client = new Parallel({ apiKey: process.env['PARALLEL_API_KEY'], // This is the default and can be omitted }); const taskRun = await client.taskRun.create({ input: 'What was the GDP of France in 2023?', processor: 'base', }); console.log(taskRun.interaction_id); ``` -------------------------------- ### Run Tests Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/CONTRIBUTING.md Execute the project's test suite. ```sh $ yarn run test ``` -------------------------------- ### Instantiate Client with Fetch Options Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Provide a `fetchOptions` object when instantiating the client to set custom fetch options. These options apply to all requests made by the client. ```typescript import Parallel from 'parallel-web'; const client = new Parallel({ fetchOptions: { // `RequestInit` options }, }); ``` -------------------------------- ### Create Task Run Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/api.md Initiates a new task run with the specified parameters. ```APIDOC ## POST /v1/tasks/runs ### Description Creates a new task run. ### Method POST ### Endpoint /v1/tasks/runs ### Request Body - **params** (object) - Required - Parameters for creating the task run. ### Request Example ```json { "params": { ... } } ``` ### Response #### Success Response (200) - **TaskRun** - The created task run object. ``` -------------------------------- ### Configure Deno Proxy Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Configure proxy behavior for Deno environments by providing a `fetchOptions` object with a custom `client` created using `Deno.createHttpClient`. This allows for detailed proxy configuration. ```typescript import Parallel from 'npm:parallel-web'; const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } }); const client = new Parallel({ fetchOptions: { client: httpClient, }, }); ``` -------------------------------- ### client.beta.taskRun.create Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Creates a new task run. This method is part of the beta task run API. ```APIDOC ## POST /v1/tasks/runs ### Description Creates a new task run. ### Method POST ### Endpoint /v1/tasks/runs ### Request Body - **params** (object) - Required - Parameters for creating the task run. ### Response #### Success Response (200) - **TaskRun** (object) - The created task run. ``` -------------------------------- ### Configure Bun Proxy Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Configure proxy behavior for Bun environments by providing a `fetchOptions` object with a `proxy` string. This is a simpler configuration specific to Bun. ```typescript import Parallel from 'parallel-web'; const client = new Parallel({ fetchOptions: { proxy: 'http://localhost:8888', }, }); ``` -------------------------------- ### Link Local Repository with PNPM Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/CONTRIBUTING.md Steps to link a local clone of the repository using PNPM for development purposes. This involves linking the SDK globally and then linking it into your project's package. ```sh # With pnpm $ pnpm link --global $ cd ../my-package $ pnpm link --global parallel-web ``` -------------------------------- ### client.beta.taskGroup.create Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Creates a new task group. This method is part of the beta task group API. ```APIDOC ## POST /v1beta/tasks/groups ### Description Creates a new task group. ### Method POST ### Endpoint /v1beta/tasks/groups ### Request Body - **params** (object) - Required - Parameters for creating the task group. ### Response #### Success Response (200) - **TaskGroup** (object) - The created task group. ``` -------------------------------- ### Create FindAll Run Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Initiates a new FindAll run. This is an asynchronous operation. ```APIDOC ## POST /v1beta/findall/runs ### Description Creates a new FindAll run. ### Method POST ### Endpoint /v1beta/findall/runs ### Request Body - **params** (object) - Required - Parameters for the FindAll run. ### Request Example ```json { "example": "client.beta.findall.create({ ...params })" } ``` ### Response #### Success Response (200) - **FindAllRun** (object) - Details of the created FindAll run. ### Response Example ```json { "example": "FindAllRun" } ``` ``` -------------------------------- ### Configure Custom Logger with Pino Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Provide a custom logger instance, such as one from 'pino', to the client options. The `logLevel` option still dictates which messages are emitted. ```typescript import Parallel from 'parallel-web'; import pino from 'pino'; const logger = pino(); const client = new Parallel({ logger: logger.child({ name: 'Parallel' }), logLevel: 'debug', // Send all messages to pino, allowing it to filter }); ``` -------------------------------- ### Pass Custom Fetch Client to Parallel SDK Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Instantiate the Parallel client with a custom `fetch` function provided via the constructor options. ```typescript import Parallel from 'parallel-web'; import fetch from 'my-fetch'; const client = new Parallel({ fetch }); ``` -------------------------------- ### Configure Node.js Proxy with Undici Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Configure proxy behavior for Node.js environments by providing a `fetchOptions` object with an `undici.ProxyAgent` dispatcher. This requires the `undici` package. ```typescript import Parallel from 'parallel-web'; import * as undici from 'undici'; const proxyAgent = new undici.ProxyAgent('http://localhost:8888'); const client = new Parallel({ fetchOptions: { dispatcher: proxyAgent, }, }); ``` -------------------------------- ### Publish NPM Package Manually Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/CONTRIBUTING.md Manually publish the package to npm by running the provided script with an NPM_TOKEN environment variable set. ```sh bin/publish-npm ``` -------------------------------- ### Link Local Repository with Yarn Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/CONTRIBUTING.md Steps to link a local clone of the repository using Yarn for development purposes. This involves linking the SDK globally and then linking it into your project's package. ```sh # Clone $ git clone https://www.github.com/parallel-web/parallel-sdk-typescript $ cd parallel-sdk-typescript # With yarn $ yarn link $ cd ../my-package $ yarn link parallel-web ``` -------------------------------- ### Monitor Management Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/api.md Methods for creating, retrieving, updating, listing, and canceling Monitors. ```APIDOC ## POST /v1/monitors ### Description Creates a new Monitor. ### Method POST ### Endpoint /v1/monitors ### Parameters #### Request Body - **params** (object) - Required - Parameters for creating the Monitor. ### Response #### Success Response (200) - **Monitor** (object) - Details of the created Monitor. ``` ```APIDOC ## GET /v1/monitors/{monitor_id} ### Description Retrieves a specific Monitor by its ID. ### Method GET ### Endpoint /v1/monitors/{monitor_id} ### Parameters #### Path Parameters - **monitor_id** (string) - Required - The ID of the Monitor to retrieve. ### Response #### Success Response (200) - **Monitor** (object) - Details of the retrieved Monitor. ``` ```APIDOC ## POST /v1/monitors/{monitor_id}/update ### Description Updates an existing Monitor. ### Method POST ### Endpoint /v1/monitors/{monitor_id}/update ### Parameters #### Path Parameters - **monitor_id** (string) - Required - The ID of the Monitor to update. #### Request Body - **params** (object) - Required - Parameters for updating the Monitor. ### Response #### Success Response (200) - **Monitor** (object) - Details of the updated Monitor. ``` ```APIDOC ## GET /v1/monitors ### Description Lists all Monitors. ### Method GET ### Endpoint /v1/monitors ### Parameters #### Query Parameters - **params** (object) - Optional - Parameters for filtering or paginating the list of Monitors. ### Response #### Success Response (200) - **PaginatedMonitorResponse** (object) - A paginated list of Monitors. ``` ```APIDOC ## POST /v1/monitors/{monitor_id}/cancel ### Description Cancels a running Monitor. ### Method POST ### Endpoint /v1/monitors/{monitor_id}/cancel ### Parameters #### Path Parameters - **monitor_id** (string) - Required - The ID of the Monitor to cancel. ### Response #### Success Response (200) - **Monitor** (object) - Details of the canceled Monitor. ``` ```APIDOC ## GET /v1/monitors/{monitor_id}/events ### Description Retrieves events for a specific Monitor. ### Method GET ### Endpoint /v1/monitors/{monitor_id}/events ### Parameters #### Path Parameters - **monitor_id** (string) - Required - The ID of the Monitor. #### Query Parameters - **params** (object) - Optional - Parameters for filtering events. ### Response #### Success Response (200) - **PaginatedMonitorEvents** (object) - A paginated list of events for the Monitor. ``` ```APIDOC ## POST /v1/monitors/{monitor_id}/trigger ### Description Triggers a specific Monitor. ### Method POST ### Endpoint /v1/monitors/{monitor_id}/trigger ### Parameters #### Path Parameters - **monitor_id** (string) - Required - The ID of the Monitor to trigger. ### Response #### Success Response (200) - **void** (empty) - Indicates the trigger was successful. ``` -------------------------------- ### Lint Code Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/CONTRIBUTING.md Run the linter to check for code style issues. ```sh $ yarn lint ``` -------------------------------- ### Use TypeScript Definitions for Request and Response Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Utilize TypeScript definitions for request parameters and response fields to ensure type safety. Import `TaskRunCreateParams` for request parameters and `TaskRun` for the response object. ```ts import Parallel from 'parallel-web'; const client = new Parallel({ apiKey: process.env['PARALLEL_API_KEY'], // This is the default and can be omitted }); const params: Parallel.TaskRunCreateParams = { input: 'What was the GDP of France in 2023?', processor: 'base', }; const taskRun: Parallel.TaskRun = await client.taskRun.create(params); ``` -------------------------------- ### TaskGroup Management Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/api.md Methods for creating, retrieving, and managing TaskGroups and their runs. ```APIDOC ## POST /v1/tasks/groups ### Description Creates a new TaskGroup. ### Method POST ### Endpoint /v1/tasks/groups ### Parameters #### Request Body - **params** (object) - Required - Parameters for creating the TaskGroup. ### Response #### Success Response (200) - **TaskGroup** (object) - Details of the created TaskGroup. ``` ```APIDOC ## GET /v1/tasks/groups/{taskgroup_id} ### Description Retrieves a specific TaskGroup by its ID. ### Method GET ### Endpoint /v1/tasks/groups/{taskgroup_id} ### Parameters #### Path Parameters - **taskgroup_id** (string) - Required - The ID of the TaskGroup to retrieve. ### Response #### Success Response (200) - **TaskGroup** (object) - Details of the retrieved TaskGroup. ``` ```APIDOC ## POST /v1/tasks/groups/{taskgroup_id}/runs ### Description Adds runs to an existing TaskGroup. ### Method POST ### Endpoint /v1/tasks/groups/{taskgroup_id}/runs ### Parameters #### Path Parameters - **taskgroup_id** (string) - Required - The ID of the TaskGroup to add runs to. #### Request Body - **params** (object) - Required - Parameters for adding runs. ### Response #### Success Response (200) - **TaskGroupRunResponse** (object) - Response indicating the status of adding runs. ``` ```APIDOC ## GET /v1/tasks/groups/{taskgroup_id}/events ### Description Retrieves events for a specific TaskGroup. ### Method GET ### Endpoint /v1/tasks/groups/{taskgroup_id}/events ### Parameters #### Path Parameters - **taskgroup_id** (string) - Required - The ID of the TaskGroup. #### Query Parameters - **params** (object) - Optional - Parameters for filtering events. ### Response #### Success Response (200) - **TaskGroupEventsResponse** (object) - A list of events for the TaskGroup. ``` ```APIDOC ## GET /v1/tasks/groups/{taskgroup_id}/runs ### Description Retrieves all runs for a specific TaskGroup. ### Method GET ### Endpoint /v1/tasks/groups/{taskgroup_id}/runs ### Parameters #### Path Parameters - **taskgroup_id** (string) - Required - The ID of the TaskGroup. #### Query Parameters - **params** (object) - Optional - Parameters for filtering runs. ### Response #### Success Response (200) - **TaskGroupGetRunsResponse** (object) - A list of runs for the TaskGroup. ``` ```APIDOC ## GET /v1/tasks/groups/{taskgroup_id}/runs/{run_id} ### Description Retrieves a specific run of a TaskGroup. ### Method GET ### Endpoint /v1/tasks/groups/{taskgroup_id}/runs/{run_id} ### Parameters #### Path Parameters - **taskgroup_id** (string) - Required - The ID of the TaskGroup. - **run_id** (string) - Required - The ID of the run. ### Response #### Success Response (200) - **TaskRun** (object) - Details of the specific run. ``` -------------------------------- ### Find All Candidates Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Retrieves a list of candidates based on specified criteria. ```APIDOC ## POST /v1beta/findall/candidates ### Description Finds candidates based on the provided request parameters. ### Method POST ### Endpoint /v1beta/findall/candidates ### Request Body - **params** (object) - Required - Parameters for finding candidates. ### Request Example ```json { "example": "client.beta.findall.candidates({ ...params })" } ``` ### Response #### Success Response (200) - **FindAllCandidatesResponse** (object) - The response containing the list of candidates. ### Response Example ```json { "example": "FindAllCandidatesResponse" } ``` ``` -------------------------------- ### Ingest Data for FindAll Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Ingests data into the FindAll system. ```APIDOC ## POST /v1beta/findall/ingest ### Description Ingests data for the FindAll process. ### Method POST ### Endpoint /v1beta/findall/ingest ### Request Body - **params** (object) - Required - The data to ingest. ### Request Example ```json { "example": "client.beta.findall.ingest({ ...params })" } ``` ### Response #### Success Response (200) - **FindAllSchema** (object) - The schema resulting from the ingestion. ### Response Example ```json { "example": "FindAllSchema" } ``` ``` -------------------------------- ### Format and Fix Lint Issues Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/CONTRIBUTING.md Automatically format the code and fix any linting issues found. ```sh $ yarn fix ``` -------------------------------- ### Extend FindAll Run Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Extends a FindAll run, potentially with updated parameters or schema. ```APIDOC ## POST /v1beta/findall/runs/{findall_id}/extend ### Description Extends an existing FindAll run. ### Method POST ### Endpoint /v1beta/findall/runs/{findall_id}/extend ### Parameters #### Path Parameters - **findall_id** (string) - Required - The ID of the FindAll run to extend. #### Query Parameters - **params** (object) - Optional - Parameters for extending the run. ### Request Example ```json { "example": "client.beta.findall.extend(findallID, { ...params })" } ``` ### Response #### Success Response (200) - **FindAllSchema** (object) - The schema information after extension. ### Response Example ```json { "example": "FindAllSchema" } ``` ``` -------------------------------- ### client.beta.extract Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Extracts information from a given URL. This method is part of the beta API. ```APIDOC ## POST /v1beta/extract ### Description Extracts information from a given URL. ### Method POST ### Endpoint /v1beta/extract ### Request Body - **params** (object) - Required - Parameters for the extraction. ### Response #### Success Response (200) - **ExtractResponse** (object) - The response containing extracted information. ``` -------------------------------- ### Configure Log Level with Client Option Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Set the `logLevel` option during client initialization to control the verbosity of log messages. This overrides the `PARALLEL_LOG` environment variable. ```typescript import Parallel from 'parallel-web'; const client = new Parallel({ logLevel: 'debug', // Show all log messages }); ``` -------------------------------- ### client.beta.taskGroup.addRuns Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Adds runs to an existing task group. This method is part of the beta task group API. ```APIDOC ## POST /v1beta/tasks/groups/{taskgroup_id}/runs ### Description Adds runs to an existing task group. ### Method POST ### Endpoint /v1beta/tasks/groups/{taskgroup_id}/runs ### Parameters #### Path Parameters - **taskgroup_id** (string) - Required - The ID of the task group. ### Request Body - **params** (object) - Required - Parameters for adding runs to the task group. ### Response #### Success Response (200) - **TaskGroupRunResponse** (object) - The response indicating the runs were added. ``` -------------------------------- ### client.beta.search Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Performs a search operation. This method is part of the beta API. ```APIDOC ## POST /v1beta/search ### Description Performs a search operation. ### Method POST ### Endpoint /v1beta/search ### Request Body - **params** (object) - Required - Parameters for the search. ### Response #### Success Response (200) - **SearchResult** (object) - The search results. ``` -------------------------------- ### Configure Default Request Timeout Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Set the default timeout for all API requests in milliseconds using the `timeout` option during client initialization. The default is 1 minute. ```ts // Configure the default for all requests: const client = new Parallel({ timeout: 20 * 1000, // 20 seconds (default is 1 minute) }); ``` -------------------------------- ### client.beta.taskRun.events Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Retrieves events for a specific task run. This method is part of the beta task run API. ```APIDOC ## GET /v1beta/tasks/runs/{run_id}/events ### Description Retrieves events for a specific task run. ### Method GET ### Endpoint /v1beta/tasks/runs/{run_id}/events ### Parameters #### Path Parameters - **run_id** (string) - Required - The ID of the task run. ### Response #### Success Response (200) - **TaskRunEventsResponse** (object) - The events for the task run. ``` -------------------------------- ### client.beta.taskRun.result Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Retrieves the result of a specific task run. This method is part of the beta task run API. ```APIDOC ## GET /v1/tasks/runs/{run_id}/result ### Description Retrieves the result of a specific task run. ### Method GET ### Endpoint /v1/tasks/runs/{run_id}/result ### Parameters #### Path Parameters - **run_id** (string) - Required - The ID of the task run. #### Query Parameters - **params** (object) - Optional - Parameters for retrieving the result. ### Response #### Success Response (200) - **TaskRunResult** (object) - The result of the task run. ``` -------------------------------- ### Retrieve FindAll Run Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Fetches the details of a specific FindAll run using its ID. ```APIDOC ## GET /v1beta/findall/runs/{findall_id} ### Description Retrieves a specific FindAll run by its ID. ### Method GET ### Endpoint /v1beta/findall/runs/{findall_id} ### Parameters #### Path Parameters - **findall_id** (string) - Required - The unique identifier of the FindAll run. #### Query Parameters - **params** (object) - Optional - Additional parameters for the retrieval. ### Request Example ```json { "example": "client.beta.findall.retrieve(findallID, { ...params })" } ``` ### Response #### Success Response (200) - **FindAllRun** (object) - Details of the requested FindAll run. ### Response Example ```json { "example": "FindAllRun" } ``` ``` -------------------------------- ### Configure Default Max Retries for API Requests Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Configure the default number of retries for all API requests by setting the `maxRetries` option during client initialization. Set to 0 to disable retries. ```js // Configure the default for all requests: const client = new Parallel({ maxRetries: 0, // default is 2 }); ``` -------------------------------- ### Access Raw Response and Parsed Data with .withResponse() Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Use `.withResponse()` to obtain both the raw `Response` object and the parsed data. This method consumes the response body and returns once parsing is complete. ```typescript const { data: taskRun, response: raw } = await client.taskRun .create({ input: 'What was the GDP of France in 2023?', processor: 'base' }) .withResponse(); console.log(raw.headers.get('X-My-Header')); console.log(taskRun.interaction_id); ``` -------------------------------- ### Enrich FindAll Run Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Enriches a FindAll run with additional schema information. ```APIDOC ## POST /v1beta/findall/runs/{findall_id}/enrich ### Description Enriches a FindAll run with additional data or schema. ### Method POST ### Endpoint /v1beta/findall/runs/{findall_id}/enrich ### Parameters #### Path Parameters - **findall_id** (string) - Required - The ID of the FindAll run to enrich. #### Query Parameters - **params** (object) - Optional - Parameters for enrichment. ### Request Example ```json { "example": "client.beta.findall.enrich(findallID, { ...params })" } ``` ### Response #### Success Response (200) - **FindAllSchema** (object) - The updated schema information. ### Response Example ```json { "example": "FindAllSchema" } ``` ``` -------------------------------- ### Retrieve Task Run Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/api.md Fetches details of a specific task run using its ID. ```APIDOC ## GET /v1/tasks/runs/{run_id} ### Description Retrieves a specific task run by its ID. ### Method GET ### Endpoint /v1/tasks/runs/{run_id} ### Parameters #### Path Parameters - **run_id** (string) - Required - The ID of the task run to retrieve. ### Response #### Success Response (200) - **TaskRun** - The requested task run object. ``` -------------------------------- ### client.beta.taskGroup.getRuns Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Retrieves all runs associated with a specific task group. This method is part of the beta task group API. ```APIDOC ## GET /v1beta/tasks/groups/{taskgroup_id}/runs ### Description Retrieves all runs associated with a specific task group. ### Method GET ### Endpoint /v1beta/tasks/groups/{taskgroup_id}/runs ### Parameters #### Path Parameters - **taskgroup_id** (string) - Required - The ID of the task group. #### Query Parameters - **params** (object) - Optional - Parameters for filtering or paginating runs. ### Response #### Success Response (200) - **TaskGroupGetRunsResponse** (object) - The list of runs for the task group. ``` -------------------------------- ### Search Data Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/api.md Utilize the `search` method to find relevant information within the dataset. ```APIDOC ## POST /v1/search ### Description Searches for information based on the provided query. ### Method POST ### Endpoint /v1/search ### Request Body - **params** (object) - Required - Parameters for the search query. ### Request Example ```json { "params": { ... } } ``` ### Response #### Success Response (200) - **SearchResult** - The response containing search results. ``` -------------------------------- ### Retrieve Task Run Result Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/api.md Fetches the result of a specific task run. ```APIDOC ## GET /v1/tasks/runs/{run_id}/result ### Description Retrieves the result of a specific task run. ### Method GET ### Endpoint /v1/tasks/runs/{run_id}/result ### Parameters #### Path Parameters - **run_id** (string) - Required - The ID of the task run. #### Query Parameters - **params** (object) - Optional - Additional parameters for retrieving the result. ### Response #### Success Response (200) - **TaskRunResult** - The result of the task run. ``` -------------------------------- ### client.beta.taskGroup.events Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Retrieves events for a specific task group. This method is part of the beta task group API. ```APIDOC ## GET /v1beta/tasks/groups/{taskgroup_id}/events ### Description Retrieves events for a specific task group. ### Method GET ### Endpoint /v1beta/tasks/groups/{taskgroup_id}/events ### Parameters #### Path Parameters - **taskgroup_id** (string) - Required - The ID of the task group. #### Query Parameters - **params** (object) - Optional - Parameters for filtering events. ### Response #### Success Response (200) - **TaskGroupEventsResponse** (object) - The events for the task group. ``` -------------------------------- ### client.beta.taskGroup.retrieve Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Retrieves a specific task group by its ID. This method is part of the beta task group API. ```APIDOC ## GET /v1beta/tasks/groups/{taskgroup_id} ### Description Retrieves a specific task group by its ID. ### Method GET ### Endpoint /v1beta/tasks/groups/{taskgroup_id} ### Parameters #### Path Parameters - **taskgroup_id** (string) - Required - The ID of the task group. ### Response #### Success Response (200) - **TaskGroup** (object) - The task group details. ``` -------------------------------- ### Make Undocumented POST Request Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Use `client.post` for making requests to undocumented endpoints. Options like retries are automatically applied. ```typescript await client.post('/some/path', { body: { some_prop: 'foo' }, query: { some_query_arg: 'bar' }, }); ``` -------------------------------- ### Extract Data Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/api.md Use the `extract` method to process and extract information from provided data. ```APIDOC ## POST /v1/extract ### Description Extracts information from the provided data. ### Method POST ### Endpoint /v1/extract ### Request Body - **params** (object) - Required - Parameters for the extraction process. ### Request Example ```json { "params": { ... } } ``` ### Response #### Success Response (200) - **ExtractResponse** - The response containing extracted information. ``` -------------------------------- ### Configure Per-Request Max Retries Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Override the default retry behavior for a specific API request by providing the `maxRetries` option in the request options. ```js // Or, configure per-request: await client.taskRun.create({ input: 'What was the GDP of France in 2023?', processor: 'base' }, { maxRetries: 5, }); ``` -------------------------------- ### Configure Per-Request Timeout Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Override the default timeout for a specific API request by providing the `timeout` option in the request options. Note that timed-out requests are retried twice by default. ```ts // Override per-request: await client.taskRun.create({ input: 'What was the GDP of France in 2023?', processor: 'base' }, { timeout: 5 * 1000, }); ``` -------------------------------- ### Handle API Errors with Catch Block Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/README.md Catch API errors by checking if the error is an instance of `Parallel.APIError`. Access properties like `status`, `name`, and `headers` for detailed error information. ```ts const taskRun = await client.taskRun .create({ input: 'What was the GDP of France in 2023?', processor: 'base' }) .catch(async (err) => { if (err instanceof Parallel.APIError) { console.log(err.status); // 400 console.log(err.name); // BadRequestError console.log(err.headers); // {server: 'nginx', ...} } else { throw err; } }); ``` -------------------------------- ### Cancel FindAll Run Source: https://github.com/parallel-web/parallel-sdk-typescript/blob/main/src/resources/beta/api.md Cancels an ongoing FindAll run. ```APIDOC ## POST /v1beta/findall/runs/{findall_id}/cancel ### Description Cancels a running FindAll process. ### Method POST ### Endpoint /v1beta/findall/runs/{findall_id}/cancel ### Parameters #### Path Parameters - **findall_id** (string) - Required - The ID of the FindAll run to cancel. #### Query Parameters - **params** (object) - Optional - Additional parameters for cancellation. ### Request Example ```json { "example": "client.beta.findall.cancel(findallID, { ...params })" } ``` ### Response #### Success Response (200) - **void** - Indicates successful cancellation. ### Response Example ```json { "example": "void" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.