export type PartnerToken = string; export type OrganizationToken = string; export type CreateApiAccountsArgs = {'Partner-Token'?: PartnerToken | undefined, 'Organization-Token'?: OrganizationToken | undefined, body: {user_full_name: string, user_email: string, user_password: string, account_name: string, account_industry?: ('Transportation & Logistics' | 'Rental & Leasing' | 'Consumer/Business Services' | 'Construction Contractors & Services' | 'Government' | 'Energy, Utilities & Mining' | 'Retail, Wholesale & Manufacturing' | 'Information & Telecommunications' | 'Education' | 'Arts, Entertainment & Recreation' | 'Non-Profit/Religious Organizations' | 'Other') | undefined, account_phone_number?: string | undefined, account_date_format?: ('mmddyyy_slash' | 'ddmmyyyy_slash' | 'ddmmyyyy_dot' | 'yyyymmdd_dot' | 'yyyymmdd_slash' | 'yyyymmdd_dash') | undefined, account_default_meter_unit?: ('mi' | 'km' | 'hr') | undefined, account_default_fuel_volume_unit?: ('us_gallons' | 'uk_gallons' | 'liters') | undefined, account_default_system_of_measurement?: ('imperial' | 'metric') | undefined, account_hide_getting_started?: boolean | undefined, account_currency?: string | undefined, account_time_24_format?: boolean | undefined, account_street_address?: string | undefined, account_city?: string | undefined, account_region?: string | undefined, account_postal_code?: string | undefined, account_country?: string | undefined, account_web_session_timeout_minutes?: string | undefined, account_go_session_timeout_minutes?: string | undefined, account_time_zone?: ('(GMT-12:00) International Date Line West' | '(GMT-11:00) American Samoa' | '(GMT-11:00) Midway Island' | '(GMT-10:00) Hawaii' | '(GMT-09:00) Alaska' | '(GMT-08:00) Pacific Time (US & Canada)' | '(GMT-08:00) Tijuana' | '(GMT-07:00) Arizona' | '(GMT-07:00) Chihuahua' | '(GMT-07:00) Mazatlan' | '(GMT-07:00) Mountain Time (US & Canada)' | '(GMT-06:00) Central America' | '(GMT-06:00) Central Time (US & Canada)' | '(GMT-06:00) Guadalajara' | '(GMT-06:00) Mexico City' | '(GMT-06:00) Monterrey' | '(GMT-06:00) Saskatchewan' | '(GMT-05:00) Bogota' | '(GMT-05:00) Eastern Time (US & Canada)' | '(GMT-05:00) Indiana (East)' | '(GMT-05:00) Lima' | '(GMT-05:00) Quito' | '(GMT-04:00) Atlantic Time (Canada)' | '(GMT-04:00) Caracas' | '(GMT-04:00) Georgetown' | '(GMT-04:00) La Paz' | '(GMT-04:00) Puerto Rico' | '(GMT-04:00) Santiago' | '(GMT-03:30) Newfoundland' | '(GMT-03:00) Brasilia' | '(GMT-03:00) Buenos Aires' | '(GMT-03:00) Greenland' | '(GMT-03:00) Montevideo' | '(GMT-02:00) Mid-Atlantic' | '(GMT-01:00) Azores' | '(GMT-01:00) Cape Verde Is.' | '(GMT+00:00) Casablanca' | '(GMT+00:00) Dublin' | '(GMT+00:00) Edinburgh' | '(GMT+00:00) Lisbon' | '(GMT+00:00) London' | '(GMT+00:00) Monrovia' | '(GMT+00:00) UTC' | '(GMT+01:00) Amsterdam' | '(GMT+01:00) Belgrade' | '(GMT+01:00) Berlin' | '(GMT+01:00) Bern' | '(GMT+01:00) Bratislava' | '(GMT+01:00) Brussels' | '(GMT+01:00) Budapest' | '(GMT+01:00) Copenhagen' | '(GMT+01:00) Ljubljana' | '(GMT+01:00) Madrid' | '(GMT+01:00) Paris' | '(GMT+01:00) Prague' | '(GMT+01:00) Rome' | '(GMT+01:00) Sarajevo' | '(GMT+01:00) Skopje' | '(GMT+01:00) Stockholm' | '(GMT+01:00) Vienna' | '(GMT+01:00) Warsaw' | '(GMT+01:00) West Central Africa' | '(GMT+01:00) Zagreb' | '(GMT+01:00) Zurich' | '(GMT+02:00) Athens' | '(GMT+02:00) Bucharest' | '(GMT+02:00) Cairo' | '(GMT+02:00) Harare' | '(GMT+02:00) Helsinki' | '(GMT+02:00) Jerusalem' | '(GMT+02:00) Kaliningrad' | '(GMT+02:00) Kyiv' | '(GMT+02:00) Pretoria' | '(GMT+02:00) Riga' | '(GMT+02:00) Sofia' | '(GMT+02:00) Tallinn' | '(GMT+02:00) Vilnius' | '(GMT+03:00) Baghdad' | '(GMT+03:00) Istanbul' | '(GMT+03:00) Kuwait' | '(GMT+03:00) Minsk' | '(GMT+03:00) Moscow' | '(GMT+03:00) Nairobi' | '(GMT+03:00) Riyadh' | '(GMT+03:00) St. Petersburg' | '(GMT+03:00) Volgograd' | '(GMT+03:30) Tehran' | '(GMT+04:00) Abu Dhabi' | '(GMT+04:00) Baku' | '(GMT+04:00) Muscat' | '(GMT+04:00) Samara' | '(GMT+04:00) Tbilisi' | '(GMT+04:00) Yerevan' | '(GMT+04:30) Kabul' | '(GMT+05:00) Ekaterinburg' | '(GMT+05:00) Islamabad' | '(GMT+05:00) Karachi' | '(GMT+05:00) Tashkent' | '(GMT+05:30) Chennai' | '(GMT+05:30) Kolkata' | '(GMT+05:30) Mumbai' | '(GMT+05:30) New Delhi' | '(GMT+05:30) Sri Jayawardenepura' | '(GMT+05:45) Kathmandu' | '(GMT+06:00) Almaty' | '(GMT+06:00) Astana' | '(GMT+06:00) Dhaka' | '(GMT+06:00) Urumqi' | '(GMT+06:30) Rangoon' | '(GMT+07:00) Bangkok' | '(GMT+07:00) Hanoi' | '(GMT+07:00) Jakarta' | '(GMT+07:00) Krasnoyarsk' | '(GMT+07:00) Novosibirsk' | '(GMT+08:00) Beijing' | '(GMT+08:00) Chongqing' | '(GMT+08:00) Hong Kong' | '(GMT+08:00) Irkutsk' | '(GMT+08:00) Kuala Lumpur' | '(GMT+08:00) Perth' | '(GMT+08:00) Singapore' | '(GMT+08:00) Taipei' | '(GMT+08:00) Ulaanbaatar' | '(GMT+09:00) Osaka' | '(GMT+09:00) Sapporo' | '(GMT+09:00) Seoul' | '(GMT+09:00) Tokyo' | '(GMT+09:00) Yakutsk' | '(GMT+09:30) Adelaide' | '(GMT+09:30) Darwin' | '(GMT+10:00) Brisbane' | '(GMT+10:00) Canberra' | '(GMT+10:00) Guam' | '(GMT+10:00) Hobart' | '(GMT+10:00) Melbourne' | '(GMT+10:00) Port Moresby' | '(GMT+10:00) Sydney' | '(GMT+10:00) Vladivostok' | '(GMT+11:00) Magadan' | '(GMT+11:00) New Caledonia' | '(GMT+11:00) Solomon Is.' | '(GMT+11:00) Srednekolymsk' | '(GMT+12:00) Auckland' | '(GMT+12:00) Fiji' | '(GMT+12:00) Kamchatka' | '(GMT+12:00) Marshall Is.' | '(GMT+12:00) Wellington' | '(GMT+12:45) Chatham Is.' | '(GMT+13:00) Nuku'alofa' | '(GMT+13:00) Samoa' | '(GMT+13:00) Tokelau Is.') | undefined, plan?: ('professional' | 'premium') | undefined}}; export type CreateApiAccountsOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, accountToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Account * * POST /accounts */ export const createApiAccounts = async (args: CreateApiAccountsArgs, options?: CreateApiAccountsOptions) => { const {baseUrl = "https://secure.fleetio.com/api", fetch: fetchFn = fetch, apiKey, accountToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Partner-Token'] != null) headers.set("Partner-Token", String(args['Partner-Token'])) if (args['Organization-Token'] != null) headers.set("Organization-Token", String(args['Organization-Token'])) if (apiKey !== undefined) headers.set("Authorization", apiKey) if (accountToken !== undefined) headers.set("Account-Token", accountToken) const url = `${baseUrl.replace(/\/+$/, '')}/accounts${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 };