2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
import { accountSchema } from './account';
|
|
|
|
import { statusSchema } from './status';
|
2024-10-16 08:03:27 -07:00
|
|
|
import { datetimeSchema } from './utils';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
2024-10-29 14:44:28 -07:00
|
|
|
/**
|
|
|
|
* @category Schemas
|
|
|
|
* @see {@link https://docs.gotosocial.org/en/latest/api/swagger.yaml#/definitions/interactionRequest}
|
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
const interactionRequestSchema = v.object({
|
2024-10-16 08:03:27 -07:00
|
|
|
accepted_at: v.fallback(v.nullable(datetimeSchema), null),
|
2024-08-28 04:43:23 -07:00
|
|
|
account: accountSchema,
|
2024-10-16 08:03:27 -07:00
|
|
|
created_at: datetimeSchema,
|
2024-10-13 15:25:30 -07:00
|
|
|
id: v.string(),
|
2024-10-16 08:03:27 -07:00
|
|
|
rejected_at: v.fallback(v.nullable(datetimeSchema), null),
|
2024-10-13 15:25:30 -07:00
|
|
|
reply: v.fallback(v.nullable(statusSchema), null),
|
|
|
|
status: v.fallback(v.nullable(statusSchema), null),
|
2024-10-14 11:54:44 -07:00
|
|
|
type: v.picklist(['favourite', 'reply', 'reblog']),
|
2024-10-13 15:25:30 -07:00
|
|
|
uri: v.fallback(v.nullable(v.string()), null),
|
2024-08-28 04:43:23 -07:00
|
|
|
});
|
|
|
|
|
2024-11-29 07:01:54 -08:00
|
|
|
/**
|
|
|
|
* @category Entity types
|
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
type InteractionRequest = v.InferOutput<typeof interactionRequestSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export { interactionRequestSchema, type InteractionRequest };
|