Skip to content

Commit d80f175

Browse files
authored
docs(client-sns): updated sns client readme v3 sample (#3821)
* Updated SNS Client Readme - Changed from v3 sample from AddPermission to PublishCommand * Update README.md
1 parent df99fc3 commit d80f175

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

clients/client-sns/README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ using your favorite package manager:
3939

4040
The AWS SDK is modulized by clients and commands.
4141
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`:
4343

4444
```js
4545
// ES5 example
46-
const { SNSClient, AddPermissionCommand } = require("@aws-sdk/client-sns");
46+
const { SNSClient, PublishCommand } = require("@aws-sdk/client-sns");
4747
```
4848

4949
```ts
5050
// ES6+ example
51-
import { SNSClient, AddPermissionCommand } from "@aws-sdk/client-sns";
51+
import { SNSClient, PublishCommand } from "@aws-sdk/client-sns";
5252
```
5353

5454
### Usage
@@ -62,12 +62,18 @@ To send a request, you:
6262

6363
```js
6464
// 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+
}
6670
6771
const params = {
68-
/** input parameters */
72+
Message: JSON.stringify(message),
73+
TopicArn: 'arn:aws:sns:<YOUR_REGION>:<YOUR_ACCOUNT_ID>:<YOUR_TOPIC_NAME>'
6974
};
70-
const command = new AddPermissionCommand(params);
75+
76+
const command = new PublishCommand(params);
7177
```
7278
7379
#### Async/await

0 commit comments

Comments
 (0)