Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fraybabak/kavenegar_nest
https://github.com/fraybabak/kavenegar_nest
kavenegar nestjs
Last synced: about 7 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/fraybabak/kavenegar_nest
- Owner: fraybabak
- License: mit
- Created: 2021-10-03T18:42:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-03T20:08:15.000Z (over 3 years ago)
- Last Synced: 2025-01-16T09:01:39.146Z (1 day ago)
- Topics: kavenegar, nestjs
- Language: TypeScript
- Homepage:
- Size: 118 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kavenegar nest module
kavenegar api in nestjs code style.
## Installation:
``` npm i @fraybabak/kavenegar_nest ```
## Usage:
Import **kavenegarModule** inside your module:
```
// inside SmsModule*.module.tsimport { KavenegarModule } from "@fraybabak/kavenegar_nest"
@Module({
imports:[
KavenegarModule.forRoot({
apikey:"your kavenegar apiKey"
})
],
controllers: [SmsController],
providers: [SmsService]
})
export class SmsModule {}
```Inject **KavenegarService** into your service:
```
// inside SmsService*.service.tsimport { KavenegarService } from "@fraybabak/kavenegar_nest";
// example message types based on http://kavenegar.com/rest.html
export interface sendMessage {
message: string;
sender: string;
receptor: string;
}
export interface verifyLookUpMessage {
template: string;
token: string;
receptor: string;
}@Injectable()
export class SmsService {
constructor(private readonly sender: KavenegarService) {}
sendMessage(data: sendMessage ){
return this.sender.Send(data)
}
verifyLookUp(data: verifyLookUpMessage ){
return this.sender.verifyLookUp(data)
}
}
```all of the methods are promised.