import {z} from 'zod' export type ValidationResult = {MemberNames?: Array | undefined, ErrorMessage?: string | undefined}; export type HiringCandidateDriverRecordRequestApi = {FirstName?: string | undefined, MiddleName?: string | undefined, LastName?: string | undefined, DriverLicenseNum?: string | undefined, DriverLicenseState?: string | undefined, ValidationErrors?: Array | undefined}; export type HiringCandidateDrugTestRequestApi = {PhoneDayTime?: string | undefined, PhoneEvening?: string | undefined, DrugTestProviderRegistrationId?: string | undefined, DrugTestProviderOrderId?: string | undefined, Gender?: string | undefined}; export type HiringCandidateEmploymentRequestApi = {CompanyName?: string | undefined, Title?: string | undefined, Salary?: string | undefined, Alias?: string | undefined, ReasonForLeaving?: string | undefined, EmployerContactFullName?: string | undefined, EmployerContactPhone?: string | undefined, ContactEmail?: string | undefined, StartMonth?: number | undefined, StartYear?: number | undefined, EndMonth?: number | undefined, EndYear?: number | undefined, IsCurrentlyEmployed?: boolean | undefined, CompanyAddress?: string | undefined, City?: string | undefined, State?: string | undefined, Comments?: string | undefined}; export type HiringCandidateLegalLocationRequestApi = {City?: string | undefined, State?: string | undefined, ZIP?: string | undefined, County?: string | undefined, ValidationErrors?: Array | undefined}; export type HiringCandidateCriminalStateRequestApi = {State?: string | undefined, ValidationErrors?: Array | undefined}; export type HiringCandidateLicenseRequestApi = {LicenseType?: string | undefined, StateIssued?: string | undefined, LicenseAuthorityName?: string | undefined, LicenseAuthorityPhone?: string | undefined, LicenseNumber?: string | undefined, IssuedDate?: string | undefined, ExpirationDate?: string | undefined, Status?: string | undefined, ApplicantPhoneNumber?: string | undefined, ValidationErrors?: Array | undefined}; export type HiringCandidateSchoolRequestApi = {InstitutionName?: string | undefined, Address?: string | undefined, City?: string | undefined, Region?: string | undefined, PostalCode?: string | undefined, Country?: string | undefined, Telephone?: string | undefined, Fax?: string | undefined, EnrollmentName?: string | undefined, Degree?: string | undefined, StudyMajor?: string | undefined, EnrollmentStartMonth?: number | undefined, EnrollmentStartYear?: number | undefined, GraduationMonth?: number | undefined, GraduationYear?: number | undefined, IsCurrentlyEnrolled?: boolean | undefined, Comments?: string | undefined}; export type HiringCandidateInternationalCriminalRequestApi = {Country: string}; export type HiringCandidateAliasRequestApi = {FirstName?: string | undefined, MiddleName?: string | undefined, LastName: string, ValidationErrors?: Array | undefined}; export type HiringCandidateRequestApi = {FirstName: string, MiddleName?: string | undefined, LastName: string, Email: string, SSN?: string | undefined, NPI?: string | undefined, ReferenceCode?: string | undefined, BillingCode?: string | undefined, DateOfBirth?: string | undefined, Phone: string, PhoneType: 'Mobile' | 'Home' | 'Work' | 'Fax', AddressLine?: string | undefined, Address?: string | undefined, City?: string | undefined, State?: string | undefined, Zip?: string | undefined, MotherMaidenName: string, DriverLicenseNumber: string, PassportNumber: string, PlaceOfBirth: string, BiologicalSex: string, CandidateDriverRecords?: Array | undefined, CandidateDrugTests?: Array | undefined, CandidateEmployments?: Array | undefined, CandidateLegalLocations?: Array | undefined, CandidateCriminalStates?: Array | undefined, CandidateLicenses?: Array | undefined, CandidateSchools?: Array | undefined, CandidateInternationalCriminals?: Array | undefined, CandidateAliases?: Array | undefined}; export type PartnerAppAccessOptionsApi = {SendPurchaseReceipt?: boolean | undefined, UrlCancel?: string | undefined, UrlCallback?: string | undefined, AffiliateId?: string | undefined, IsAllowedToUpdateOffer?: boolean | undefined, SuppressCandidateSelfCompleteEmails?: boolean | undefined, SuppressCandidateConsentEmails?: boolean | undefined, SuppressCandidatePHMConsentEmails?: boolean | undefined, SuppressCandidateDrugConsentEmails?: boolean | undefined, IsPermissionToContactCurrentEmployerProvided?: boolean | undefined, PermissionToContactCurrentEmployerAfter?: string | undefined, ConsentReceived?: boolean | undefined, DrugConsentReceived?: boolean | undefined}; export type StepSelectReportRequestApi = {Id?: string | undefined, Candidate: HiringCandidateRequestApi, RequestOptions?: PartnerAppAccessOptionsApi | undefined}; export type CreateApiV1CompanyPartnerEmployerIdRequestorPartnerCustomerIdPartnerAppAccessStepSelectReportArgs = {partnerEmployerId: string, partnerCustomerId: string, body: StepSelectReportRequestApi}; export type CreateApiV1CompanyPartnerEmployerIdRequestorPartnerCustomerIdPartnerAppAccessStepSelectReportOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; export const createApiV1CompanyPartnerEmployerIdRequestorPartnerCustomerIdPartnerAppAccessStepSelectReportResponse = z.object({}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * POST /v1/Company/{partnerEmployerId}/Requestor/{partnerCustomerId}/PartnerAppAccess/StepSelectReport */ export const createApiV1CompanyPartnerEmployerIdRequestorPartnerCustomerIdPartnerAppAccessStepSelectReport = async (args: CreateApiV1CompanyPartnerEmployerIdRequestorPartnerCustomerIdPartnerAppAccessStepSelectReportArgs, options?: CreateApiV1CompanyPartnerEmployerIdRequestorPartnerCustomerIdPartnerAppAccessStepSelectReportOptions) => { const {baseUrl = "https://api.goodhire.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/Company/${encodeURIComponent(String(args.partnerEmployerId))}/Requestor/${encodeURIComponent(String(args.partnerCustomerId))}/PartnerAppAccess/StepSelectReport${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(createApiV1CompanyPartnerEmployerIdRequestorPartnerCustomerIdPartnerAppAccessStepSelectReportResponse, await res.json()) };