Skip to content

Latest commit

 

History

History
37 lines (31 loc) · 1.49 KB

File metadata and controls

37 lines (31 loc) · 1.49 KB

List Employees

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

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

async function run() {
  const result = await stackOne.hris.listEmployees({
    prefer: "heartbeat",
    expand: "company,employments,work_location,home_location,groups,skills",
    fields:
      "id,remote_id,title,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,bank_details,skills,unified_custom_fields",
    filter: {
      updatedAfter: new Date("2020-01-01T00:00:00.000Z"),
    },
    include:
      "avatar_url,avatar,custom_fields,job_description,benefits,bank_details",
    updatedAfter: new Date("2020-01-01T00:00:00.000Z"),
    xAccountId: "<id>",
  });

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

run();