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';
|
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(
|
const adminAccountSchema = v.pipe(
|
||||||
v.any(),
|
v.any(),
|
||||||
v.transform((account: any) => {
|
v.transform((account: any) => {
|
||||||
|
@ -65,6 +68,9 @@ const adminAccountSchema = v.pipe(
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminAccount = v.InferOutput<typeof adminAccountSchema>;
|
type AdminAccount = v.InferOutput<typeof adminAccountSchema>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -3,7 +3,10 @@ import * as v from 'valibot';
|
||||||
|
|
||||||
import { announcementSchema } from '../announcement';
|
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(
|
const adminAnnouncementSchema = v.pipe(
|
||||||
v.any(),
|
v.any(),
|
||||||
v.transform((announcement: any) => ({
|
v.transform((announcement: any) => ({
|
||||||
|
@ -16,6 +19,9 @@ const adminAnnouncementSchema = v.pipe(
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminAnnouncement = v.InferOutput<typeof adminAnnouncementSchema>;
|
type AdminAnnouncement = v.InferOutput<typeof adminAnnouncementSchema>;
|
||||||
|
|
||||||
export { adminAnnouncementSchema, type AdminAnnouncement };
|
export { adminAnnouncementSchema, type AdminAnnouncement };
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
import * as v from 'valibot';
|
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({
|
const adminCanonicalEmailBlockSchema = v.object({
|
||||||
id: v.string(),
|
id: v.string(),
|
||||||
canonical_email_hash: v.string(),
|
canonical_email_hash: v.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminCanonicalEmailBlock = v.InferOutput<typeof adminCanonicalEmailBlockSchema>;
|
type AdminCanonicalEmailBlock = v.InferOutput<typeof adminCanonicalEmailBlockSchema>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
||||||
|
|
||||||
import { datetimeSchema } from '../utils';
|
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({
|
const adminCohortSchema = v.object({
|
||||||
period: datetimeSchema,
|
period: datetimeSchema,
|
||||||
frequency: v.picklist(['day', 'month']),
|
frequency: v.picklist(['day', 'month']),
|
||||||
|
@ -13,6 +16,9 @@ const adminCohortSchema = v.object({
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminCohort = v.InferOutput<typeof adminCohortSchema>;
|
type AdminCohort = v.InferOutput<typeof adminCohortSchema>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import * as v from 'valibot';
|
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({
|
const adminDimensionSchema = v.object({
|
||||||
key: v.string(),
|
key: v.string(),
|
||||||
data: v.object({
|
data: v.object({
|
||||||
|
@ -12,6 +15,9 @@ const adminDimensionSchema = v.object({
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminDimension = v.InferOutput<typeof adminDimensionSchema>;
|
type AdminDimension = v.InferOutput<typeof adminDimensionSchema>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -2,13 +2,19 @@ import * as v from 'valibot';
|
||||||
|
|
||||||
import { datetimeSchema } from '../utils';
|
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({
|
const adminDomainAllowSchema = v.object({
|
||||||
id: v.string(),
|
id: v.string(),
|
||||||
domain: v.string(),
|
domain: v.string(),
|
||||||
created_at: datetimeSchema,
|
created_at: datetimeSchema,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminDomainAllow = v.InferOutput<typeof adminDomainAllowSchema>;
|
type AdminDomainAllow = v.InferOutput<typeof adminDomainAllowSchema>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
||||||
|
|
||||||
import { datetimeSchema } from '../utils';
|
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({
|
const adminDomainBlockSchema = v.object({
|
||||||
id: v.string(),
|
id: v.string(),
|
||||||
domain: v.string(),
|
domain: v.string(),
|
||||||
|
@ -16,6 +19,9 @@ const adminDomainBlockSchema = v.object({
|
||||||
obfuscate: v.boolean(),
|
obfuscate: v.boolean(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminDomainBlock = v.InferOutput<typeof adminDomainBlockSchema>;
|
type AdminDomainBlock = v.InferOutput<typeof adminDomainBlockSchema>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -10,6 +10,9 @@ const adminDomainSchema = v.object({
|
||||||
last_checked_at: v.fallback(v.nullable(datetimeSchema), null),
|
last_checked_at: v.fallback(v.nullable(datetimeSchema), null),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminDomain = v.InferOutput<typeof adminDomainSchema>
|
type AdminDomain = v.InferOutput<typeof adminDomainSchema>
|
||||||
|
|
||||||
export { adminDomainSchema, type AdminDomain };
|
export { adminDomainSchema, type AdminDomain };
|
||||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
||||||
|
|
||||||
import { datetimeSchema } from '../utils';
|
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({
|
const adminEmailDomainBlockSchema = v.object({
|
||||||
id: v.string(),
|
id: v.string(),
|
||||||
domain: v.string(),
|
domain: v.string(),
|
||||||
|
@ -14,6 +17,9 @@ const adminEmailDomainBlockSchema = v.object({
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminEmailDomainBlock = v.InferOutput<typeof adminEmailDomainBlockSchema>;
|
type AdminEmailDomainBlock = v.InferOutput<typeof adminEmailDomainBlockSchema>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
||||||
|
|
||||||
import { datetimeSchema } from '../utils';
|
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({
|
const adminIpBlockSchema = v.object({
|
||||||
id: v.string(),
|
id: v.string(),
|
||||||
ip: v.pipe(v.string(), v.ip()),
|
ip: v.pipe(v.string(), v.ip()),
|
||||||
|
@ -12,6 +15,9 @@ const adminIpBlockSchema = v.object({
|
||||||
expires_at: v.fallback(v.nullable(datetimeSchema), null),
|
expires_at: v.fallback(v.nullable(datetimeSchema), null),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminIpBlock = v.InferOutput<typeof adminIpBlockSchema>;
|
type AdminIpBlock = v.InferOutput<typeof adminIpBlockSchema>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -2,12 +2,18 @@ import * as v from 'valibot';
|
||||||
|
|
||||||
import { datetimeSchema } from '../utils';
|
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({
|
const adminIpSchema = v.object({
|
||||||
ip: v.pipe(v.string(), v.ip()),
|
ip: v.pipe(v.string(), v.ip()),
|
||||||
used_at: datetimeSchema,
|
used_at: datetimeSchema,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminIp = v.InferOutput<typeof adminIpSchema>;
|
type AdminIp = v.InferOutput<typeof adminIpSchema>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
||||||
|
|
||||||
import { datetimeSchema } from '../utils';
|
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({
|
const adminMeasureSchema = v.object({
|
||||||
key: v.string(),
|
key: v.string(),
|
||||||
unit: v.fallback(v.nullable(v.string()), null),
|
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>;
|
type AdminMeasure = v.InferOutput<typeof adminMeasureSchema>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import * as v from 'valibot';
|
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({
|
const adminModerationLogEntrySchema = v.object({
|
||||||
id: v.pipe(v.unknown(), v.transform(String)),
|
id: v.pipe(v.unknown(), v.transform(String)),
|
||||||
data: v.fallback(v.record(v.string(), v.any()), {}),
|
data: v.fallback(v.record(v.string(), v.any()), {}),
|
||||||
|
@ -8,6 +11,9 @@ const adminModerationLogEntrySchema = v.object({
|
||||||
message: v.fallback(v.string(), ''),
|
message: v.fallback(v.string(), ''),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminModerationLogEntry = v.InferOutput<typeof adminModerationLogEntrySchema>
|
type AdminModerationLogEntry = v.InferOutput<typeof adminModerationLogEntrySchema>
|
||||||
|
|
||||||
export { adminModerationLogEntrySchema, type AdminModerationLogEntry };
|
export { adminModerationLogEntrySchema, type AdminModerationLogEntry };
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as v from 'valibot';
|
import * as v from 'valibot';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Schemas
|
* @category Admin schemas
|
||||||
*/
|
*/
|
||||||
const pleromaConfigSchema = v.object({
|
const pleromaConfigSchema = v.object({
|
||||||
configs: v.array(v.object({
|
configs: v.array(v.object({
|
||||||
|
@ -12,6 +12,9 @@ const pleromaConfigSchema = v.object({
|
||||||
need_reboot: v.boolean(),
|
need_reboot: v.boolean(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type PleromaConfig = v.InferOutput<typeof pleromaConfigSchema>
|
type PleromaConfig = v.InferOutput<typeof pleromaConfigSchema>
|
||||||
|
|
||||||
export { pleromaConfigSchema, type PleromaConfig };
|
export { pleromaConfigSchema, type PleromaConfig };
|
||||||
|
|
|
@ -10,6 +10,9 @@ const adminRelaySchema = v.pipe(
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminRelay = v.InferOutput<typeof adminRelaySchema>
|
type AdminRelay = v.InferOutput<typeof adminRelaySchema>
|
||||||
|
|
||||||
export { adminRelaySchema, type AdminRelay };
|
export { adminRelaySchema, type AdminRelay };
|
||||||
|
|
|
@ -7,7 +7,10 @@ import { datetimeSchema, filteredArray } from '../utils';
|
||||||
|
|
||||||
import { adminAccountSchema } from './account';
|
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(
|
const adminReportSchema = v.pipe(
|
||||||
v.any(),
|
v.any(),
|
||||||
v.transform((report: any) => {
|
v.transform((report: any) => {
|
||||||
|
@ -45,6 +48,9 @@ const adminReportSchema = v.pipe(
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminReport = v.InferOutput<typeof adminReportSchema>;
|
type AdminReport = v.InferOutput<typeof adminReportSchema>;
|
||||||
|
|
||||||
export { adminReportSchema, type AdminReport };
|
export { adminReportSchema, type AdminReport };
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import * as v from 'valibot';
|
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({
|
const adminRuleSchema = v.object({
|
||||||
id: v.string(),
|
id: v.string(),
|
||||||
text: v.fallback(v.string(), ''),
|
text: v.fallback(v.string(), ''),
|
||||||
|
@ -8,6 +11,9 @@ const adminRuleSchema = v.object({
|
||||||
priority: v.fallback(v.nullable(v.number()), null),
|
priority: v.fallback(v.nullable(v.number()), null),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminRule = v.InferOutput<typeof adminRuleSchema>;
|
type AdminRule = v.InferOutput<typeof adminRuleSchema>;
|
||||||
|
|
||||||
export { adminRuleSchema, type AdminRule };
|
export { adminRuleSchema, type AdminRule };
|
||||||
|
|
|
@ -2,7 +2,10 @@ import * as v from 'valibot';
|
||||||
|
|
||||||
import { tagSchema } from '../tag';
|
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({
|
const adminTagSchema = v.object({
|
||||||
...tagSchema.entries,
|
...tagSchema.entries,
|
||||||
id: v.string(),
|
id: v.string(),
|
||||||
|
@ -11,6 +14,9 @@ const adminTagSchema = v.object({
|
||||||
requires_review: v.boolean(),
|
requires_review: v.boolean(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Admin types
|
||||||
|
*/
|
||||||
type AdminTag = v.InferOutput<typeof adminTagSchema>;
|
type AdminTag = v.InferOutput<typeof adminTagSchema>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
import * as v from 'valibot';
|
import * as v from 'valibot';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Directory schemas
|
||||||
|
*/
|
||||||
const directoryCategorySchema = v.object({
|
const directoryCategorySchema = v.object({
|
||||||
category: v.string(),
|
category: v.string(),
|
||||||
servers_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null),
|
servers_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Directory types
|
||||||
|
*/
|
||||||
type DirectoryCategory = v.InferOutput<typeof directoryCategorySchema>;
|
type DirectoryCategory = v.InferOutput<typeof directoryCategorySchema>;
|
||||||
|
|
||||||
export { directoryCategorySchema, type DirectoryCategory };
|
export { directoryCategorySchema, type DirectoryCategory };
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
import * as v from 'valibot';
|
import * as v from 'valibot';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Directory schemas
|
||||||
|
*/
|
||||||
const directoryLanguageSchema = v.object({
|
const directoryLanguageSchema = v.object({
|
||||||
locale: v.string(),
|
locale: v.string(),
|
||||||
language: v.string(),
|
language: v.string(),
|
||||||
servers_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null),
|
servers_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Directory types
|
||||||
|
*/
|
||||||
type DirectoryLanguage = v.InferOutput<typeof directoryLanguageSchema>;
|
type DirectoryLanguage = v.InferOutput<typeof directoryLanguageSchema>;
|
||||||
|
|
||||||
export { directoryLanguageSchema, type DirectoryLanguage };
|
export { directoryLanguageSchema, type DirectoryLanguage };
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
import * as v from 'valibot';
|
import * as v from 'valibot';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Directory schemas
|
||||||
|
*/
|
||||||
const directoryServerSchema = v.object({
|
const directoryServerSchema = v.object({
|
||||||
domain: v.string(),
|
domain: v.string(),
|
||||||
version: v.string(),
|
version: v.string(),
|
||||||
|
@ -16,6 +19,9 @@ const directoryServerSchema = v.object({
|
||||||
category: v.string(),
|
category: v.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Directory types
|
||||||
|
*/
|
||||||
type DirectoryServer = v.InferOutput<typeof directoryServerSchema>;
|
type DirectoryServer = v.InferOutput<typeof directoryServerSchema>;
|
||||||
|
|
||||||
export { directoryServerSchema, type DirectoryServer };
|
export { directoryServerSchema, type DirectoryServer };
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
import * as v from 'valibot';
|
import * as v from 'valibot';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Directory schemas
|
||||||
|
*/
|
||||||
const directoryStatisticsPeriodSchema = v.object({
|
const directoryStatisticsPeriodSchema = v.object({
|
||||||
period: v.pipe(v.string(), v.isoDate()),
|
period: v.pipe(v.string(), v.isoDate()),
|
||||||
server_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null),
|
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),
|
active_user_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Directory types
|
||||||
|
*/
|
||||||
type DirectoryStatisticsPeriod = v.InferOutput<typeof directoryStatisticsPeriodSchema>;
|
type DirectoryStatisticsPeriod = v.InferOutput<typeof directoryStatisticsPeriodSchema>;
|
||||||
|
|
||||||
export { directoryStatisticsPeriodSchema, type DirectoryStatisticsPeriod };
|
export { directoryStatisticsPeriodSchema, type DirectoryStatisticsPeriod };
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
import type { PaginationParams } from './common';
|
import type { PaginationParams } from './common';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Request params
|
||||||
|
*/
|
||||||
interface GetGroupedNotificationsParams extends PaginationParams {
|
interface GetGroupedNotificationsParams extends PaginationParams {
|
||||||
/** Types to include in the result. */
|
/** Types to include in the result. */
|
||||||
types?: Array<string>;
|
types?: Array<string>;
|
||||||
|
@ -15,6 +18,9 @@ interface GetGroupedNotificationsParams extends PaginationParams {
|
||||||
include_filtered?: boolean;
|
include_filtered?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Request params
|
||||||
|
*/
|
||||||
interface GetUnreadNotificationGroupCountParams {
|
interface GetUnreadNotificationGroupCountParams {
|
||||||
/** Maximum number of results to return. Defaults to 100 notifications. Max 1000 notifications. */
|
/** Maximum number of results to return. Defaults to 100 notifications. Max 1000 notifications. */
|
||||||
limit?: number;
|
limit?: number;
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/**
|
||||||
|
* @category Utils
|
||||||
|
*/
|
||||||
interface PaginatedResponse<T, IsArray extends boolean = true> {
|
interface PaginatedResponse<T, IsArray extends boolean = true> {
|
||||||
previous: (() => Promise<PaginatedResponse<T, IsArray>>) | null;
|
previous: (() => Promise<PaginatedResponse<T, IsArray>>) | null;
|
||||||
next: (() => Promise<PaginatedResponse<T, IsArray>>) | null;
|
next: (() => Promise<PaginatedResponse<T, IsArray>>) | null;
|
||||||
|
|
Loading…
Reference in a new issue