Skip to content

Commit

Permalink
添加index.d.ts文件 支持typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryhu committed Dec 24, 2020
1 parent 31a1405 commit 032177d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
41 changes: 41 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import Client = require('@alicloud/mns/lib/client');

interface MNSClientResponse {
code: any;
headers: {};
body: any;
}

interface MNSClient extends Client{
sendMessage(queueName: string, params: {}): Promise<MNSClientResponse>;
async batchSendMessage(queueName: string, params: {}): Promise<MNSClientResponse>;
receiveMessage(queueName: string, waitSeconds?: number): Promise<MNSClientResponse>;
async batchReceiveMessage(queueName: string, numOfMessages: number, waitSeconds?: number): Promise<MNSClientResponse>;
peekMessage(queueName: string): Promise<MNSClientResponse>;
async batchPeekMessage(queueName: string, numOfMessages: number): Promise<MNSClientResponse>;
deleteMessage(queueName: string, receiptHandle: string): Promise<MNSClientResponse>;
async batchDeleteMessage(queueName: string, receiptHandles: Array<string>): Promise<MNSClientResponse>;
}

interface EggAlicloudMNSOptions {
client: {
accountId: string,
accessKeyId: string,
secretAccessKey: string,
region: string,
secure: boolean,
internal: boolean,
vpc: boolean,
},
}


declare module 'egg' {
interface Application {
alicloudMns: MNSClient & Singleton<MNSClient>;
}

interface EggAppConfig {
alicloudMns: EggAlicloudMNSOptions;
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "egg-alicloud-mns",
"version": "1.0.4",
"version": "1.1.0",
"description": "Alicloud MNS plugin for egg",
"eggPlugin": {
"name": "alicloudMns"
Expand Down

0 comments on commit 032177d

Please sign in to comment.