pl-api: Update docs

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-11-29 16:01:54 +01:00
parent b357261ff2
commit bc65755862
78 changed files with 221 additions and 22 deletions

View file

@ -23,6 +23,9 @@ const accountWarningSchema = v.object({
created_at: v.fallback(datetimeSchema, new Date().toISOString()),
});
/**
* @category Entity types
*/
type AccountWarning = v.InferOutput<typeof accountWarningSchema>;
export { accountWarningSchema, type AccountWarning };

View file

@ -164,6 +164,9 @@ type WithMoved = {
moved: Account | null;
};
/**
* @category Entity types
*/
type Account = v.InferOutput<typeof accountWithMovedAccountSchema> & WithMoved;
/**
@ -200,6 +203,9 @@ const untypedCredentialAccountSchema = v.pipe(v.any(), preprocessAccount, v.obje
})), undefined),
}));
/**
* @category Entity types
*/
type CredentialAccount = v.InferOutput<typeof untypedCredentialAccountSchema> & WithMoved;
/**
@ -212,6 +218,9 @@ const untypedMutedAccountSchema = v.pipe(v.any(), preprocessAccount, v.object({
mute_expires_at: v.fallback(v.nullable(datetimeSchema), null),
}));
/**
* @category Entity types
*/
type MutedAccount = v.InferOutput<typeof untypedMutedAccountSchema> & WithMoved;
/**

View file

@ -69,7 +69,7 @@ const adminAccountSchema = v.pipe(
);
/**
* @category Admin types
* @category Admin entity types
*/
type AdminAccount = v.InferOutput<typeof adminAccountSchema>;

View file

@ -20,7 +20,7 @@ const adminAnnouncementSchema = v.pipe(
);
/**
* @category Admin types
* @category Admin entity types
*/
type AdminAnnouncement = v.InferOutput<typeof adminAnnouncementSchema>;

View file

@ -10,7 +10,7 @@ const adminCanonicalEmailBlockSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminCanonicalEmailBlock = v.InferOutput<typeof adminCanonicalEmailBlockSchema>;

View file

@ -17,7 +17,7 @@ const adminCohortSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminCohort = v.InferOutput<typeof adminCohortSchema>;

View file

@ -16,7 +16,7 @@ const adminDimensionSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminDimension = v.InferOutput<typeof adminDimensionSchema>;

View file

@ -13,7 +13,7 @@ const adminDomainAllowSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminDomainAllow = v.InferOutput<typeof adminDomainAllowSchema>;

View file

@ -20,7 +20,7 @@ const adminDomainBlockSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminDomainBlock = v.InferOutput<typeof adminDomainBlockSchema>;

View file

@ -2,6 +2,9 @@ import * as v from 'valibot';
import { datetimeSchema } from '../utils';
/**
* @category Admin schemas
*/
const adminDomainSchema = v.object({
domain: v.fallback(v.string(), ''),
id: v.pipe(v.unknown(), v.transform(String)),
@ -11,7 +14,7 @@ const adminDomainSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminDomain = v.InferOutput<typeof adminDomainSchema>

View file

@ -18,7 +18,7 @@ const adminEmailDomainBlockSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminEmailDomainBlock = v.InferOutput<typeof adminEmailDomainBlockSchema>;

View file

@ -16,7 +16,7 @@ const adminIpBlockSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminIpBlock = v.InferOutput<typeof adminIpBlockSchema>;

View file

@ -12,7 +12,7 @@ const adminIpSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminIp = v.InferOutput<typeof adminIpSchema>;

View file

@ -19,7 +19,7 @@ const adminMeasureSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminMeasure = v.InferOutput<typeof adminMeasureSchema>;

View file

@ -12,7 +12,7 @@ const adminModerationLogEntrySchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminModerationLogEntry = v.InferOutput<typeof adminModerationLogEntrySchema>

View file

@ -13,7 +13,7 @@ const pleromaConfigSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type PleromaConfig = v.InferOutput<typeof pleromaConfigSchema>

View file

@ -1,5 +1,8 @@
import * as v from 'valibot';
/**
* @category Admin schemas
*/
const adminRelaySchema = v.pipe(
v.any(),
v.transform((data: any) => ({ id: data.actor, ...data })),
@ -11,7 +14,7 @@ const adminRelaySchema = v.pipe(
);
/**
* @category Admin types
* @category Admin entity types
*/
type AdminRelay = v.InferOutput<typeof adminRelaySchema>

View file

@ -49,7 +49,7 @@ const adminReportSchema = v.pipe(
);
/**
* @category Admin types
* @category Admin entity types
*/
type AdminReport = v.InferOutput<typeof adminReportSchema>;

View file

@ -12,7 +12,7 @@ const adminRuleSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminRule = v.InferOutput<typeof adminRuleSchema>;

View file

@ -15,7 +15,7 @@ const adminTagSchema = v.object({
});
/**
* @category Admin types
* @category Admin entity types
*/
type AdminTag = v.InferOutput<typeof adminTagSchema>;

View file

@ -13,6 +13,9 @@ const announcementReactionSchema = v.object({
announcement_id: v.fallback(v.string(), ''),
});
/**
* @category Entity types
*/
type AnnouncementReaction = v.InferOutput<typeof announcementReactionSchema>;
export { announcementReactionSchema, type AnnouncementReaction };

View file

@ -32,6 +32,9 @@ const announcementSchema = v.object({
updated_at: v.fallback(datetimeSchema, new Date().toISOString()),
});
/**
* @category Entity types
*/
type Announcement = v.InferOutput<typeof announcementSchema>;
export { announcementSchema, type Announcement };

View file

@ -39,6 +39,9 @@ const credentialApplicationSchema = v.pipe(
}),
);
/**
* @category Entity types
*/
type CredentialApplication = v.InferOutput<typeof credentialApplicationSchema>;
export { applicationSchema, credentialApplicationSchema, type Application, type CredentialApplication };

View file

@ -15,6 +15,9 @@ const backupSchema = v.object({
url: v.fallback(v.string(), ''),
});
/**
* @category Entity types
*/
type Backup = v.InferOutput<typeof backupSchema>;
export { backupSchema, type Backup };

View file

@ -10,6 +10,9 @@ const bookmarkFolderSchema = v.object({
emoji_url: v.fallback(v.nullable(v.string()), null),
});
/**
* @category Entity types
*/
type BookmarkFolder = v.InferOutput<typeof bookmarkFolderSchema>;
export { bookmarkFolderSchema, type BookmarkFolder };

View file

@ -21,6 +21,9 @@ const chatMessageSchema = v.object({
card: v.fallback(v.nullable(previewCardSchema), null),
});
/**
* @category Entity types
*/
type ChatMessage = v.InferOutput<typeof chatMessageSchema>;
export { chatMessageSchema, type ChatMessage };

View file

@ -16,6 +16,9 @@ const chatSchema = v.object({
updated_at: datetimeSchema,
});
/**
* @category Entity types
*/
type Chat = v.InferOutput<typeof chatSchema>;
export { chatSchema, type Chat };

View file

@ -11,6 +11,9 @@ const contextSchema = v.object({
descendants: v.array(statusSchema),
});
/**
* @category Entity types
*/
type Context = v.InferOutput<typeof contextSchema>;
export { contextSchema, type Context };

View file

@ -15,6 +15,9 @@ const conversationSchema = v.object({
last_status: v.fallback(v.nullable(statusSchema), null),
});
/**
* @category Entity types
*/
type Conversation = v.InferOutput<typeof conversationSchema>;
export { conversationSchema, type Conversation };

View file

@ -14,6 +14,9 @@ const customEmojiSchema = v.object({
category: v.fallback(v.nullable(v.string()), null),
});
/**
* @category Entity types
*/
type CustomEmoji = v.InferOutput<typeof customEmojiSchema>;
export { customEmojiSchema, type CustomEmoji };

View file

@ -9,7 +9,7 @@ const directoryCategorySchema = v.object({
});
/**
* @category Directory types
* @category Directory entity types
*/
type DirectoryCategory = v.InferOutput<typeof directoryCategorySchema>;

View file

@ -10,7 +10,7 @@ const directoryLanguageSchema = v.object({
});
/**
* @category Directory types
* @category Directory entity types
*/
type DirectoryLanguage = v.InferOutput<typeof directoryLanguageSchema>;

View file

@ -20,7 +20,7 @@ const directoryServerSchema = v.object({
});
/**
* @category Directory types
* @category Directory entity types
*/
type DirectoryServer = v.InferOutput<typeof directoryServerSchema>;

View file

@ -11,7 +11,7 @@ const directoryStatisticsPeriodSchema = v.object({
});
/**
* @category Directory types
* @category Directory entity types
*/
type DirectoryStatisticsPeriod = v.InferOutput<typeof directoryStatisticsPeriodSchema>;

View file

@ -11,6 +11,9 @@ const domainBlockSchema = v.object({
comment: v.fallback(v.optional(v.string()), undefined),
});
/**
* @category Entity types
*/
type DomainBlock = v.InferOutput<typeof domainBlockSchema>;
export { domainBlockSchema, type DomainBlock };

View file

@ -36,6 +36,9 @@ const emojiReactionSchema = v.pipe(
v.union([baseEmojiReactionSchema, customEmojiReactionSchema]),
);
/**
* @category Entity types
*/
type EmojiReaction = v.InferOutput<typeof emojiReactionSchema>;
export { emojiReactionSchema, type EmojiReaction };

View file

@ -11,6 +11,9 @@ const extendedDescriptionSchema = v.object({
content: v.string(),
});
/**
* @category Entity types
*/
type ExtendedDescription = v.InferOutput<typeof extendedDescriptionSchema>;
export { extendedDescriptionSchema, type ExtendedDescription };

View file

@ -12,6 +12,9 @@ const familiarFollowersSchema = v.object({
accounts: filteredArray(accountSchema),
});
/**
* @category Entity types
*/
type FamiliarFollowers = v.InferOutput<typeof familiarFollowersSchema>
export { familiarFollowersSchema, type FamiliarFollowers };

View file

@ -12,6 +12,9 @@ const featuredTagSchema = v.object({
last_status_at: v.number(),
});
/**
* @category Entity types
*/
type FeaturedTag = v.InferOutput<typeof featuredTagSchema>;
export { featuredTagSchema, type FeaturedTag };

View file

@ -12,6 +12,9 @@ const filterResultSchema = v.object({
status_matches: v.fallback(v.nullable(v.string()), null),
});
/**
* @category Entity types
*/
type FilterResult = v.InferOutput<typeof filterResultSchema>;
export { filterResultSchema, type FilterResult };

View file

@ -53,6 +53,9 @@ const filterSchema = v.pipe(
}),
);
/**
* @category Entity types
*/
type Filter = v.InferOutput<typeof filterSchema>;
export { filterKeywordSchema, filterStatusSchema, filterSchema, type Filter };

View file

@ -19,6 +19,9 @@ const groupMemberSchema = v.object({
role: v.enum(GroupRoles),
});
/**
* @category Entity types
*/
type GroupMember = v.InferOutput<typeof groupMemberSchema>;
export { groupMemberSchema, type GroupMember, GroupRoles, type GroupRole };

View file

@ -12,6 +12,9 @@ const groupRelationshipSchema = v.object({
requested: v.fallback(v.boolean(), false),
});
/**
* @category Entity types
*/
type GroupRelationship = v.InferOutput<typeof groupRelationshipSchema>;
export { groupRelationshipSchema, type GroupRelationship };

View file

@ -31,6 +31,9 @@ const groupSchema = v.object({
header_description: v.fallback(v.string(), ''),
});
/**
* @category Entity types
*/
type Group = v.InferOutput<typeof groupSchema>;
export { groupSchema, type Group };

View file

@ -122,6 +122,9 @@ const notificationGroupSchema: v.BaseSchema<any, NotificationGroup, v.BaseIssue<
eventParticipationRequestNotificationGroupSchema,
])) as any;
/**
* @category Entity types
*/
type NotificationGroup = v.InferOutput<
| typeof accountNotificationGroupSchema
| typeof mentionNotificationGroupSchema

View file

@ -332,6 +332,9 @@ const instanceSchema = v.pipe(
}),
);
/**
* @category Entity types
*/
type Instance = v.InferOutput<typeof instanceSchema>;
export { instanceSchema, type Instance };

View file

@ -4,6 +4,9 @@ import { coerceObject } from './utils';
const interactionPolicyEntrySchema = v.picklist(['public', 'followers', 'following', 'mutuals', 'mentioned', 'author', 'me']);
/**
* @category Entity types
*/
type InteractionPolicyEntry = v.InferOutput<typeof interactionPolicyEntrySchema>;
const interactionPolicyRuleSchema = coerceObject({
@ -21,6 +24,9 @@ const interactionPolicySchema = coerceObject({
can_reply: interactionPolicyRuleSchema,
});
/**
* @category Entity types
*/
type InteractionPolicy = v.InferOutput<typeof interactionPolicySchema>;
/**
@ -33,6 +39,9 @@ const interactionPoliciesSchema = coerceObject({
direct: interactionPolicySchema,
});
/**
* @category Entity types
*/
type InteractionPolicies = v.InferOutput<typeof interactionPoliciesSchema>;
export { interactionPolicySchema, interactionPoliciesSchema, type InteractionPolicyEntry, type InteractionPolicy, type InteractionPolicies };

View file

@ -20,6 +20,9 @@ const interactionRequestSchema = v.object({
uri: v.fallback(v.nullable(v.string()), null),
});
/**
* @category Entity types
*/
type InteractionRequest = v.InferOutput<typeof interactionRequestSchema>;
export { interactionRequestSchema, type InteractionRequest };

View file

@ -11,6 +11,9 @@ const listSchema = v.object({
exclusive: v.fallback(v.optional(v.boolean()), undefined),
});
/**
* @category Entity types
*/
type List = v.InferOutput<typeof listSchema>;
export { listSchema, type List };

View file

@ -21,6 +21,9 @@ const locationSchema = v.object({
})), null),
});
/**
* @category Entity types
*/
type Location = v.InferOutput<typeof locationSchema>;
export { locationSchema, type Location };

View file

@ -20,6 +20,9 @@ const markerSchema = v.pipe(
}),
);
/**
* @category Entity types
*/
type Marker = v.InferOutput<typeof markerSchema>;
/**
@ -27,6 +30,9 @@ type Marker = v.InferOutput<typeof markerSchema>;
*/
const markersSchema = v.record(v.string(), markerSchema);
/**
* @category Entity types
*/
type Markers = v.InferOutput<typeof markersSchema>;
export {

View file

@ -114,6 +114,9 @@ const mediaAttachmentSchema = v.pipe(
]),
);
/**
* @category Entity types
*/
type MediaAttachment = v.InferOutput<typeof mediaAttachmentSchema>;
export { blurhashSchema, mediaAttachmentSchema, type MediaAttachment };

View file

@ -20,6 +20,9 @@ const mentionSchema = v.pipe(
}),
);
/**
* @category Entity types
*/
type Mention = v.InferOutput<typeof mentionSchema>;
export { mentionSchema, type Mention };

View file

@ -18,6 +18,9 @@ const notificationPolicySchema = v.object({
}),
});
/**
* @category Entity types
*/
type NotificationPolicy = v.InferOutput<typeof notificationPolicySchema>;
export { notificationPolicySchema, type NotificationPolicy };

View file

@ -17,6 +17,9 @@ const notificationRequestSchema = v.object({
last_status: v.fallback(v.optional(statusSchema), undefined),
});
/**
* @category Entity types
*/
type NotificationRequest = v.InferOutput<typeof notificationRequestSchema>;
export { notificationRequestSchema, type NotificationRequest };

View file

@ -110,6 +110,9 @@ const notificationSchema: v.BaseSchema<any, Notification, v.BaseIssue<unknown>>
eventParticipationRequestNotificationSchema,
])) as any;
/**
* @category Entity types
*/
type Notification = v.InferOutput<
| typeof accountNotificationSchema
| typeof mentionNotificationSchema

View file

@ -19,6 +19,9 @@ const oauthTokenSchema = v.pipe(
}),
);
/**
* @category Entity types
*/
type OauthToken = v.InferOutput<typeof oauthTokenSchema>;
export { oauthTokenSchema, type OauthToken };

View file

@ -29,7 +29,14 @@ const pollSchema = v.object({
non_anonymous: v.fallback(v.boolean(), false),
});
/**
* @category Entity types
*/
type Poll = v.InferOutput<typeof pollSchema>;
/**
* @category Entity types
*/
type PollOption = Poll['options'][number];
export { pollSchema, type Poll, type PollOption };

View file

@ -12,6 +12,9 @@ const previewCardAuthorSchema = v.object({
account: v.fallback(v.nullable(accountSchema), null),
});
/**
* @category Entity types
*/
type PreviewCardAuthor = v.InferOutput<typeof previewCardAuthorSchema>;
export { previewCardAuthorSchema, type PreviewCardAuthor };

View file

@ -28,6 +28,9 @@ const previewCardSchema = v.object({
width: v.fallback(v.number(), 0),
});
/**
* @category Entity types
*/
type PreviewCard = v.InferOutput<typeof previewCardSchema>;
export { previewCardSchema, type PreviewCard };

View file

@ -14,6 +14,9 @@ const relationshipSeveranceEventSchema = v.object({
created_at: datetimeSchema,
});
/**
* @category Entity types
*/
type RelationshipSeveranceEvent = v.InferOutput<typeof relationshipSeveranceEventSchema>;
export { relationshipSeveranceEventSchema, type RelationshipSeveranceEvent };

View file

@ -20,6 +20,9 @@ const relationshipSchema = v.object({
showing_reblogs: v.fallback(v.boolean(), false),
});
/**
* @category Entity types
*/
type Relationship = v.InferOutput<typeof relationshipSchema>;
export { relationshipSchema, type Relationship };

View file

@ -20,6 +20,9 @@ const reportSchema = v.object({
target_account: v.fallback(v.nullable(accountSchema), null),
});
/**
* @category Entity types
*/
type Report = v.InferOutput<typeof reportSchema>;
export { reportSchema, type Report };

View file

@ -13,6 +13,9 @@ const roleSchema = v.object({
highlighted: v.fallback(v.boolean(), true),
});
/**
* @category Entity types
*/
type Role = v.InferOutput<typeof roleSchema>;
export {

View file

@ -19,6 +19,9 @@ const ruleSchema = v.pipe(
baseRuleSchema,
);
/**
* @category Entity types
*/
type Rule = v.InferOutput<typeof ruleSchema>;
export { ruleSchema, type Rule };

View file

@ -34,6 +34,9 @@ const scheduledStatusSchema = v.object({
media_attachments: filteredArray(mediaAttachmentSchema),
});
/**
* @category Entity types
*/
type ScheduledStatus = v.InferOutput<typeof scheduledStatusSchema>;
export { scheduledStatusSchema, type ScheduledStatus };

View file

@ -24,6 +24,9 @@ const scrobbleSchema = v.pipe(
}),
);
/**
* @category Entity types
*/
type Scrobble = v.InferOutput<typeof scrobbleSchema>;
export { scrobbleSchema, type Scrobble };

View file

@ -17,6 +17,9 @@ const searchSchema = v.object({
groups: filteredArray(groupSchema),
});
/**
* @category Entity types
*/
type Search = v.InferOutput<typeof searchSchema>;
export { searchSchema, type Search };

View file

@ -24,6 +24,9 @@ const statusEditSchema = v.object({
emojis: filteredArray(customEmojiSchema),
});
/**
* @category Entity types
*/
type StatusEdit = v.InferOutput<typeof statusEditSchema>;
export { statusEditSchema, type StatusEdit };

View file

@ -18,6 +18,9 @@ const statusSourceSchema = v.object({
spoiler_text_map: v.fallback(v.nullable(v.record(v.string(), v.string())), null),
});
/**
* @category Entity types
*/
type StatusSource = v.InferOutput<typeof statusSourceSchema>;
export { statusSourceSchema, type StatusSource };

View file

@ -155,12 +155,18 @@ const statusWithoutAccountSchema = v.pipe(v.any(), v.transform(preprocess), v.ob
quote: v.fallback(v.nullable(v.lazy(() => statusSchema)), null),
}));
/**
* @category Entity types
*/
type StatusWithoutAccount = Omit<v.InferOutput<typeof baseStatusSchema>, 'account'> & {
account: Account | null;
reblog: Status | null;
quote: Status | null;
}
/**
* @category Entity types
*/
type Status = v.InferOutput<typeof baseStatusSchema> & {
reblog: Status | null;
quote: Status | null;

View file

@ -25,6 +25,9 @@ const followRelationshipUpdateSchema = v.object({
}),
});
/**
* @category Entity types
*/
type FollowRelationshipUpdate = v.InferOutput<typeof followRelationshipUpdateSchema>;
const baseStreamingEventSchema = v.object({
@ -130,6 +133,9 @@ const streamingEventSchema: v.BaseSchema<any, StreamingEvent, v.BaseIssue<unknow
]),
) as any;
/**
* @category Entity types
*/
type StreamingEvent = v.InferOutput<
| typeof statusStreamingEventSchema
| typeof stringStreamingEventSchema

View file

@ -42,6 +42,9 @@ const suggestionSchema = v.pipe(
}),
);
/**
* @category Entity types
*/
type Suggestion = v.InferOutput<typeof suggestionSchema>;
export { suggestionSchema, type Suggestion };

View file

@ -20,6 +20,9 @@ const tagSchema = v.object({
following: v.fallback(v.optional(v.boolean()), undefined),
});
/**
* @category Entity types
*/
type Tag = v.InferOutput<typeof tagSchema>;
export { historySchema, tagSchema, type Tag };

View file

@ -16,6 +16,9 @@ const tokenSchema = v.object({
me: v.fallback(v.optional(v.string()), undefined),
});
/**
* @category Entity types
*/
type Token = v.InferOutput<typeof tokenSchema>;
export { tokenSchema, type Token };

View file

@ -43,6 +43,9 @@ const translationSchema = v.pipe(
}),
);
/**
* @category Entity types
*/
type Translation = v.InferOutput<typeof translationSchema>;
export { translationSchema, type Translation };

View file

@ -31,6 +31,9 @@ const trendsLinkSchema = v.pipe(
}),
);
/**
* @category Entity types
*/
type TrendsLink = v.InferOutput<typeof trendsLinkSchema>;
export { trendsLinkSchema, type TrendsLink };

View file

@ -11,6 +11,9 @@ const webPushSubscriptionSchema = v.object({
server_key: v.string(),
});
/**
* @category Entity types
*/
type WebPushSubscription = v.InferOutput<typeof webPushSubscriptionSchema>;
export { webPushSubscriptionSchema, type WebPushSubscription };