messaging-api-messenger
Advanced tools
Comparing version 1.0.0-beta.25 to 1.0.0-beta.26
@@ -26,2 +26,11 @@ import * as Types from './MessengerTypes'; | ||
} & Types.BatchRequestOptions): Types.BatchItem; | ||
declare function getUserPersistentMenu(userId: string, options?: { | ||
accessToken?: string; | ||
} & Types.BatchRequestOptions): Types.BatchItem; | ||
declare function setUserPersistentMenu(userId: string, menuItems: Types.MenuItem[] | Types.PersistentMenuItem[], options?: { | ||
accessToken?: string; | ||
} & Types.BatchRequestOptions): Types.BatchItem; | ||
declare function deleteUserPersistentMenu(userId: string, options?: { | ||
accessToken?: string; | ||
} & Types.BatchRequestOptions): Types.BatchItem; | ||
declare function sendSenderAction(psidOrRecipient: Types.PsidOrRecipient, senderAction: Types.SenderAction, options?: Types.SendOption & Types.BatchRequestOptions): Types.BatchItem; | ||
@@ -75,2 +84,5 @@ declare function typingOn(idOrRecipient: Types.PsidOrRecipient, options?: Types.SendOption & Types.BatchRequestOptions): Types.BatchItem; | ||
getUserProfile: typeof getUserProfile; | ||
getUserPersistentMenu: typeof getUserPersistentMenu; | ||
setUserPersistentMenu: typeof setUserPersistentMenu; | ||
deleteUserPersistentMenu: typeof deleteUserPersistentMenu; | ||
sendSenderAction: typeof sendSenderAction; | ||
@@ -77,0 +89,0 @@ typingOn: typeof typingOn; |
@@ -103,2 +103,29 @@ "use strict"; | ||
} | ||
function getUserPersistentMenu(userId, options = {}) { | ||
const batchRequestOptions = pick_1.default(options, ['name', 'dependsOn']); | ||
return Object.assign({ method: 'GET', relativeUrl: `/me/custom_user_settings?psid=${userId}`.concat(options.accessToken ? `&access_token=${options.accessToken}` : '') }, batchRequestOptions); | ||
} | ||
function setUserPersistentMenu(userId, menuItems, options = {}) { | ||
const batchRequestOptions = pick_1.default(options, ['name', 'dependsOn']); | ||
if (menuItems.some((item) => 'locale' in item && item.locale === 'default')) { | ||
return Object.assign({ method: 'POST', relativeUrl: `/me/custom_user_settings`.concat(options.accessToken ? `?access_token=${options.accessToken}` : ''), body: { | ||
psid: userId, | ||
persistentMenu: menuItems, | ||
} }, batchRequestOptions); | ||
} | ||
return Object.assign({ method: 'POST', relativeUrl: `/me/custom_user_settings`.concat(options.accessToken ? `?access_token=${options.accessToken}` : ''), body: { | ||
psid: userId, | ||
persistentMenu: [ | ||
{ | ||
locale: 'default', | ||
composerInputDisabled: false, | ||
callToActions: menuItems, | ||
}, | ||
], | ||
} }, batchRequestOptions); | ||
} | ||
function deleteUserPersistentMenu(userId, options = {}) { | ||
const batchRequestOptions = pick_1.default(options, ['name', 'dependsOn']); | ||
return Object.assign({ method: 'DELETE', relativeUrl: `/me/custom_user_settings?psid=${userId}¶ms=[%22persistent_menu%22]`.concat(options.accessToken ? `&access_token=${options.accessToken}` : '') }, batchRequestOptions); | ||
} | ||
function sendSenderAction(psidOrRecipient, senderAction, options = {}) { | ||
@@ -175,2 +202,5 @@ const recipient = typeof psidOrRecipient === 'string' | ||
getUserProfile, | ||
getUserPersistentMenu, | ||
setUserPersistentMenu, | ||
deleteUserPersistentMenu, | ||
sendSenderAction, | ||
@@ -177,0 +207,0 @@ typingOn, |
@@ -104,3 +104,3 @@ "use strict"; | ||
const appSecret = this._appSecret; | ||
this._axios.interceptors.request.use(config => { | ||
this._axios.interceptors.request.use((config) => { | ||
const isBatch = config.url === '/' && Array.isArray(config.data.batch); | ||
@@ -115,3 +115,3 @@ if (isBatch) { | ||
.split('&') | ||
.map(pair => pair.split('=')); | ||
.map((pair) => pair.split('=')); | ||
const accessTokenEntry = entries.find(([key]) => key === 'access_token'); | ||
@@ -176,3 +176,3 @@ if (accessTokenEntry) { | ||
.get(`/me?access_token=${customAccessToken || this._accessToken}`) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -195,3 +195,3 @@ /** | ||
}) | ||
.then(res => res.data.data, handleError); | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -223,3 +223,3 @@ /** | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -238,3 +238,3 @@ /** | ||
.get(`/${appId}/subscriptions?access_token=${accessToken}`) | ||
.then(res => res.data.data, handleError); | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -253,3 +253,3 @@ /** | ||
accessToken, | ||
}).then((subscriptions) => subscriptions.filter(subscription => subscription.object === 'page')[0] || null); | ||
}).then((subscriptions) => subscriptions.filter((subscription) => subscription.object === 'page')[0] || null); | ||
} | ||
@@ -263,5 +263,4 @@ /** | ||
return this._axios | ||
.get(`/me/messaging_feature_review?access_token=${customAccessToken || | ||
this._accessToken}`) | ||
.then(res => res.data.data, handleError); | ||
.get(`/me/messaging_feature_review?access_token=${customAccessToken || this._accessToken}`) | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -277,3 +276,3 @@ /** | ||
.get(`/${userId}?fields=${fields.join(',')}&access_token=${customAccessToken || this._accessToken}`) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -288,14 +287,12 @@ /** | ||
.get(`/me/messenger_profile?fields=${fields.join(',')}&access_token=${customAccessToken || this._accessToken}`) | ||
.then(res => res.data.data, handleError); | ||
.then((res) => res.data.data, handleError); | ||
} | ||
setMessengerProfile(profile, { accessToken: customAccessToken } = {}) { | ||
return this._axios | ||
.post(`/me/messenger_profile?access_token=${customAccessToken || | ||
this._accessToken}`, profile) | ||
.then(res => res.data, handleError); | ||
.post(`/me/messenger_profile?access_token=${customAccessToken || this._accessToken}`, profile) | ||
.then((res) => res.data, handleError); | ||
} | ||
deleteMessengerProfile(fields, { accessToken: customAccessToken } = {}) { | ||
return this._axios | ||
.delete(`/me/messenger_profile?access_token=${customAccessToken || | ||
this._accessToken}`, { | ||
.delete(`/me/messenger_profile?access_token=${customAccessToken || this._accessToken}`, { | ||
data: { | ||
@@ -305,3 +302,3 @@ fields, | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -314,3 +311,3 @@ /** | ||
getGetStarted(options = {}) { | ||
return this.getMessengerProfile(['get_started'], options).then(res => res[0] | ||
return this.getMessengerProfile(['get_started'], options).then((res) => res[0] | ||
? res[0].getStarted | ||
@@ -335,3 +332,3 @@ : null); | ||
getPersistentMenu(options = {}) { | ||
return this.getMessengerProfile(['persistent_menu'], options).then(res => res[0] ? res[0].persistentMenu : null); | ||
return this.getMessengerProfile(['persistent_menu'], options).then((res) => res[0] ? res[0].persistentMenu : null); | ||
} | ||
@@ -367,5 +364,4 @@ setPersistentMenu(menuItems, _a = {}) { | ||
return this._axios | ||
.get(`/me/custom_user_settings?psid=${userId}&access_token=${customAccessToken || | ||
this._accessToken}`) | ||
.then(res => res.data.data[0] | ||
.get(`/me/custom_user_settings?psid=${userId}&access_token=${customAccessToken || this._accessToken}`) | ||
.then((res) => res.data.data[0] | ||
? res.data.data[0].userLevelPersistentMenu | ||
@@ -378,13 +374,11 @@ : null, handleError); | ||
return this._axios | ||
.post(`/me/custom_user_settings?access_token=${customAccessToken || | ||
this._accessToken}`, { | ||
.post(`/me/custom_user_settings?access_token=${customAccessToken || this._accessToken}`, { | ||
psid: userId, | ||
persistentMenu: menuItems, | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
// menuItems is in type MenuItem[] | ||
return this._axios | ||
.post(`/me/custom_user_settings?access_token=${customAccessToken || | ||
this._accessToken}`, { | ||
.post(`/me/custom_user_settings?access_token=${customAccessToken || this._accessToken}`, { | ||
psid: userId, | ||
@@ -399,9 +393,8 @@ persistentMenu: [ | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
deleteUserPersistentMenu(userId, { accessToken: customAccessToken } = {}) { | ||
return this._axios | ||
.delete(`/me/custom_user_settings?psid=${userId}¶ms=[%22persistent_menu%22]&access_token=${customAccessToken || | ||
this._accessToken}`) | ||
.then(res => res.data, handleError); | ||
.delete(`/me/custom_user_settings?psid=${userId}¶ms=[%22persistent_menu%22]&access_token=${customAccessToken || this._accessToken}`) | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -414,3 +407,3 @@ /** | ||
getGreeting(options = {}) { | ||
return this.getMessengerProfile(['greeting'], options).then(res => res[0] ? res[0].greeting : null); | ||
return this.getMessengerProfile(['greeting'], options).then((res) => res[0] ? res[0].greeting : null); | ||
} | ||
@@ -441,3 +434,3 @@ setGreeting(greeting, options = {}) { | ||
getIceBreakers(options = {}) { | ||
return this.getMessengerProfile(['ice_breakers'], options).then(res => res[0] ? res[0].iceBreakers : null); | ||
return this.getMessengerProfile(['ice_breakers'], options).then((res) => res[0] ? res[0].iceBreakers : null); | ||
} | ||
@@ -458,3 +451,3 @@ setIceBreakers(iceBreakers, options = {}) { | ||
getWhitelistedDomains(options = {}) { | ||
return this.getMessengerProfile(['whitelisted_domains'], options).then(res => (res[0] ? res[0].whitelistedDomains : null)); | ||
return this.getMessengerProfile(['whitelisted_domains'], options).then((res) => (res[0] ? res[0].whitelistedDomains : null)); | ||
} | ||
@@ -475,3 +468,3 @@ setWhitelistedDomains(whitelistedDomains, options = {}) { | ||
getAccountLinkingURL(options = {}) { | ||
return this.getMessengerProfile(['account_linking_url'], options).then(res => (res[0] ? res[0] : null)); | ||
return this.getMessengerProfile(['account_linking_url'], options).then((res) => (res[0] ? res[0] : null)); | ||
} | ||
@@ -492,3 +485,3 @@ setAccountLinkingURL(accountLinkingUrl, options = {}) { | ||
getHomeURL(options = {}) { | ||
return this.getMessengerProfile(['home_url'], options).then(res => res[0] | ||
return this.getMessengerProfile(['home_url'], options).then((res) => res[0] | ||
? res[0] | ||
@@ -517,5 +510,4 @@ : null); | ||
return this._axios | ||
.get(`/page_message_tags?access_token=${customAccessToken || | ||
this._accessToken}`) | ||
.then(res => res.data.data, handleError); | ||
.get(`/page_message_tags?access_token=${customAccessToken || this._accessToken}`) | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -531,3 +523,3 @@ /** | ||
.post(`/me/messages?access_token=${customAccessToken || this._accessToken}`, body) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -569,3 +561,3 @@ sendMessage(psidOrRecipient, message, options = {}) { | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -692,10 +684,10 @@ /** | ||
invariant_1.default(batch.length <= 50, 'limit the number of requests which can be in a batch to 50'); | ||
const responseAccessPaths = batch.map(item => item.responseAccessPath); | ||
const responseAccessPaths = batch.map((item) => item.responseAccessPath); | ||
const bodyEncodedbatch = batch | ||
.map(item => omit_1.default(item, 'responseAccessPath')) | ||
.map(item => { | ||
.map((item) => omit_1.default(item, 'responseAccessPath')) | ||
.map((item) => { | ||
if (item.body) { | ||
const body = messaging_api_common_1.snakecaseKeysDeep(item.body); | ||
return Object.assign(Object.assign({}, item), { body: Object.keys(body) | ||
.map(key => { | ||
.map((key) => { | ||
const val = body[key]; | ||
@@ -713,3 +705,3 @@ return `${encodeURIComponent(key)}=${encodeURIComponent(typeof val === 'object' ? JSON.stringify(val) : val)}`; | ||
}) | ||
.then(res => res.data.map((item, index) => { | ||
.then((res) => res.data.map((item, index) => { | ||
const responseAccessPath = responseAccessPaths[index]; | ||
@@ -735,7 +727,6 @@ const datum = messaging_api_common_1.camelcaseKeysDeep(item); | ||
return this._axios | ||
.post(`/me/custom_labels?access_token=${customAccessToken || | ||
this._accessToken}`, { | ||
.post(`/me/custom_labels?access_token=${customAccessToken || this._accessToken}`, { | ||
name, | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -749,7 +740,6 @@ /** | ||
return this._axios | ||
.post(`/${labelId}/label?access_token=${customAccessToken || | ||
this._accessToken}`, { | ||
.post(`/${labelId}/label?access_token=${customAccessToken || this._accessToken}`, { | ||
user: userId, | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -763,7 +753,6 @@ /** | ||
return this._axios | ||
.delete(`/${labelId}/label?access_token=${customAccessToken || | ||
this._accessToken}`, { | ||
.delete(`/${labelId}/label?access_token=${customAccessToken || this._accessToken}`, { | ||
data: { user: userId }, | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -778,5 +767,4 @@ /** | ||
return this._axios | ||
.get(`/${userId}/custom_labels?fields=${fields}&access_token=${options.accessToken || | ||
this._accessToken}`) | ||
.then(res => res.data, handleError); | ||
.get(`/${userId}/custom_labels?fields=${fields}&access_token=${options.accessToken || this._accessToken}`) | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -791,5 +779,4 @@ /** | ||
return this._axios | ||
.get(`/${labelId}?fields=${fields}&access_token=${options.accessToken || | ||
this._accessToken}`) | ||
.then(res => res.data, handleError); | ||
.get(`/${labelId}?fields=${fields}&access_token=${options.accessToken || this._accessToken}`) | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -804,5 +791,4 @@ /** | ||
return this._axios | ||
.get(`/me/custom_labels?fields=${fields}&access_token=${options.accessToken || | ||
this._accessToken}`) | ||
.then(res => res.data, handleError); | ||
.get(`/me/custom_labels?fields=${fields}&access_token=${options.accessToken || this._accessToken}`) | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -817,3 +803,3 @@ /** | ||
.delete(`/${labelId}?access_token=${customAccessToken || this._accessToken}`) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -859,5 +845,4 @@ /** | ||
return this._axios | ||
.post(`/me/message_attachments?access_token=${options.accessToken || | ||
this._accessToken}`, ...args) | ||
.then(res => res.data, handleError); | ||
.post(`/me/message_attachments?access_token=${options.accessToken || this._accessToken}`, ...args) | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -892,4 +877,3 @@ // FIXME: use TypeScript overloading | ||
return this._axios | ||
.post(`/me/pass_thread_control?access_token=${customAccessToken || | ||
this._accessToken}`, { | ||
.post(`/me/pass_thread_control?access_token=${customAccessToken || this._accessToken}`, { | ||
recipient: { id: recipientId }, | ||
@@ -899,3 +883,3 @@ targetAppId, | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -912,8 +896,7 @@ passThreadControlToPageInbox(recipientId, metadata, options = {}) { | ||
return this._axios | ||
.post(`/me/take_thread_control?access_token=${customAccessToken || | ||
this._accessToken}`, { | ||
.post(`/me/take_thread_control?access_token=${customAccessToken || this._accessToken}`, { | ||
recipient: { id: recipientId }, | ||
metadata, | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -927,8 +910,7 @@ /** | ||
return this._axios | ||
.post(`/me/request_thread_control?access_token=${customAccessToken || | ||
this._accessToken}`, { | ||
.post(`/me/request_thread_control?access_token=${customAccessToken || this._accessToken}`, { | ||
recipient: { id: recipientId }, | ||
metadata, | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -942,5 +924,4 @@ /** | ||
return this._axios | ||
.get(`/me/secondary_receivers?fields=id,name&access_token=${customAccessToken || | ||
this._accessToken}`) | ||
.then(res => res.data.data, handleError); | ||
.get(`/me/secondary_receivers?fields=id,name&access_token=${customAccessToken || this._accessToken}`) | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -954,5 +935,4 @@ /** | ||
return this._axios | ||
.get(`/me/thread_owner?recipient=${recipientId}&access_token=${customAccessToken || | ||
this._accessToken}`) | ||
.then(res => res.data.data[0].threadOwner, handleError); | ||
.get(`/me/thread_owner?recipient=${recipientId}&access_token=${customAccessToken || this._accessToken}`) | ||
.then((res) => res.data.data[0].threadOwner, handleError); | ||
} | ||
@@ -967,9 +947,9 @@ /** | ||
.get(`/me/insights/?${querystring_1.default.stringify(Object.assign({ metric: metrics.join(','), access_token: options.accessToken || this._accessToken }, options))}`) | ||
.then(res => res.data.data, handleError); | ||
.then((res) => res.data.data, handleError); | ||
} | ||
getBlockedConversations(options) { | ||
return this.getInsights(['page_messages_blocked_conversations_unique'], options).then(result => result[0]); | ||
return this.getInsights(['page_messages_blocked_conversations_unique'], options).then((result) => result[0]); | ||
} | ||
getReportedConversations(options) { | ||
return this.getInsights(['page_messages_reported_conversations_unique'], options).then(result => result[0]); | ||
return this.getInsights(['page_messages_reported_conversations_unique'], options).then((result) => result[0]); | ||
} | ||
@@ -979,6 +959,6 @@ // https://developers.facebook.com/docs/messenger-platform/reference/messaging-insights-api?locale=en_US#metrics | ||
getTotalMessagingConnections(options) { | ||
return this.getInsights(['page_messages_total_messaging_connections'], options).then(result => result[0]); | ||
return this.getInsights(['page_messages_total_messaging_connections'], options).then((result) => result[0]); | ||
} | ||
getNewConversations(options) { | ||
return this.getInsights(['page_messages_new_conversations_unique'], options).then(result => result[0]); | ||
return this.getInsights(['page_messages_new_conversations_unique'], options).then((result) => result[0]); | ||
} | ||
@@ -996,3 +976,3 @@ /** | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1024,3 +1004,3 @@ // FIXME: [type] return type | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1042,3 +1022,3 @@ /** | ||
.get(`/${userId}/${field}?access_token=${accessToken}&appsecret_proof=${appsecretProof}${appQueryString}${pageQueryString}`) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1086,3 +1066,3 @@ /** | ||
.post(`/me/personas?access_token=${customAccessToken || this._accessToken}`, persona) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1097,3 +1077,3 @@ /** | ||
.get(`/${personaId}?access_token=${customAccessToken || this._accessToken}`) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1108,3 +1088,3 @@ /** | ||
.get(`/me/personas?access_token=${customAccessToken || this._accessToken}${cursor ? `&after=${cursor}` : ''}`) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1134,3 +1114,3 @@ getAllPersonas({ accessToken: customAccessToken, } = {}) { | ||
.delete(`/${personaId}?access_token=${customAccessToken || this._accessToken}`) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1137,0 +1117,0 @@ } |
@@ -9,3 +9,3 @@ { | ||
}, | ||
"version": "1.0.0-beta.25", | ||
"version": "1.0.0-beta.26", | ||
"main": "dist/index.js", | ||
@@ -17,7 +17,7 @@ "browser": "lib/browser.js", | ||
"axios": "^0.19.2", | ||
"axios-error": "^1.0.0-beta.24", | ||
"axios-error": "^1.0.0-beta.26", | ||
"form-data": "^3.0.0", | ||
"invariant": "^2.2.4", | ||
"lodash": "^4.17.15", | ||
"messaging-api-common": "^1.0.0-beta.24", | ||
"messaging-api-common": "^1.0.0-beta.26", | ||
"warning": "^4.0.3" | ||
@@ -34,3 +34,3 @@ }, | ||
}, | ||
"gitHead": "5cca124548cbd6d36cafbdfb3ce6856fd338dbe3" | ||
"gitHead": "a22b819aad9b425d5d0d2bb45aada31f0ecee42e" | ||
} |
@@ -1157,2 +1157,271 @@ import MessengerBatch from '../MessengerBatch'; | ||
describe('#userPersistentMenu', () => { | ||
describe('getUserPersistentMenu', () => { | ||
it('should create get user persistent menu request', () => { | ||
expect(MessengerBatch.getUserPersistentMenu(RECIPIENT_ID)).toEqual({ | ||
method: 'GET', | ||
relativeUrl: `/me/custom_user_settings?psid=${RECIPIENT_ID}`, | ||
}); | ||
}); | ||
it('should support access_token', () => { | ||
expect( | ||
MessengerBatch.getUserPersistentMenu(RECIPIENT_ID, { | ||
accessToken: 'ACCESS_TOKEN', | ||
}) | ||
).toEqual({ | ||
method: 'GET', | ||
relativeUrl: `/me/custom_user_settings?psid=${RECIPIENT_ID}&access_token=ACCESS_TOKEN`, | ||
}); | ||
}); | ||
it('should support specifying dependencies between operations', () => { | ||
expect( | ||
MessengerBatch.getUserPersistentMenu(RECIPIENT_ID, { | ||
name: 'second', | ||
dependsOn: 'first', | ||
}) | ||
).toEqual({ | ||
method: 'GET', | ||
relativeUrl: `/me/custom_user_settings?psid=${RECIPIENT_ID}`, | ||
name: 'second', | ||
dependsOn: 'first', | ||
}); | ||
}); | ||
}); | ||
describe('setUserPersistentMenu', () => { | ||
it('should create set user persistent menu request', () => { | ||
expect( | ||
MessengerBatch.setUserPersistentMenu(RECIPIENT_ID, [ | ||
{ | ||
locale: 'default', | ||
composerInputDisabled: false, | ||
callToActions: [ | ||
{ | ||
type: 'postback', | ||
title: 'Restart Conversation', | ||
payload: 'RESTART', | ||
}, | ||
{ | ||
type: 'web_url', | ||
title: 'Powered by ALOHA.AI, Yoctol', | ||
url: 'https://www.yoctol.com/', | ||
}, | ||
], | ||
}, | ||
]) | ||
).toEqual({ | ||
method: 'POST', | ||
relativeUrl: `/me/custom_user_settings`, | ||
body: { | ||
psid: `${RECIPIENT_ID}`, | ||
persistentMenu: [ | ||
{ | ||
locale: 'default', | ||
composerInputDisabled: false, | ||
callToActions: [ | ||
{ | ||
type: 'postback', | ||
title: 'Restart Conversation', | ||
payload: 'RESTART', | ||
}, | ||
{ | ||
type: 'web_url', | ||
title: 'Powered by ALOHA.AI, Yoctol', | ||
url: 'https://www.yoctol.com/', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}); | ||
}); | ||
it('should response correctly if input is not a full Persistent Menu', () => { | ||
expect( | ||
MessengerBatch.setUserPersistentMenu(RECIPIENT_ID, [ | ||
{ | ||
type: 'postback', | ||
title: 'Restart Conversation', | ||
payload: 'RESTART', | ||
}, | ||
{ | ||
type: 'web_url', | ||
title: 'Powered by ALOHA.AI, Yoctol', | ||
url: 'https://www.yoctol.com/', | ||
}, | ||
]) | ||
).toEqual({ | ||
method: 'POST', | ||
relativeUrl: `/me/custom_user_settings`, | ||
body: { | ||
psid: `${RECIPIENT_ID}`, | ||
persistentMenu: [ | ||
{ | ||
locale: 'default', | ||
composerInputDisabled: false, | ||
callToActions: [ | ||
{ | ||
type: 'postback', | ||
title: 'Restart Conversation', | ||
payload: 'RESTART', | ||
}, | ||
{ | ||
type: 'web_url', | ||
title: 'Powered by ALOHA.AI, Yoctol', | ||
url: 'https://www.yoctol.com/', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}); | ||
}); | ||
it('should support access_token', () => { | ||
expect( | ||
MessengerBatch.setUserPersistentMenu( | ||
RECIPIENT_ID, | ||
[ | ||
{ | ||
locale: 'default', | ||
composerInputDisabled: false, | ||
callToActions: [ | ||
{ | ||
type: 'postback', | ||
title: 'Restart Conversation', | ||
payload: 'RESTART', | ||
}, | ||
{ | ||
type: 'web_url', | ||
title: 'Powered by ALOHA.AI, Yoctol', | ||
url: 'https://www.yoctol.com/', | ||
}, | ||
], | ||
}, | ||
], | ||
{ | ||
accessToken: 'ACCESS_TOKEN', | ||
} | ||
) | ||
).toEqual({ | ||
method: 'POST', | ||
relativeUrl: `/me/custom_user_settings?access_token=ACCESS_TOKEN`, | ||
body: { | ||
psid: `${RECIPIENT_ID}`, | ||
persistentMenu: [ | ||
{ | ||
locale: 'default', | ||
composerInputDisabled: false, | ||
callToActions: [ | ||
{ | ||
type: 'postback', | ||
title: 'Restart Conversation', | ||
payload: 'RESTART', | ||
}, | ||
{ | ||
type: 'web_url', | ||
title: 'Powered by ALOHA.AI, Yoctol', | ||
url: 'https://www.yoctol.com/', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}); | ||
}); | ||
it('should support specifying dependencies between operations', () => { | ||
expect( | ||
MessengerBatch.setUserPersistentMenu( | ||
RECIPIENT_ID, | ||
[ | ||
{ | ||
locale: 'default', | ||
composerInputDisabled: false, | ||
callToActions: [ | ||
{ | ||
type: 'postback', | ||
title: 'Restart Conversation', | ||
payload: 'RESTART', | ||
}, | ||
{ | ||
type: 'web_url', | ||
title: 'Powered by ALOHA.AI, Yoctol', | ||
url: 'https://www.yoctol.com/', | ||
}, | ||
], | ||
}, | ||
], | ||
{ | ||
name: 'second', | ||
dependsOn: 'first', | ||
} | ||
) | ||
).toEqual({ | ||
method: 'POST', | ||
relativeUrl: `/me/custom_user_settings`, | ||
body: { | ||
psid: `${RECIPIENT_ID}`, | ||
persistentMenu: [ | ||
{ | ||
locale: 'default', | ||
composerInputDisabled: false, | ||
callToActions: [ | ||
{ | ||
type: 'postback', | ||
title: 'Restart Conversation', | ||
payload: 'RESTART', | ||
}, | ||
{ | ||
type: 'web_url', | ||
title: 'Powered by ALOHA.AI, Yoctol', | ||
url: 'https://www.yoctol.com/', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
name: 'second', | ||
dependsOn: 'first', | ||
}); | ||
}); | ||
}); | ||
describe('deleteUserPersistentMenu', () => { | ||
it('should create delete user persistent menu request', () => { | ||
expect(MessengerBatch.deleteUserPersistentMenu(RECIPIENT_ID)).toEqual({ | ||
method: 'DELETE', | ||
relativeUrl: `/me/custom_user_settings?psid=${RECIPIENT_ID}¶ms=[%22persistent_menu%22]`, | ||
}); | ||
}); | ||
it('should support access_token', () => { | ||
expect( | ||
MessengerBatch.deleteUserPersistentMenu(RECIPIENT_ID, { | ||
accessToken: 'ACCESS_TOKEN', | ||
}) | ||
).toEqual({ | ||
method: 'DELETE', | ||
relativeUrl: `/me/custom_user_settings?psid=${RECIPIENT_ID}¶ms=[%22persistent_menu%22]&access_token=ACCESS_TOKEN`, | ||
}); | ||
}); | ||
it('should support specifying dependencies between operations', () => { | ||
expect( | ||
MessengerBatch.deleteUserPersistentMenu(RECIPIENT_ID, { | ||
name: 'second', | ||
dependsOn: 'first', | ||
}) | ||
).toEqual({ | ||
method: 'DELETE', | ||
relativeUrl: `/me/custom_user_settings?psid=${RECIPIENT_ID}¶ms=[%22persistent_menu%22]`, | ||
name: 'second', | ||
dependsOn: 'first', | ||
}); | ||
}); | ||
}); | ||
}); | ||
describe('sendSenderAction', () => { | ||
@@ -1159,0 +1428,0 @@ it('should create send sender action request', () => { |
@@ -330,3 +330,3 @@ import MockAdapter from 'axios-mock-adapter'; | ||
let url; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -362,3 +362,3 @@ return [200, reply]; | ||
let url; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -400,3 +400,3 @@ return [200, reply]; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -403,0 +403,0 @@ data = config.data; |
@@ -36,3 +36,3 @@ import MockAdapter from 'axios-mock-adapter'; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -75,3 +75,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -114,3 +114,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -152,3 +152,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -190,3 +190,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -227,3 +227,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -264,3 +264,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -301,3 +301,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -340,3 +340,3 @@ data = config.data; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -375,3 +375,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -408,3 +408,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -411,0 +411,0 @@ return [200, reply]; |
@@ -33,3 +33,3 @@ import MockAdapter from 'axios-mock-adapter'; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -66,3 +66,3 @@ data = config.data; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -271,3 +271,3 @@ return [200, reply]; | ||
let url; | ||
mock.onDelete().reply(config => { | ||
mock.onDelete().reply((config) => { | ||
url = config.url; | ||
@@ -274,0 +274,0 @@ return [200, reply]; |
@@ -56,3 +56,3 @@ import MockAdapter from 'axios-mock-adapter'; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -106,3 +106,3 @@ return [200, reply]; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -166,3 +166,3 @@ data = config.data; | ||
let data; | ||
mock.onDelete().reply(config => { | ||
mock.onDelete().reply((config) => { | ||
url = config.url; | ||
@@ -204,3 +204,3 @@ data = config.data; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -229,3 +229,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -255,3 +255,3 @@ return [200, reply]; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -285,3 +285,3 @@ data = config.data; | ||
let data; | ||
mock.onDelete().reply(config => { | ||
mock.onDelete().reply((config) => { | ||
url = config.url; | ||
@@ -335,3 +335,3 @@ data = config.data; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -375,3 +375,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -401,3 +401,3 @@ return [200, reply]; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -455,3 +455,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -515,3 +515,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -565,3 +565,3 @@ data = config.data; | ||
let data; | ||
mock.onDelete().reply(config => { | ||
mock.onDelete().reply((config) => { | ||
url = config.url; | ||
@@ -613,3 +613,3 @@ data = config.data; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -653,3 +653,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -679,3 +679,3 @@ return [200, reply]; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -736,3 +736,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -799,3 +799,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -851,3 +851,3 @@ data = config.data; | ||
let url; | ||
mock.onDelete().reply(config => { | ||
mock.onDelete().reply((config) => { | ||
url = config.url; | ||
@@ -887,3 +887,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -915,3 +915,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -941,3 +941,3 @@ return [200, reply]; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -972,3 +972,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1018,3 +1018,3 @@ data = config.data; | ||
let data; | ||
mock.onDelete().reply(config => { | ||
mock.onDelete().reply((config) => { | ||
url = config.url; | ||
@@ -1060,3 +1060,3 @@ data = config.data; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -1092,3 +1092,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -1118,3 +1118,3 @@ return [200, reply]; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1164,3 +1164,3 @@ data = config.data; | ||
let data; | ||
mock.onDelete().reply(config => { | ||
mock.onDelete().reply((config) => { | ||
url = config.url; | ||
@@ -1197,3 +1197,3 @@ data = config.data; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -1220,3 +1220,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -1246,3 +1246,3 @@ return [200, reply]; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1274,3 +1274,3 @@ data = config.data; | ||
let data; | ||
mock.onDelete().reply(config => { | ||
mock.onDelete().reply((config) => { | ||
url = config.url; | ||
@@ -1308,3 +1308,3 @@ data = config.data; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -1334,3 +1334,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -1360,3 +1360,3 @@ return [200, reply]; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1391,3 +1391,3 @@ data = config.data; | ||
let data; | ||
mock.onDelete().reply(config => { | ||
mock.onDelete().reply((config) => { | ||
url = config.url; | ||
@@ -1426,3 +1426,3 @@ data = config.data; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -1453,3 +1453,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -1479,3 +1479,3 @@ return [200, reply]; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1514,3 +1514,3 @@ data = config.data; | ||
let data; | ||
mock.onDelete().reply(config => { | ||
mock.onDelete().reply((config) => { | ||
url = config.url; | ||
@@ -1517,0 +1517,0 @@ data = config.data; |
@@ -42,3 +42,3 @@ import fs from 'fs'; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -86,3 +86,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -134,3 +134,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -172,3 +172,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -217,3 +217,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -260,3 +260,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -303,3 +303,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -345,3 +345,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -388,3 +388,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -431,3 +431,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -490,3 +490,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -534,3 +534,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -581,3 +581,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -629,3 +629,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -665,3 +665,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -706,3 +706,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -750,3 +750,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -793,3 +793,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -823,3 +823,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -867,3 +867,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -910,3 +910,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -940,3 +940,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -984,3 +984,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1027,7 +1027,9 @@ data = config.data; | ||
let data; | ||
mock.onPost(`/me/messages?access_token=${ACCESS_TOKEN}`).reply(config => { | ||
url = config.url; | ||
data = config.data; | ||
return [200, reply]; | ||
}); | ||
mock | ||
.onPost(`/me/messages?access_token=${ACCESS_TOKEN}`) | ||
.reply((config) => { | ||
url = config.url; | ||
data = config.data; | ||
return [200, reply]; | ||
}); | ||
@@ -1057,3 +1059,3 @@ const res = await client.sendVideo(USER_ID, fs.createReadStream('./')); | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1101,3 +1103,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1144,7 +1146,9 @@ data = config.data; | ||
let data; | ||
mock.onPost(`/me/messages?access_token=${ACCESS_TOKEN}`).reply(config => { | ||
url = config.url; | ||
data = config.data; | ||
return [200, reply]; | ||
}); | ||
mock | ||
.onPost(`/me/messages?access_token=${ACCESS_TOKEN}`) | ||
.reply((config) => { | ||
url = config.url; | ||
data = config.data; | ||
return [200, reply]; | ||
}); | ||
@@ -1178,3 +1182,3 @@ const res = await client.sendFile(USER_ID, fs.createReadStream('./')); | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1218,3 +1222,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1264,3 +1268,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1295,3 +1299,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1331,3 +1335,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1362,3 +1366,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1398,3 +1402,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1429,3 +1433,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1465,3 +1469,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1496,3 +1500,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1499,0 +1503,0 @@ data = config.data; |
@@ -36,3 +36,3 @@ import MockAdapter from 'axios-mock-adapter'; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -97,3 +97,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -154,3 +154,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -236,3 +236,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -325,3 +325,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -416,3 +416,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -484,3 +484,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -627,3 +627,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -830,3 +830,3 @@ data = config.data; | ||
}) | ||
.reply(config => { | ||
.reply((config) => { | ||
url = config.url; | ||
@@ -926,3 +926,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1210,3 +1210,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1302,3 +1302,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -1305,0 +1305,0 @@ data = config.data; |
@@ -46,3 +46,3 @@ import fs from 'fs'; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -82,3 +82,3 @@ return [200, reply]; | ||
let params; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -120,3 +120,3 @@ params = config.params; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -156,3 +156,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -208,3 +208,3 @@ data = config.data; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -267,3 +267,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -307,3 +307,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -340,3 +340,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -373,3 +373,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -430,3 +430,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -467,3 +467,3 @@ return [200, reply]; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -508,3 +508,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -550,3 +550,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -583,3 +583,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -625,3 +625,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -667,3 +667,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -709,3 +709,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -753,3 +753,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -786,3 +786,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -814,3 +814,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -844,3 +844,3 @@ data = config.data; | ||
let data; | ||
mock.onPost().reply(config => { | ||
mock.onPost().reply((config) => { | ||
url = config.url; | ||
@@ -916,3 +916,3 @@ data = config.data; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -962,3 +962,3 @@ return [200, reply]; | ||
let url; | ||
mock.onGet().reply(config => { | ||
mock.onGet().reply((config) => { | ||
url = config.url; | ||
@@ -965,0 +965,0 @@ return [200, reply]; |
@@ -282,2 +282,83 @@ import omit from 'lodash/omit'; | ||
function getUserPersistentMenu( | ||
userId: string, | ||
options: { | ||
accessToken?: string; | ||
} & Types.BatchRequestOptions = {} | ||
): Types.BatchItem { | ||
const batchRequestOptions = pick(options, ['name', 'dependsOn']); | ||
return { | ||
method: 'GET', | ||
relativeUrl: `/me/custom_user_settings?psid=${userId}`.concat( | ||
options.accessToken ? `&access_token=${options.accessToken}` : '' | ||
), | ||
...batchRequestOptions, | ||
}; | ||
} | ||
function setUserPersistentMenu( | ||
userId: string, | ||
menuItems: Types.MenuItem[] | Types.PersistentMenuItem[], | ||
options: { | ||
accessToken?: string; | ||
} & Types.BatchRequestOptions = {} | ||
): Types.BatchItem { | ||
const batchRequestOptions = pick(options, ['name', 'dependsOn']); | ||
if ( | ||
menuItems.some( | ||
(item: Types.MenuItem | Types.PersistentMenuItem) => | ||
'locale' in item && item.locale === 'default' | ||
) | ||
) { | ||
return { | ||
method: 'POST', | ||
relativeUrl: `/me/custom_user_settings`.concat( | ||
options.accessToken ? `?access_token=${options.accessToken}` : '' | ||
), | ||
body: { | ||
psid: userId, | ||
persistentMenu: menuItems, | ||
}, | ||
...batchRequestOptions, | ||
}; | ||
} | ||
return { | ||
method: 'POST', | ||
relativeUrl: `/me/custom_user_settings`.concat( | ||
options.accessToken ? `?access_token=${options.accessToken}` : '' | ||
), | ||
body: { | ||
psid: userId, | ||
persistentMenu: [ | ||
{ | ||
locale: 'default', | ||
composerInputDisabled: false, | ||
callToActions: menuItems as Types.MenuItem[], | ||
}, | ||
], | ||
}, | ||
...batchRequestOptions, | ||
}; | ||
} | ||
function deleteUserPersistentMenu( | ||
userId: string, | ||
options: { | ||
accessToken?: string; | ||
} & Types.BatchRequestOptions = {} | ||
): Types.BatchItem { | ||
const batchRequestOptions = pick(options, ['name', 'dependsOn']); | ||
return { | ||
method: 'DELETE', | ||
relativeUrl: `/me/custom_user_settings?psid=${userId}¶ms=[%22persistent_menu%22]`.concat( | ||
options.accessToken ? `&access_token=${options.accessToken}` : '' | ||
), | ||
...batchRequestOptions, | ||
}; | ||
} | ||
function sendSenderAction( | ||
@@ -483,2 +564,5 @@ psidOrRecipient: Types.PsidOrRecipient, | ||
getUserProfile, | ||
getUserPersistentMenu, | ||
setUserPersistentMenu, | ||
deleteUserPersistentMenu, | ||
@@ -485,0 +569,0 @@ sendSenderAction, |
@@ -141,3 +141,3 @@ import crypto from 'crypto'; | ||
this._axios.interceptors.request.use(config => { | ||
this._axios.interceptors.request.use((config) => { | ||
const isBatch = config.url === '/' && Array.isArray(config.data.batch); | ||
@@ -153,3 +153,3 @@ | ||
.split('&') | ||
.map(pair => pair.split('=')); | ||
.map((pair) => pair.split('=')); | ||
@@ -230,3 +230,3 @@ const accessTokenEntry = entries.find( | ||
.get(`/me?access_token=${customAccessToken || this._accessToken}`) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -254,3 +254,3 @@ | ||
}) | ||
.then(res => res.data.data, handleError); | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -303,3 +303,3 @@ | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -328,3 +328,3 @@ | ||
.get(`/${appId}/subscriptions?access_token=${accessToken}`) | ||
.then(res => res.data.data, handleError); | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -356,3 +356,3 @@ | ||
subscriptions.filter( | ||
subscription => subscription.object === 'page' | ||
(subscription) => subscription.object === 'page' | ||
)[0] || null | ||
@@ -372,6 +372,7 @@ ); | ||
.get( | ||
`/me/messaging_feature_review?access_token=${customAccessToken || | ||
this._accessToken}` | ||
`/me/messaging_feature_review?access_token=${ | ||
customAccessToken || this._accessToken | ||
}` | ||
) | ||
.then(res => res.data.data, handleError); | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -394,7 +395,7 @@ | ||
.get<Types.User>( | ||
`/${userId}?fields=${fields.join( | ||
',' | ||
)}&access_token=${customAccessToken || this._accessToken}` | ||
`/${userId}?fields=${fields.join(',')}&access_token=${ | ||
customAccessToken || this._accessToken | ||
}` | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -413,7 +414,7 @@ | ||
.get<{ data: Types.MessengerProfile[] }>( | ||
`/me/messenger_profile?fields=${fields.join( | ||
',' | ||
)}&access_token=${customAccessToken || this._accessToken}` | ||
`/me/messenger_profile?fields=${fields.join(',')}&access_token=${ | ||
customAccessToken || this._accessToken | ||
}` | ||
) | ||
.then(res => res.data.data, handleError); | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -427,7 +428,8 @@ | ||
.post<Types.MutationSuccessResponse>( | ||
`/me/messenger_profile?access_token=${customAccessToken || | ||
this._accessToken}`, | ||
`/me/messenger_profile?access_token=${ | ||
customAccessToken || this._accessToken | ||
}`, | ||
profile | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -441,4 +443,5 @@ | ||
.delete<Types.MutationSuccessResponse>( | ||
`/me/messenger_profile?access_token=${customAccessToken || | ||
this._accessToken}`, | ||
`/me/messenger_profile?access_token=${ | ||
customAccessToken || this._accessToken | ||
}`, | ||
{ | ||
@@ -450,3 +453,3 @@ data: { | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -464,3 +467,3 @@ | ||
} | null> { | ||
return this.getMessengerProfile(['get_started'], options).then(res => | ||
return this.getMessengerProfile(['get_started'], options).then((res) => | ||
res[0] | ||
@@ -502,3 +505,3 @@ ? (res[0].getStarted as { | ||
): Promise<Types.PersistentMenu | null> { | ||
return this.getMessengerProfile(['persistent_menu'], options).then(res => | ||
return this.getMessengerProfile(['persistent_menu'], options).then((res) => | ||
res[0] ? (res[0].persistentMenu as Types.PersistentMenu) : null | ||
@@ -565,7 +568,8 @@ ); | ||
.get( | ||
`/me/custom_user_settings?psid=${userId}&access_token=${customAccessToken || | ||
this._accessToken}` | ||
`/me/custom_user_settings?psid=${userId}&access_token=${ | ||
customAccessToken || this._accessToken | ||
}` | ||
) | ||
.then( | ||
res => | ||
(res) => | ||
res.data.data[0] | ||
@@ -598,4 +602,5 @@ ? (res.data.data[0].userLevelPersistentMenu as Types.PersistentMenu) | ||
.post<Types.MutationSuccessResponse>( | ||
`/me/custom_user_settings?access_token=${customAccessToken || | ||
this._accessToken}`, | ||
`/me/custom_user_settings?access_token=${ | ||
customAccessToken || this._accessToken | ||
}`, | ||
{ | ||
@@ -606,3 +611,3 @@ psid: userId, | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -613,4 +618,5 @@ | ||
.post( | ||
`/me/custom_user_settings?access_token=${customAccessToken || | ||
this._accessToken}`, | ||
`/me/custom_user_settings?access_token=${ | ||
customAccessToken || this._accessToken | ||
}`, | ||
{ | ||
@@ -627,3 +633,3 @@ psid: userId, | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -637,6 +643,7 @@ | ||
.delete( | ||
`/me/custom_user_settings?psid=${userId}¶ms=[%22persistent_menu%22]&access_token=${customAccessToken || | ||
this._accessToken}` | ||
`/me/custom_user_settings?psid=${userId}¶ms=[%22persistent_menu%22]&access_token=${ | ||
customAccessToken || this._accessToken | ||
}` | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -652,3 +659,3 @@ | ||
): Promise<Types.GreetingConfig[] | null> { | ||
return this.getMessengerProfile(['greeting'], options).then(res => | ||
return this.getMessengerProfile(['greeting'], options).then((res) => | ||
res[0] ? (res[0].greeting as Types.GreetingConfig[]) : null | ||
@@ -698,3 +705,3 @@ ); | ||
): Promise<Types.IceBreaker[] | null> { | ||
return this.getMessengerProfile(['ice_breakers'], options).then(res => | ||
return this.getMessengerProfile(['ice_breakers'], options).then((res) => | ||
res[0] ? (res[0].iceBreakers as Types.IceBreaker[]) : null | ||
@@ -733,3 +740,3 @@ ); | ||
options | ||
).then(res => (res[0] ? (res[0].whitelistedDomains as string[]) : null)); | ||
).then((res) => (res[0] ? (res[0].whitelistedDomains as string[]) : null)); | ||
} | ||
@@ -766,3 +773,3 @@ | ||
options | ||
).then(res => (res[0] ? (res[0] as string) : null)); | ||
).then((res) => (res[0] ? (res[0] as string) : null)); | ||
} | ||
@@ -801,3 +808,3 @@ | ||
} | null> { | ||
return this.getMessengerProfile(['home_url'], options).then(res => | ||
return this.getMessengerProfile(['home_url'], options).then((res) => | ||
res[0] | ||
@@ -856,6 +863,7 @@ ? (res[0] as { | ||
.get<{ data: Types.MessageTagResponse }>( | ||
`/page_message_tags?access_token=${customAccessToken || | ||
this._accessToken}` | ||
`/page_message_tags?access_token=${ | ||
customAccessToken || this._accessToken | ||
}` | ||
) | ||
.then(res => res.data.data, handleError); | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -878,3 +886,3 @@ | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -940,3 +948,3 @@ | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1224,7 +1232,7 @@ | ||
const responseAccessPaths = batch.map(item => item.responseAccessPath); | ||
const responseAccessPaths = batch.map((item) => item.responseAccessPath); | ||
const bodyEncodedbatch = batch | ||
.map(item => omit(item, 'responseAccessPath')) | ||
.map(item => { | ||
.map((item) => omit(item, 'responseAccessPath')) | ||
.map((item) => { | ||
if (item.body) { | ||
@@ -1235,3 +1243,3 @@ const body = snakecaseKeysDeep(item.body) as Record<string, any>; | ||
body: Object.keys(body) | ||
.map(key => { | ||
.map((key) => { | ||
const val = body[key]; | ||
@@ -1254,3 +1262,3 @@ return `${encodeURIComponent(key)}=${encodeURIComponent( | ||
.then( | ||
res => | ||
(res) => | ||
res.data.map( | ||
@@ -1295,4 +1303,5 @@ (item: { code: number; body: string }, index: number) => { | ||
.post<{ id: string }>( | ||
`/me/custom_labels?access_token=${customAccessToken || | ||
this._accessToken}`, | ||
`/me/custom_labels?access_token=${ | ||
customAccessToken || this._accessToken | ||
}`, | ||
{ | ||
@@ -1302,3 +1311,3 @@ name, | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1318,4 +1327,5 @@ | ||
.post<{ success: true }>( | ||
`/${labelId}/label?access_token=${customAccessToken || | ||
this._accessToken}`, | ||
`/${labelId}/label?access_token=${ | ||
customAccessToken || this._accessToken | ||
}`, | ||
{ | ||
@@ -1325,3 +1335,3 @@ user: userId, | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1341,4 +1351,5 @@ | ||
.delete<{ success: true }>( | ||
`/${labelId}/label?access_token=${customAccessToken || | ||
this._accessToken}`, | ||
`/${labelId}/label?access_token=${ | ||
customAccessToken || this._accessToken | ||
}`, | ||
{ | ||
@@ -1348,3 +1359,3 @@ data: { user: userId }, | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1380,6 +1391,7 @@ | ||
}>( | ||
`/${userId}/custom_labels?fields=${fields}&access_token=${options.accessToken || | ||
this._accessToken}` | ||
`/${userId}/custom_labels?fields=${fields}&access_token=${ | ||
options.accessToken || this._accessToken | ||
}` | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1399,6 +1411,7 @@ | ||
.get<{ name: string; id: string }>( | ||
`/${labelId}?fields=${fields}&access_token=${options.accessToken || | ||
this._accessToken}` | ||
`/${labelId}?fields=${fields}&access_token=${ | ||
options.accessToken || this._accessToken | ||
}` | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1433,6 +1446,7 @@ | ||
}>( | ||
`/me/custom_labels?fields=${fields}&access_token=${options.accessToken || | ||
this._accessToken}` | ||
`/me/custom_labels?fields=${fields}&access_token=${ | ||
options.accessToken || this._accessToken | ||
}` | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1453,3 +1467,3 @@ | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1509,7 +1523,8 @@ | ||
.post( | ||
`/me/message_attachments?access_token=${options.accessToken || | ||
this._accessToken}`, | ||
`/me/message_attachments?access_token=${ | ||
options.accessToken || this._accessToken | ||
}`, | ||
...args | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1568,4 +1583,5 @@ | ||
.post<{ success: true }>( | ||
`/me/pass_thread_control?access_token=${customAccessToken || | ||
this._accessToken}`, | ||
`/me/pass_thread_control?access_token=${ | ||
customAccessToken || this._accessToken | ||
}`, | ||
{ | ||
@@ -1577,3 +1593,3 @@ recipient: { id: recipientId }, | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1606,4 +1622,5 @@ | ||
.post<{ success: true }>( | ||
`/me/take_thread_control?access_token=${customAccessToken || | ||
this._accessToken}`, | ||
`/me/take_thread_control?access_token=${ | ||
customAccessToken || this._accessToken | ||
}`, | ||
{ | ||
@@ -1614,3 +1631,3 @@ recipient: { id: recipientId }, | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1630,4 +1647,5 @@ | ||
.post<{ success: true }>( | ||
`/me/request_thread_control?access_token=${customAccessToken || | ||
this._accessToken}`, | ||
`/me/request_thread_control?access_token=${ | ||
customAccessToken || this._accessToken | ||
}`, | ||
{ | ||
@@ -1638,3 +1656,3 @@ recipient: { id: recipientId }, | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1662,6 +1680,7 @@ | ||
}>( | ||
`/me/secondary_receivers?fields=id,name&access_token=${customAccessToken || | ||
this._accessToken}` | ||
`/me/secondary_receivers?fields=id,name&access_token=${ | ||
customAccessToken || this._accessToken | ||
}` | ||
) | ||
.then(res => res.data.data, handleError); | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -1690,6 +1709,7 @@ | ||
}>( | ||
`/me/thread_owner?recipient=${recipientId}&access_token=${customAccessToken || | ||
this._accessToken}` | ||
`/me/thread_owner?recipient=${recipientId}&access_token=${ | ||
customAccessToken || this._accessToken | ||
}` | ||
) | ||
.then(res => res.data.data[0].threadOwner, handleError); | ||
.then((res) => res.data.data[0].threadOwner, handleError); | ||
} | ||
@@ -1714,3 +1734,3 @@ | ||
) | ||
.then(res => res.data.data, handleError); | ||
.then((res) => res.data.data, handleError); | ||
} | ||
@@ -1731,3 +1751,3 @@ | ||
options | ||
).then(result => result[0]); | ||
).then((result) => result[0]); | ||
} | ||
@@ -1748,3 +1768,3 @@ | ||
options | ||
).then(result => result[0]); | ||
).then((result) => result[0]); | ||
} | ||
@@ -1767,3 +1787,3 @@ | ||
options | ||
).then(result => result[0]); | ||
).then((result) => result[0]); | ||
} | ||
@@ -1784,3 +1804,3 @@ | ||
options | ||
).then(result => result[0]); | ||
).then((result) => result[0]); | ||
} | ||
@@ -1807,3 +1827,3 @@ | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1848,3 +1868,3 @@ | ||
}) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1886,3 +1906,3 @@ | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1964,3 +1984,3 @@ | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -1987,3 +2007,3 @@ | ||
}>(`/${personaId}?access_token=${customAccessToken || this._accessToken}`) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -2020,3 +2040,3 @@ | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
@@ -2077,4 +2097,4 @@ | ||
) | ||
.then(res => res.data, handleError); | ||
.then((res) => res.data, handleError); | ||
} | ||
} |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
753064
13443
3476