2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
2024-10-27 16:10:25 -07:00
|
|
|
const notificationPolicyRuleSchema = v.picklist(['accept', 'filter', 'drop']);
|
|
|
|
|
2024-10-29 14:44:28 -07:00
|
|
|
/**
|
|
|
|
* @category Schemas
|
|
|
|
* @see {@link https://docs.joinmastodon.org/entities/NotificationPolicy}
|
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
const notificationPolicySchema = v.object({
|
2024-10-27 16:10:25 -07:00
|
|
|
for_not_following: notificationPolicyRuleSchema,
|
|
|
|
for_not_followers: notificationPolicyRuleSchema,
|
|
|
|
for_new_accounts: notificationPolicyRuleSchema,
|
|
|
|
for_private_mentions: notificationPolicyRuleSchema,
|
|
|
|
for_limited_accounts: notificationPolicyRuleSchema,
|
2024-10-13 15:25:30 -07:00
|
|
|
summary: v.object({
|
2024-10-14 11:54:44 -07:00
|
|
|
pending_requests_count: v.pipe(v.number(), v.integer()),
|
|
|
|
pending_notifications_count: v.pipe(v.number(), v.integer()),
|
2024-08-28 04:43:23 -07:00
|
|
|
}),
|
|
|
|
});
|
|
|
|
|
2024-11-29 07:01:54 -08:00
|
|
|
/**
|
|
|
|
* @category Entity types
|
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
type NotificationPolicy = v.InferOutput<typeof notificationPolicySchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export { notificationPolicySchema, type NotificationPolicy };
|