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

Function createLuckmailClient

background.js:2055–2184  ·  view source on GitHub ↗
(state = {})

Source from the content-addressed store, hash-verified

2053}
2054
2055function createLuckmailClient(state = {}) {
2056 const config = getLuckmailSessionConfig(state);
2057 const apiKey = ensureLuckmailApiKey(state);
2058 const request = (method, path, options = {}) => requestLuckmail(method, path, {
2059 baseUrl: config.baseUrl,
2060 apiKey,
2061 ...options,
2062 });
2063
2064 return {
2065 user: {
2066 async purchaseEmails(projectCode, quantity, { emailType, domain } = {}) {
2067 const body = {
2068 project_code: projectCode,
2069 quantity,
2070 email_type: normalizeLuckmailEmailType(emailType),
2071 };
2072 if (domain) {
2073 body.domain = String(domain).trim();
2074 }
2075 return request('POST', '/api/v1/openapi/email/purchase', {
2076 jsonData: body,
2077 });
2078 },
2079 async getPurchases({ page = 1, pageSize = 100, projectId, tagId, keyword, userDisabled } = {}) {
2080 return normalizeLuckmailPurchaseListPage(await request('GET', '/api/v1/openapi/email/purchases', {
2081 params: {
2082 page,
2083 page_size: pageSize,
2084 project_id: projectId,
2085 tag_id: tagId,
2086 keyword,
2087 user_disabled: userDisabled,
2088 },
2089 }));
2090 },
2091 async getTokenCode(token) {
2092 return normalizeLuckmailTokenCode(await request(
2093 'GET',
2094 `/api/v1/openapi/email/token/${encodeURIComponent(token)}/code`
2095 ));
2096 },
2097 async checkTokenAlive(token) {
2098 const data = await request(
2099 'GET',
2100 `/api/v1/openapi/email/token/${encodeURIComponent(token)}/alive`
2101 );
2102 return {
2103 email_address: String(data?.email_address || ''),
2104 project: String(data?.project || ''),
2105 alive: Boolean(data?.alive),
2106 status: String(data?.status || ''),
2107 message: String(data?.message || ''),
2108 mail_count: Number(data?.mail_count) || 0,
2109 };
2110 },
2111 async getTokenMails(token) {
2112 const data = await request('GET', `/api/v1/openapi/email/token/${encodeURIComponent(token)}/mails`);

Calls 2

getLuckmailSessionConfigFunction · 0.85
ensureLuckmailApiKeyFunction · 0.85

Tested by

no test coverage detected