Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zapfy-sdk

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zapfy-sdk - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

dist/index.js

@@ -1,2 +0,2 @@

function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t,n,r,o,s=/*#__PURE__*/e(require("axios")),i=s.default.create({baseURL:"https://api.zapfy.me/v1",headers:{Accept:"*/*",Connection:"keep-alive","User-Agent":"request","Content-Type":"application/json"}});function c(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}exports.ZapfySdk=void 0,(n=(t=exports.ZapfySdk||(exports.ZapfySdk={})).Instance||(t.Instance={})).connect=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/connect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},n.disconnect=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/disconnect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},n.getState=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.get("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getState")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},n.updateWebhook=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateWebhook",{webhookUrl:e.webhookUrl})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(r=t.Profile||(t.Profile={})).verifyIfNumberIsInWhatsApp=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/onWhatsApp",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.getProfileStatus=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfileStatus",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.updateProfileStatus=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileStatus",{status:e.status})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.updateProfileName=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileName",{name:e.name})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.getProfilePictureUrl=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfilePictureUrl",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.blockUser=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/blockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.unblockUser=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/unblockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.getBusinessProfile=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getBusinessProfile",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(o=t.Message||(t.Message={})).sendTextMessage=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=text",{text:e.text,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.sendButtonsMessage=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(i.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=buttons",{text:e.text,footer:e.footer,buttons:e.buttons,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.sendListMessage=function(e){try{return Promise.resolve(c(function(){var t=e.instanceKey,n=e.instanceToken;return Promise.resolve(i.post("/instance/"+t+"/token/"+n+"/message?type=list",{text:e.text,buttonText:e.buttonText,title:e.title,destination:e.destination,sections:e.sections,instanceKey:t,instanceToken:n})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.sendLocationMessage=function(e){try{return Promise.resolve(c(function(){var t=e.instanceKey,n=e.instanceToken;return Promise.resolve(i.post("/instance/"+t+"/token/"+n+"/message?type=location",{lat:e.lat,long:e.long,instanceKey:t,instanceToken:n})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.sendMediaMessage=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.default.post("https://api.zapfy.me/v1/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type="+e.type,{base64:e.base64,fileName:e.fileName,text:e.text})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},exports.ZapfyTypes=void 0,exports.ZapfyTypes||(exports.ZapfyTypes={});
function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t,n,r,o,i,s=/*#__PURE__*/e(require("axios")).default.create({baseURL:"https://api.zapfy.me/v1",headers:{Accept:"*/*",Connection:"keep-alive","User-Agent":"request","Content-Type":"application/json"}});function c(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}exports.ZapfySdk=void 0,(n=(t=exports.ZapfySdk||(exports.ZapfySdk={})).Instance||(t.Instance={})).connect=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/connect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},n.disconnect=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/disconnect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},n.getState=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.get("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getState")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},n.updateWebhook=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateWebhook",{webhookUrl:e.webhookUrl})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(r=t.Profile||(t.Profile={})).verifyIfNumberIsInWhatsApp=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/onWhatsApp",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.getProfileStatus=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfileStatus",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.updateProfileStatus=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileStatus",{status:e.status})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.updateProfileName=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileName",{name:e.name})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.getProfilePictureUrl=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfilePictureUrl",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.blockUser=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/blockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.unblockUser=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/unblockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},r.getBusinessProfile=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getBusinessProfile",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(o=t.Message||(t.Message={})).sendTextMessage=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=text",{text:e.text,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.sendButtonsMessage=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=buttons",{text:e.text,footer:e.footer,buttons:e.buttons,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.sendListMessage=function(e){try{return Promise.resolve(c(function(){var t=e.instanceKey,n=e.instanceToken;return Promise.resolve(s.post("/instance/"+t+"/token/"+n+"/message?type=list",{text:e.text,buttonText:e.buttonText,title:e.title,destination:e.destination,sections:e.sections,instanceKey:t,instanceToken:n})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.sendLocationMessage=function(e){try{return Promise.resolve(c(function(){var t=e.instanceKey,n=e.instanceToken;return Promise.resolve(s.post("/instance/"+t+"/token/"+n+"/message?type=location",{lat:e.lat,long:e.long,instanceKey:t,instanceToken:n})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.sendMediaMessage=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type="+e.type,{base64:e.base64,fileName:e.fileName,text:e.text})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(i=t.Group||(t.Group={})).createGroup=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/createGroup",{name:e.name,participants:e.participants})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.groupUpdateSubject=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupUpdateSubject",{groupId:e.groupId,subject:e.subject})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.groupUpdateDescription=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupUpdateDescription",{groupId:e.groupId,description:e.description})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.groupInviteCode=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupInviteCode",{groupId:e.groupId})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.groupRevokeInvite=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupRevokeInvite",{groupId:e.groupId})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.groupMetadata=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupMetadata",{groupId:e.groupId})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.groupParticipantsUpdate=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupParticipantsUpdate",{groupId:e.groupId,action:e.action,participants:e.participants})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.groupSettingUpdate=function(e){try{return Promise.resolve(c(function(){return Promise.resolve(s.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupSettingUpdate",{groupId:e.groupId,setting:e.setting})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},exports.ZapfyTypes=void 0,exports.ZapfyTypes||(exports.ZapfyTypes={});
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import e from"axios";var n,t,r=e.create({baseURL:"https://api.zapfy.me/v1",headers:{Accept:"*/*",Connection:"keep-alive","User-Agent":"request","Content-Type":"application/json"}});function o(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}!function(n){var t,s,i;(t=n.Instance||(n.Instance={})).connect=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/connect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},t.disconnect=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/disconnect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},t.getState=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.get("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getState")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},t.updateWebhook=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateWebhook",{webhookUrl:e.webhookUrl})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(s=n.Profile||(n.Profile={})).verifyIfNumberIsInWhatsApp=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/onWhatsApp",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.getProfileStatus=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfileStatus",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.updateProfileStatus=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileStatus",{status:e.status})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.updateProfileName=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileName",{name:e.name})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.getProfilePictureUrl=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfilePictureUrl",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.blockUser=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/blockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.unblockUser=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/unblockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.getBusinessProfile=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getBusinessProfile",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(i=n.Message||(n.Message={})).sendTextMessage=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=text",{text:e.text,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendButtonsMessage=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=buttons",{text:e.text,footer:e.footer,buttons:e.buttons,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendListMessage=function(e){try{return Promise.resolve(o(function(){var n=e.instanceKey,t=e.instanceToken;return Promise.resolve(r.post("/instance/"+n+"/token/"+t+"/message?type=list",{text:e.text,buttonText:e.buttonText,title:e.title,destination:e.destination,sections:e.sections,instanceKey:n,instanceToken:t})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendLocationMessage=function(e){try{return Promise.resolve(o(function(){var n=e.instanceKey,t=e.instanceToken;return Promise.resolve(r.post("/instance/"+n+"/token/"+t+"/message?type=location",{lat:e.lat,long:e.long,instanceKey:n,instanceToken:t})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendMediaMessage=function(n){try{return Promise.resolve(o(function(){return Promise.resolve(e.post("https://api.zapfy.me/v1/instance/"+n.instanceKey+"/token/"+n.instanceToken+"/message?type="+n.type,{base64:n.base64,fileName:n.fileName,text:n.text})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}}}(n||(n={})),t||(t={});export{n as ZapfySdk,t as ZapfyTypes};
import e from"axios";var n,t,r=e.create({baseURL:"https://api.zapfy.me/v1",headers:{Accept:"*/*",Connection:"keep-alive","User-Agent":"request","Content-Type":"application/json"}});function o(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}!function(e){var n,t,i,s;(n=e.Instance||(e.Instance={})).connect=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/connect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},n.disconnect=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/disconnect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},n.getState=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.get("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getState")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},n.updateWebhook=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateWebhook",{webhookUrl:e.webhookUrl})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(t=e.Profile||(e.Profile={})).verifyIfNumberIsInWhatsApp=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/onWhatsApp",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},t.getProfileStatus=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfileStatus",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},t.updateProfileStatus=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileStatus",{status:e.status})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},t.updateProfileName=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileName",{name:e.name})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},t.getProfilePictureUrl=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfilePictureUrl",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},t.blockUser=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/blockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},t.unblockUser=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/unblockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},t.getBusinessProfile=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getBusinessProfile",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(i=e.Message||(e.Message={})).sendTextMessage=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=text",{text:e.text,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendButtonsMessage=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=buttons",{text:e.text,footer:e.footer,buttons:e.buttons,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendListMessage=function(e){try{return Promise.resolve(o(function(){var n=e.instanceKey,t=e.instanceToken;return Promise.resolve(r.post("/instance/"+n+"/token/"+t+"/message?type=list",{text:e.text,buttonText:e.buttonText,title:e.title,destination:e.destination,sections:e.sections,instanceKey:n,instanceToken:t})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendLocationMessage=function(e){try{return Promise.resolve(o(function(){var n=e.instanceKey,t=e.instanceToken;return Promise.resolve(r.post("/instance/"+n+"/token/"+t+"/message?type=location",{lat:e.lat,long:e.long,instanceKey:n,instanceToken:t})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendMediaMessage=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type="+e.type,{base64:e.base64,fileName:e.fileName,text:e.text})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(s=e.Group||(e.Group={})).createGroup=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/createGroup",{name:e.name,participants:e.participants})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.groupUpdateSubject=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupUpdateSubject",{groupId:e.groupId,subject:e.subject})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.groupUpdateDescription=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupUpdateDescription",{groupId:e.groupId,description:e.description})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.groupInviteCode=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupInviteCode",{groupId:e.groupId})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.groupRevokeInvite=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupRevokeInvite",{groupId:e.groupId})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.groupMetadata=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupMetadata",{groupId:e.groupId})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.groupParticipantsUpdate=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupParticipantsUpdate",{groupId:e.groupId,action:e.action,participants:e.participants})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.groupSettingUpdate=function(e){try{return Promise.resolve(o(function(){return Promise.resolve(r.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupSettingUpdate",{groupId:e.groupId,setting:e.setting})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}}}(n||(n={})),t||(t={});export{n as ZapfySdk,t as ZapfyTypes};
//# sourceMappingURL=index.modern.js.map

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],n):n((e||self).zapfySdk={},e.axios)}(this,function(e,n){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r,o,s,i,c=/*#__PURE__*/t(n),u=c.default.create({baseURL:"https://api.zapfy.me/v1",headers:{Accept:"*/*",Connection:"keep-alive","User-Agent":"request","Content-Type":"application/json"}});function a(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}e.ZapfySdk=void 0,(o=(r=e.ZapfySdk||(e.ZapfySdk={})).Instance||(r.Instance={})).connect=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/connect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.disconnect=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/disconnect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.getState=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.get("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getState")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.updateWebhook=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateWebhook",{webhookUrl:e.webhookUrl})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(s=r.Profile||(r.Profile={})).verifyIfNumberIsInWhatsApp=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/onWhatsApp",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.getProfileStatus=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfileStatus",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.updateProfileStatus=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileStatus",{status:e.status})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.updateProfileName=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileName",{name:e.name})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.getProfilePictureUrl=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfilePictureUrl",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.blockUser=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/blockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.unblockUser=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/unblockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.getBusinessProfile=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getBusinessProfile",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(i=r.Message||(r.Message={})).sendTextMessage=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=text",{text:e.text,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendButtonsMessage=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=buttons",{text:e.text,footer:e.footer,buttons:e.buttons,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendListMessage=function(e){try{return Promise.resolve(a(function(){var n=e.instanceKey,t=e.instanceToken;return Promise.resolve(u.post("/instance/"+n+"/token/"+t+"/message?type=list",{text:e.text,buttonText:e.buttonText,title:e.title,destination:e.destination,sections:e.sections,instanceKey:n,instanceToken:t})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendLocationMessage=function(e){try{return Promise.resolve(a(function(){var n=e.instanceKey,t=e.instanceToken;return Promise.resolve(u.post("/instance/"+n+"/token/"+t+"/message?type=location",{lat:e.lat,long:e.long,instanceKey:n,instanceToken:t})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.sendMediaMessage=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(c.default.post("https://api.zapfy.me/v1/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type="+e.type,{base64:e.base64,fileName:e.fileName,text:e.text})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},e.ZapfyTypes=void 0,e.ZapfyTypes||(e.ZapfyTypes={})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],n):n((e||self).zapfySdk={},e.axios)}(this,function(e,n){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r,o,i,s,c,u=/*#__PURE__*/t(n).default.create({baseURL:"https://api.zapfy.me/v1",headers:{Accept:"*/*",Connection:"keep-alive","User-Agent":"request","Content-Type":"application/json"}});function a(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}e.ZapfySdk=void 0,(o=(r=e.ZapfySdk||(e.ZapfySdk={})).Instance||(r.Instance={})).connect=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/connect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.disconnect=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/disconnect")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.getState=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.get("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getState")).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},o.updateWebhook=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateWebhook",{webhookUrl:e.webhookUrl})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(i=r.Profile||(r.Profile={})).verifyIfNumberIsInWhatsApp=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/onWhatsApp",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.getProfileStatus=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfileStatus",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.updateProfileStatus=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileStatus",{status:e.status})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.updateProfileName=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/updateProfileName",{name:e.name})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.getProfilePictureUrl=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getProfilePictureUrl",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.blockUser=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/blockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.unblockUser=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/unblockUser",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},i.getBusinessProfile=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/getBusinessProfile",{phoneNumber:e.phoneNumber})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(s=r.Message||(r.Message={})).sendTextMessage=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=text",{text:e.text,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.sendButtonsMessage=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type=buttons",{text:e.text,footer:e.footer,buttons:e.buttons,destination:e.destination})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.sendListMessage=function(e){try{return Promise.resolve(a(function(){var n=e.instanceKey,t=e.instanceToken;return Promise.resolve(u.post("/instance/"+n+"/token/"+t+"/message?type=list",{text:e.text,buttonText:e.buttonText,title:e.title,destination:e.destination,sections:e.sections,instanceKey:n,instanceToken:t})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.sendLocationMessage=function(e){try{return Promise.resolve(a(function(){var n=e.instanceKey,t=e.instanceToken;return Promise.resolve(u.post("/instance/"+n+"/token/"+t+"/message?type=location",{lat:e.lat,long:e.long,instanceKey:n,instanceToken:t})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},s.sendMediaMessage=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/message?type="+e.type,{base64:e.base64,fileName:e.fileName,text:e.text})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},(c=r.Group||(r.Group={})).createGroup=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/createGroup",{name:e.name,participants:e.participants})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},c.groupUpdateSubject=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupUpdateSubject",{groupId:e.groupId,subject:e.subject})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},c.groupUpdateDescription=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupUpdateDescription",{groupId:e.groupId,description:e.description})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},c.groupInviteCode=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupInviteCode",{groupId:e.groupId})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},c.groupRevokeInvite=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupRevokeInvite",{groupId:e.groupId})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},c.groupMetadata=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupMetadata",{groupId:e.groupId})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},c.groupParticipantsUpdate=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupParticipantsUpdate",{groupId:e.groupId,action:e.action,participants:e.participants})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},c.groupSettingUpdate=function(e){try{return Promise.resolve(a(function(){return Promise.resolve(u.post("/instance/"+e.instanceKey+"/token/"+e.instanceToken+"/groupSettingUpdate",{groupId:e.groupId,setting:e.setting})).then(function(e){return e.data})},function(e){throw new Error(e)}))}catch(e){return Promise.reject(e)}},e.ZapfyTypes=void 0,e.ZapfyTypes||(e.ZapfyTypes={})});
//# sourceMappingURL=index.umd.js.map

@@ -26,2 +26,15 @@ import { ZapfyTypes } from "./types";

}
namespace Group {
const createGroup: (params: ZapfyTypes.CreateGroupParams) => Promise<ZapfyTypes.CreateGroupResponse>;
const groupUpdateSubject: (params: ZapfyTypes.GroupUpdateSubjectParams) => Promise<ZapfyTypes.DefaultZapfyResultObject<void>>;
const groupUpdateDescription: (params: ZapfyTypes.GroupUpdateDescriptionParams) => Promise<ZapfyTypes.DefaultZapfyResultObject<void>>;
const groupInviteCode: (params: ZapfyTypes.GroupInviteCodeParams) => Promise<ZapfyTypes.DefaultZapfyResultObject<string>>;
const groupRevokeInvite: (params: ZapfyTypes.GroupInviteCodeParams) => Promise<ZapfyTypes.DefaultZapfyResultObject<string>>;
const groupMetadata: (params: ZapfyTypes.GroupInviteCodeParams) => Promise<ZapfyTypes.DefaultZapfyResultObject<string>>;
const groupParticipantsUpdate: (params: ZapfyTypes.GroupParticipantsUpdateParams) => Promise<ZapfyTypes.DefaultZapfyResultObject<{
status: string;
jid: string;
}[]>>;
const groupSettingUpdate: (params: ZapfyTypes.GroupSettingsUpdateParams) => Promise<ZapfyTypes.DefaultZapfyResultObject<void>>;
}
}

@@ -13,3 +13,57 @@ export declare namespace ZapfyTypes {

};
interface Contact {
id: string;
name?: string;
notify?: string;
verifiedName?: string;
imgUrl?: string;
status?: string;
}
type MediaType = 'image' | 'audio' | 'video' | 'document';
type GroupParticipant = (Contact & {
isAdmin?: boolean;
isSuperAdmin?: boolean;
admin?: 'admin' | 'superadmin' | null;
});
interface GroupMetadata {
id: string;
owner: string | undefined;
subject: string;
subjectOwner?: string;
subjectTime?: number;
creation?: number;
desc?: string;
descOwner?: string;
descId?: string;
restrict?: boolean;
announce?: boolean;
size?: number;
participants: GroupParticipant[];
ephemeralDuration?: number;
}
type GroupUpdateSubjectParams = DefaultParams & {
groupId: string;
subject: string;
};
type GroupUpdateDescriptionParams = DefaultParams & {
groupId: string;
description: string;
};
type GroupInviteCodeParams = DefaultParams & {
groupId: string;
};
type GroupParticipantsUpdateParams = DefaultParams & {
groupId: string;
participants: string[];
action: 'add' | 'demote' | 'promote' | 'remove';
};
type GroupSettingsUpdateParams = DefaultParams & {
groupId: string;
setting: 'announcement' | 'not_announcement' | 'unlocked' | 'locked';
};
type CreateGroupParams = DefaultParams & {
name: string;
participants: string[];
};
type CreateGroupResponse = DefaultZapfyResultObject<GroupMetadata>;
type UpdateProfileStatusParams = DefaultParams & {

@@ -16,0 +70,0 @@ status: string;

@@ -5,3 +5,3 @@ {

"description": "A package to request all routes on ZapFy",
"version": "1.1.0",
"version": "1.1.1",
"license": "MIT",

@@ -8,0 +8,0 @@ "main": "dist/index.js",

@@ -1,2 +0,2 @@

import axios, { AxiosResponse } from "axios";
import { AxiosResponse } from "axios";
import { client } from "./http/zapfy.http"

@@ -368,6 +368,6 @@ import {

const response = await axios.post<
const response = await client.post<
ZapfyTypes.DefaultMessageResponse,
AxiosResponse<ZapfyTypes.DefaultMessageResponse>
>(`https://api.zapfy.me/v1/instance/${instanceKey}/token/${instanceToken}/message?type=${type}`, {
>(`/instance/${instanceKey}/token/${instanceToken}/message?type=${type}`, {
base64,

@@ -384,2 +384,185 @@ fileName,

}
export namespace Group {
export const createGroup = async (
params: ZapfyTypes.CreateGroupParams,
): Promise<ZapfyTypes.CreateGroupResponse> => {
try {
const {
instanceKey,
instanceToken,
name,
participants,
} = params;
const response = await client.post<
ZapfyTypes.CreateGroupResponse,
AxiosResponse<ZapfyTypes.CreateGroupResponse>
>(`/instance/${instanceKey}/token/${instanceToken}/createGroup`, { name, participants });
return response.data;
} catch (err: any) {
throw new Error(err);
}
}
export const groupUpdateSubject = async (
params: ZapfyTypes.GroupUpdateSubjectParams,
): Promise<ZapfyTypes.DefaultZapfyResultObject<void>> => {
try {
const {
instanceKey,
instanceToken,
groupId,
subject,
} = params;
const response = await client.post<
ZapfyTypes.DefaultZapfyResultObject<void>,
AxiosResponse<ZapfyTypes.DefaultZapfyResultObject<void>>
>(`/instance/${instanceKey}/token/${instanceToken}/groupUpdateSubject`, { groupId, subject });
return response.data;
} catch (err: any) {
throw new Error(err);
}
}
export const groupUpdateDescription = async (
params: ZapfyTypes.GroupUpdateDescriptionParams,
): Promise<ZapfyTypes.DefaultZapfyResultObject<void>> => {
try {
const {
instanceKey,
instanceToken,
groupId,
description,
} = params;
const response = await client.post<
ZapfyTypes.DefaultZapfyResultObject<void>,
AxiosResponse<ZapfyTypes.DefaultZapfyResultObject<void>>
>(`/instance/${instanceKey}/token/${instanceToken}/groupUpdateDescription`, { groupId, description });
return response.data;
} catch (err: any) {
throw new Error(err);
}
}
export const groupInviteCode = async (
params: ZapfyTypes.GroupInviteCodeParams,
): Promise<ZapfyTypes.DefaultZapfyResultObject<string>> => {
try {
const {
instanceKey,
instanceToken,
groupId,
} = params;
const response = await client.post<
ZapfyTypes.DefaultZapfyResultObject<string>,
AxiosResponse<ZapfyTypes.DefaultZapfyResultObject<string>>
>(`/instance/${instanceKey}/token/${instanceToken}/groupInviteCode`, { groupId });
return response.data;
} catch (err: any) {
throw new Error(err);
}
}
export const groupRevokeInvite = async (
params: ZapfyTypes.GroupInviteCodeParams,
): Promise<ZapfyTypes.DefaultZapfyResultObject<string>> => {
try {
const {
instanceKey,
instanceToken,
groupId,
} = params;
const response = await client.post<
ZapfyTypes.DefaultZapfyResultObject<string>,
AxiosResponse<ZapfyTypes.DefaultZapfyResultObject<string>>
>(`/instance/${instanceKey}/token/${instanceToken}/groupRevokeInvite`, { groupId });
return response.data;
} catch (err: any) {
throw new Error(err);
}
}
export const groupMetadata = async (
params: ZapfyTypes.GroupInviteCodeParams,
): Promise<ZapfyTypes.DefaultZapfyResultObject<string>> => {
try {
const {
instanceKey,
instanceToken,
groupId,
} = params;
const response = await client.post<
ZapfyTypes.DefaultZapfyResultObject<string>,
AxiosResponse<ZapfyTypes.DefaultZapfyResultObject<string>>
>(`/instance/${instanceKey}/token/${instanceToken}/groupMetadata`, { groupId });
return response.data;
} catch (err: any) {
throw new Error(err);
}
}
export const groupParticipantsUpdate = async (
params: ZapfyTypes.GroupParticipantsUpdateParams,
): Promise<ZapfyTypes.DefaultZapfyResultObject<{ status: string, jid: string }[]>> => {
try {
const {
instanceKey,
instanceToken,
groupId,
action,
participants
} = params;
const response = await client.post<
ZapfyTypes.DefaultZapfyResultObject<{ status: string, jid: string }[]>,
AxiosResponse<ZapfyTypes.DefaultZapfyResultObject<{ status: string, jid: string }[]>>
>(`/instance/${instanceKey}/token/${instanceToken}/groupParticipantsUpdate`, {
groupId,
action,
participants,
});
return response.data;
} catch (err: any) {
throw new Error(err);
}
}
export const groupSettingUpdate = async (
params: ZapfyTypes.GroupSettingsUpdateParams,
): Promise<ZapfyTypes.DefaultZapfyResultObject<void>> => {
try {
const {
instanceKey,
instanceToken,
groupId,
setting,
} = params;
const response = await client.post<
ZapfyTypes.DefaultZapfyResultObject<void>,
AxiosResponse<ZapfyTypes.DefaultZapfyResultObject<void>>
>(`/instance/${instanceKey}/token/${instanceToken}/groupSettingUpdate`, {
groupId,
setting,
});
return response.data;
} catch (err: any) {
throw new Error(err);
}
}
}
}

@@ -12,4 +12,52 @@ export namespace ZapfyTypes {

export interface Contact {
id: string;
/** name of the contact, you have saved on your WA */
name?: string;
/** name of the contact, the contact has set on their own on WA */
notify?: string;
/** I have no idea */
verifiedName?: string;
imgUrl?: string;
status?: string;
}
export type MediaType = 'image' | 'audio' | 'video' | 'document';
export declare type GroupParticipant = (Contact & {
isAdmin?: boolean;
isSuperAdmin?: boolean;
admin?: 'admin' | 'superadmin' | null;
});
export interface GroupMetadata {
id: string;
owner: string | undefined;
subject: string;
/** group subject owner */
subjectOwner?: string;
/** group subject modification date */
subjectTime?: number;
creation?: number;
desc?: string;
descOwner?: string;
descId?: string;
/** is set when the group only allows admins to change group settings */
restrict?: boolean;
/** is set when the group only allows admins to write messages */
announce?: boolean;
/** number of group participants */
size?: number;
participants: GroupParticipant[];
ephemeralDuration?: number;
}
export type GroupUpdateSubjectParams = DefaultParams & { groupId: string, subject: string };
export type GroupUpdateDescriptionParams = DefaultParams & { groupId: string, description: string };
export type GroupInviteCodeParams = DefaultParams & { groupId: string };
export type GroupParticipantsUpdateParams = DefaultParams & { groupId: string, participants: string[], action: 'add' | 'demote' | 'promote' | 'remove' };
export type GroupSettingsUpdateParams = DefaultParams & { groupId: string, setting: 'announcement' | 'not_announcement' | 'unlocked' | 'locked'};
export type CreateGroupParams = DefaultParams & { name: string, participants: string[] };
export type CreateGroupResponse = DefaultZapfyResultObject<GroupMetadata>;
export type UpdateProfileStatusParams = DefaultParams & { status: string };

@@ -16,0 +64,0 @@ export type UpdateProfileNameParams = DefaultParams & { name: string };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc