wip
This commit is contained in:
@@ -446,3 +446,17 @@ export const endpoints = {
|
||||
}],
|
||||
},
|
||||
} as const satisfies { [x: string]: IEndpointMeta; };
|
||||
|
||||
export function getEndpointSchema(reqres: 'req' | 'res', key: keyof typeof endpoints) {
|
||||
const endpoint = endpoints[key];
|
||||
const schemas = endpoint.defines.map(d => d[reqres]).filter(d => d !== undefined);
|
||||
if (schemas.length === 0) {
|
||||
return null;
|
||||
}
|
||||
if (schemas.length === 1) {
|
||||
return schemas[0];
|
||||
}
|
||||
return {
|
||||
oneOf: schemas,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import Stream, { Connection } from './streaming.js';
|
||||
import { Channels } from './streaming.types.js';
|
||||
import { Acct } from './acct.js';
|
||||
import type { Packed, Def } from './schemas.js';
|
||||
import { refs as _refs } from './schemas.js';
|
||||
import * as consts from './consts.js';
|
||||
|
||||
export {
|
||||
@@ -15,8 +14,6 @@ export {
|
||||
Packed, Def,
|
||||
};
|
||||
|
||||
export const refs = _refs;
|
||||
|
||||
export const permissions = consts.permissions;
|
||||
export const notificationTypes = consts.notificationTypes;
|
||||
export const obsoleteNotificationTypes = consts.obsoleteNotificationTypes;
|
||||
|
||||
Reference in New Issue
Block a user