{"id":15046225,"url":"https://github.com/willin/yunpian-sdk","last_synced_at":"2025-10-26T13:31:01.949Z","repository":{"id":57404769,"uuid":"59492798","full_name":"willin/yunpian-sdk","owner":"willin","description":"Yunpian（云片API）Node.js SDK","archived":false,"fork":false,"pushed_at":"2016-07-07T02:09:04.000Z","size":9,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T22:37:33.067Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-23T15:13:28.000Z","updated_at":"2021-06-22T04:25:45.000Z","dependencies_parsed_at":"2022-09-26T17:01:36.309Z","dependency_job_id":null,"html_url":"https://github.com/willin/yunpian-sdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fyunpian-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fyunpian-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fyunpian-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fyunpian-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willin","download_url":"https://codeload.github.com/willin/yunpian-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238027889,"owners_count":19404575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T20:52:52.780Z","updated_at":"2025-10-26T13:31:01.617Z","avatar_url":"https://github.com/willin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YunPian SDK For Node.js\n\n[![npm](https://img.shields.io/npm/v/yunpian-sdk.svg?style=plastic)](https://npmjs.org/package/yunpian-sdk) [![npm](https://img.shields.io/npm/dm/yunpian-sdk.svg?style=plastic)](https://npmjs.org/package/yunpian-sdk) [![npm](https://img.shields.io/npm/dt/yunpian-sdk.svg?style=plastic)](https://npmjs.org/package/yunpian-sdk)\n\n云片注册地址： \u003chttps://www.yunpian.com/component/reg?inviteCode=atevkh\u003e\n\nMinimum, Flexible, Scalable.\n\n支持Lazy Require。\n\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**  *generated with [DocToc](https://github.com/thlorenz/doctoc)*\n\n- [安装和使用](#%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8)\n- [手机号合法性校验](#%E6%89%8B%E6%9C%BA%E5%8F%B7%E5%90%88%E6%B3%95%E6%80%A7%E6%A0%A1%E9%AA%8C)\n- [已支持的接口](#%E5%B7%B2%E6%94%AF%E6%8C%81%E7%9A%84%E6%8E%A5%E5%8F%A3)\n  - [USER - 账户API](#user---%E8%B4%A6%E6%88%B7api)\n  - [TPL - 模板API](#tpl---%E6%A8%A1%E6%9D%BFapi)\n  - [SMS - 短信API](#sms---%E7%9F%AD%E4%BF%A1api)\n  - [VOICE - 语音API](#voice---%E8%AF%AD%E9%9F%B3api)\n  - [FLOW - 流量API](#flow---%E6%B5%81%E9%87%8Fapi)\n- [License](#license)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n\n## 安装和使用\n\n国际惯例：\n\n```\nnpm install yunpian-sdk --save\n```\n\n公共参数：\n\n```js\nvar options = {\n  apikey: 'xxxxxxx'\n};\n```\n\nES7:\n\n```js\nimport {USER} from 'yunpian-sdk';\nconst user = new USER({\n  apikey: 'xxxx'\n});\n// Within Async Func\n(async() =\u003e {\n  const result = await user.set({\n    emergency_contact: 'Willin',\n    emergency_mobile: '1xxxxxxxxxx'\n  });\n  // xxxx\n});\n```\n\nES5:\n\n```js\nvar YUNPIAN = require('yunpian-sdk');\n// 加载全部方法\nvar user = new YUNPIAN.USER({\n  apikey: 'xxxx'\n});\n// 或加载某些方法\nvar user = new YUNPIAN.USER({\n  apikey: 'xxxx'\n}, ['get', 'set']);\n// 或加载某个方法\nvar user = new YUNPIAN.USER({\n  apikey: 'xxxx'\n}, 'get');\nuser.set({\n  emergency_contact: 'Willin',\n  emergency_mobile: '1xxxxxxxxxx'\n}).then(function(result){\n  // xxxx\n});\n```\n\n## 手机号合法性校验\n\nES7 示例代码：\n\n```js\nimport {phone} from 'yunpian-sdk';\n\n// 加区号匹配国际各国号码格式\nphone('+8613312345678'); // true\nphone('+85265698900'); // true\nphone('+112345678'); // false\n\n// 不加区号按中国号码匹配\nphone('13312341234'); // true\nphone('112345678'); // false\n\n// 按地区匹配\n// 地区码使用3位缩写国家代码（大写）\nphone('+18175698900', 'USA'); // true\nphone('13212345678', 'CHN'); // true\nphone('+18175698900', 'CHN'); // false\nphone('13212345678', 'HKG'); // false\n```\n\nES5 示例代码：\n\n```js\nvar phone = require('yunpian-sdk').phone;\n\nphone('+8613312345678'); // true\nphone('13312341234'); // true\nphone('13212345678', 'CHN'); // true\n```\n\n\n## 已支持的接口\n\n### USER - 账户API\n\nAPI文档参考： \u003chttps://www.yunpian.com/api2.0/user.html\u003e\n\n\nES7 示例：\n\n```js\nimport {USER} from 'yunpian-sdk';\n\nconst user = new USER({\n  apikey: 'xxxx'\n});\n\n(async() =\u003e {\n  const user = await user.get();\n  // xxxx\n\n  const result = await user.set({\n    emergency_contact: 'Willin',\n    emergency_mobile: '1xxxxxxxxxx'\n  });\n  // xxxx\n})();\n\n```\n\n### TPL - 模板API\n\nAPI文档参考： \u003chttps://www.yunpian.com/api2.0/tpl.html\u003e\n\n### SMS - 短信API\n\nAPI文档参考： \u003chttps://www.yunpian.com/api2.0/sms.html\u003e\n\nES7 示例：\n\n```js\nimport {SMS} from 'yunpian-sdk';\n\nconst sms = new SMS({\n  apikey: 'xxxx'\n});\n\n(async() =\u003e {\n  console.log(await sms.singleSend({\n    mobile: 'xxxx',\n    text: '【xxxx】您的验证码是：123456 （验证码10分钟内有效），请勿将验证码泄露给其他人。如非本人操作，请忽略本短信。'\n  }));\n})();\n\n```\n\n### VOICE - 语音API\n\nAPI文档参考： \u003chttps://www.yunpian.com/api2.0/voice.html\u003e\n\n### FLOW - 流量API\n\nAPI文档参考： \u003chttps://www.yunpian.com/api2.0/flow.html\u003e\n\n\n## License\n\nMIT\n\n通过支付宝捐赠：\n\n![qr](https://cloud.githubusercontent.com/assets/1890238/15489630/fccbb9cc-2193-11e6-9fed-b93c59d6ef37.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillin%2Fyunpian-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillin%2Fyunpian-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillin%2Fyunpian-sdk/lists"}