Skip to content

Commit

Permalink
feat: Added WPP.whatsapp.PinInChatStore
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Mar 28, 2024
1 parent 94fbd00 commit e81a362
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 0 deletions.
37 changes: 37 additions & 0 deletions 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<PinInChatModel> {
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
);
1 change: 1 addition & 0 deletions src/whatsapp/collections/index.ts
Expand Up @@ -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';
Expand Down
33 changes: 33 additions & 0 deletions 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
);
1 change: 1 addition & 0 deletions src/whatsapp/enums/index.ts
Expand Up @@ -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';
70 changes: 70 additions & 0 deletions 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<Props, Session, Derived> {}

/**
* @whatsapp WAWebPinInChatModel >= 2.3000.1012170943
*/
export declare class PinInChatModel extends Model<CartCollection> {
constructor(
proterties?: ModelPropertiesContructor<PinInChatModel>,
options?: ModelOptions
);
deleteByParentMessageKey(): void;
getByMsgKey(): CartCollection;
getByParentMsgKey(): PinInChatCollection;
}

exportModule(
exports,
{
PinInChatModel: 'PinInChat',
},
(m) => m.PinInChat
);
2 changes: 2 additions & 0 deletions src/whatsapp/stores.ts
Expand Up @@ -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',
Expand All @@ -146,6 +147,7 @@ const storeNames = [
'MsgInfoStore',
'MuteStore',
'OrderStore',
'PinInChatStore',
'PresenceStore',
'ProductMessageListStore',
'ProfilePicThumbStore',
Expand Down

0 comments on commit e81a362

Please sign in to comment.