export type ServiceProviderHrefWithPermission = {permissionDecision?: ('ALWAYS' | 'JUST_ONCE' | 'NEVER') | undefined, serviceProviderHref?: string | undefined}; export type AssociatedServiceProviderPersonNotification = {credentialTypeHref?: string | undefined, eventTypeOfInterest?: ('FAILED_ISSUANCE' | 'SUCCESSFUL_ISSUANCE') | undefined, serviceProviderHrefs?: Array | undefined, spHrefWithPermissions?: Array | undefined}; export type CreateApiApiPersonsPersonIdAssociatedServiceProvidersNotifyArgs = {personId: string, body: AssociatedServiceProviderPersonNotification}; export type CreateApiApiPersonsPersonIdAssociatedServiceProvidersNotifyOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Notify the associated service providers for this person of the event * * POST /api/persons/{personId}/associatedServiceProviders/notify */ export const createApiApiPersonsPersonIdAssociatedServiceProvidersNotify = async (args: CreateApiApiPersonsPersonIdAssociatedServiceProvidersNotifyArgs, options: CreateApiApiPersonsPersonIdAssociatedServiceProvidersNotifyOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/persons/${encodeURIComponent(String(args.personId))}/associatedServiceProviders/notify${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 };