bigbuffet-rw/packages/pl-api/lib/entities/admin/cohort.ts
marcin mikołajczak bc65755862 pl-api: Update docs
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-11-29 16:01:54 +01:00

27 lines
570 B
TypeScript

import * as v from 'valibot';
import { datetimeSchema } from '../utils';
/**
* @category Admin schemas
* @see {@link https://docs.joinmastodon.org/entities/Admin_Cohort/}
*/
const adminCohortSchema = v.object({
period: datetimeSchema,
frequency: v.picklist(['day', 'month']),
data: v.array(v.object({
date: datetimeSchema,
rate: v.number(),
value: v.pipe(v.number(), v.integer()),
})),
});
/**
* @category Admin entity types
*/
type AdminCohort = v.InferOutput<typeof adminCohortSchema>;
export {
adminCohortSchema,
type AdminCohort,
};