File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -39,16 +39,16 @@ using your favorite package manager:
39
39
40
40
The AWS SDK is modulized by clients and commands.
41
41
To send a request, you only need to import the ` SNSClient ` and
42
- the commands you need, for example ` AddPermissionCommand ` :
42
+ the commands you need, for example ` PublishCommand ` :
43
43
44
44
``` js
45
45
// ES5 example
46
- const { SNSClient , AddPermissionCommand } = require (" @aws-sdk/client-sns" );
46
+ const { SNSClient , PublishCommand } = require (" @aws-sdk/client-sns" );
47
47
```
48
48
49
49
``` ts
50
50
// ES6+ example
51
- import { SNSClient , AddPermissionCommand } from " @aws-sdk/client-sns" ;
51
+ import { SNSClient , PublishCommand } from " @aws-sdk/client-sns" ;
52
52
```
53
53
54
54
### Usage
@@ -62,12 +62,18 @@ To send a request, you:
62
62
63
63
``` js
64
64
// a client can be shared by different commands.
65
- const client = new SNSClient ({ region: " REGION" });
65
+ const client = new SNSClient ({ region: " <YOUR_REGION>" });
66
+
67
+ const message = {
68
+ hello" :" world"
69
+ }
66
70
67
71
const params = {
68
- /** input parameters */
72
+ Message: JSON.stringify(message),
73
+ TopicArn: 'arn:aws:sns:<YOUR_REGION>:<YOUR_ACCOUNT_ID>:<YOUR_TOPIC_NAME>'
69
74
};
70
- const command = new AddPermissionCommand (params);
75
+
76
+ const command = new PublishCommand(params);
71
77
```
72
78
73
79
#### Async/await
You can’t perform that action at this time.
0 commit comments