Skip to content

Commit

Permalink
feat: Added WPP.order.get function
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Aug 31, 2023
1 parent 3114b31 commit 7a0dce9
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/order/functions/get.ts
@@ -0,0 +1,34 @@
/*!
* 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 { WPPError } from '../../util';
import { MsgKey, MsgStore } from '../../whatsapp';
import { getOrderInfo } from '../../whatsapp/functions';
/**
* Get info of your sended order
*
* @example
* ```javascript
* const orderInfo = await WPP.order.get();
* ```
*
* @return Your current catalog
*/
export async function get(msgId: string | MsgKey) {
const msg = MsgStore.get(msgId);
if (!msg) throw new WPPError('msg_not_found', 'Message not found');
return await getOrderInfo(msg);
}
17 changes: 17 additions & 0 deletions src/order/functions/index.ts
@@ -0,0 +1,17 @@
/*!
* Copyright 2023 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.
*/

export { get } from './get';
17 changes: 17 additions & 0 deletions src/order/index.ts
@@ -0,0 +1,17 @@
/*!
* Copyright 2023 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.
*/

export * from './functions';

0 comments on commit 7a0dce9

Please sign in to comment.