{"id":15020857,"url":"https://github.com/nailyjs/nest-tencentcloud","last_synced_at":"2026-02-28T18:02:39.863Z","repository":{"id":219143938,"uuid":"748266564","full_name":"nailyjs/nest-tencentcloud","owner":"nailyjs","description":"☁️ nest.js版腾讯云SDK Tencent cloud SDK for nest.js","archived":false,"fork":false,"pushed_at":"2024-01-26T19:12:59.000Z","size":459,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"v1","last_synced_at":"2025-02-04T15:04:44.094Z","etag":null,"topics":["nest","nestjs","nestjs-module","tencent","tencent-cloud"],"latest_commit_sha":null,"homepage":"https://github.com/nailyjs/nest-tencentcloud","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/nailyjs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-25T16:12:21.000Z","updated_at":"2024-01-25T18:27:58.000Z","dependencies_parsed_at":"2024-01-25T18:25:25.782Z","dependency_job_id":"f9ee73db-afa2-4028-b11c-14fbae2e4bed","html_url":"https://github.com/nailyjs/nest-tencentcloud","commit_stats":{"total_commits":15,"total_committers":2,"mean_commits":7.5,"dds":0.1333333333333333,"last_synced_commit":"9d989efe7f1549020c6e62191c91cf64a9e6eaab"},"previous_names":["nailyjs/nest-tencentcloud"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nailyjs%2Fnest-tencentcloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nailyjs%2Fnest-tencentcloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nailyjs%2Fnest-tencentcloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nailyjs%2Fnest-tencentcloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nailyjs","download_url":"https://codeload.github.com/nailyjs/nest-tencentcloud/tar.gz/refs/heads/v1","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240271520,"owners_count":19774859,"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":["nest","nestjs","nestjs-module","tencent","tencent-cloud"],"created_at":"2024-09-24T19:55:46.244Z","updated_at":"2026-02-28T18:02:39.813Z","avatar_url":"https://github.com/nailyjs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nest.js 版 Tencent Cloud Node SDK ☁️\n\n中文 | [English](./README_EN.md)\n\n[官方Node.js SDK](https://github.com/TencentCloud/tencentcloud-sdk-nodejs)\n\n本SDK为官方Node.js SDK的nest.js版封装，提供了在nest中的更加简单的使用方式。\n\n## 安装 📦\n\n`npm`、`yarn`、`pnpm` 都支持，推荐使用 `pnpm`。\n\n```bash\n$ pnpm i --save @nailyjs.nest.modules/tencentcloud tencentcloud-sdk-nodejs\n```\n\n## 使用 👋\n\n### 导入模块 🧩\n\n首先，先导入模块并配置。建议在根模块中导入。\n\n#### 正常用法 🚀\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { sms } from 'tencentcloud-sdk-nodejs';\nimport { TencentCloudModule } from '@nailyjs.nest.modules/tencentcloud';\n\n@Module({\n  imports: [\n    TencentCloudModule.registerAsync({\n      // 如果你想在所有模块中使用这个客户端，你可以设置global为true。\n      global: true,\n      clients: [\n        {\n          // 你可以在这里注入其他Injectable，例如ConfigService。\n          inject: [ConfigService],\n          // 然后useFactory方法中的参数就是你注入的对象。\n          useFactory: async (configService: ConfigService) =\u003e {\n            // 返回腾讯云配置对象，👆和上面的正常的用法一样。\n            return {\n              credential: {\n                secretId: 'Hello',\n                secretKey: 'world',\n              },\n            };\n          },\n        },\n      ],\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\n#### 异步用法 🚀\n\n你也可以使用异步配置。换成`registerAsync` + `useFactory`方法即可。\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { sms } from 'tencentcloud-sdk-nodejs';\nimport { TencentCloudModule } from '@nailyjs.nest.modules/tencentcloud';\n\n@Module({\n  imports: [\n    TencentCloudModule.registerAsync({\n      // 你可以在这里注入配置对象，例如ConfigService。\n      inject: [ConfigService],\n      useFactory: async (configService: ConfigService) =\u003e {\n        // 返回腾讯云配置对象，和上面的正常的用法一样。\n        return {\n          clients: [\n            {\n              client: sms.v20210111.Client,\n              options: {\n                credential: {\n                  secretId: '',\n                  secretKey: '',\n                },\n              },\n            },\n          ],\n          global: true,\n        };\n      },\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\n### 如何使用Client类 📝\n\n```typescript\nimport { ClientRepository } from '@nailyjs.nest.modules/tencentcloud';\nimport { Injectable, Inject } from '@nestjs/common';\nimport { sms } from 'tencentcloud-sdk-nodejs';\n\n@Injectable()\nexport class AppController {\n  constructor(\n    // 可以在这此注入腾讯云Client。例如，你想使用腾讯云的sms客户端，你可以这样做：\n    @Inject(sms.v20210111.Client)\n    private readonly client: ClientRepository\u003ctypeof sms.v20210111.Client\u003e;\n  ) {}\n\n  public async sendSms() {\n    // 像正常的服务一样使用sms客户端。类型仍然是保持安全的！\n    const response = await this.client.SendSms({\n      SmsSdkAppId: '',\n      TemplateId: '',\n      PhoneNumberSet: ['110'],\n    });\n  }\n}\n```\n\n\u003e ClientRepository 是一个泛型类型，你可以使用它来获取Client类们的类型。\n\n## 作者 👨‍💻\n\n###### **Zero**\n\n- QQ：1203970284\n- Gtihub: [跳转](https://groupguanfang/groupguanfang)\n\n## ☕️ 捐赠 ☕️\n\n如果你觉得这个项目对你有帮助，你可以请我喝杯咖啡QWQ~\n\n![wechat](./screenshots/wechat.jpg)\n![alipay](./screenshots/alipay.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnailyjs%2Fnest-tencentcloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnailyjs%2Fnest-tencentcloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnailyjs%2Fnest-tencentcloud/lists"}