RocketChat/Rocket.Chat

View on GitHub
packages/rest-typings/src/v1/dm/DmDeleteProps.ts

Summary

Maintainability
A
0 mins
Test Coverage
import Ajv from 'ajv';

const ajv = new Ajv({
    coerceTypes: true,
});

export type DmDeleteProps =
    | {
            roomId: string;
      }
    | {
            username: string;
      };

export const isDmDeleteProps = ajv.compile<DmDeleteProps>({
    oneOf: [
        {
            type: 'object',
            properties: {
                roomId: {
                    type: 'string',
                },
            },
            required: ['roomId'],
            additionalProperties: false,
        },
        {
            type: 'object',
            properties: {
                username: {
                    type: 'string',
                },
            },
            required: ['username'],
            additionalProperties: false,
        },
    ],
});