export type CountryCodeEnum = 'AL' | 'AM' | 'AR' | 'AT' | 'AU' | 'AW' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BG' | 'BH' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CH' | 'CN' | 'CO' | 'CR' | 'CW' | 'CY' | 'CZ' | 'DE' | 'DK' | 'DO' | 'EC' | 'EE' | 'ES' | 'FI' | 'FR' | 'GB' | 'GE' | 'GG' | 'GH' | 'GI' | 'GR' | 'HK' | 'HR' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IS' | 'IT' | 'JE' | 'JO' | 'KH' | 'KW' | 'KY' | 'LI' | 'LK' | 'LS' | 'LT' | 'LU' | 'LV' | 'MA' | 'ME' | 'MH' | 'MM' | 'MT' | 'MU' | 'MY' | 'NL' | 'NO' | 'NZ' | 'PE' | 'PH' | 'PK' | 'PL' | 'PR' | 'PT' | 'QA' | 'RO' | 'RS' | 'RU' | 'SB' | 'SE' | 'SG' | 'SI' | 'SK' | 'TH' | 'TN' | 'TO' | 'TR' | 'TT' | 'TW' | 'UG' | 'US' | 'UY' | 'VG' | 'VI' | 'VN' | 'VU' | 'WS' | 'ZA'; export type GovPartnerOrderDocumentRequest = {countryCode: CountryCodeEnum, registrationNumber: string, region?: string | undefined, companyName: string, productKey: string}; export type CreateApiApiV2GovOrderedDocumentsDocumentOrderArgs = {body: GovPartnerOrderDocumentRequest}; export type CreateApiApiV2GovOrderedDocumentsDocumentOrderOptions = {baseUrl?: string | undefined, apiKeyPair?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Order GOV document * * POST /api/v2/gov-ordered-documents/document-order/ */ export const createApiApiV2GovOrderedDocumentsDocumentOrder = async (args: CreateApiApiV2GovOrderedDocumentsDocumentOrderArgs, options?: CreateApiApiV2GovOrderedDocumentsDocumentOrderOptions) => { const {baseUrl = "https://ivs.idenfy.com", fetch: fetchFn = fetch, apiKeyPair} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKeyPair !== undefined) headers.set('authorization', `Basic ${btoa(`${apiKeyPair.username}:${apiKeyPair.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/gov-ordered-documents/document-order/${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 undefined };