# <img src="./brand/logo.png" width="50"/> Hermes

_The herald of the POLITICO newsroom_

## Why This?

The AWS-SDK has a great set of tools for uploading and removing files form S3. Hermes is an opinionated library built on top of that to make publishing easier for those projects that follow our configurations.

## Basic Usage

Install the library

```
$ npm i @politico/hermes
```

Import and run in node script in your bin scripts.

```javascript
/* bin/publish.js */
import * as hermes from '@politico/hermes';

await hermes.publish(sourceDirectory, destinationKey, { ...options });
```

Run the bin script:

```
$ node bin/publish.js
```

## Advanced Usage (Clients)

Another major offer of hermes is our clients systems. Hermes offers the following clients:

```javascript
import * as hermes from '@politico/hermes';

const s3 = await hermes.clients.aws.s3();
await s3.upload({
  ...options,
});
```

Each client also comes with a `.client` property which allows access to the base client instance for custom calls.

### Client Offerings

Our client offerings are:

- AWS DynamoDB (`aws.ddb`)
  - batchGetDocuments
  - query
  - scan
  - Document Functions (`client.document.X`)
    - delete
    - get
    - getFromIndex
    - put
    - update
- AWS S3 (`aws.s3`)
  - copy
  - delete
  - download
  - etag
  - exists
  - head
  - list
  - upload
- AWS Secrets Manager (`aws.secrets`)
  - getJSONSecret
- AWS Systems Manager (Paramter Store) (`aws.ssm`)
  - getParameters
- AWS Security Token Serve (`aws.sts`)
  - assumeConfiguredRole
  - getCallerIdentity
- Brightspot (`bsp`)
  - Embed Functions (`client.embed.X`)
    - get
    - create
    - update
  - Article Functions (`client.article.X`)
    - get
    - list
- Cloudflare (`cloudflare`)
  - purge
- DOMO (`domo`)
  - Auth Functions (`client.auth.X`)
    - token
  - query
- Notion (`notion`)
  - getPageBlocks
  - writeHeadingToPage
  - writeToPage
- Slack (`slack`)
  - _only returns base client for now._

_Icon in logo courtesy of: Hermés by IconMark from NounProject.com_

©2022 POLITICO
