pl-api: update interaction policies API

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-03-11 04:59:13 +01:00
parent f0d610e448
commit 465f0552b8
5 changed files with 37 additions and 21 deletions

View File

@ -17,10 +17,21 @@ const interactionPolicyEntrySchema = v.picklist([
*/
type InteractionPolicyEntry = v.InferOutput<typeof interactionPolicyEntrySchema>;
const interactionPolicyRuleSchema = coerceObject({
always: v.fallback(v.array(interactionPolicyEntrySchema), ['public', 'me']),
with_approval: v.fallback(v.array(interactionPolicyEntrySchema), []),
});
const interactionPolicyRuleSchema = v.optional(
v.pipe(
v.any(),
v.transform((rule) => {
if (rule.always) rule.automatic_approval = rule.always;
if (rule.with_approval) rule.manual_approval = rule.with_approval;
return rule;
}),
v.object({
automatic_approval: v.fallback(v.array(interactionPolicyEntrySchema), ['public', 'me']),
manual_approval: v.fallback(v.array(interactionPolicyEntrySchema), []),
}),
),
{},
);
/**
* @category Schemas

View File

@ -204,7 +204,7 @@ type UpdateInteractionPoliciesParams = Record<
Record<
'can_favourite' | 'can_reblog' | 'can_reply',
Record<
'always' | 'with_approval',
'automatic_approval' | 'manual_approval',
Array<
'public' | 'followers' | 'following' | 'mutuals' | 'mentioned' | 'author' | 'me' | string
>