/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import { expect, test } from "vitest";
import { Vercel } from "../index.js";
import { createTestHTTPClient } from "./testclient.js";
test("Deployments Get Deployment Events", async () => {
    const testHttpClient = createTestHTTPClient("getDeploymentEvents");
    const vercel = new Vercel({
        serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
        httpClient: testHttpClient,
        bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
    });
    await vercel.deployments.getDeploymentEvents({
        idOrUrl: "dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd",
        follow: 1,
        limit: 100,
        name: "bld_cotnkcr76",
        since: 1540095775941,
        until: 1540106318643,
        statusCode: "5xx",
        delimiter: 1,
        builds: 1,
        teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
        slug: "my-team-url-slug",
    });
});
test("Deployments Update Integration Deployment Action", async () => {
    const testHttpClient = createTestHTTPClient("update-integration-deployment-action");
    const vercel = new Vercel({
        serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
        httpClient: testHttpClient,
        bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
    });
    await vercel.deployments.updateIntegrationDeploymentAction({
        deploymentId: "<id>",
        integrationConfigurationId: "<id>",
        resourceId: "<id>",
        action: "<value>",
    });
});
test("Deployments Get Deployment", async () => {
    const testHttpClient = createTestHTTPClient("getDeployment");
    const vercel = new Vercel({
        serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
        httpClient: testHttpClient,
        bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
    });
    const result = await vercel.deployments.getDeployment({
        idOrUrl: "dpl_89qyp1cskzkLrVicDaZoDbjyHuDJ",
        withGitRepoInfo: "true",
        teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
        slug: "my-team-url-slug",
    });
    expect(result).toBeDefined();
    expect(result).toEqual({
        aliasAssigned: false,
        bootedAt: 2317.28,
        buildingAt: 458.05,
        buildSkipped: true,
        creator: {
            uid: "<id>",
        },
        public: true,
        status: "ERROR",
        id: "<id>",
        name: "<value>",
        type: "LAMBDAS",
        createdAt: 3161.76,
        readyState: "READY",
        meta: {
            "key": "<value>",
            "key1": "<value>",
        },
        regions: [],
        url: "https://disloyal-backburn.info",
        version: 1604.95,
    });
});
test("Deployments Create Deployment", async () => {
    const testHttpClient = createTestHTTPClient("createDeployment");
    const vercel = new Vercel({
        serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
        httpClient: testHttpClient,
        bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
    });
    const result = await vercel.deployments.createDeployment({
        teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
        slug: "my-team-url-slug",
        requestBody: {
            deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
            files: [
                {
                    file: "folder/file.js",
                },
                {
                    file: "folder/file.js",
                },
            ],
            gitMetadata: {
                remoteUrl: "https://github.com/vercel/next.js",
                commitAuthorName: "kyliau",
                commitMessage: "add method to measure Interaction to Next Paint (INP) (#36490)",
                commitRef: "main",
                commitSha: "dc36199b2234c6586ebe05ec94078a895c707e29",
                dirty: true,
            },
            gitSource: {
                ref: "main",
                repoId: 123456789,
                sha: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0",
                type: "github",
            },
            meta: {
                "foo": "bar",
            },
            name: "my-instant-deployment",
            project: "my-deployment-project",
            projectSettings: {
                buildCommand: "next build",
                installCommand: "pnpm install",
            },
            target: "production",
        },
    });
    expect(result).toBeDefined();
    expect(result).toEqual({
        build: {
            env: [
                "<value>",
                "<value>",
                "<value>",
            ],
        },
        env: [
            "<value>",
            "<value>",
        ],
        inspectorUrl: "https://firm-casket.name/",
        isInConcurrentBuildsQueue: false,
        isInSystemBuildsQueue: false,
        projectSettings: {},
        aliasAssigned: true,
        bootedAt: 7030.55,
        buildingAt: 2916.6,
        buildSkipped: false,
        creator: {
            uid: "<id>",
        },
        public: true,
        status: "BUILDING",
        type: "LAMBDAS",
        name: "<value>",
        createdAt: 1218,
        id: "<id>",
        version: 5856.16,
        meta: {
            "key": "<value>",
            "key1": "<value>",
        },
        readyState: "CANCELED",
        regions: [
            "<value>",
        ],
        url: "https://quiet-formation.name/",
        plan: "pro",
        projectId: "<id>",
        ownerId: "<id>",
        routes: [
            {
                src: "<value>",
            },
        ],
        createdIn: "<value>",
    });
});
test("Deployments Cancel Deployment", async () => {
    const testHttpClient = createTestHTTPClient("cancelDeployment");
    const vercel = new Vercel({
        serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
        httpClient: testHttpClient,
        bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
    });
    const result = await vercel.deployments.cancelDeployment({
        id: "dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd",
        teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
        slug: "my-team-url-slug",
    });
    expect(result).toBeDefined();
    expect(result).toEqual({
        build: {
            env: [
                "<value>",
                "<value>",
                "<value>",
            ],
        },
        env: [
            "<value>",
            "<value>",
        ],
        inspectorUrl: "https://concrete-gerbil.org",
        isInConcurrentBuildsQueue: false,
        isInSystemBuildsQueue: true,
        projectSettings: {},
        aliasAssigned: false,
        bootedAt: 8528.74,
        buildingAt: 7590.79,
        buildSkipped: false,
        creator: {
            uid: "<id>",
        },
        public: true,
        status: "BUILDING",
        id: "<id>",
        createdAt: 3071.53,
        name: "<value>",
        meta: {
            "key": "<value>",
            "key1": "<value>",
            "key2": "<value>",
        },
        readyState: "QUEUED",
        regions: [
            "<value>",
        ],
        type: "LAMBDAS",
        url: "https://timely-reboot.name",
        version: 6067.47,
        createdIn: "<value>",
        ownerId: "<id>",
        plan: "pro",
        projectId: "<id>",
        routes: [
            {
                handle: "resource",
            },
            {
                src: "<value>",
                continue: true,
                middleware: 4831.29,
            },
        ],
    });
});
test("Deployments Upload File", async () => {
    const testHttpClient = createTestHTTPClient("uploadFile");
    const vercel = new Vercel({
        serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
        httpClient: testHttpClient,
        bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
    });
    const result = await vercel.deployments.uploadFile({
        teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
        slug: "my-team-url-slug",
    });
    expect(result).toBeDefined();
    expect(result).toEqual({});
});
test("Deployments List Deployment Files", async () => {
    const testHttpClient = createTestHTTPClient("listDeploymentFiles");
    const vercel = new Vercel({
        serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
        httpClient: testHttpClient,
        bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
    });
    const result = await vercel.deployments.listDeploymentFiles({
        id: "<id>",
        teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
        slug: "my-team-url-slug",
    });
    expect(result).toBeDefined();
    expect(result).toEqual([
        {
            name: "my-file.json",
            type: "file",
            uid: "2d4aad419917f15b1146e9e03ddc9bb31747e4d0",
            contentType: "application/json",
            mode: 956.43,
        },
        {
            name: "my-file.json",
            type: "file",
            uid: "2d4aad419917f15b1146e9e03ddc9bb31747e4d0",
            contentType: "application/json",
            mode: 1805.56,
        },
    ]);
});
test("Deployments Get Deployment File Contents", async () => {
    const testHttpClient = createTestHTTPClient("getDeploymentFileContents");
    const vercel = new Vercel({
        serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
        httpClient: testHttpClient,
        bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
    });
    await vercel.deployments.getDeploymentFileContents({
        id: "<id>",
        fileId: "<id>",
        teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
        slug: "my-team-url-slug",
    });
});
test("Deployments Get Deployments", async () => {
    const testHttpClient = createTestHTTPClient("getDeployments");
    const vercel = new Vercel({
        serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
        httpClient: testHttpClient,
        bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
    });
    const result = await vercel.deployments.getDeployments({
        app: "docs",
        from: 1612948664566,
        limit: 10,
        projectId: "QmXGTs7mvAMMC7WW5ebrM33qKG32QK3h4vmQMjmY",
        target: "production",
        to: 1612948664566,
        users: "kr1PsOIzqEL5Xg6M4VZcZosf,K4amb7K9dAt5R2vBJWF32bmY",
        since: 1540095775941,
        until: 1540095775951,
        state: "BUILDING,READY",
        teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
        slug: "my-team-url-slug",
    });
    expect(result).toBeDefined();
    expect(result).toEqual({
        pagination: {
            count: 20,
            next: 1540095775951,
            prev: 1540095775951,
        },
        deployments: [
            {
                uid: "dpl_2euZBFqxYdDMDG1jTrHFnNZ2eUVa",
                name: "docs",
                url: "docs-9jaeg38me.vercel.app",
                created: 1609492210000,
                defaultRoute: "/docs",
                deleted: 1609492210000,
                undeleted: 1609492210000,
                softDeletedByRetention: true,
                source: "cli",
                state: "READY",
                readyState: "READY",
                type: "LAMBDAS",
                creator: {
                    uid: "eLrCnEgbKhsHyfbiNR7E8496",
                    email: "example@example.com",
                    username: "johndoe",
                    githubLogin: "johndoe",
                    gitlabLogin: "johndoe",
                },
                target: "production",
                createdAt: 1609492210000,
                buildingAt: 1609492210000,
                ready: 1609492210000,
                inspectorUrl: "https://vercel.com/acme/nextjs/J1hXN00qjUeoYfpEEf7dnDtpSiVq",
            },
            {
                uid: "dpl_2euZBFqxYdDMDG1jTrHFnNZ2eUVa",
                name: "docs",
                url: "docs-9jaeg38me.vercel.app",
                created: 1609492210000,
                defaultRoute: "/docs",
                deleted: 1609492210000,
                undeleted: 1609492210000,
                softDeletedByRetention: true,
                source: "cli",
                state: "READY",
                readyState: "READY",
                type: "LAMBDAS",
                creator: {
                    uid: "eLrCnEgbKhsHyfbiNR7E8496",
                    email: "example@example.com",
                    username: "johndoe",
                    githubLogin: "johndoe",
                    gitlabLogin: "johndoe",
                },
                target: "production",
                createdAt: 1609492210000,
                buildingAt: 1609492210000,
                ready: 1609492210000,
                inspectorUrl: "https://vercel.com/acme/nextjs/J1hXN00qjUeoYfpEEf7dnDtpSiVq",
            },
        ],
    });
});
test("Deployments Delete Deployment", async () => {
    const testHttpClient = createTestHTTPClient("deleteDeployment");
    const vercel = new Vercel({
        serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
        httpClient: testHttpClient,
        bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
    });
    const result = await vercel.deployments.deleteDeployment({
        id: "dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd",
        url: "https://files-orcin-xi.vercel.app/",
        teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
        slug: "my-team-url-slug",
    });
    expect(result).toBeDefined();
    expect(result).toEqual({
        uid: "dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd",
        state: "DELETED",
    });
});
//# sourceMappingURL=deployments.test.js.map