diff --git a/packages/pl-api/lib/entities/admin/pleroma-config.ts b/packages/pl-api/lib/entities/admin/pleroma-config.ts index aee37727a..e55e936fd 100644 --- a/packages/pl-api/lib/entities/admin/pleroma-config.ts +++ b/packages/pl-api/lib/entities/admin/pleroma-config.ts @@ -1,5 +1,8 @@ import * as v from 'valibot'; +/** + * @category Schemas + */ const pleromaConfigSchema = v.object({ configs: v.array(v.object({ value: v.any(), diff --git a/packages/pl-api/lib/entities/emoji-reaction.ts b/packages/pl-api/lib/entities/emoji-reaction.ts index 2fbccf22d..f1c7326b7 100644 --- a/packages/pl-api/lib/entities/emoji-reaction.ts +++ b/packages/pl-api/lib/entities/emoji-reaction.ts @@ -22,6 +22,8 @@ const customEmojiReactionSchema = v.object({ /** * Pleroma emoji reaction. + * + * @category Schemas * @see {@link https://docs.pleroma.social/backend/development/API/differences_in_mastoapi_responses/#statuses} */ const emojiReactionSchema = v.pipe( diff --git a/packages/pl-api/lib/entities/extended-description.ts b/packages/pl-api/lib/entities/extended-description.ts index 934f7a413..f739f19fb 100644 --- a/packages/pl-api/lib/entities/extended-description.ts +++ b/packages/pl-api/lib/entities/extended-description.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { datetimeSchema } from './utils'; -/** @see {@link https://docs.joinmastodon.org/entities/ExtendedDescription} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/ExtendedDescription} + */ const extendedDescriptionSchema = v.object({ updated_at: datetimeSchema, content: v.string(), diff --git a/packages/pl-api/lib/entities/familiar-followers.ts b/packages/pl-api/lib/entities/familiar-followers.ts index ddf1e5c91..2356b3418 100644 --- a/packages/pl-api/lib/entities/familiar-followers.ts +++ b/packages/pl-api/lib/entities/familiar-followers.ts @@ -3,7 +3,10 @@ import * as v from 'valibot'; import { accountSchema } from './account'; import { filteredArray } from './utils'; -/** @see {@link https://docs.joinmastodon.org/entities/FamiliarFollowers/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/FamiliarFollowers/} + */ const familiarFollowersSchema = v.object({ id: v.string(), accounts: filteredArray(accountSchema), diff --git a/packages/pl-api/lib/entities/featured-tag.ts b/packages/pl-api/lib/entities/featured-tag.ts index f07ad3e7b..e044377d2 100644 --- a/packages/pl-api/lib/entities/featured-tag.ts +++ b/packages/pl-api/lib/entities/featured-tag.ts @@ -1,6 +1,9 @@ import * as v from 'valibot'; -/** @see {@link https://docs.joinmastodon.org/entities/FeaturedTag/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/FeaturedTag/} + */ const featuredTagSchema = v.object({ id: v.string(), name: v.string(), diff --git a/packages/pl-api/lib/entities/filter-result.ts b/packages/pl-api/lib/entities/filter-result.ts index fcd64be77..4811c3799 100644 --- a/packages/pl-api/lib/entities/filter-result.ts +++ b/packages/pl-api/lib/entities/filter-result.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { filterSchema } from './filter'; -/** @see {@link https://docs.joinmastodon.org/entities/FilterResult/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/FilterResult/} + */ const filterResultSchema = v.object({ filter: filterSchema, keyword_matches: v.fallback(v.nullable(v.string()), null), diff --git a/packages/pl-api/lib/entities/filter.ts b/packages/pl-api/lib/entities/filter.ts index 07c898f2b..1d1f0d7ab 100644 --- a/packages/pl-api/lib/entities/filter.ts +++ b/packages/pl-api/lib/entities/filter.ts @@ -2,20 +2,29 @@ import * as v from 'valibot'; import { datetimeSchema, filteredArray } from './utils'; -/** @see {@link https://docs.joinmastodon.org/entities/FilterKeyword/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/FilterKeyword/} + */ const filterKeywordSchema = v.object({ id: v.string(), keyword: v.string(), whole_word: v.boolean(), }); -/** @see {@link https://docs.joinmastodon.org/entities/FilterStatus/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/FilterStatus/} + */ const filterStatusSchema = v.object({ id: v.string(), status_id: v.string(), }); -/** @see {@link https://docs.joinmastodon.org/entities/Filter/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Filter/} + */ const filterSchema = v.pipe( v.any(), v.transform((filter: any) => { diff --git a/packages/pl-api/lib/entities/group-member.ts b/packages/pl-api/lib/entities/group-member.ts index 7f4f80f26..c0dd0384f 100644 --- a/packages/pl-api/lib/entities/group-member.ts +++ b/packages/pl-api/lib/entities/group-member.ts @@ -10,6 +10,9 @@ enum GroupRoles { type GroupRole =`${GroupRoles}`; +/** + * @category Schemas + */ const groupMemberSchema = v.object({ id: v.string(), account: accountSchema, diff --git a/packages/pl-api/lib/entities/group-relationship.ts b/packages/pl-api/lib/entities/group-relationship.ts index 96c2a0436..74fd7dc99 100644 --- a/packages/pl-api/lib/entities/group-relationship.ts +++ b/packages/pl-api/lib/entities/group-relationship.ts @@ -2,6 +2,9 @@ import * as v from 'valibot'; import { GroupRoles } from './group-member'; +/** + * @category Schemas + */ const groupRelationshipSchema = v.object({ id: v.string(), member: v.fallback(v.boolean(), false), diff --git a/packages/pl-api/lib/entities/group.ts b/packages/pl-api/lib/entities/group.ts index 47b413e0e..76ba749db 100644 --- a/packages/pl-api/lib/entities/group.ts +++ b/packages/pl-api/lib/entities/group.ts @@ -4,6 +4,9 @@ import { customEmojiSchema } from './custom-emoji'; import { groupRelationshipSchema } from './group-relationship'; import { datetimeSchema, filteredArray } from './utils'; +/** + * @category Schemas + */ const groupSchema = v.object({ avatar: v.fallback(v.string(), ''), avatar_static: v.fallback(v.string(), ''), diff --git a/packages/pl-api/lib/entities/instance.ts b/packages/pl-api/lib/entities/instance.ts index d61a8d3b0..41cd0417b 100644 --- a/packages/pl-api/lib/entities/instance.ts +++ b/packages/pl-api/lib/entities/instance.ts @@ -290,7 +290,10 @@ const instanceV1Schema = coerceObject({ version: v.fallback(v.string(), '0.0.0'), }); -/** @see {@link https://docs.joinmastodon.org/entities/Instance/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Instance/} + */ const instanceSchema = v.pipe( v.any(), v.transform((data: any) => { diff --git a/packages/pl-api/lib/entities/interaction-policy.ts b/packages/pl-api/lib/entities/interaction-policy.ts index ace8b2fba..db2168ace 100644 --- a/packages/pl-api/lib/entities/interaction-policy.ts +++ b/packages/pl-api/lib/entities/interaction-policy.ts @@ -11,7 +11,10 @@ const interactionPolicyRuleSchema = coerceObject({ with_approval: v.fallback(v.array(interactionPolicyEntrySchema), []), }); -/** @see {@link https://docs.gotosocial.org/en/latest/api/swagger/} */ +/** + * @category Schemas + * @see {@link https://docs.gotosocial.org/en/latest/api/swagger/} + */ const interactionPolicySchema = coerceObject({ can_favourite: interactionPolicyRuleSchema, can_reblog: interactionPolicyRuleSchema, @@ -20,6 +23,9 @@ const interactionPolicySchema = coerceObject({ type InteractionPolicy = v.InferOutput; +/** + * @category Schemas + */ const interactionPoliciesSchema = coerceObject({ public: interactionPolicySchema, unlisted: interactionPolicySchema, diff --git a/packages/pl-api/lib/entities/interaction-request.ts b/packages/pl-api/lib/entities/interaction-request.ts index b917292ea..34857bebe 100644 --- a/packages/pl-api/lib/entities/interaction-request.ts +++ b/packages/pl-api/lib/entities/interaction-request.ts @@ -4,7 +4,10 @@ import { accountSchema } from './account'; import { statusSchema } from './status'; import { datetimeSchema } from './utils'; -/** @see {@link https://docs.gotosocial.org/en/latest/api/swagger.yaml#/definitions/interactionRequest} */ +/** + * @category Schemas + * @see {@link https://docs.gotosocial.org/en/latest/api/swagger.yaml#/definitions/interactionRequest} + */ const interactionRequestSchema = v.object({ accepted_at: v.fallback(v.nullable(datetimeSchema), null), account: accountSchema, diff --git a/packages/pl-api/lib/entities/list.ts b/packages/pl-api/lib/entities/list.ts index 2ffc350a4..72bd5e370 100644 --- a/packages/pl-api/lib/entities/list.ts +++ b/packages/pl-api/lib/entities/list.ts @@ -1,6 +1,9 @@ import * as v from 'valibot'; -/** @see {@link https://docs.joinmastodon.org/entities/List/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/List/} + */ const listSchema = v.object({ id: v.pipe(v.unknown(), v.transform(String)), title: v.string(), diff --git a/packages/pl-api/lib/entities/location.ts b/packages/pl-api/lib/entities/location.ts index ff723fa95..c83740f7e 100644 --- a/packages/pl-api/lib/entities/location.ts +++ b/packages/pl-api/lib/entities/location.ts @@ -1,5 +1,8 @@ import * as v from 'valibot'; +/** + * @category Schemas + */ const locationSchema = v.object({ url: v.fallback(v.pipe(v.string(), v.url()), ''), description: v.fallback(v.string(), ''), diff --git a/packages/pl-api/lib/entities/marker.ts b/packages/pl-api/lib/entities/marker.ts index dd7a9483f..bf498dc42 100644 --- a/packages/pl-api/lib/entities/marker.ts +++ b/packages/pl-api/lib/entities/marker.ts @@ -2,6 +2,10 @@ import * as v from 'valibot'; import { datetimeSchema } from './utils'; +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Marker/} + */ const markerSchema = v.pipe( v.any(), v.transform((marker: any) => marker ? ({ @@ -16,9 +20,11 @@ const markerSchema = v.pipe( }), ); -/** @see {@link https://docs.joinmastodon.org/entities/Marker/} */ type Marker = v.InferOutput; +/** + * @category Schemas + */ const markersSchema = v.record(v.string(), markerSchema); type Markers = v.InferOutput; diff --git a/packages/pl-api/lib/entities/media-attachment.ts b/packages/pl-api/lib/entities/media-attachment.ts index 47e9ee8f9..5d459d505 100644 --- a/packages/pl-api/lib/entities/media-attachment.ts +++ b/packages/pl-api/lib/entities/media-attachment.ts @@ -3,6 +3,9 @@ import * as v from 'valibot'; import { mimeSchema } from './utils'; +/** + * @category Schemas + */ const blurhashSchema = v.pipe(v.string(), v.check( (value) => isBlurhashValid(value).result, 'invalid blurhash', // .errorReason @@ -87,7 +90,10 @@ const unknownAttachmentSchema = v.object({ type: v.literal('unknown'), }); -/** @see {@link https://docs.joinmastodon.org/entities/MediaAttachment} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/MediaAttachment} + */ const mediaAttachmentSchema = v.pipe( v.any(), v.transform((data: any) => { diff --git a/packages/pl-api/lib/entities/mention.ts b/packages/pl-api/lib/entities/mention.ts index 43b15c25a..88c73f6f4 100644 --- a/packages/pl-api/lib/entities/mention.ts +++ b/packages/pl-api/lib/entities/mention.ts @@ -1,6 +1,9 @@ import * as v from 'valibot'; -/** @see {@link https://docs.joinmastodon.org/entities/Status/#Mention} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Status/#Mention} + */ const mentionSchema = v.pipe( v.object({ id: v.string(), diff --git a/packages/pl-api/lib/entities/notification-policy.ts b/packages/pl-api/lib/entities/notification-policy.ts index 2eb3660f0..19396a4f5 100644 --- a/packages/pl-api/lib/entities/notification-policy.ts +++ b/packages/pl-api/lib/entities/notification-policy.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; const notificationPolicyRuleSchema = v.picklist(['accept', 'filter', 'drop']); -/** @see {@link https://docs.joinmastodon.org/entities/NotificationPolicy} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/NotificationPolicy} + */ const notificationPolicySchema = v.object({ for_not_following: notificationPolicyRuleSchema, for_not_followers: notificationPolicyRuleSchema, diff --git a/packages/pl-api/lib/entities/notification-request.ts b/packages/pl-api/lib/entities/notification-request.ts index cdef784d2..080c09c62 100644 --- a/packages/pl-api/lib/entities/notification-request.ts +++ b/packages/pl-api/lib/entities/notification-request.ts @@ -4,7 +4,10 @@ import { accountSchema } from './account'; import { statusSchema } from './status'; import { datetimeSchema } from './utils'; -/** @see {@link https://docs.joinmastodon.org/entities/NotificationRequest} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/NotificationRequest} + */ const notificationRequestSchema = v.object({ id: v.string(), created_at: datetimeSchema, diff --git a/packages/pl-api/lib/entities/notification.ts b/packages/pl-api/lib/entities/notification.ts index a22345711..5ec909580 100644 --- a/packages/pl-api/lib/entities/notification.ts +++ b/packages/pl-api/lib/entities/notification.ts @@ -83,7 +83,10 @@ const eventParticipationRequestNotificationSchema = v.object({ participation_message: v.fallback(v.nullable(v.string()), null), }); -/** @see {@link https://docs.joinmastodon.org/entities/Notification/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Notification/} + * */ const notificationSchema: v.BaseSchema> = v.pipe( v.any(), v.transform((notification: any) => ({ diff --git a/packages/pl-api/lib/entities/oauth-token.ts b/packages/pl-api/lib/entities/oauth-token.ts index f041ade19..462615991 100644 --- a/packages/pl-api/lib/entities/oauth-token.ts +++ b/packages/pl-api/lib/entities/oauth-token.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { datetimeSchema } from './utils'; -/** @see {@link https://docs.pleroma.social/backend/development/API/pleroma_api/#get-apioauth_tokens} */ +/** + * @category Schemas + * @see {@link https://docs.pleroma.social/backend/development/API/pleroma_api/#get-apioauth_tokens} + */ const oauthTokenSchema = v.pipe( v.any(), v.transform((token: any) => ({ diff --git a/packages/pl-api/lib/entities/poll.ts b/packages/pl-api/lib/entities/poll.ts index 24ebe6f9c..1180e9133 100644 --- a/packages/pl-api/lib/entities/poll.ts +++ b/packages/pl-api/lib/entities/poll.ts @@ -10,7 +10,10 @@ const pollOptionSchema = v.object({ title_map: v.fallback(v.nullable(v.record(v.string(), v.string())), null), }); -/** @see {@link https://docs.joinmastodon.org/entities/Poll/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Poll/} + */ const pollSchema = v.object({ emojis: filteredArray(customEmojiSchema), expired: v.fallback(v.boolean(), false), diff --git a/packages/pl-api/lib/entities/preview-card.ts b/packages/pl-api/lib/entities/preview-card.ts index 04c4cdc9e..2a875d39e 100644 --- a/packages/pl-api/lib/entities/preview-card.ts +++ b/packages/pl-api/lib/entities/preview-card.ts @@ -1,6 +1,9 @@ import * as v from 'valibot'; -/** @see {@link https://docs.joinmastodon.org/entities/PreviewCard/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/PreviewCard/} + */ const previewCardSchema = v.object({ author_name: v.fallback(v.string(), ''), author_url: v.fallback(v.pipe(v.string(), v.url()), ''), diff --git a/packages/pl-api/lib/entities/relationship-severance-event.ts b/packages/pl-api/lib/entities/relationship-severance-event.ts index df76cfd0d..19085a983 100644 --- a/packages/pl-api/lib/entities/relationship-severance-event.ts +++ b/packages/pl-api/lib/entities/relationship-severance-event.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { datetimeSchema } from './utils'; -/** @see {@link https://docs.joinmastodon.org/entities/RelationshipSeveranceEvent/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/RelationshipSeveranceEvent/} + */ const relationshipSeveranceEventSchema = v.object({ id: v.string(), type: v.picklist(['domain_block', 'user_domain_block', 'account_suspension']), diff --git a/packages/pl-api/lib/entities/relationship.ts b/packages/pl-api/lib/entities/relationship.ts index e2fc728af..bc8d6f3df 100644 --- a/packages/pl-api/lib/entities/relationship.ts +++ b/packages/pl-api/lib/entities/relationship.ts @@ -1,6 +1,9 @@ import * as v from 'valibot'; -/** @see {@link https://docs.joinmastodon.org/entities/Relationship/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Relationship/} + */ const relationshipSchema = v.object({ blocked_by: v.fallback(v.boolean(), false), blocking: v.fallback(v.boolean(), false), diff --git a/packages/pl-api/lib/entities/report.ts b/packages/pl-api/lib/entities/report.ts index 83970f0dc..fe930a4b5 100644 --- a/packages/pl-api/lib/entities/report.ts +++ b/packages/pl-api/lib/entities/report.ts @@ -3,7 +3,10 @@ import * as v from 'valibot'; import { accountSchema } from './account'; import { datetimeSchema } from './utils'; -/** @see {@link https://docs.joinmastodon.org/entities/Report/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Report/} + */ const reportSchema = v.object({ id: v.string(), action_taken: v.fallback(v.optional(v.boolean()), undefined), diff --git a/packages/pl-api/lib/entities/role.ts b/packages/pl-api/lib/entities/role.ts index 1b1c2eab9..a10e7cda5 100644 --- a/packages/pl-api/lib/entities/role.ts +++ b/packages/pl-api/lib/entities/role.ts @@ -2,6 +2,9 @@ import * as v from 'valibot'; const hexSchema = v.pipe(v.string(), v.regex(/^#[a-f0-9]{6}$/i)); +/** + * @category Schemas + */ const roleSchema = v.object({ id: v.fallback(v.string(), ''), name: v.fallback(v.string(), ''), diff --git a/packages/pl-api/lib/entities/rule.ts b/packages/pl-api/lib/entities/rule.ts index c1077cb0d..2b949b414 100644 --- a/packages/pl-api/lib/entities/rule.ts +++ b/packages/pl-api/lib/entities/rule.ts @@ -6,7 +6,10 @@ const baseRuleSchema = v.object({ hint: v.fallback(v.string(), ''), }); -/** @see {@link https://docs.joinmastodon.org/entities/Rule/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Rule/} + */ const ruleSchema = v.pipe( v.any(), v.transform((data: any) => ({ diff --git a/packages/pl-api/lib/entities/scheduled-status.ts b/packages/pl-api/lib/entities/scheduled-status.ts index 347cc0946..90f52c4d6 100644 --- a/packages/pl-api/lib/entities/scheduled-status.ts +++ b/packages/pl-api/lib/entities/scheduled-status.ts @@ -3,7 +3,10 @@ import * as v from 'valibot'; import { mediaAttachmentSchema } from './media-attachment'; import { datetimeSchema, filteredArray } from './utils'; -/** @see {@link https://docs.joinmastodon.org/entities/ScheduledStatus/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/ScheduledStatus/} + */ const scheduledStatusSchema = v.object({ id: v.string(), scheduled_at: datetimeSchema, diff --git a/packages/pl-api/lib/entities/scrobble.ts b/packages/pl-api/lib/entities/scrobble.ts index 483805caf..41ecc51b4 100644 --- a/packages/pl-api/lib/entities/scrobble.ts +++ b/packages/pl-api/lib/entities/scrobble.ts @@ -3,6 +3,9 @@ import * as v from 'valibot'; import { accountSchema } from './account'; import { datetimeSchema } from './utils'; +/** + * @category Schemas + */ const scrobbleSchema = v.pipe( v.any(), v.transform((scrobble: any) => scrobble ? { diff --git a/packages/pl-api/lib/entities/search.ts b/packages/pl-api/lib/entities/search.ts index 250644d10..21eaa0ea2 100644 --- a/packages/pl-api/lib/entities/search.ts +++ b/packages/pl-api/lib/entities/search.ts @@ -6,7 +6,10 @@ import { statusSchema } from './status'; import { tagSchema } from './tag'; import { filteredArray } from './utils'; -/** @see {@link https://docs.joinmastodon.org/entities/Search} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Search} + */ const searchSchema = v.object({ accounts: filteredArray(accountSchema), statuses: filteredArray(statusSchema), diff --git a/packages/pl-api/lib/entities/status-edit.ts b/packages/pl-api/lib/entities/status-edit.ts index 9aaa1a74c..d419cc80b 100644 --- a/packages/pl-api/lib/entities/status-edit.ts +++ b/packages/pl-api/lib/entities/status-edit.ts @@ -5,7 +5,10 @@ import { customEmojiSchema } from './custom-emoji'; import { mediaAttachmentSchema } from './media-attachment'; import { datetimeSchema, filteredArray } from './utils'; -/** @see {@link https://docs.joinmastodon.org/entities/StatusEdit/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/StatusEdit/} + */ const statusEditSchema = v.object({ content: v.fallback(v.string(), ''), spoiler_text: v.fallback(v.string(), ''), diff --git a/packages/pl-api/lib/entities/status-source.ts b/packages/pl-api/lib/entities/status-source.ts index 7b521cfa9..d87f917cf 100644 --- a/packages/pl-api/lib/entities/status-source.ts +++ b/packages/pl-api/lib/entities/status-source.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { locationSchema } from './location'; -/** @see {@link https://docs.joinmastodon.org/entities/StatusSource/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/StatusSource/} + */ const statusSourceSchema = v.object({ id: v.string(), text: v.fallback(v.string(), ''), diff --git a/packages/pl-api/lib/entities/status.ts b/packages/pl-api/lib/entities/status.ts index dd7b24f4d..7fdfe563a 100644 --- a/packages/pl-api/lib/entities/status.ts +++ b/packages/pl-api/lib/entities/status.ts @@ -134,6 +134,9 @@ const preprocess = (status: any) => { return status; }; +/** + * @category Schemas + */ const statusSchema: v.BaseSchema> = v.pipe(v.any(), v.transform(preprocess), v.object({ ...baseStatusSchema.entries, reblog: v.fallback(v.nullable(v.lazy(() => statusSchema)), null), @@ -141,6 +144,9 @@ const statusSchema: v.BaseSchema> = v.pipe(v.a quote: v.fallback(v.nullable(v.lazy(() => statusSchema)), null), })) as any; +/** + * @category Schemas + */ const statusWithoutAccountSchema = v.pipe(v.any(), v.transform(preprocess), v.object({ ...(v.omit(baseStatusSchema, ['account']).entries), account: v.fallback(v.nullable(accountSchema), null), diff --git a/packages/pl-api/lib/entities/streaming-event.ts b/packages/pl-api/lib/entities/streaming-event.ts index d41e6586f..ab4c34024 100644 --- a/packages/pl-api/lib/entities/streaming-event.ts +++ b/packages/pl-api/lib/entities/streaming-event.ts @@ -8,6 +8,9 @@ import { markersSchema } from './marker'; import { notificationSchema } from './notification'; import { statusSchema } from './status'; +/** + * @category Schemas + */ const followRelationshipUpdateSchema = v.object({ state: v.picklist(['follow_pending', 'follow_accept', 'follow_reject']), follower: v.object({ @@ -96,7 +99,10 @@ const markerStreamingEventSchema = v.object({ payload: v.pipe(v.any(), v.transform((payload: any) => JSON.parse(payload)), markersSchema), }); -/** @see {@link https://docs.joinmastodon.org/methods/streaming/#events} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/methods/streaming/#events} + */ const streamingEventSchema: v.BaseSchema> = v.pipe( v.any(), v.transform((event: any) => ({ diff --git a/packages/pl-api/lib/entities/suggestion.ts b/packages/pl-api/lib/entities/suggestion.ts index 875c0f8d1..8f27e0193 100644 --- a/packages/pl-api/lib/entities/suggestion.ts +++ b/packages/pl-api/lib/entities/suggestion.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { accountSchema } from './account'; -/** @see {@link https://docs.joinmastodon.org/entities/Suggestion} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Suggestion} + */ const suggestionSchema = v.pipe( v.any(), v.transform((suggestion: any) => { diff --git a/packages/pl-api/lib/entities/tag.ts b/packages/pl-api/lib/entities/tag.ts index f9010d436..31abaaba8 100644 --- a/packages/pl-api/lib/entities/tag.ts +++ b/packages/pl-api/lib/entities/tag.ts @@ -1,12 +1,18 @@ import * as v from 'valibot'; +/** + * @category Schemas + */ const historySchema = v.array(v.object({ day: v.pipe(v.unknown(), v.transform(Number)), accounts: v.pipe(v.unknown(), v.transform(Number)), uses: v.pipe(v.unknown(), v.transform(Number)), })); -/** @see {@link https://docs.joinmastodon.org/entities/tag} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/tag} + */ const tagSchema = v.object({ name: v.pipe(v.string(), v.minLength(1)), url: v.fallback(v.pipe(v.string(), v.url()), ''), diff --git a/packages/pl-api/lib/entities/token.ts b/packages/pl-api/lib/entities/token.ts index 3fff4e40b..f0c790674 100644 --- a/packages/pl-api/lib/entities/token.ts +++ b/packages/pl-api/lib/entities/token.ts @@ -1,6 +1,9 @@ import * as v from 'valibot'; -/** @see {@link https://docs.joinmastodon.org/entities/Token/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Token/} + */ const tokenSchema = v.object({ access_token: v.string(), token_type: v.string(), diff --git a/packages/pl-api/lib/entities/translation.ts b/packages/pl-api/lib/entities/translation.ts index 4ecc043a6..594d7effe 100644 --- a/packages/pl-api/lib/entities/translation.ts +++ b/packages/pl-api/lib/entities/translation.ts @@ -14,7 +14,10 @@ const translationMediaAttachment = v.object({ description: v.fallback(v.string(), ''), }); -/** @see {@link https://docs.joinmastodon.org/entities/Translation/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/Translation/} + */ const translationSchema = v.pipe( v.any(), v.transform((translation: any) => { diff --git a/packages/pl-api/lib/entities/trends-link.ts b/packages/pl-api/lib/entities/trends-link.ts index e2909347a..fe39f4142 100644 --- a/packages/pl-api/lib/entities/trends-link.ts +++ b/packages/pl-api/lib/entities/trends-link.ts @@ -3,7 +3,10 @@ import * as v from 'valibot'; import { blurhashSchema } from './media-attachment'; import { historySchema } from './tag'; -/** @see {@link https://docs.joinmastodon.org/entities/PreviewCard/#trends-link} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/PreviewCard/#trends-link} + */ const trendsLinkSchema = v.pipe( v.any(), v.transform((link: any) => ({ ...link, id: link.url })), diff --git a/packages/pl-api/lib/entities/web-push-subscription.ts b/packages/pl-api/lib/entities/web-push-subscription.ts index 6ed56360b..29f111a79 100644 --- a/packages/pl-api/lib/entities/web-push-subscription.ts +++ b/packages/pl-api/lib/entities/web-push-subscription.ts @@ -1,6 +1,9 @@ import * as v from 'valibot'; -/** @see {@link https://docs.joinmastodon.org/entities/WebPushSubscription/} */ +/** + * @category Schemas + * @see {@link https://docs.joinmastodon.org/entities/WebPushSubscription/} + */ const webPushSubscriptionSchema = v.object({ id: v.pipe(v.unknown(), v.transform(String)), endpoint: v.string(), diff --git a/packages/pl-api/lib/features.ts b/packages/pl-api/lib/features.ts index 74bd026e7..22ebf0e68 100644 --- a/packages/pl-api/lib/features.ts +++ b/packages/pl-api/lib/features.ts @@ -142,7 +142,10 @@ const REBASED = 'soapbox'; */ const UNRELEASED = 'unreleased'; -/** Parse features for the given instance */ +/** + * Parse features for the given instance + * @category Utils + */ const getFeatures = (instance: Instance) => { const v = parseVersion(instance.version || ''); const federation = !!instance.pleroma.metadata.federation.enabled; diff --git a/packages/pl-api/lib/params/accounts.ts b/packages/pl-api/lib/params/accounts.ts index 6c22ed3ea..391febf0d 100644 --- a/packages/pl-api/lib/params/accounts.ts +++ b/packages/pl-api/lib/params/accounts.ts @@ -1,7 +1,13 @@ import type { LanguageParam, OnlyEventsParam, OnlyMediaParam, PaginationParams, WithMutedParam, WithRelationshipsParam } from './common'; +/** + * @category Request params + */ type GetAccountParams = WithMutedParam; +/** + * @category Request params + */ interface GetAccountStatusesParams extends PaginationParams, WithMutedParam, OnlyEventsParam, OnlyMediaParam, LanguageParam { /** Boolean. Filter out statuses in reply to a different account. */ exclude_replies?: boolean; @@ -11,9 +17,19 @@ interface GetAccountStatusesParams extends PaginationParams, WithMutedParam, Onl tagged?: string; } +/** + * @category Request params + */ type GetAccountFollowersParams = PaginationParams & WithRelationshipsParam; + +/** + * @category Request params + */ type GetAccountFollowingParams = PaginationParams & WithRelationshipsParam; +/** + * @category Request params + */ interface FollowAccountParams { /** Boolean. Receive this account’s reblogs in home timeline? Defaults to true. */ reblogs?: boolean; @@ -26,11 +42,17 @@ interface FollowAccountParams { languages?: string[]; } +/** + * @category Request params + */ interface GetRelationshipsParams { /** Boolean. Whether relationships should be returned for suspended users, defaults to false. */ with_suspended?: boolean; } +/** + * @category Request params + */ interface SearchAccountParams { /** Integer. Maximum number of results. Defaults to 40 accounts. Max 80 accounts. */ limit?: number; @@ -42,6 +64,9 @@ interface SearchAccountParams { following?: boolean; } +/** + * @category Request params + */ interface ReportAccountParams { status_ids?: string[]; comment?: string; @@ -50,11 +75,24 @@ interface ReportAccountParams { rule_ids?: string[]; } +/** + * @category Request params + */ type GetAccountEndorsementsParams = WithRelationshipsParam; + +/** + * @category Request params + */ type GetAccountFavouritesParams = PaginationParams; +/** + * @category Request params + */ type GetScrobblesParams = PaginationParams; +/** + * @category Request params + */ interface CreateScrobbleParams { /** the title of the media playing */ title: string; diff --git a/packages/pl-api/lib/params/admin.ts b/packages/pl-api/lib/params/admin.ts index 6e256e6f3..21fa51e5b 100644 --- a/packages/pl-api/lib/params/admin.ts +++ b/packages/pl-api/lib/params/admin.ts @@ -1,5 +1,8 @@ import type { PaginationParams } from './common'; +/** + * @category Request params + */ interface AdminGetAccountsParams extends PaginationParams { /** String. Filter for `local` or `remote` accounts. */ origin?: 'local' | 'remote'; @@ -23,8 +26,14 @@ interface AdminGetAccountsParams extends PaginationParams { ip?: string; } +/** + * @category Request params + */ type AdminAccountAction = 'none' | 'sensitive' | 'disable' | 'silence' | 'suspend'; +/** + * @category Request params + */ interface AdminPerformAccountActionParams { /** String. The ID of an associated report that caused this action to be taken. */ report_id?: string; @@ -36,8 +45,14 @@ interface AdminPerformAccountActionParams { send_email_notification?: boolean; } +/** + * @category Request params + */ type AdminGetDomainBlocksParams = PaginationParams; +/** + * @category Request params + */ interface AdminCreateDomainBlockParams { /** String. Whether to apply a `silence`, `suspend`, or `noop` to the domain. Defaults to `silence` */ severity?: 'silence' | 'suspend' | 'noop'; @@ -53,8 +68,14 @@ interface AdminCreateDomainBlockParams { obfuscate?: boolean; } +/** + * @category Request params + */ type AdminUpdateDomainBlockParams = AdminCreateDomainBlockParams; +/** + * @category Request params + */ interface AdminGetReportsParams extends PaginationParams { /** Boolean. Filter for resolved reports? */ resolved?: boolean; @@ -64,6 +85,9 @@ interface AdminGetReportsParams extends PaginationParams { target_account_id?: string; } +/** + * @category Request params + */ interface AdminUpdateReportParams { /** String. Change the classification of the report to `spam`, `violation`, or `other`. */ category?: 'spam' | 'violation' | 'other'; @@ -71,6 +95,9 @@ interface AdminUpdateReportParams { rule_ids?: string[]; } +/** + * @category Request params + */ interface AdminGetStatusesParams { limit?: number; local_only?: boolean; @@ -78,15 +105,27 @@ interface AdminGetStatusesParams { with_private?: boolean; } +/** + * @category Request params + */ interface AdminUpdateStatusParams { sensitive?: boolean; visibility?: 'public' | 'private' | 'unlisted'; } +/** + * @category Request params + */ type AdminGetCanonicalEmailBlocks = PaginationParams; +/** + * @category Request params + */ type AdminDimensionKey = 'languages' | 'sources' | 'servers' | 'space_usage' | 'software_versions' | 'tag_servers' | 'tag_languages' | 'instance_accounts' | 'instance_languages'; +/** + * @category Request params + */ interface AdminGetDimensionsParams { /** String (ISO 8601 Datetime). The start date for the time period. If a time is provided, it will be ignored. */ start_at?: string; @@ -112,12 +151,24 @@ interface AdminGetDimensionsParams { }; } +/** + * @category Request params + */ type AdminGetDomainAllowsParams = PaginationParams; +/** + * @category Request params + */ type AdminGetEmailDomainBlocksParams = PaginationParams; +/** + * @category Request params + */ type AdminGetIpBlocksParams = PaginationParams; +/** + * @category Request params + */ interface AdminCreateIpBlockParams { /** String. The IP address and prefix to block. Defaults to 0.0.0.0/32 */ ip?: string; @@ -129,10 +180,19 @@ interface AdminCreateIpBlockParams { expires_in?: number; } +/** + * @category Request params + */ type AdminUpdateIpBlockParams = Partial; +/** + * @category Request params + */ type AdminMeasureKey = 'active_users' | 'new_users' | 'interactions' | 'opened_reports' | 'resolved_reports' | 'tag_accounts' | 'tag_uses' | 'tag_servers' | 'instance_accounts' | 'instance_media_attachments' | 'instance_reports' | 'instance_statuses' | 'instance_follows' | 'instance_followers'; +/** + * @category Request params + */ interface AdminGetMeasuresParams { tag_accounts?: { /** String. When `tag_accounts` is one of the requested keys, you must provide a tag ID to obtain the measure of how many accounts used that hashtag in at least one status within the given time period. */ @@ -172,11 +232,17 @@ interface AdminGetMeasuresParams { }; } +/** + * @category Request params + */ interface AdminGetAnnouncementsParams { offset?: number; limit?: number; } +/** + * @category Request params + */ interface AdminCreateAnnouncementParams { /** announcement content */ content: string; @@ -188,8 +254,14 @@ interface AdminCreateAnnouncementParams { all_day?: boolean; } +/** + * @category Request params + */ type AdminUpdateAnnouncementParams = Partial; +/** + * @category Request params + */ interface AdminCreateDomainParams { /** domain name */ domain: string; @@ -197,6 +269,9 @@ interface AdminCreateDomainParams { public?: boolean; } +/** + * @category Request params + */ interface AdminGetModerationLogParams extends Pick { /** page number */ page?: number; @@ -210,14 +285,23 @@ interface AdminGetModerationLogParams extends Pick { search?: string; } +/** + * @category Request params + */ interface AdminCreateRuleParams { text: string; hint?: string; priority?: number; } +/** + * @category Request params + */ type AdminUpdateRuleParams = Partial; +/** + * @category Request params + */ interface AdminGetGroupsParams { } diff --git a/packages/pl-api/lib/params/apps.ts b/packages/pl-api/lib/params/apps.ts index 538ac1a34..17e5a839d 100644 --- a/packages/pl-api/lib/params/apps.ts +++ b/packages/pl-api/lib/params/apps.ts @@ -1,3 +1,6 @@ +/** + * @category Request params + */ interface CreateApplicationParams { /** String. A name for your application */ client_name: string; diff --git a/packages/pl-api/lib/params/chats.ts b/packages/pl-api/lib/params/chats.ts index bf19f88e0..c9e16a5db 100644 --- a/packages/pl-api/lib/params/chats.ts +++ b/packages/pl-api/lib/params/chats.ts @@ -1,8 +1,18 @@ import { PaginationParams, WithMutedParam } from './common'; +/** + * @category Request params + */ type GetChatsParams = PaginationParams & WithMutedParam; + +/** + * @category Request params + */ type GetChatMessagesParams = PaginationParams; +/** + * @category Request params + */ type CreateChatMessageParams = { content?: string; media_id: string; diff --git a/packages/pl-api/lib/params/events.ts b/packages/pl-api/lib/params/events.ts index c4120017a..4b40ab030 100644 --- a/packages/pl-api/lib/params/events.ts +++ b/packages/pl-api/lib/params/events.ts @@ -1,5 +1,8 @@ import { PaginationParams } from './common'; +/** + * @category Request params + */ interface CreateEventParams { /** name of the event */ name: string; @@ -19,9 +22,24 @@ interface CreateEventParams { content_type?: string; } +/** + * @category Request params + */ type EditEventParams = Partial>; + +/** + * @category Request params + */ type GetJoinedEventsParams = PaginationParams; + +/** + * @category Request params + */ type GetEventParticipationsParams = PaginationParams; + +/** + * @category Request params + */ type GetEventParticipationRequestsParams = PaginationParams; export type { diff --git a/packages/pl-api/lib/params/filtering.ts b/packages/pl-api/lib/params/filtering.ts index 165dff6ac..3fa4e1bfa 100644 --- a/packages/pl-api/lib/params/filtering.ts +++ b/packages/pl-api/lib/params/filtering.ts @@ -1,5 +1,8 @@ import type { PaginationParams, WithRelationshipsParam } from './common'; +/** + * @category Request params + */ interface MuteAccountParams { /** Boolean. Mute notifications in addition to statuses? Defaults to true. */ notifications?: boolean; @@ -7,12 +10,29 @@ interface MuteAccountParams { duration?: number; } +/** + * @category Request params + */ type GetMutesParams = Omit & WithRelationshipsParam; + +/** + * @category Request params + */ type GetBlocksParams = PaginationParams & WithRelationshipsParam; + +/** + * @category Request params + */ type GetDomainBlocksParams = PaginationParams; +/** + * @category Request params + */ type FilterContext = 'home' | 'notifications' | 'public' | 'thread' | 'account'; +/** + * @category Request params + */ interface CreateFilterParams { title: string; context: Array; @@ -24,6 +44,9 @@ interface CreateFilterParams { }>; } +/** + * @category Request params + */ interface UpdateFilterParams { title?: string; context?: Array; diff --git a/packages/pl-api/lib/params/groups.ts b/packages/pl-api/lib/params/groups.ts index 5ec218914..e6ad616bd 100644 --- a/packages/pl-api/lib/params/groups.ts +++ b/packages/pl-api/lib/params/groups.ts @@ -1,5 +1,8 @@ import type { PaginationParams } from './common'; +/** + * @category Request params + */ interface CreateGroupParams { display_name: string; note?: string; @@ -7,6 +10,9 @@ interface CreateGroupParams { header?: File; } +/** + * @category Request params + */ interface UpdateGroupParams { display_name?: string; note?: string; @@ -14,8 +20,19 @@ interface UpdateGroupParams { header?: File | ''; } +/** + * @category Request params + */ type GetGroupMembershipsParams = Omit; + +/** + * @category Request params + */ type GetGroupMembershipRequestsParams = Omit; + +/** + * @category Request params + */ type GetGroupBlocksParams = Omit; export type { diff --git a/packages/pl-api/lib/params/instance.ts b/packages/pl-api/lib/params/instance.ts index c8a9fa4fa..4d5652573 100644 --- a/packages/pl-api/lib/params/instance.ts +++ b/packages/pl-api/lib/params/instance.ts @@ -1,3 +1,6 @@ +/** + * @category Request params + */ interface ProfileDirectoryParams { /** Number. Skip the first n results. */ offset?: number; diff --git a/packages/pl-api/lib/params/interaction-requests.ts b/packages/pl-api/lib/params/interaction-requests.ts index 403c05b1b..b5c53fac5 100644 --- a/packages/pl-api/lib/params/interaction-requests.ts +++ b/packages/pl-api/lib/params/interaction-requests.ts @@ -1,5 +1,8 @@ import { PaginationParams } from './common'; +/** + * @category Request params + */ interface GetInteractionRequestsParams extends PaginationParams { /** If set, then only interactions targeting the given status_id will be included in the results. */ status_id?: string; diff --git a/packages/pl-api/lib/params/lists.ts b/packages/pl-api/lib/params/lists.ts index af98e821f..3eec175fb 100644 --- a/packages/pl-api/lib/params/lists.ts +++ b/packages/pl-api/lib/params/lists.ts @@ -1,5 +1,8 @@ import type { PaginationParams } from './common'; +/** + * @category Request params + */ interface CreateListParams { /** String. The title of the list to be created. */ title: string; @@ -9,7 +12,14 @@ interface CreateListParams { exclusive?: boolean; } +/** + * @category Request params + */ type UpdateListParams = CreateListParams; + +/** + * @category Request params + */ type GetListAccountsParams = PaginationParams; export type { diff --git a/packages/pl-api/lib/params/media.ts b/packages/pl-api/lib/params/media.ts index 288f5ba8c..973c0a13e 100644 --- a/packages/pl-api/lib/params/media.ts +++ b/packages/pl-api/lib/params/media.ts @@ -1,3 +1,6 @@ +/** + * @category Request params + */ interface UploadMediaParams { /** Object. The file to be attached, encoded using multipart form data. The file must have a MIME type. */ file: File; @@ -12,6 +15,9 @@ interface UploadMediaParams { focus?: string; } +/** + * @category Request params + */ interface UpdateMediaParams { /** Object. The custom thumbnail of the media to be attached, encoded using multipart form data. */ thumbnail?: File; diff --git a/packages/pl-api/lib/params/my-account.ts b/packages/pl-api/lib/params/my-account.ts index d0c372e76..d8edde5c4 100644 --- a/packages/pl-api/lib/params/my-account.ts +++ b/packages/pl-api/lib/params/my-account.ts @@ -1,5 +1,8 @@ import type { PaginationParams } from './common'; +/** + * @category Request params + */ interface GetBookmarksParams extends PaginationParams { /** * Bookmark folder ID @@ -8,16 +11,37 @@ interface GetBookmarksParams extends PaginationParams { folder_id?: string; } +/** + * @category Request params + */ type GetFavouritesParams = PaginationParams; + +/** + * @category Request params + */ type GetFollowRequestsParams = Omit; + +/** + * @category Request params + */ type GetEndorsementsParams = Omit; + +/** + * @category Request params + */ type GetFollowedTagsParams = PaginationParams; +/** + * @category Request params + */ interface CreateBookmarkFolderParams { name: string; emoji?: string; } +/** + * @category Request params + */ type UpdateBookmarkFolderParams = Partial; export type { diff --git a/packages/pl-api/lib/params/notifications.ts b/packages/pl-api/lib/params/notifications.ts index 52d8f9553..90125ebbc 100644 --- a/packages/pl-api/lib/params/notifications.ts +++ b/packages/pl-api/lib/params/notifications.ts @@ -1,5 +1,8 @@ import type { PaginationParams } from './common'; +/** + * @category Request params + */ interface GetNotificationParams extends PaginationParams { /** Types to include in the result. */ types?: string[]; @@ -14,6 +17,9 @@ interface GetNotificationParams extends PaginationParams { exclude_visibilities?: string[]; } +/** + * @category Request params + */ interface GetUnreadNotificationCountParams { /** Maximum number of results to return. Defaults to 100 notifications. Max 1000 notifications. */ limit?: number; @@ -25,6 +31,9 @@ interface GetUnreadNotificationCountParams { account_id?: string; } +/** + * @category Request params + */ interface UpdateNotificationPolicyRequest { /** Whether to `accept`, `filter` or `drop` notifications from accounts the user is not following. */ for_not_following?: boolean; @@ -38,6 +47,9 @@ interface UpdateNotificationPolicyRequest { for_limited_accounts?: boolean; } +/** + * @category Request params + */ type GetNotificationRequestsParams = PaginationParams; export type { diff --git a/packages/pl-api/lib/params/oauth.ts b/packages/pl-api/lib/params/oauth.ts index 75e6059b3..b912d936f 100644 --- a/packages/pl-api/lib/params/oauth.ts +++ b/packages/pl-api/lib/params/oauth.ts @@ -1,3 +1,6 @@ +/** + * @category Request params + */ interface OauthAuthorizeParams { /** String. Should be set equal to `code`. */ response_type: string; @@ -13,6 +16,9 @@ interface OauthAuthorizeParams { lang?: string; } +/** + * @category Request params + */ interface GetTokenParams { /** String. Set equal to `authorization_code` if `code` is provided in order to gain user-level access. Otherwise, set equal to `client_credentials` to obtain app-level access only. */ grant_type: string; @@ -28,6 +34,9 @@ interface GetTokenParams { scope?: string; } +/** + * @category Request params + */ interface RevokeTokenParams { /** String. The client ID, obtained during app registration. */ client_id: string; @@ -37,6 +46,9 @@ interface RevokeTokenParams { token: string; } +/** + * @category Request params + */ interface MfaChallengeParams { client_id: string; client_secret: string; diff --git a/packages/pl-api/lib/params/push-notifications.ts b/packages/pl-api/lib/params/push-notifications.ts index 67b85dd91..5a561bd7a 100644 --- a/packages/pl-api/lib/params/push-notifications.ts +++ b/packages/pl-api/lib/params/push-notifications.ts @@ -1,3 +1,6 @@ +/** + * @category Request params + */ interface CreatePushNotificationsSubscriptionParams { subscription: { /** String. The endpoint URL that is called when a notification event occurs. */ @@ -16,6 +19,9 @@ interface CreatePushNotificationsSubscriptionParams { }; } +/** + * @category Request params + */ interface UpdatePushNotificationsSubscriptionParams { data?: { alerts?: Record; diff --git a/packages/pl-api/lib/params/scheduled-statuses.ts b/packages/pl-api/lib/params/scheduled-statuses.ts index 53875e490..4fdb0fa5b 100644 --- a/packages/pl-api/lib/params/scheduled-statuses.ts +++ b/packages/pl-api/lib/params/scheduled-statuses.ts @@ -1,5 +1,8 @@ import type { PaginationParams } from './common'; +/** + * @category Request params + */ type GetScheduledStatusesParams = PaginationParams; export type { diff --git a/packages/pl-api/lib/params/search.ts b/packages/pl-api/lib/params/search.ts index ecbeb2e30..4f3df33ea 100644 --- a/packages/pl-api/lib/params/search.ts +++ b/packages/pl-api/lib/params/search.ts @@ -1,5 +1,8 @@ import type { PaginationParams, WithRelationshipsParam } from './common'; +/** + * @category Request params + */ interface SearchParams extends Exclude, WithRelationshipsParam { /** String. Specify whether to search for only `accounts`, `hashtags`, `statuses` */ type?: 'accounts' | 'hashtags' | 'statuses' | 'groups'; diff --git a/packages/pl-api/lib/params/settings.ts b/packages/pl-api/lib/params/settings.ts index 9dc5a3e9a..8b0f5432e 100644 --- a/packages/pl-api/lib/params/settings.ts +++ b/packages/pl-api/lib/params/settings.ts @@ -1,3 +1,6 @@ +/** + * @category Request params + */ interface CreateAccountParams { /** String. The desired username for the account */ username: string; @@ -30,6 +33,9 @@ interface CreateAccountParams { accepts_email_list?: boolean; } +/** + * @category Request params + */ interface UpdateCredentialsParams { /** String. The display name to use for the profile. */ display_name?: string; @@ -115,6 +121,9 @@ interface UpdateCredentialsParams { enable_rss?: boolean; } +/** + * @category Request params + */ interface UpdateNotificationSettingsParams { /** * blocks notifications from accounts you do not follow @@ -127,6 +136,9 @@ interface UpdateNotificationSettingsParams { hide_notification_contents?: boolean; } +/** + * @category Request params + */ type UpdateInteractionPoliciesParams = Record< 'public' | 'unlisted' | 'private' | 'direct', Record< diff --git a/packages/pl-api/lib/params/statuses.ts b/packages/pl-api/lib/params/statuses.ts index b4ae3f0d9..e83d71ed5 100644 --- a/packages/pl-api/lib/params/statuses.ts +++ b/packages/pl-api/lib/params/statuses.ts @@ -2,6 +2,9 @@ import { UpdateInteractionPoliciesParams } from './settings'; import type { PaginationParams } from './common'; +/** + * @category Request params + */ interface CreateStatusWithContent { /** The text content of the status. If `media_ids` is provided, this becomes optional. Attaching a `poll` is optional while `status` is provided. */ status: string; @@ -9,6 +12,9 @@ interface CreateStatusWithContent { media_ids?: string[]; } +/** + * @category Request params + */ interface CreateStatusWithMedia { /** The text content of the status. If `media_ids` is provided, this becomes optional. Attaching a `poll` is optional while `status` is provided. */ status?: string; @@ -16,6 +22,9 @@ interface CreateStatusWithMedia { media_ids: string[]; } +/** + * @category Request params + */ interface CreateStatusOptionalParams { poll?: { /** Array of String. Possible answers to the poll. If provided, `media_ids` cannot be used, and poll[expires_in] must be provided. */ @@ -90,30 +99,61 @@ interface CreateStatusOptionalParams { interaction_policy?: UpdateInteractionPoliciesParams['public']; } +/** + * @category Request params + */ type CreateStatusParams = (CreateStatusWithContent | CreateStatusWithMedia) & CreateStatusOptionalParams; +/** + * @category Request params + */ interface LanguageParam { /** Attach translated version of a post. Requires `features.autoTranslate`. */ language?: string; } +/** + * @category Request params + */ type GetStatusParams = LanguageParam; +/** + * @category Request params + */ type GetStatusesParams = LanguageParam; +/** + * @category Request params + */ type GetStatusContextParams = LanguageParam; +/** + * @category Request params + */ type GetRebloggedByParams = Omit +/** + * @category Request params + */ type GetFavouritedByParams = Omit +/** + * @category Request params + */ interface EditStatusOptionalParams { sensitive?: boolean; spoiler_text?: string; language?: string; } +/** + * @category Request params + */ type EditStatusParams = (CreateStatusWithContent | CreateStatusWithMedia) & EditStatusOptionalParams; + +/** + * @category Request params + */ type GetStatusQuotesParams = PaginationParams; export type { diff --git a/packages/pl-api/lib/params/timelines.ts b/packages/pl-api/lib/params/timelines.ts index 9a0377981..ba295ec1b 100644 --- a/packages/pl-api/lib/params/timelines.ts +++ b/packages/pl-api/lib/params/timelines.ts @@ -1,5 +1,8 @@ import type { LanguageParam, OnlyEventsParam, OnlyMediaParam, PaginationParams, WithMutedParam } from './common'; +/** + * @category Request params + */ interface PublicTimelineParams extends PaginationParams, WithMutedParam, OnlyEventsParam, OnlyMediaParam, LanguageParam { /** Boolean. Show only local statuses? Defaults to false. */ local?: boolean; @@ -13,6 +16,9 @@ interface PublicTimelineParams extends PaginationParams, WithMutedParam, OnlyEve instance?: string; } +/** + * @category Request params + */ interface HashtagTimelineParams extends PaginationParams, WithMutedParam, OnlyEventsParam, OnlyMediaParam, LanguageParam { /** Array of String. Return statuses that contain any of these additional tags. */ any?: string[]; @@ -26,10 +32,24 @@ interface HashtagTimelineParams extends PaginationParams, WithMutedParam, OnlyEv remote?: boolean; } +/** + * @category Request params + */ type HomeTimelineParams = PaginationParams & WithMutedParam & OnlyEventsParam & LanguageParam; + +/** + * @category Request params + */ type LinkTimelineParams = PaginationParams & WithMutedParam & LanguageParam; + +/** + * @category Request params + */ type ListTimelineParams = PaginationParams & WithMutedParam & OnlyEventsParam & LanguageParam; +/** + * @category Request params + */ interface GetConversationsParams extends PaginationParams, LanguageParam { /** * Only return conversations with the given recipients (a list of user ids). @@ -38,6 +58,9 @@ interface GetConversationsParams extends PaginationParams, LanguageParam { recipients?: string[]; } +/** + * @category Request params + */ interface SaveMarkersParams { home?: { /** String. ID of the last status read in the home timeline. */ @@ -49,7 +72,14 @@ interface SaveMarkersParams { }; } +/** + * @category Request params + */ type GroupTimelineParams = PaginationParams & WithMutedParam & OnlyMediaParam & LanguageParam; + +/** + * @category Request params + */ type BubbleTimelineParams = PaginationParams & WithMutedParam & OnlyEventsParam & OnlyMediaParam & LanguageParam; export type { diff --git a/packages/pl-api/lib/params/trends.ts b/packages/pl-api/lib/params/trends.ts index e167f3ca3..b4ff665c5 100644 --- a/packages/pl-api/lib/params/trends.ts +++ b/packages/pl-api/lib/params/trends.ts @@ -1,3 +1,6 @@ +/** + * @category Request params + */ interface GetTrends { /** Integer. Maximum number of results to return. */ limit?: number; @@ -5,8 +8,19 @@ interface GetTrends { offset?: number; } +/** + * @category Request params + */ type GetTrendingTags = GetTrends; + +/** + * @category Request params + */ type GetTrendingStatuses = GetTrends; + +/** + * @category Request params + */ type GetTrendingLinks = GetTrends; export type {