Skip to content

docs(client-sns): updated sns client readme v3 sample #3821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions clients/client-sns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ using your favorite package manager:

The AWS SDK is modulized by clients and commands.
To send a request, you only need to import the `SNSClient` and
the commands you need, for example `AddPermissionCommand`:
the commands you need, for example `PublishCommand`:

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

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

### Usage
Expand All @@ -62,12 +62,18 @@ To send a request, you:

```js
// a client can be shared by different commands.
const client = new SNSClient({ region: "REGION" });
const client = new SNSClient({ region: "<YOUR_REGION>" });

const message = {
hello":"world"
}

const params = {
/** input parameters */
Message: JSON.stringify(message),
TopicArn: 'arn:aws:sns:<YOUR_REGION>:<YOUR_ACCOUNT_ID>:<YOUR_TOPIC_NAME>'
};
const command = new AddPermissionCommand(params);

const command = new PublishCommand(params);
```

#### Async/await
Expand Down