From cdfab72b35d2b14ffc7e5a985bc7ff1a3f353fa6 Mon Sep 17 00:00:00 2001 From: tamaina Date: Mon, 15 May 2023 17:39:41 +0900 Subject: [PATCH] wip --- packages/misskey-js/src/schemas/ad.ts | 48 +++++++++++++++++++ .../misskey-js/src/schemas/announcement.ts | 35 ++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 packages/misskey-js/src/schemas/ad.ts create mode 100644 packages/misskey-js/src/schemas/announcement.ts diff --git a/packages/misskey-js/src/schemas/ad.ts b/packages/misskey-js/src/schemas/ad.ts new file mode 100644 index 000000000..f198fc759 --- /dev/null +++ b/packages/misskey-js/src/schemas/ad.ts @@ -0,0 +1,48 @@ +import type { JSONSchema7Definition } from 'schema-type'; + +export const packedAdSchema = { + $id: 'https://misskey-hub.net/api/schemas/Ad', + + type: 'object', + properties: { + id: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + createdAt: { + type: 'string', + format: 'date-time', + }, + expiresAt: { + type: 'string', + format: 'date-time', + }, + startsAt: { + type: 'string', + format: 'date-time', + }, + place: { + type: 'string', + }, + property: { + type: 'string', + }, + ratio: { + type: 'number', + }, + imageUrl: { + type: ['string', 'null'], + }, + memo: { + type: 'string', + }, + }, + required: [ + 'id', + 'createdAt', + 'expiresAt', + 'startsAt', + 'place', + 'property', + 'ratio', + 'imageUrl', + 'memo', + ], +} as const satisfies JSONSchema7Definition; diff --git a/packages/misskey-js/src/schemas/announcement.ts b/packages/misskey-js/src/schemas/announcement.ts new file mode 100644 index 000000000..eb8b945b5 --- /dev/null +++ b/packages/misskey-js/src/schemas/announcement.ts @@ -0,0 +1,35 @@ +import type { JSONSchema7Definition } from 'schema-type'; + +export const packedAnnouncementSchema = { + $id: 'https://misskey-hub.net/api/schemas/Announcement', + + type: 'object', + properties: { + id: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + createdAt: { + type: 'string', + format: 'date-time', + }, + updatedAt: { + type: 'string', + format: 'date-time', + }, + title: { + type: 'string', + }, + text: { + type: 'string', + }, + imageUrl: { + type: ['string', 'null'], + }, + }, + required: [ + 'id', + 'createdAt', + 'updatedAt', + 'title', + 'text', + 'imageUrl', + ], +} as const satisfies JSONSchema7Definition;