MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / getAllLuckmailPurchases

Function getAllLuckmailPurchases

background.js:2226–2256  ·  view source on GitHub ↗
(state, options = {})

Source from the content-addressed store, hash-verified

2224}
2225
2226async function getAllLuckmailPurchases(state, options = {}) {
2227 const client = options.client || createLuckmailClient(state);
2228 const pageSize = Math.max(1, Math.min(100, Number(options.pageSize) || 100));
2229 const maxPages = Math.max(1, Number(options.maxPages) || 50);
2230 const purchases = [];
2231
2232 for (let page = 1; page <= maxPages; page += 1) {
2233 const pageResult = await client.user.getPurchases({
2234 page,
2235 pageSize,
2236 keyword: options.keyword,
2237 projectId: options.projectId,
2238 tagId: options.tagId,
2239 userDisabled: options.userDisabled,
2240 });
2241 const normalizedPage = normalizeLuckmailPurchaseListPage(pageResult);
2242 purchases.push(...normalizedPage.list);
2243
2244 if (normalizedPage.list.length === 0) {
2245 break;
2246 }
2247 if (normalizedPage.total > 0 && purchases.length >= normalizedPage.total) {
2248 break;
2249 }
2250 if (normalizedPage.list.length < normalizedPage.page_size) {
2251 break;
2252 }
2253 }
2254
2255 return purchases;
2256}
2257
2258async function listLuckmailPurchasesByProject(state, options = {}) {
2259 const projectCode = normalizeLuckmailProjectName(options.projectCode || DEFAULT_LUCKMAIL_PROJECT_CODE)

Callers 1

Calls 2

createLuckmailClientFunction · 0.85

Tested by

no test coverage detected