Skip to content

Latest commit

 

History

History
476 lines (393 loc) · 32.7 KB

File metadata and controls

476 lines (393 loc) · 32.7 KB

Screening

Overview

Available Operations

createScreeningOrder

Create Screening Order

Example Usage

import { StackOne } from "@stackone/stackone-client-ts";

const stackOne = new StackOne({
  security: {
    password: "",
    username: "",
  },
});

async function run() {
  const result = await stackOne.screening.createScreeningOrder({
    prefer: "heartbeat",
    screeningCreateOrderRequestDto: {
      candidate: {
        email: "john.doe@example.com",
        firstName: "John",
        lastName: "Doe",
      },
      packageId: "54321",
      passthrough: {
        "other_known_names": "John Doe",
      },
      unifiedCustomFields: {
        "my_project_custom_field_1": "REF-1236",
        "my_project_custom_field_2": "some other value",
      },
    },
    xAccountId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { StackOneCore } from "@stackone/stackone-client-ts/core.js";
import { screeningCreateScreeningOrder } from "@stackone/stackone-client-ts/funcs/screeningCreateScreeningOrder.js";

// Use `StackOneCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const stackOne = new StackOneCore({
  security: {
    password: "",
    username: "",
  },
});

async function run() {
  const res = await screeningCreateScreeningOrder(stackOne, {
    prefer: "heartbeat",
    screeningCreateOrderRequestDto: {
      candidate: {
        email: "john.doe@example.com",
        firstName: "John",
        lastName: "Doe",
      },
      packageId: "54321",
      passthrough: {
        "other_known_names": "John Doe",
      },
      unifiedCustomFields: {
        "my_project_custom_field_1": "REF-1236",
        "my_project_custom_field_2": "some other value",
      },
    },
    xAccountId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("screeningCreateScreeningOrder failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ScreeningCreateScreeningOrderRequest ✔️ The request object to use for the 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<operations.ScreeningCreateScreeningOrderResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.ForbiddenResponse 403 application/json
errors.NotFoundResponse 404 application/json
errors.RequestTimedOutResponse 408 application/json
errors.ConflictResponse 409 application/json
errors.PreconditionFailedResponse 412 application/json
errors.UnprocessableEntityResponse 422 application/json
errors.TooManyRequestsResponse 429 application/json
errors.InternalServerErrorResponse 500 application/json
errors.NotImplementedResponse 501 application/json
errors.BadGatewayResponse 502 application/json
errors.SDKError 4XX, 5XX */*

getScreeningPackage

Get Screening Package

Example Usage

import { StackOne } from "@stackone/stackone-client-ts";

const stackOne = new StackOne({
  security: {
    password: "",
    username: "",
  },
});

async function run() {
  const result = await stackOne.screening.getScreeningPackage({
    prefer: "heartbeat",
    fields: "id,remote_id,name,description,unified_custom_fields",
    id: "<id>",
    xAccountId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { StackOneCore } from "@stackone/stackone-client-ts/core.js";
import { screeningGetScreeningPackage } from "@stackone/stackone-client-ts/funcs/screeningGetScreeningPackage.js";

// Use `StackOneCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const stackOne = new StackOneCore({
  security: {
    password: "",
    username: "",
  },
});

async function run() {
  const res = await screeningGetScreeningPackage(stackOne, {
    prefer: "heartbeat",
    fields: "id,remote_id,name,description,unified_custom_fields",
    id: "<id>",
    xAccountId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("screeningGetScreeningPackage failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ScreeningGetScreeningPackageRequest ✔️ The request object to use for the 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<operations.ScreeningGetScreeningPackageResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.ForbiddenResponse 403 application/json
errors.NotFoundResponse 404 application/json
errors.RequestTimedOutResponse 408 application/json
errors.ConflictResponse 409 application/json
errors.PreconditionFailedResponse 412 application/json
errors.UnprocessableEntityResponse 422 application/json
errors.TooManyRequestsResponse 429 application/json
errors.InternalServerErrorResponse 500 application/json
errors.NotImplementedResponse 501 application/json
errors.BadGatewayResponse 502 application/json
errors.SDKError 4XX, 5XX */*

listScreeningPackages

List Screening Packages

Example Usage

import { StackOne } from "@stackone/stackone-client-ts";

const stackOne = new StackOne({
  security: {
    password: "",
    username: "",
  },
});

async function run() {
  const result = await stackOne.screening.listScreeningPackages({
    prefer: "heartbeat",
    fields: "id,remote_id,name,description,unified_custom_fields",
    filter: {
      updatedAfter: new Date("2020-01-01T00:00:00.000Z"),
    },
    xAccountId: "<id>",
  });

  for await (const page of result) {
    console.log(page);
  }
}

run();

Standalone function

The standalone function version of this method:

import { StackOneCore } from "@stackone/stackone-client-ts/core.js";
import { screeningListScreeningPackages } from "@stackone/stackone-client-ts/funcs/screeningListScreeningPackages.js";

// Use `StackOneCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const stackOne = new StackOneCore({
  security: {
    password: "",
    username: "",
  },
});

async function run() {
  const res = await screeningListScreeningPackages(stackOne, {
    prefer: "heartbeat",
    fields: "id,remote_id,name,description,unified_custom_fields",
    filter: {
      updatedAfter: new Date("2020-01-01T00:00:00.000Z"),
    },
    xAccountId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    for await (const page of result) {
    console.log(page);
  }
  } else {
    console.log("screeningListScreeningPackages failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ScreeningListScreeningPackagesRequest ✔️ The request object to use for the 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<operations.ScreeningListScreeningPackagesResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.ForbiddenResponse 403 application/json
errors.NotFoundResponse 404 application/json
errors.RequestTimedOutResponse 408 application/json
errors.ConflictResponse 409 application/json
errors.PreconditionFailedResponse 412 application/json
errors.UnprocessableEntityResponse 422 application/json
errors.TooManyRequestsResponse 429 application/json
errors.InternalServerErrorResponse 500 application/json
errors.NotImplementedResponse 501 application/json
errors.BadGatewayResponse 502 application/json
errors.SDKError 4XX, 5XX */*

webhookScreeningResult

Webhook Screening Result

Example Usage

import { StackOne } from "@stackone/stackone-client-ts";
import { Event, ScreeningResultStatus } from "@stackone/stackone-client-ts/sdk/models/shared";

const stackOne = new StackOne({
  security: {
    password: "",
    username: "",
  },
});

async function run() {
  const result = await stackOne.screening.webhookScreeningResult({
    prefer: "heartbeat",
    screeningResultWebhook: {
      data: {
        id: "8187e5da-dc77-475e-9949-af0f1fa4e4e3",
        orderId: "12345",
        remoteId: "8187e5da-dc77-475e-9949-af0f1fa4e4e3",
        resultUrl: "https://example.com/results/12345",
        score: {
          label: "Overall Risk",
          max: "100",
          min: "0",
          value: "75",
        },
        startDate: new Date("2023-01-01T00:00:00Z"),
        status: ScreeningResultStatus.Completed,
        submissionDate: new Date("2023-01-02T00:00:00Z"),
        summary: "Background check completed successfully",
        unifiedCustomFields: {
          "my_project_custom_field_1": "REF-1236",
          "my_project_custom_field_2": "some other value",
        },
      },
      event: Event.ScreeningResultsCancelled,
    },
    xAccountId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { StackOneCore } from "@stackone/stackone-client-ts/core.js";
import { screeningWebhookScreeningResult } from "@stackone/stackone-client-ts/funcs/screeningWebhookScreeningResult.js";
import { Event, ScreeningResultStatus } from "@stackone/stackone-client-ts/sdk/models/shared";

// Use `StackOneCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const stackOne = new StackOneCore({
  security: {
    password: "",
    username: "",
  },
});

async function run() {
  const res = await screeningWebhookScreeningResult(stackOne, {
    prefer: "heartbeat",
    screeningResultWebhook: {
      data: {
        id: "8187e5da-dc77-475e-9949-af0f1fa4e4e3",
        orderId: "12345",
        remoteId: "8187e5da-dc77-475e-9949-af0f1fa4e4e3",
        resultUrl: "https://example.com/results/12345",
        score: {
          label: "Overall Risk",
          max: "100",
          min: "0",
          value: "75",
        },
        startDate: new Date("2023-01-01T00:00:00Z"),
        status: ScreeningResultStatus.Completed,
        submissionDate: new Date("2023-01-02T00:00:00Z"),
        summary: "Background check completed successfully",
        unifiedCustomFields: {
          "my_project_custom_field_1": "REF-1236",
          "my_project_custom_field_2": "some other value",
        },
      },
      event: Event.ScreeningResultsCancelled,
    },
    xAccountId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("screeningWebhookScreeningResult failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ScreeningWebhookScreeningResultRequest ✔️ The request object to use for the 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<operations.ScreeningWebhookScreeningResultResponse>

Errors

Error Type Status Code Content Type
errors.BadRequestResponse 400 application/json
errors.UnauthorizedResponse 401 application/json
errors.ForbiddenResponse 403 application/json
errors.NotFoundResponse 404 application/json
errors.RequestTimedOutResponse 408 application/json
errors.ConflictResponse 409 application/json
errors.PreconditionFailedResponse 412 application/json
errors.UnprocessableEntityResponse 422 application/json
errors.TooManyRequestsResponse 429 application/json
errors.InternalServerErrorResponse 500 application/json
errors.NotImplementedResponse 501 application/json
errors.BadGatewayResponse 502 application/json
errors.SDKError 4XX, 5XX */*