{"id":26473022,"url":"https://github.com/unicreators/extend-api","last_synced_at":"2026-05-16T23:14:09.679Z","repository":{"id":57232005,"uuid":"103241362","full_name":"unicreators/extend-api","owner":"unicreators","description":"extend api.","archived":false,"fork":false,"pushed_at":"2017-09-13T03:29:18.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-28T16:47:18.291Z","etag":null,"topics":["api","extend","web-api"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unicreators.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-12T08:05:57.000Z","updated_at":"2017-09-12T08:06:53.000Z","dependencies_parsed_at":"2022-08-31T14:11:44.195Z","dependency_job_id":null,"html_url":"https://github.com/unicreators/extend-api","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/unicreators%2Fextend-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicreators%2Fextend-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicreators%2Fextend-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicreators%2Fextend-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unicreators","download_url":"https://codeload.github.com/unicreators/extend-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244513916,"owners_count":20464601,"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":["api","extend","web-api"],"created_at":"2025-03-19T21:50:39.459Z","updated_at":"2026-05-16T23:14:04.637Z","avatar_url":"https://github.com/unicreators.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## extend-api\n\nextend api.\n\n\n## Install\n\n```sh\n$ npm install extend-api\n```\n\n\n## Usage\n\n### Custom api\n\n\n```js\n\nconst { Api, ApiExtend } = require('extend-api');\n\nlet CustomApi = class customApi extends Api {\n    constructor(token) { super(); this.token = token; }\n    // override\n    async buildApiReqOpts(extendInvokeOpts) {\n        // attach 'token'\n        extendInvokeOpts.qs = Object.assign({ token: this.token }, extendInvokeOpts.qs);\n        return extendInvokeOpts;\n    }\n};\n\n\n```\n\n\n### Custom extend\n\n\n```js\n\n\nlet MessageExtend = class MessageExtend extends ApiExtend {\n    async send(to, content) {\n        return await this.invoke(\n            'https://api.weixin.qq.com/cgi-bin/message/custom/send',\n            // request opts.   \n            // (see: https://github.com/request/request#requestoptions-callback)\n            {\n                body: {\n                    touser: to, msgtype: 'text',\n                    text: { content }\n                }\n            }, 'POST');\n    }\n};\n\n\n```\n\n\n### Register extend\n\n\n```js\n\n\nlet api = new CustomApi('token..');\n\n\n// register\napi.extend('message', MessageExtend);\n\n\n```\n\n\n\n### Use\n\n\n```js\n\n\napi.message.send('to', 'content')\n    .then(function (result) {\n        // ..\n    }).catch(function (err) {\n        // ..\n    });\n\n    \n// or\n// await api.message.send('openId', 'content');\n\n\n```\n\n\n\n\n\n\n### License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funicreators%2Fextend-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funicreators%2Fextend-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funicreators%2Fextend-api/lists"}