export type CreateApiAppsGovPlV1EntrySiloEntryIdCertificateArgs = {silo_entry_id: string, body: {password: string, private_key: string, certificate: string}}; export type CreateApiAppsGovPlV1EntrySiloEntryIdCertificateOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload the KSeF certificate, private key, and password for a registered party. This endpoint provides an alternative to the web-based certificate upload wizard for programmatic integration. * * POST /apps/gov-pl/v1/entry/{silo_entry_id}/certificate */ export const createApiAppsGovPlV1EntrySiloEntryIdCertificate = async (args: CreateApiAppsGovPlV1EntrySiloEntryIdCertificateArgs, options?: CreateApiAppsGovPlV1EntrySiloEntryIdCertificateOptions) => { const {baseUrl = "https://api.invopop.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/apps/gov-pl/v1/entry/${encodeURIComponent(String(args.silo_entry_id))}/certificate${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 };