"use strict";
// @ts-nocheck
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Runs = void 0;
const resource_js_1 = require("../core/resource.cjs");
const pagination_js_1 = require("../core/pagination.cjs");
const headers_js_1 = require("../internal/headers.cjs");
const path_js_1 = require("../internal/utils/path.cjs");
class Runs extends resource_js_1.APIResource {
    constructor() {
        super(...arguments);
        Object.defineProperty(this, "retrieve", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: this.retrieveV2
        });
        Object.defineProperty(this, "query", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: this.queryV2
        });
    }
    /**
     * **Alpha:** The request and response contract may change; Returns a paginated
     * list of runs for the given projects within min/max start_time. Supports filters,
     * cursor pagination, and `selects` to select fields to return.
     *
     * @example
     * ```ts
     * // Automatically fetches more pages as needed.
     * for await (const run of client.runs.queryV2()) {
     *   // ...
     * }
     * ```
     */
    queryV2(params, options) {
        const { Accept, ...body } = params;
        return this._client.getAPIList('/v2/runs/query', (pagination_js_1.ItemsCursorPostPagination), {
            body,
            method: 'post',
            ...options,
            headers: (0, headers_js_1.buildHeaders)([{ ...(Accept != null ? { Accept: Accept } : undefined) }, options?.headers]),
        });
    }
    /**
     * **Alpha:** The request and response contract may change; Returns one run by ID
     * for the given session and start_time. Use the `selects` query parameter
     * (repeatable) to select fields to return.
     *
     * @example
     * ```ts
     * const run = await client.runs.retrieveV2(
     *   '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
     *   {
     *     project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
     *     start_time: '2019-12-27T18:11:19.117Z',
     *   },
     * );
     * ```
     */
    retrieveV2(runID, params, options) {
        const { Accept, ...query } = params;
        return this._client.get((0, path_js_1.path) `/v2/runs/${runID}`, {
            query,
            ...options,
            headers: (0, headers_js_1.buildHeaders)([{ ...(Accept != null ? { Accept: Accept } : undefined) }, options?.headers]),
        });
    }
}
exports.Runs = Runs;
