# moar-rpc-client

> RPC Client for JSON/REST over http with AWS4 signatures

Latest version **1.0.4** (published 2018-09-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install moar-rpc-client
pnpm add moar-rpc-client
yarn add moar-rpc-client
bun add moar-rpc-client
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-09-05 |
| First published | 2018-08-31 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Mark Farnsworth |
| Maintainers | farnsworth |

## Links

- npm: https://www.npmjs.com/package/moar-rpc-client
- Repository: https://github.com/farnsworth2008/moar-rpc-client
- Homepage: https://github.com/farnsworth2008/moar-rpc-client#readme
- Issues: https://github.com/farnsworth2008/moar-rpc-client/issues
- npm.io page: https://npm.io/package/moar-rpc-client

## Dependencies (3)

- [aws4](https://npm.io/package/aws4.md) ^1.8.0
- [request](https://npm.io/package/request.md) ^2.88.0
- [farnsworth-attach](https://npm.io/package/farnsworth-attach.md) ^1.0.3

## Recent versions

- 1.0.4 (latest) — 2018-09-05
- 1.0.3 — 2018-09-05
- 1.0.2 — 2018-09-02
- 1.0.1 — 2018-08-31
- 1.0.0 — 2018-08-31

## README

## Classes

<dl>
<dt><a href="#Client">Client</a></dt>
<dd><p>Client for JSON/REST/RPC over http with AWS4 signatures</p>
</dd>
</dl>

## Typedefs

<dl>
<dt><a href="#CallResult">CallResult</a> : <code><a href="#CallResultArray">CallResultArray</a></code></dt>
<dd><p>Map of s for the associated calls</p>
</dd>
<dt><a href="#CallResultArray">CallResultArray</a></dt>
<dd></dd>
<dt><a href="#CallStructure">CallStructure</a> : <code><a href="#CallResultArray">CallResultArray</a></code></dt>
<dd><p>A structure with method names and their associated parameters.</p>
<p>Each result is an  for the associated call key.</p>
</dd>
</dl>

<a name="Client"></a>

## Client
Client for JSON/REST/RPC over http with AWS4 signatures

**Kind**: global class  

* [Client](#Client)
    * [new Client(host, keys)](#new_Client_new)
    * [.call(structures)](#Client+call) ⇒ [<code>CallResult</code>](#CallResult)

<a name="new_Client_new"></a>

### new Client(host, keys)
Create client for a host


| Param | Type | Description |
| --- | --- | --- |
| host | <code>string</code> | Host name |
| keys | <code>Credentials</code> | Optional credentials for AWS4 signing |

**Example**  
```js
const client = new Client('api.moarhealth.com')
client.call({
    greeting: "Mark"
    initialize: { "some": "stuff" }
}).then(results => {
     console.log(`Result for greeting was ${results.greeting}`)
     console.log(`Result for initialize was ${results.initialize}`)
})
```
<a name="Client+call"></a>

### client.call(structures) ⇒ [<code>CallResult</code>](#CallResult)
Call one or more methods

**Kind**: instance method of [<code>Client</code>](#Client)  
**Returns**: [<code>CallResult</code>](#CallResult) - A promise to produce  

| Param | Type | Description |
| --- | --- | --- |
| structures | [<code>CallStructure</code>](#CallStructure) | Structure for the calls the client will make. |

<a name="CallResult"></a>

## CallResult : [<code>CallResultArray</code>](#CallResultArray)
Map of s for the associated calls

**Kind**: global typedef  
<a name="CallResultArray"></a>

## CallResultArray
**Kind**: global typedef  
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| 0 | <code>object</code> | Error object |
| 1 | <code>object</code> | Data object |

<a name="CallStructure"></a>

## CallStructure : [<code>CallResultArray</code>](#CallResultArray)
A structure with method names and their associated parameters.

Each result is an  for the associated call key.

**Kind**: global typedef

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