pl-api: Update docs
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
486b98fdc0
commit
b357261ff2
24 changed files with 148 additions and 16 deletions
|
@ -6,7 +6,10 @@ import { datetimeSchema, filteredArray } from '../utils';
|
|||
|
||||
import { adminIpSchema } from './ip';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Admin_Account/} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Admin_Account/}
|
||||
*/
|
||||
const adminAccountSchema = v.pipe(
|
||||
v.any(),
|
||||
v.transform((account: any) => {
|
||||
|
@ -65,6 +68,9 @@ const adminAccountSchema = v.pipe(
|
|||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminAccount = v.InferOutput<typeof adminAccountSchema>;
|
||||
|
||||
export {
|
||||
|
|
|
@ -3,7 +3,10 @@ import * as v from 'valibot';
|
|||
|
||||
import { announcementSchema } from '../announcement';
|
||||
|
||||
/** @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminannouncements} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminannouncements}
|
||||
*/
|
||||
const adminAnnouncementSchema = v.pipe(
|
||||
v.any(),
|
||||
v.transform((announcement: any) => ({
|
||||
|
@ -16,6 +19,9 @@ const adminAnnouncementSchema = v.pipe(
|
|||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminAnnouncement = v.InferOutput<typeof adminAnnouncementSchema>;
|
||||
|
||||
export { adminAnnouncementSchema, type AdminAnnouncement };
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
import * as v from 'valibot';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Admin_CanonicalEmailBlock/} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Admin_CanonicalEmailBlock/}
|
||||
*/
|
||||
const adminCanonicalEmailBlockSchema = v.object({
|
||||
id: v.string(),
|
||||
canonical_email_hash: v.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminCanonicalEmailBlock = v.InferOutput<typeof adminCanonicalEmailBlockSchema>;
|
||||
|
||||
export {
|
||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
|||
|
||||
import { datetimeSchema } from '../utils';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Admin_Cohort/} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Admin_Cohort/}
|
||||
*/
|
||||
const adminCohortSchema = v.object({
|
||||
period: datetimeSchema,
|
||||
frequency: v.picklist(['day', 'month']),
|
||||
|
@ -13,6 +16,9 @@ const adminCohortSchema = v.object({
|
|||
})),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminCohort = v.InferOutput<typeof adminCohortSchema>;
|
||||
|
||||
export {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import * as v from 'valibot';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Admin_Dimension/} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Admin_Dimension/}
|
||||
*/
|
||||
const adminDimensionSchema = v.object({
|
||||
key: v.string(),
|
||||
data: v.object({
|
||||
|
@ -12,6 +15,9 @@ const adminDimensionSchema = v.object({
|
|||
}),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminDimension = v.InferOutput<typeof adminDimensionSchema>;
|
||||
|
||||
export {
|
||||
|
|
|
@ -2,13 +2,19 @@ import * as v from 'valibot';
|
|||
|
||||
import { datetimeSchema } from '../utils';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Admin_DomainAllow/} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Admin_DomainAllow/}
|
||||
*/
|
||||
const adminDomainAllowSchema = v.object({
|
||||
id: v.string(),
|
||||
domain: v.string(),
|
||||
created_at: datetimeSchema,
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminDomainAllow = v.InferOutput<typeof adminDomainAllowSchema>;
|
||||
|
||||
export {
|
||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
|||
|
||||
import { datetimeSchema } from '../utils';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Admin_DomainBlock/} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Admin_DomainBlock/}
|
||||
*/
|
||||
const adminDomainBlockSchema = v.object({
|
||||
id: v.string(),
|
||||
domain: v.string(),
|
||||
|
@ -16,6 +19,9 @@ const adminDomainBlockSchema = v.object({
|
|||
obfuscate: v.boolean(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminDomainBlock = v.InferOutput<typeof adminDomainBlockSchema>;
|
||||
|
||||
export {
|
||||
|
|
|
@ -10,6 +10,9 @@ const adminDomainSchema = v.object({
|
|||
last_checked_at: v.fallback(v.nullable(datetimeSchema), null),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminDomain = v.InferOutput<typeof adminDomainSchema>
|
||||
|
||||
export { adminDomainSchema, type AdminDomain };
|
||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
|||
|
||||
import { datetimeSchema } from '../utils';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Admin_EmailDomainBlock/} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Admin_EmailDomainBlock/}
|
||||
*/
|
||||
const adminEmailDomainBlockSchema = v.object({
|
||||
id: v.string(),
|
||||
domain: v.string(),
|
||||
|
@ -14,6 +17,9 @@ const adminEmailDomainBlockSchema = v.object({
|
|||
})),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminEmailDomainBlock = v.InferOutput<typeof adminEmailDomainBlockSchema>;
|
||||
|
||||
export {
|
||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
|||
|
||||
import { datetimeSchema } from '../utils';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Admin_IpBlock/} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Admin_IpBlock/}
|
||||
*/
|
||||
const adminIpBlockSchema = v.object({
|
||||
id: v.string(),
|
||||
ip: v.pipe(v.string(), v.ip()),
|
||||
|
@ -12,6 +15,9 @@ const adminIpBlockSchema = v.object({
|
|||
expires_at: v.fallback(v.nullable(datetimeSchema), null),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminIpBlock = v.InferOutput<typeof adminIpBlockSchema>;
|
||||
|
||||
export {
|
||||
|
|
|
@ -2,12 +2,18 @@ import * as v from 'valibot';
|
|||
|
||||
import { datetimeSchema } from '../utils';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Admin_Ip/} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Admin_Ip/}
|
||||
*/
|
||||
const adminIpSchema = v.object({
|
||||
ip: v.pipe(v.string(), v.ip()),
|
||||
used_at: datetimeSchema,
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminIp = v.InferOutput<typeof adminIpSchema>;
|
||||
|
||||
export {
|
||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
|||
|
||||
import { datetimeSchema } from '../utils';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Admin_Measure/} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Admin_Measure/}
|
||||
*/
|
||||
const adminMeasureSchema = v.object({
|
||||
key: v.string(),
|
||||
unit: v.fallback(v.nullable(v.string()), null),
|
||||
|
@ -15,6 +18,9 @@ const adminMeasureSchema = v.object({
|
|||
})),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminMeasure = v.InferOutput<typeof adminMeasureSchema>;
|
||||
|
||||
export {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import * as v from 'valibot';
|
||||
|
||||
/** @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminmoderation_log} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminmoderation_log}
|
||||
*/
|
||||
const adminModerationLogEntrySchema = v.object({
|
||||
id: v.pipe(v.unknown(), v.transform(String)),
|
||||
data: v.fallback(v.record(v.string(), v.any()), {}),
|
||||
|
@ -8,6 +11,9 @@ const adminModerationLogEntrySchema = v.object({
|
|||
message: v.fallback(v.string(), ''),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminModerationLogEntry = v.InferOutput<typeof adminModerationLogEntrySchema>
|
||||
|
||||
export { adminModerationLogEntrySchema, type AdminModerationLogEntry };
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as v from 'valibot';
|
||||
|
||||
/**
|
||||
* @category Schemas
|
||||
* @category Admin schemas
|
||||
*/
|
||||
const pleromaConfigSchema = v.object({
|
||||
configs: v.array(v.object({
|
||||
|
@ -12,6 +12,9 @@ const pleromaConfigSchema = v.object({
|
|||
need_reboot: v.boolean(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type PleromaConfig = v.InferOutput<typeof pleromaConfigSchema>
|
||||
|
||||
export { pleromaConfigSchema, type PleromaConfig };
|
||||
|
|
|
@ -10,6 +10,9 @@ const adminRelaySchema = v.pipe(
|
|||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminRelay = v.InferOutput<typeof adminRelaySchema>
|
||||
|
||||
export { adminRelaySchema, type AdminRelay };
|
||||
|
|
|
@ -7,7 +7,10 @@ import { datetimeSchema, filteredArray } from '../utils';
|
|||
|
||||
import { adminAccountSchema } from './account';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Admin_Report/} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Admin_Report/}
|
||||
*/
|
||||
const adminReportSchema = v.pipe(
|
||||
v.any(),
|
||||
v.transform((report: any) => {
|
||||
|
@ -45,6 +48,9 @@ const adminReportSchema = v.pipe(
|
|||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminReport = v.InferOutput<typeof adminReportSchema>;
|
||||
|
||||
export { adminReportSchema, type AdminReport };
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import * as v from 'valibot';
|
||||
|
||||
/** @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminrules} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminrules}
|
||||
*/
|
||||
const adminRuleSchema = v.object({
|
||||
id: v.string(),
|
||||
text: v.fallback(v.string(), ''),
|
||||
|
@ -8,6 +11,9 @@ const adminRuleSchema = v.object({
|
|||
priority: v.fallback(v.nullable(v.number()), null),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminRule = v.InferOutput<typeof adminRuleSchema>;
|
||||
|
||||
export { adminRuleSchema, type AdminRule };
|
||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
|||
|
||||
import { tagSchema } from '../tag';
|
||||
|
||||
/** @see {@link https://docs.joinmastodon.org/entities/Tag/#admin} */
|
||||
/**
|
||||
* @category Admin schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Tag/#admin}
|
||||
*/
|
||||
const adminTagSchema = v.object({
|
||||
...tagSchema.entries,
|
||||
id: v.string(),
|
||||
|
@ -11,6 +14,9 @@ const adminTagSchema = v.object({
|
|||
requires_review: v.boolean(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Admin types
|
||||
*/
|
||||
type AdminTag = v.InferOutput<typeof adminTagSchema>;
|
||||
|
||||
export {
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
import * as v from 'valibot';
|
||||
|
||||
/**
|
||||
* @category Directory schemas
|
||||
*/
|
||||
const directoryCategorySchema = v.object({
|
||||
category: v.string(),
|
||||
servers_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Directory types
|
||||
*/
|
||||
type DirectoryCategory = v.InferOutput<typeof directoryCategorySchema>;
|
||||
|
||||
export { directoryCategorySchema, type DirectoryCategory };
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
import * as v from 'valibot';
|
||||
|
||||
/**
|
||||
* @category Directory schemas
|
||||
*/
|
||||
const directoryLanguageSchema = v.object({
|
||||
locale: v.string(),
|
||||
language: v.string(),
|
||||
servers_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Directory types
|
||||
*/
|
||||
type DirectoryLanguage = v.InferOutput<typeof directoryLanguageSchema>;
|
||||
|
||||
export { directoryLanguageSchema, type DirectoryLanguage };
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import * as v from 'valibot';
|
||||
|
||||
/**
|
||||
* @category Directory schemas
|
||||
*/
|
||||
const directoryServerSchema = v.object({
|
||||
domain: v.string(),
|
||||
version: v.string(),
|
||||
|
@ -16,6 +19,9 @@ const directoryServerSchema = v.object({
|
|||
category: v.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Directory types
|
||||
*/
|
||||
type DirectoryServer = v.InferOutput<typeof directoryServerSchema>;
|
||||
|
||||
export { directoryServerSchema, type DirectoryServer };
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import * as v from 'valibot';
|
||||
|
||||
/**
|
||||
* @category Directory schemas
|
||||
*/
|
||||
const directoryStatisticsPeriodSchema = v.object({
|
||||
period: v.pipe(v.string(), v.isoDate()),
|
||||
server_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null),
|
||||
|
@ -7,6 +10,9 @@ const directoryStatisticsPeriodSchema = v.object({
|
|||
active_user_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Directory types
|
||||
*/
|
||||
type DirectoryStatisticsPeriod = v.InferOutput<typeof directoryStatisticsPeriodSchema>;
|
||||
|
||||
export { directoryStatisticsPeriodSchema, type DirectoryStatisticsPeriod };
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import type { PaginationParams } from './common';
|
||||
|
||||
/**
|
||||
* @category Request params
|
||||
*/
|
||||
interface GetGroupedNotificationsParams extends PaginationParams {
|
||||
/** Types to include in the result. */
|
||||
types?: Array<string>;
|
||||
|
@ -15,6 +18,9 @@ interface GetGroupedNotificationsParams extends PaginationParams {
|
|||
include_filtered?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @category Request params
|
||||
*/
|
||||
interface GetUnreadNotificationGroupCountParams {
|
||||
/** Maximum number of results to return. Defaults to 100 notifications. Max 1000 notifications. */
|
||||
limit?: number;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
interface PaginatedResponse<T, IsArray extends boolean = true> {
|
||||
previous: (() => Promise<PaginatedResponse<T, IsArray>>) | null;
|
||||
next: (() => Promise<PaginatedResponse<T, IsArray>>) | null;
|
||||
|
|
Loading…
Reference in a new issue