{"_id":"@cao-mei-you-ren/afdian","_rev":"4-1c708a58d15361e5443956f9740a53b0","name":"@cao-mei-you-ren/afdian","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.2":{"name":"@cao-mei-you-ren/afdian","version":"1.0.2","keywords":["afdian","sdk","爱发电"],"author":{"url":"https://willin.wang/","name":"Willin Wang","email":"willin@willin.org"},"license":"Apache-2.0","_id":"@cao-mei-you-ren/afdian@1.0.2","maintainers":[{"name":"cao-mei-you-ren","email":"caomeiyouren@qq.com"}],"homepage":"https://github.com/willin/afdian-sdk#readme","bugs":{"url":"https://github.com/willin/afdian-sdk/issues"},"dist":{"shasum":"797c7ec8364ca24115b2f84e9bc92b659b3a6d78","tarball":"https://registry.npmjs.org/@cao-mei-you-ren/afdian/-/afdian-1.0.2.tgz","fileCount":25,"integrity":"sha512-X9j1YLJT4rcFxGnPY9gVCo/q95mRZlgAqJSdtPc2eeZYKNpfe+Ql2ZAlP/KB17whYvvKc6pgLwYTsSgie2GOQA==","signatures":[{"sig":"MEUCIGJafXoJwQ9U0ikkwnDtevqKFSQyRWQgEAJD7NWKRlwdAiEAzQFH/AgWmjbMbWMDoeUCYqvYtTab2DLyuSI/3RqrNZI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56999},"main":"dist/main.js","types":"dist/types.d.ts","module":"dist/module.js","source":"src/index.ts","gitHead":"347a987a2504d4f42aad8f01597d40a6783e4208","scripts":{"test":"jest --coverage","build":"parcel build","watch":"parcel watch","version":"conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"},"_npmUser":{"name":"cao-mei-you-ren","email":"caomeiyouren@qq.com"},"repository":{"url":"git+https://github.com/willin/afdian-sdk.git","type":"git"},"_npmVersion":"10.9.0","description":"爱发电 SDK for Node.js and Browser","directories":{},"_nodeVersion":"22.12.0","dependencies":{"crypto-js":"^4.2.0","isomorphic-unfetch":"^3.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.5.1","eslint":"^8.53.0","parcel":"^2.10.2","ts-jest":"^27.1.5","prettier":"^2.8.8","typescript":"^4.9.5","@types/jest":"^27.5.2","@types/node":"^20.9.0","@commitlint/cli":"^15.0.0","@types/crypto-js":"^4.2.1","@parcel/packager-ts":"^2.10.2","@willin/eslint-config":"^0.0.6","conventional-changelog-cli":"^2.2.2","@commitlint/config-conventional":"^15.0.0","@parcel/transformer-typescript-types":"^2.10.2"},"_npmOperationalInternal":{"tmp":"tmp/afdian_1.0.2_1742117183759_0.5543728213536843","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@cao-mei-you-ren/afdian","version":"1.0.3","keywords":["afdian","sdk","爱发电"],"author":{"url":"https://willin.wang/","name":"Willin Wang","email":"willin@willin.org"},"license":"Apache-2.0","_id":"@cao-mei-you-ren/afdian@1.0.3","maintainers":[{"name":"cao-mei-you-ren","email":"caomeiyouren@qq.com"}],"homepage":"https://github.com/willin/afdian-sdk#readme","bugs":{"url":"https://github.com/willin/afdian-sdk/issues"},"dist":{"shasum":"b6d4393fb2ab2c0076f5a8a11f509b50dbb33625","tarball":"https://registry.npmjs.org/@cao-mei-you-ren/afdian/-/afdian-1.0.3.tgz","fileCount":25,"integrity":"sha512-ljTvoOurLcb03I4u2EcsB5iXfjoeSNQB5hSXxi/HAlMG1Eduhh2BuOs45AgD6cYAp/TZjhsRuPZkl0GZ265rvA==","signatures":[{"sig":"MEUCIQDHc9fyrDFxQInB7U0PuQ01VWH34pRF7qj7wfNXPUYQqQIgOhX3d8PNVg0eOa7lMhOrSktDKIcNUtu3W4XEYuAEISk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57725},"main":"dist/main.js","types":"dist/types.d.ts","module":"dist/module.js","source":"src/index.ts","gitHead":"2a47ce9c89ed196bf84363fdcfda1e5403c217d4","scripts":{"test":"jest --coverage","build":"parcel build","watch":"parcel watch","version":"conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"},"_npmUser":{"name":"cao-mei-you-ren","email":"caomeiyouren@qq.com"},"repository":{"url":"git+https://github.com/willin/afdian-sdk.git","type":"git"},"_npmVersion":"10.9.0","description":"爱发电 SDK for Node.js and Browser","directories":{},"_nodeVersion":"22.12.0","dependencies":{"crypto-js":"^4.2.0","isomorphic-unfetch":"^3.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.5.1","eslint":"^8.53.0","parcel":"^2.10.2","ts-jest":"^27.1.5","prettier":"^2.8.8","typescript":"^4.9.5","@types/jest":"^27.5.2","@types/node":"^20.9.0","@commitlint/cli":"^15.0.0","@types/crypto-js":"^4.2.1","@parcel/packager-ts":"^2.10.2","@willin/eslint-config":"^0.0.6","conventional-changelog-cli":"^2.2.2","@commitlint/config-conventional":"^15.0.0","@parcel/transformer-typescript-types":"^2.10.2"},"_npmOperationalInternal":{"tmp":"tmp/afdian_1.0.3_1742119875795_0.0027847672816256885","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@cao-mei-you-ren/afdian","version":"1.0.4","keywords":["afdian","sdk","爱发电"],"author":{"url":"https://willin.wang/","name":"Willin Wang","email":"willin@willin.org"},"license":"Apache-2.0","_id":"@cao-mei-you-ren/afdian@1.0.4","maintainers":[{"name":"cao-mei-you-ren","email":"caomeiyouren@qq.com"}],"homepage":"https://github.com/willin/afdian-sdk#readme","bugs":{"url":"https://github.com/willin/afdian-sdk/issues"},"dist":{"shasum":"7f48cdc670752c0897abab36455f3a2a27837013","tarball":"https://registry.npmjs.org/@cao-mei-you-ren/afdian/-/afdian-1.0.4.tgz","fileCount":26,"integrity":"sha512-YQZ1wnxWaRVDwuIn+GPxQmk/A0X46nU+cz14XzDBqqVM1nagdx7XZnrjTEr314HhIB6+2FYLHgf8tqywGbXugA==","signatures":[{"sig":"MEYCIQC00juaaaf80meL+4xY8RbI92n7xdBxONyeMDHZyexOxwIhANRdp6BtIyTcfzIG4XYG6Z0n/HZGetP6opVMyxk11rgf","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56740},"main":"dist/index.cjs","types":"dist/types.d.ts","module":"dist/index.mjs","source":"src/index.ts","gitHead":"3390aa0c233b14e1fcaf9cd645cc3ec1d91167b9","scripts":{"test":"jest --coverage","build":"tsup","watch":"tsup --watch","version":"conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"},"_npmUser":{"name":"cao-mei-you-ren","email":"caomeiyouren@qq.com"},"repository":{"url":"git+https://github.com/willin/afdian-sdk.git","type":"git"},"_npmVersion":"10.9.0","description":"爱发电 SDK for Node.js and Browser","directories":{},"_nodeVersion":"22.12.0","dependencies":{"crypto-js":"^4.2.0","isomorphic-unfetch":"^3.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.5.1","tsup":"^8.4.0","eslint":"^8.53.0","parcel":"^2.10.2","ts-jest":"^27.1.5","prettier":"^2.8.8","typescript":"^4.9.5","@types/jest":"^27.5.2","@types/node":"^20.9.0","@commitlint/cli":"^15.0.0","@types/crypto-js":"^4.2.1","@parcel/packager-ts":"^2.10.2","@willin/eslint-config":"^0.0.6","conventional-changelog-cli":"^2.2.2","@commitlint/config-conventional":"^15.0.0","@parcel/transformer-typescript-types":"^2.10.2"},"_npmOperationalInternal":{"tmp":"tmp/afdian_1.0.4_1745223294994_0.718333287191943","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@cao-mei-you-ren/afdian","version":"1.0.5","description":"爱发电 SDK for Node.js and Browser","source":"src/index.ts","main":"dist/index.cjs","module":"dist/index.mjs","types":"dist/index.d.ts","scripts":{"watch":"tsup --watch","build":"tsup","test":"jest --coverage","version":"conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"},"dependencies":{"crypto-js":"^4.2.0","isomorphic-unfetch":"^3.1.0"},"devDependencies":{"@commitlint/cli":"^15.0.0","@commitlint/config-conventional":"^15.0.0","@parcel/packager-ts":"^2.10.2","@parcel/transformer-typescript-types":"^2.10.2","@types/crypto-js":"^4.2.1","@types/jest":"^27.5.2","@types/node":"^20.9.0","@willin/eslint-config":"^0.0.6","conventional-changelog-cli":"^2.2.2","eslint":"^8.53.0","jest":"^27.5.1","parcel":"^2.10.2","prettier":"^2.8.8","ts-jest":"^27.1.5","tsup":"^8.4.0","typescript":"^4.9.5"},"repository":{"type":"git","url":"git+https://github.com/willin/afdian-sdk.git"},"keywords":["afdian","sdk","爱发电"],"author":{"name":"Willin Wang","email":"willin@willin.org","url":"https://willin.wang/"},"license":"Apache-2.0","bugs":{"url":"https://github.com/willin/afdian-sdk/issues"},"homepage":"https://github.com/willin/afdian-sdk#readme","publishConfig":{"access":"public"},"_id":"@cao-mei-you-ren/afdian@1.0.5","gitHead":"ac196e6501488e753e4b34acca47f57dcc42f3db","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-5C+N0mZUVKf7t8uH5HdF59nRjePRbvjgUsIguGMpMWkl5zcODxz4TpCQUw1Apr0g9Oqc0u9pZ9KzyCx8AKpgwQ==","shasum":"084a1ce1a948659d32f867ffe65642f3d6b66a54","tarball":"https://registry.npmjs.org/@cao-mei-you-ren/afdian/-/afdian-1.0.5.tgz","fileCount":26,"unpackedSize":56997,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDBDkhaW3u2adGISiIm7/5RIRJxh6mse+ZCFfZsgG8xDwIhAPYX9STBuDQjkJ2mf6DG7nsHOuUt1qLmFi3iGK3kiFdt"}]},"_npmUser":{"name":"cao-mei-you-ren","email":"caomeiyouren@qq.com"},"directories":{},"maintainers":[{"name":"cao-mei-you-ren","email":"caomeiyouren@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/afdian_1.0.5_1745223852474_0.9475510316697426"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-16T09:26:23.673Z","modified":"2025-04-21T08:24:12.845Z","1.0.2":"2025-03-16T09:26:23.956Z","1.0.3":"2025-03-16T10:11:16.136Z","1.0.4":"2025-04-21T08:14:55.156Z","1.0.5":"2025-04-21T08:24:12.653Z"},"bugs":{"url":"https://github.com/willin/afdian-sdk/issues"},"author":{"name":"Willin Wang","email":"willin@willin.org","url":"https://willin.wang/"},"license":"Apache-2.0","homepage":"https://github.com/willin/afdian-sdk#readme","keywords":["afdian","sdk","爱发电"],"repository":{"type":"git","url":"git+https://github.com/willin/afdian-sdk.git"},"description":"爱发电 SDK for Node.js and Browser","maintainers":[{"name":"cao-mei-you-ren","email":"caomeiyouren@qq.com"}],"readme":"# afdian - 爱发电 SDK for Node.js & Browser\n\n[![GitHub followers](https://img.shields.io/github/followers/willin?logo=github&style=flat-square&label=)](https://github.com/willin) [![npm](https://img.shields.io/npm/v/afdian?style=flat-square&logo=npm)](https://npmjs.org/package/afdian) [![npm](https://img.shields.io/npm/dm/afdian?style=flat-square&label=down)](https://npmjs.org/package/afdian) [![npm](https://img.shields.io/npm/dt/afdian?style=flat-square&label=down)](https://npmjs.org/package/v0) [![Travis (.com)](https://img.shields.io/travis/com/willin/afdian-sdk?style=flat-square&logo=travis&label=ci)](https://app.travis-ci.com/willin/afdian-sdk) [![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/willin/afdian-sdk?style=flat-square&logo=codeclimate&label=rank)](https://codeclimate.com/github/willin/afdian-sdk/maintainability) [![Code Climate coverage](https://img.shields.io/codeclimate/coverage/willin/afdian-sdk?style=flat-square&label=cov)](https://codeclimate.com/github/willin/afdian-sdk/test_coverage)\n\n## 使用 Usage\n\n### 安装 Install\n\n```bash\nyarn add afdian\n# or\nnpm install --save afdian\n```\n\n### 引入 Import\n\n```js\nimport Afdian, { AfdianClientOptions, AfdianSponsorResponse, AfdianOrderResponse } from 'afdian';\n// 其中 { } 中 ts 类型可以不导入\n// Types in { } block can be ignored\n\nconst afdian = new Afdian({\n  userId: 'xxxx',\n  token: 'xxxx'\n});\n// Ref: https://afdian.net/dashboard/dev\n\nconst res = await afdian.ping();\n// {\n//   ec: 200,\n//   em: 'pong',\n//   data: { }\n// }\n\n// 查询订单\nconst res = await afdian.queryOrder(1);\n// {\n//   ec: 200,\n//   em: 'order',\n//   data: {\n//     list: [],\n//     total_count: 0,\n//     total_page: 0\n//   }\n// }\n\n// 查询赞助者\nconst res = await afdian.querySponsor(1);\n// {\n//   ec: 200,\n//   em: 'sponsor',\n//   data: {\n//     list: [],\n//     total_count: 0,\n//     total_page: 0\n//   }\n// }\n\n// 订单 Webhook 回调\nconst res = await afdian.webhookOrder(context);\n// {\n//   \"ec\": 200,\n//   \"em\": \"ok\",\n//   \"data\": {\n//     \"type\": \"order\",\n//     \"order\": {\n//       \"out_trade_no\": \"202106232138371083454010626\",\n//       \"user_id\": \"adf397fe8374811eaacee52540025c377\",\n//       \"plan_id\": \"a45353328af911eb973052540025c377\",\n//       \"month\": 1,\n//       \"total_amount\": \"5.00\",\n//       \"show_amount\": \"5.00\",\n//       \"status\": 2,\n//       \"remark\": \"\",\n//       \"redeem_id\": \"\",\n//       \"product_type\": 0,\n//       \"discount\": \"0.00\",\n//       \"sku_detail\": [],\n//       \"address_person\": \"\",\n//       \"address_phone\": \"\",\n//       \"address_address\": \"\"\n//     }\n//   }\n// }\n```\n\n## License\n\nApache 2.0\n\n捐赠 / Donate: <https://afdian.net/@willin>\n","readmeFilename":"README.md"}