Skip to content

Latest commit

 

History

History
290 lines (214 loc) · 24.4 KB

File metadata and controls

290 lines (214 loc) · 24.4 KB

Run

(project.run)

Overview

Run Project's exposed APIs

Available Operations

  • sync - Run API - Sync
  • start - Run API - Async Start
  • result - Run API - Async Result

sync

Runs a project API synchronously.

Example Usage

import { IntunedClient } from "@intuned/client";

const intunedClient = new IntunedClient({
  apiKey: "<YOUR_API_KEY_HERE>",
  workspaceId: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
});

async function run() {
  const result = await intunedClient.project.run.sync("my-project", {
    api: "get-contracts",
  parameters:     [
        {
          "page": 1,
          "isLastPage": false,
        },
      ],
    retry: {
      maximumAttempts: 3,
    },
    proxy: "http://username:password@domain:port",
  });

  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { IntunedClientCore } from "@intuned/client/core.js";
import { projectRunSync } from "@intuned/client/funcs/projectRunSync.js";

// Use `IntunedClientCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const intunedClient = new IntunedClientCore({
  apiKey: "<YOUR_API_KEY_HERE>",
  workspaceId: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
});

async function run() {
  const res = await projectRunSync(intunedClient, "my-project", {
    api: "get-contracts",
  parameters:     {
        "page": 1,
        "isLastPage": false,
      },
    retry: {
      maximumAttempts: 3,
    },
    proxy: "http://username:password@domain:port",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description Example
projectName string ✔️ Your project name. It is the name you provide when creating a project. [object Object]
runProjectApiRequest components.RunProjectApiRequest ✔️ run project api request
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.SyncResultResponse>

Errors

Error Object Status Code Content Type
errors.ApiErrorInvalidInput 400 application/json
errors.ApiErrorUnauthorized 401 application/json
errors.SDKError 4xx-5xx /

start

Starts a project API run operation

Example Usage

import { IntunedClient } from "@intuned/client";

const intunedClient = new IntunedClient({
  apiKey: "<YOUR_API_KEY_HERE>",
  workspaceId: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
});

async function run() {
  const result = await intunedClient.project.run.start("my-project", {
    api: "get-contracts",
  parameters:     {
        "page": 1,
        "isLastPage": false,
      },
    retry: {
      maximumAttempts: 3,
    },
    proxy: "http://username:password@domain:port",
  });

  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { IntunedClientCore } from "@intuned/client/core.js";
import { projectRunStart } from "@intuned/client/funcs/projectRunStart.js";

// Use `IntunedClientCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const intunedClient = new IntunedClientCore({
  apiKey: "<YOUR_API_KEY_HERE>",
  workspaceId: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
});

async function run() {
  const res = await projectRunStart(intunedClient, "my-project", {
    api: "get-contracts",
  parameters:     [
        {
          "page": 1,
          "isLastPage": false,
        },
      ],
    retry: {
      maximumAttempts: 3,
    },
    proxy: "http://username:password@domain:port",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description Example
projectName string ✔️ Your project name. It is the name you provide when creating a project. [object Object]
runProjectApiRequest components.RunProjectApiRequest ✔️ run project api request
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.AsyncRunPendingResponse>

Errors

Error Object Status Code Content Type
errors.ApiErrorInvalidInput 400 application/json
errors.ApiErrorUnauthorized 401 application/json
errors.SDKError 4xx-5xx /

result

Retrieves the result of a started project API run operation.

Example Usage

import { IntunedClient } from "@intuned/client";

const intunedClient = new IntunedClient({
  apiKey: "<YOUR_API_KEY_HERE>",
  workspaceId: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
});

async function run() {
  const result = await intunedClient.project.run.result("my-project", "aabbccddeeffggh");

  // Handle the result
  console.log(result)
}

run();

Standalone function

The standalone function version of this method:

import { IntunedClientCore } from "@intuned/client/core.js";
import { projectRunResult } from "@intuned/client/funcs/projectRunResult.js";

// Use `IntunedClientCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const intunedClient = new IntunedClientCore({
  apiKey: "<YOUR_API_KEY_HERE>",
  workspaceId: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
});

async function run() {
  const res = await projectRunResult(intunedClient, "my-project", "aabbccddeeffggh");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description Example
projectName string ✔️ Your project name. It is the name you provide when creating a project. [object Object]
runId string ✔️ Run ID [object Object]
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.AsyncResultResponse>

Errors

Error Object Status Code Content Type
errors.ApiErrorInvalidInput 400 application/json
errors.ApiErrorUnauthorized 401 application/json
errors.SDKError 4xx-5xx /