{"id":17118984,"url":"https://github.com/chyroc/v2ex-nodejs-sdk","last_synced_at":"2025-04-13T04:37:12.824Z","repository":{"id":43447639,"uuid":"459521405","full_name":"chyroc/v2ex-nodejs-sdk","owner":"chyroc","description":"NodeJS(TypeScript) SDK For V2EX(https://www.v2ex.com)","archived":false,"fork":false,"pushed_at":"2022-03-02T02:23:40.000Z","size":374,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-02T00:58:24.895Z","etag":null,"topics":["v2ex","v2ex-api"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@chyroc/v2ex-api","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chyroc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-15T10:00:37.000Z","updated_at":"2022-03-02T01:28:28.000Z","dependencies_parsed_at":"2022-08-20T18:10:53.682Z","dependency_job_id":null,"html_url":"https://github.com/chyroc/v2ex-nodejs-sdk","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chyroc%2Fv2ex-nodejs-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chyroc%2Fv2ex-nodejs-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chyroc%2Fv2ex-nodejs-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chyroc%2Fv2ex-nodejs-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chyroc","download_url":"https://codeload.github.com/chyroc/v2ex-nodejs-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665672,"owners_count":21142121,"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":["v2ex","v2ex-api"],"created_at":"2024-10-14T17:55:56.621Z","updated_at":"2025-04-13T04:37:12.800Z","avatar_url":"https://github.com/chyroc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# V2EX NodeJS SDK\n\nNodeJS(TypeScript) SDK For V2EX(https://www.v2ex.com)\n\n## Install\n\n```shell\nnpm i --save @chyroc/v2ex-api\n```\n\n### Usage\n\n#### New Client\n\n\u003e get token from https://www.v2ex.com/settings/tokens\n\n```node\nimport V2EX from \"@chyroc/v2ex-api\";\n\nconst token = process.env.V2EX_TOKEN || ''\nconst client = new V2EX({token, timeout: 10000})\n```\n\n#### Get Notifications\n\n```node\nconst getNotifications = async (client: V2EX) =\u003e {\n  const {notifications, total} = await client.getNotifications({page: 1})\n  console.log('notifications:', notifications)\n  console.log('total:', total)\n}\n```\n\n#### Delete Notification\n\n```node\nconst deleteNotification = async (client: V2EX) =\u003e {\n  await client.deleteNotification({notificationID: 1})\n}\n```\n\n#### Get Profile\n\n```node\nconst getProfile = async (client: V2EX) =\u003e {\n  const profile = await client.getProfile()\n  console.log('profile', profile)\n}\n```\n\n#### Get Token\n\n```node\nconst getToken = async (client: V2EX) =\u003e {\n  const token = await client.getToken()\n  console.log('token', token)\n}\n```\n\n#### Create Token\n\n```node\nconst createToken = async (client: V2EX) =\u003e {\n  const token = await client.createToken({\n    scope: TokenScope.everything,\n    expiration: TokenExpiration.D30,\n  })\n  console.log('token', token)\n}\n```\n\n#### Get Node\n\n```node\nconst getNode = async (client: V2EX) =\u003e {\n  const node = await client.getNode({nodeName: 'python'})\n  console.log('node', node)\n}\n```\n\n#### Get Topic By Node\n\n```node\nconst getTopicByNode = async (client: V2EX) =\u003e {\n  const topics = await client.getTopicByNode({nodeName: 'python', page: 2})\n  console.log('topics', topics)\n}\n```\n\n#### Get Topic\n\n```node\nconst getTopic = async (client: V2EX) =\u003e {\n  const topic = await client.getTopic({topicID: 1})\n  console.log('topic', topic)\n}\n```\n\n#### Get Topic Reply\n\n```node\nconst getTopicReply = async (client: V2EX) =\u003e {\n  const topicReply = await client.getTopicReply({topicID: 1, page: 2})\n  console.log('topicReply', topicReply)\n}\n```\n\n#### Get Plane\n\n```node\nconst getPlanes = async (client: V2EX) =\u003e {\n  const plane = await client.getPlanes()\n  console.log('plane', plane)\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchyroc%2Fv2ex-nodejs-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchyroc%2Fv2ex-nodejs-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchyroc%2Fv2ex-nodejs-sdk/lists"}