Skip to content

Improve API usability #7

@Yann-P

Description

@Yann-P

Some API functions accept a large number of optional arguments, like

public async applicationsList (xAccountToken: string, candidateId?: string, createdAfter?: Date, createdBefore?: Date, creditedToId?: string, currentStageId?: string, cursor?: string, expand?: 'candidate' | 'candidate,credited_to' | 'candidate,credited_to,current_stage' | 'candidate,credited_to,current_stage,reject_reason' | 'candidate,credited_to,reject_reason' | 'candidate,current_stage' | 'candidate,current_stage,reject_reason' | 'candidate,job' | 'candidate,job,credited_to' | 'candidate,job,credited_to,current_stage' | 'candidate,job,credited_to,current_stage,reject_reason' | 'candidate,job,credited_to,reject_reason' | 'candidate,job,current_stage' | 'candidate,job,current_stage,reject_reason' | 'candidate,job,reject_reason' | 'candidate,reject_reason' | 'credited_to' | 'credited_to,current_stage' | 'credited_to,current_stage,reject_reason' | 'credited_to,reject_reason' | 'current_stage' | 'current_stage,reject_reason' | 'job' | 'job,credited_to' | 'job,credited_to,current_stage' | 'job,credited_to,current_stage,reject_reason' | 'job,credited_to,reject_reason' | 'job,current_stage' | 'job,current_stage,reject_reason' | 'job,reject_reason' | 'reject_reason', includeRemoteData?: boolean, jobId?: string, modifiedAfter?: Date, modifiedBefore?: Date, pageSize?: number, rejectReasonId?: string, remoteId?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: PaginatedApplicationList;  }> 

(https://github.com/merge-api/merge-ats-node/blob/9a10a0fd8d230977ed5fac56bac5990c9fddbe15/api/applicationsApi.ts)

We need to filter by modifiedAfter so we have to use it like this:

await applicationsList(token, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, modifiedAfter)

It would be more practical to accept an object so we can simply call

await applicationsList({ xAccountToken, modifiedAfter }) or await applicationsList(xAccountToken, { modifiedAfter })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions