# client-attachments-node

> Node.js / ES2017 client sdk for service-attachments microservice

Latest version **1.1.0** (published 2022-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install client-attachments-node
pnpm add client-attachments-node
yarn add client-attachments-node
bun add client-attachments-node
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-12-21 |
| First published | 2022-05-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14.0.0 |
| Dependencies | 5 |
| Unpacked size | 102.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Conceptual Vision Consulting LLC |
| Maintainers | pipdeveloper |
| Keywords | pip.services, attachments, microservice, client, sdk |

## Links

- npm: https://www.npmjs.com/package/client-attachments-node
- Repository: https://github.com/pip-services-content2/client-attachments-node
- Homepage: https://github.com/pip-services-content2/client-attachments-node#readme
- Issues: https://github.com/pip-services-content2/client-attachments-node/issues
- npm.io page: https://npm.io/package/client-attachments-node

## Dependencies (5)

- [pip-services3-aws-nodex](https://npm.io/package/pip-services3-aws-nodex.md) ^1.1.*
- [pip-services3-rpc-nodex](https://npm.io/package/pip-services3-rpc-nodex.md) ^1.2.*
- [service-attachments-node](https://npm.io/package/service-attachments-node.md) ^1.0.*
- [pip-services3-commons-nodex](https://npm.io/package/pip-services3-commons-nodex.md) ^1.0.*
- [pip-services3-components-nodex](https://npm.io/package/pip-services3-components-nodex.md) ^1.4.*

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2022-12-21
- 1.0.0 — 2022-05-12

## README

# Attachments Microservice Client SDK for Node.js / ES2017

This is a Node.js client SDK for [service-attachments](https://github.com/pip-services-content2/service-attachments-node) microservice.
It provides an easy to use abstraction over communication protocols:

* HTTP/REST client
* Seneca client (see http://www.senecajs.org)
* Direct client for monolythic deployments
* Null client to be used in testing

<a name="links"></a> Quick Links:

* [Development Guide](doc/Development.md)
* [API Version 1](doc/NodeClientApiV1.md)

## Install

Add dependency to the client SDK into **package.json** file of your project
```javascript
{
    ...
    "dependencies": {
        ....
        "client-attachments-node": "^1.0.*",
        ...
    }
}
```

Then install the dependency using **npm** tool
```bash
# Install new dependencies
npm install

# Update already installed dependencies
npm update
```

## Use

Inside your code get the reference to the client SDK
```javascript
var sdk = new require('client-attachments-node');
```

Define client configuration parameters that match configuration of the microservice external API
```javascript
// Client configuration
var config = {
    connection: {
        protocol: 'http',
        host: 'localhost', 
        port: 8080
    }
};
```

Instantiate the client and open connection to the microservice
```javascript
// Create the client instance
var client = sdk.AttachmentsHttpClientV1(config);

// Connect to the microservice
try {
    await client.open(null);
    // Work with the microservice
    ...
} catch(err) {
    console.error('Connection to the microservice failed');
    console.error(err);
}
```

Now the client is ready to perform operations
```javascript
// Add attachments to a document
let attachments = await client.addAttachments(
    null,
    { 
        id: '123',
        type: 'document',
        name: 'My document'
    },
    ['1', '2', '3']
);
```

```javascript
var now = new Date();

// Get specific attachment
let attachment = await client.getAttachmentById(
    null,
    '1'
);
```    

## Acknowledgements

This client SDK was created and currently maintained by *Sergey Seroukhov*.

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