export type CreateCountryDto = {countryName: string, domain: string, currencyCode: string, currencySymbol: string, mailFrom: string, supportMail: string, emailSignature?: string | undefined, displayName?: string | undefined}; export type CreateApiCountriesArgs = {body: CreateCountryDto}; export type CreateApiCountriesOptions = {baseUrl?: string | undefined, accessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a new country * * POST /countries */ export const createApiCountries = async (args: CreateApiCountriesArgs, options?: CreateApiCountriesOptions) => { const {baseUrl = "https://api.findmydocument.net", fetch: fetchFn = fetch, accessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (accessToken !== undefined) headers.set('authorization', `Bearer ${accessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/countries${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 };