我正在使用 Xero 作为试用版。我有 100 多个联系人,现在我想通过 NodeJS API 添加分页。阅读它指定但不起作用的文档(https://developer.xero.com/documentation/api/contacts )。
我的代码是这样的: -
let paging = await xeroClient.core.contacts.getContacts({page: 1})
我调用了传递页面是可选参数的函数,但它为我显示了所有联系人。
传递参数有我的错误吗?
我正在使用 Xero 作为试用版。我有 100 多个联系人,现在我想通过 NodeJS API 添加分页。阅读它指定但不起作用的文档(https://developer.xero.com/documentation/api/contacts )。
我的代码是这样的: -
let paging = await xeroClient.core.contacts.getContacts({page: 1})
我调用了传递页面是可选参数的函数,但它为我显示了所有联系人。
传递参数有我的错误吗?
我没有将 node.js 与XeroApi一起使用,但从文档中您可以尝试以下操作:
/* Called per page */
const onContacts = (err, response, cb) => {
let contacts = response.data;
if (response.finished) // finished paging
....
cb(); // Async support
};
xeroClient.core.contacts.getContacts({ pager: {start:1 /* page number */, callback: onContacts}})
.catch(err => {
console.log(`Oh no, an error: ${err}`);
});
用寻呼机检查零件。