//native
type Persona = {
apiKey: string;
};
/**
* Redact a Report
* Permanently deletes personally identifiable information (PII) for a Report.
This endpoint can be used to comply with privacy regulations such as GDPR / CCPA or to enforce data privacy.
Note that this will only delete the report -- it does not delete associated accounts, inquiries, verifications, or other Persona resources.
*/
export async function main(
auth: Persona,
report_id: string,
include: string | undefined,
fields: string | undefined,
Key_Inflection?: string,
Idempotency_Key?: string,
Persona_Version?: string,
) {
const url = new URL(
`https://api.withpersona.com/api/v1/reports/${report_id}`,
);
for (const [k, v] of [
["include", include],
["fields", fields],
]) {
if (v !== undefined && v !== "" && k !== undefined) {
url.searchParams.append(k, v);
}
}
const headers: Record<string, string> = {
Authorization: `Bearer ${auth.apiKey}`,
};
if (Key_Inflection) {
headers["Key-Inflection"] = Key_Inflection;
}
if (Idempotency_Key) {
headers["Idempotency-Key"] = Idempotency_Key;
}
if (Persona_Version) {
headers["Persona-Version"] = Persona_Version;
}
const response = await fetch(url, {
method: "DELETE",
headers,
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago