refactor: remove unecessary type

This commit is contained in:
Mohamed Marrouchi 2025-01-09 17:02:31 +01:00
parent 0737cd99c6
commit b57e4693c5
4 changed files with 11 additions and 24 deletions

View File

@ -28,8 +28,3 @@ export interface AttachmentPayload<
type: FileType;
payload: A;
}
export interface IncomingAttachmentPayload {
type: FileType;
payload: AttachmentForeignKey;
}

View File

@ -11,11 +11,7 @@ import { PluginName } from '@/plugins/types';
import { Message } from '../message.schema';
import {
AttachmentForeignKey,
AttachmentPayload,
IncomingAttachmentPayload,
} from './attachment';
import { AttachmentForeignKey, AttachmentPayload } from './attachment';
import { Button } from './button';
import { ContentOptions } from './options';
import { StdQuickReply } from './quick-reply';
@ -146,7 +142,9 @@ export type StdIncomingLocationMessage = {
export type StdIncomingAttachmentMessage = {
type: PayloadType.attachments;
serialized_text: string;
attachment: IncomingAttachmentPayload | IncomingAttachmentPayload[];
attachment:
| AttachmentPayload<AttachmentForeignKey>
| AttachmentPayload<AttachmentForeignKey>[];
};
export type StdIncomingMessage =

View File

@ -1,12 +1,12 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
*/
import { IncomingAttachmentPayload } from './attachment';
import { AttachmentForeignKey, AttachmentPayload } from './attachment';
import { PayloadType } from './message';
export type Payload =
@ -19,7 +19,7 @@ export type Payload =
}
| {
type: PayloadType.attachments;
attachments: IncomingAttachmentPayload;
attachments: AttachmentPayload<AttachmentForeignKey>;
};
export enum QuickReplyType {

View File

@ -63,15 +63,7 @@ export interface AttachmentPayload<
payload?: A;
}
export interface IncomingAttachmentPayload {
type: FileType;
payload: {
url: string;
};
}
// Content
export interface ContentOptions {
display: OutgoingMessageFormat.list | OutgoingMessageFormat.carousel;
fields: {
@ -104,7 +96,7 @@ export type Payload =
}
| {
type: PayloadType.attachments;
attachments: IncomingAttachmentPayload;
attachments: AttachmentPayload<AttachmentForeignKey>;
};
export enum QuickReplyType {
@ -198,7 +190,9 @@ export type StdIncomingLocationMessage = {
export type StdIncomingAttachmentMessage = {
type: PayloadType.attachments;
serialized_text: string;
attachment: IncomingAttachmentPayload | IncomingAttachmentPayload[];
attachment:
| AttachmentPayload<AttachmentForeignKey>
| AttachmentPayload<AttachmentForeignKey>[];
};
export type StdPluginMessage = {