diff --git a/src/whatsapp/collections/PinInChatCollection.ts b/src/whatsapp/collections/PinInChatCollection.ts new file mode 100644 index 0000000000..5a2bb2e847 --- /dev/null +++ b/src/whatsapp/collections/PinInChatCollection.ts @@ -0,0 +1,37 @@ +/*! + * Copyright 2024 WPPConnect Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { exportModule } from '../exportModule'; +import { PinInChatModel } from '../models/PinInChatModel'; +import { Collection } from './Collection'; + +/** + * @whatsapp WAWebPinInChatCollection >= 2.3000.1012170943 + */ +export declare class PinInChatCollection extends Collection { + static model: PinInChatModel; + static cachePolicy?: any; + deleteByParentMessageKey(a?: any): any; + getByMsgKey(a?: any): PinInChatModel; + getByParentMsgKey(a?: any): PinInChatModel; + byChatId(a?: any): PinInChatModel[]; + byIsFailedByMe(a?: any): any; +} +exportModule( + exports, + { PinInChatCollection: 'PinInChatCollectionImpl' }, + (m) => m.PinInChatCollectionImpl +); diff --git a/src/whatsapp/collections/index.ts b/src/whatsapp/collections/index.ts index e8f3637943..fa5dcfaf47 100644 --- a/src/whatsapp/collections/index.ts +++ b/src/whatsapp/collections/index.ts @@ -41,6 +41,7 @@ export * from './MuteCollection'; export * from './OrderCollection'; export * from './OrderItemCollection'; export * from './ParticipantCollection'; +export * from './PinInChatCollection'; export * from './PresenceCollection'; export * from './ProductCollCollection'; export * from './ProductCollection'; diff --git a/src/whatsapp/enums/PIN_STATE.ts b/src/whatsapp/enums/PIN_STATE.ts new file mode 100644 index 0000000000..567e2028d1 --- /dev/null +++ b/src/whatsapp/enums/PIN_STATE.ts @@ -0,0 +1,33 @@ +/*! + * Copyright 2021 WPPConnect Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { exportModule } from '../exportModule'; + +/** @whatsapp WAWebPinMsgConstants >= 2.3000.1012170943 + */ +export declare enum PIN_STATE { + INVALID = 0, + PIN = 1, + UNPIN = 2, +} + +exportModule( + exports, + { + PIN_STATE: 'PIN_STATE', + }, + (m) => m.PIN_STATE +); diff --git a/src/whatsapp/enums/index.ts b/src/whatsapp/enums/index.ts index 0cb682ec6d..4573dc932b 100644 --- a/src/whatsapp/enums/index.ts +++ b/src/whatsapp/enums/index.ts @@ -21,4 +21,5 @@ export * from './KIC_ENTRY_POINT_TYP'; export * from './LogoutReason'; export * from './MSG_TYPE'; export * from './OUTWARD_TYPES'; +export * from './PIN_STATE'; export * from './SendMsgResult'; diff --git a/src/whatsapp/models/PinInChatModel.ts b/src/whatsapp/models/PinInChatModel.ts new file mode 100644 index 0000000000..dc6e8c2280 --- /dev/null +++ b/src/whatsapp/models/PinInChatModel.ts @@ -0,0 +1,70 @@ +/*! + * Copyright 2024 WPPConnect Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { CartCollection } from '../collections'; +import { PinInChatCollection } from '../collections/PinInChatCollection'; +import { exportModule } from '../exportModule'; +import { MsgKey, Wid } from '../misc'; +import { + Model, + ModelOptions, + ModelPropertiesContructor, + ModelProxy, +} from './Model'; + +interface Props { + msgKey: MsgKey; + parentMsgKey: MsgKey; + senderTimestampMs: number; + t: number; + sender: Wid; + chatId: Wid; + pinType: number; //todo + pinExpiryDuration: number; + id: MsgKey; + read: boolean; +} + +interface Session {} + +interface Derived {} + +/** + * @whatsapp WAWebPinInChatModel >= 2.3000.1012170943 + */ +export declare interface PinInChatModel + extends ModelProxy {} + +/** + * @whatsapp WAWebPinInChatModel >= 2.3000.1012170943 + */ +export declare class PinInChatModel extends Model { + constructor( + proterties?: ModelPropertiesContructor, + options?: ModelOptions + ); + deleteByParentMessageKey(): void; + getByMsgKey(): CartCollection; + getByParentMsgKey(): PinInChatCollection; +} + +exportModule( + exports, + { + PinInChatModel: 'PinInChat', + }, + (m) => m.PinInChat +); diff --git a/src/whatsapp/stores.ts b/src/whatsapp/stores.ts index 22578c329b..6ea95f610c 100644 --- a/src/whatsapp/stores.ts +++ b/src/whatsapp/stores.ts @@ -128,6 +128,7 @@ export declare const StickerPackStore: collections.StickerPackCollection; * @whatsapp 545068 >= 2.2222.8 */ export declare const StickerSearchStore: collections.StickerSearchCollection; +export declare const PinInChatStore: collections.PinInChatCollection; const storeNames = [ 'BlocklistStore', @@ -146,6 +147,7 @@ const storeNames = [ 'MsgInfoStore', 'MuteStore', 'OrderStore', + 'PinInChatStore', 'PresenceStore', 'ProductMessageListStore', 'ProfilePicThumbStore',