employmentRecords.js

import Resource from './resources';

/**
 * Retrieve employment records information for a specific government link.
 *
 * @extends Resource
 */
class EmploymentRecord extends Resource {
  #endpoint = 'api/employment-records/'

  /**
  * Retrieve employment records information from a specific government link.
  *
  * @async
  * @param {string} link - UUID4 representation of a link id.
  * @param {object} options - Optional parameters (saveData, attachPDF)
  * @returns {object} Response
  * @throws {RequestError}
  */
  async retrieve(link, options = {}) {
    const {
      saveData, attachPDF,
    } = options;
    const data = {
      link,
      save_data: saveData,
      attach_pdf: attachPDF,
    };
    const result = await this.session.post(this.#endpoint, data);
    return result;
  }
}

export default EmploymentRecord;