Hierarchy

  • default
    • Jobs

Constructors

  • Parameters

    Returns Jobs

    const OneBlink = require('@oneblink/sdk')
    const options = {
    accessKey: '123455678901ABCDEFGHIJKL',
    secretKey: '123455678901ABCDEFGHIJKL123455678901ABCDEFGHIJKL',
    }
    const jobs = new OneBlink.Jobs(options)

Methods

  • Create a single Job

    Minimum Role Permission

    Jobs: Manager

    Upload Form Prefill Data: On (only if using preFillData)

    Parameters

    • data: NewFormsAppJob

      The Job to create

    • OptionalpreFillData: Record<string, unknown>

      Key/value pairs with the form field names as keys and the pre-fill data as the values

    Returns Promise<FormsAppJob>

    const newJob = {
    username: 'user@domain.io',
    formId: 1,
    externalId: 'your-job-identifier',
    details: {
    key: 'JOB-123',
    title: 'Job Title',
    description: 'Job description',
    type: 'Type',
    priority: 3,
    },
    }

    const preFillData = {
    text_element: 'abc',
    number_element: 123,
    }

    jobs.createJob(newJob, preFillData).then((job) => {
    // job.id can be used to delete the Job
    })
  • Delete a single Job

    Minimum Role Permission

    Jobs: Manager

    Parameters

    • jobId: string

      The exact id of the job you wish to delete

    Returns Promise<void>

    const jobId = 'f73985fd-2dba-4bf7-abbe-e204889f5216'
    jobs.deleteJob(jobId).then(() => {
    // Job has been deleted
    })
  • Search Jobs

    Minimum Role Permission

    Jobs: Read Only

    Parameters

    • Optionaloptions: {
          externalId?: string;
          formId?: number;
          isSubmitted?: boolean;
          limit?: number;
          offset?: number;
          username?: string;
      }

      Search options

      • OptionalexternalId?: string

        The externalId property of a job

      • OptionalformId?: number

        The formId matching the form that a job was created for

      • OptionalisSubmitted?: boolean

        Whether the job has been submitted or not

      • Optionallimit?: number

        Limit the number of jobs returned

      • Optionaloffset?: number

        Skip a specific number of results, used in conjunction with limit to enforce paging

      • Optionalusername?: string

        The username that the job was assigned to

    Returns Promise<JobsSearchResult>

    const results = await jobs.searchJobs({
    username: 'user@domain.io',
    formId: 10,
    })

    // an array of jobs
    const jobs = results.jobs