# @aws-sdk/client-sqs-node

> Node SDK for Amazon Simple Queue Service

Latest version **0.1.0-preview.2** (published 2019-01-25) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @aws-sdk/client-sqs-node
pnpm add @aws-sdk/client-sqs-node
yarn add @aws-sdk/client-sqs-node
bun add @aws-sdk/client-sqs-node
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.0-preview.2 |
| Published | 2019-01-25 |
| First published | 2019-01-25 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 25 |
| Unpacked size | 390.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | AWS SDK for JavaScript Team |
| Maintainers | aws-sdk-bot, zheallan, cjradek, jpeddicord, amzn-oss |

## Links

- npm: https://www.npmjs.com/package/@aws-sdk/client-sqs-node
- npm.io page: https://npm.io/package/@aws-sdk/client-sqs-node

## Dependencies (25)

- [tslib](https://npm.io/package/tslib.md) ^1.8.0
- [@aws-sdk/types](https://npm.io/package/@aws-sdk/types.md) ^0.1.0-preview.1
- [@aws-sdk/hash-node](https://npm.io/package/@aws-sdk/hash-node.md) ^0.1.0-preview.1
- [@aws-sdk/core-handler](https://npm.io/package/@aws-sdk/core-handler.md) ^0.1.0-preview.1
- [@aws-sdk/signature-v4](https://npm.io/package/@aws-sdk/signature-v4.md) ^0.1.0-preview.2
- [@aws-sdk/query-builder](https://npm.io/package/@aws-sdk/query-builder.md) ^0.1.0-preview.1
- [@aws-sdk/protocol-query](https://npm.io/package/@aws-sdk/protocol-query.md) ^0.1.0-preview.2
- [@aws-sdk/util-utf8-node](https://npm.io/package/@aws-sdk/util-utf8-node.md) ^0.1.0-preview.1
- [@aws-sdk/config-resolver](https://npm.io/package/@aws-sdk/config-resolver.md) ^0.1.0-preview.1
- [@aws-sdk/region-provider](https://npm.io/package/@aws-sdk/region-provider.md) ^0.1.0-preview.1
- [@aws-sdk/url-parser-node](https://npm.io/package/@aws-sdk/url-parser-node.md) ^0.1.0-preview.1
- [@aws-sdk/xml-body-parser](https://npm.io/package/@aws-sdk/xml-body-parser.md) ^0.1.0-preview.2
- [@aws-sdk/middleware-stack](https://npm.io/package/@aws-sdk/middleware-stack.md) ^0.1.0-preview.2
- [@aws-sdk/retry-middleware](https://npm.io/package/@aws-sdk/retry-middleware.md) ^0.1.0-preview.1
- [@aws-sdk/util-base64-node](https://npm.io/package/@aws-sdk/util-base64-node.md) ^0.1.0-preview.1
- [@aws-sdk/node-http-handler](https://npm.io/package/@aws-sdk/node-http-handler.md) ^0.1.0-preview.2
- [@aws-sdk/signing-middleware](https://npm.io/package/@aws-sdk/signing-middleware.md) ^0.1.0-preview.2
- [@aws-sdk/util-user-agent-node](https://npm.io/package/@aws-sdk/util-user-agent-node.md) ^0.1.0-preview.2
- [@aws-sdk/middleware-serializer](https://npm.io/package/@aws-sdk/middleware-serializer.md) ^0.1.0-preview.1
- [@aws-sdk/stream-collector-node](https://npm.io/package/@aws-sdk/stream-collector-node.md) ^0.1.0-preview.1
- [@aws-sdk/util-body-length-node](https://npm.io/package/@aws-sdk/util-body-length-node.md) ^0.1.0-preview.2
- [@aws-sdk/credential-provider-node](https://npm.io/package/@aws-sdk/credential-provider-node.md) ^0.1.0-preview.2
- [@aws-sdk/query-error-unmarshaller](https://npm.io/package/@aws-sdk/query-error-unmarshaller.md) ^0.1.0-preview.2
- [@aws-sdk/middleware-content-length](https://npm.io/package/@aws-sdk/middleware-content-length.md) ^0.1.0-preview.1
- [@aws-sdk/middleware-header-default](https://npm.io/package/@aws-sdk/middleware-header-default.md) ^0.1.0-preview.1

## Recent versions

- 0.1.0-preview.2 (latest) — 2019-01-25
- 0.1.0-preview.11 (preview) — 2019-11-19
- 0.1.0-preview.10 — 2019-10-30
- 0.1.0-preview.9 — 2019-10-29
- 0.1.0-preview.8 — 2019-09-19
- 0.1.0-preview.7 — 2019-09-09
- 0.1.0-preview.6 — 2019-07-12
- 0.1.0-preview.5 — 2019-04-19
- 0.1.0-preview.4 — 2019-03-27
- 0.1.0-preview.3 — 2019-02-13

## README

# @aws-sdk/client-sqs-node

## Description

<p>Welcome to the <i>Amazon Simple Queue Service API Reference</i>.</p> <p>Amazon Simple Queue Service (Amazon SQS) is a reliable, highly-scalable hosted queue for storing messages as they travel between applications or microservices. Amazon SQS moves data between distributed application components and helps you decouple these components.</p> <note> <p> <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/standard-queues.html">Standard queues</a> are available in all regions. <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html">FIFO queues</a> are available in the US East (N. Virginia), US East (Ohio), US West (Oregon), and EU (Ireland) regions.</p> </note> <p>You can use <a href="http://aws.amazon.com/tools/#sdk">AWS SDKs</a> to access Amazon SQS using your favorite programming language. The SDKs perform tasks such as the following automatically:</p> <ul> <li> <p>Cryptographically sign your service requests</p> </li> <li> <p>Retry requests</p> </li> <li> <p>Handle error responses</p> </li> </ul> <p> <b>Additional Information</b> </p> <ul> <li> <p> <a href="http://aws.amazon.com/sqs/">Amazon SQS Product Page</a> </p> </li> <li> <p> <i>Amazon Simple Queue Service Developer Guide</i> </p> <ul> <li> <p> <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-making-api-requests.html">Making API Requests</a> </p> </li> <li> <p> <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html">Amazon SQS Message Attributes</a> </p> </li> <li> <p> <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html">Amazon SQS Dead-Letter Queues</a> </p> </li> </ul> </li> <li> <p> <a href="http://docs.aws.amazon.com/cli/latest/reference/sqs/index.html">Amazon SQS in the <i>AWS CLI Command Reference</i> </a> </p> </li> <li> <p> <i>Amazon Web Services General Reference</i> </p> <ul> <li> <p> <a href="http://docs.aws.amazon.com/general/latest/gr/rande.html#sqs_region">Regions and Endpoints</a> </p> </li> </ul> </li> </ul>

## Installing

To install the this package using NPM, simply type the following into a terminal window: 

```
npm install @aws-sdk/client-sqs-node
```

## Getting Started

### Import

The AWS SDK is modulized by clients and commends in CommonJS modules. To send a request, you only need to import the client(`SQSClient`) and the commands you need, for example `AddPermissionCommand`:

```javascript
//javascript
const { SQSClient } = require('@aws-sdk/client-sqs-node/SQSClient');
const { AddPermissionCommand } = require('@aws-sdk/client-sqs-node/AddPermissionCommand');
```

```javascript
//typescript
const { SQSClient } = import '@aws-sdk/client-sqs-node/SQSClient';
const { AddPermissionCommand } = import '@aws-sdk/client-sqs-node/commands/AddPermissionCommand';
```

### Usage

To send a request, you:

* Initiate client with configurations.(credentials, region). For more information you can refer to the [API reference][].
* Initiate command with input parameters.
* Call `send` operation of client with command object as input.
* If you are using a custom http handler, you may call `destroy()` to close open connections. 

```javascript
const sQS = new SQSClient({region: 'region'});
//clients can be shared by different commands
const params = {
    QueueUrl: /**a string value*/,
    Label: /**a string value*/,
    AWSAccountIds: [ /**a list of string*/ ],
    Actions: [ /**a list of string*/ ],
};
const addPermissionCommand = new AddPermissionCommand(params);
sQS.send(addPermissionCommand).then(data => {
    // do something
}).catch(error => {
    // error handling
})
```

Besides using promise style, there are 2 other ways to send a request:

```javascript
// async/await
try {
    const data = await sQS.send(addPermissionCommand);
    // do something
} catch(error) {
    // error handling
}
```

```javascript
// callback
sQS.send(addPermissionCommand, (err, data) => {
    //do something
})
```
 
Besides using `send()`, the SDK can also send requests using the simplified callback style in version 2 of the SDK.

```javascript
import * as AWS from '@aws-sdk/@aws-sdk/client-sqs-node/SQS';
const sQS = new AWS.SQS({region: 'region'})
sQS.addPermission(params, (err, data) => {
    //do something
})

```

### Troubleshooting 

When the service returns an exception, inpecting the exceptions is always helpful. You can not only access the exception information but also response metadata(i.e request id).

```javascript
try {
    const data = await sQS.send(addPermissionCommand);
    // do something
} catch(error) {
    const metadata = error.$metadata;
    console.log(
`requestId: ${metadata.requestId}
cfId: ${metadata.cfId}
extendedRequestId: ${metadata.extendedRequestId}`
    );
/*
The keys within exceptions are also parsed, you can access them by specifying exception names like below:
    if(error.name === 'SomeServiceException') {
        const value = error.specialKeyInException;
    }
*/
}
```

## Getting Help

Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them.

 * Ask a question on [StackOverflow](https://stackoverflow.com/) and tag it with `aws-sdk-js`
 * Come join the AWS JavaScript community on [gitter](https://gitter.im/aws/aws-sdk-js-v3)
 * If it turns out that you may have found a bug, please [open an issue](https://github.com/aws/aws-sdk-js-v3/issues)

## Contributing
 
This client code is generated automatically. Any modifications will be overwritten the next time the `@aws-sdk/@aws-sdk/client-sqs-node' package is updated. To contribute to SDK you can checkout our [code generator package][].

## License

This SDK is distributed under the
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0),
see LICENSE for more information.

[code generator package]: https://github.com/aws/aws-sdk-js-v3/tree/master/packages/service-types-generator

[API reference]: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/

---
_Source: https://npm.io/package/@aws-sdk/client-sqs-node · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
