# ministry-platform

> [![Teamcity Status]()](https://ci.crossroads.net/viewType.html?buildTypeId=SharedCode_Release_MinistryPlatformNode)

Latest version **1.0.0** (published 2019-07-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install ministry-platform
pnpm add ministry-platform
yarn add ministry-platform
bun add ministry-platform
```

## 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.0.0 |
| Published | 2019-07-10 |
| First published | 2018-07-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=7.6 |
| Dependencies | 5 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | crds_npm_org, d3m, dan.rye, dillon.courts, dshannon, tcmacdonald |

## Links

- npm: https://www.npmjs.com/package/ministry-platform
- npm.io page: https://npm.io/package/ministry-platform

## Dependencies (5)

- [axios](https://npm.io/package/axios.md) ^0.18.0
- [dotenv](https://npm.io/package/dotenv.md) ^6.0.0
- [typescript](https://npm.io/package/typescript.md) ^3.5.3
- [@types/node](https://npm.io/package/@types/node.md) ^12.0.8
- [querystring](https://npm.io/package/querystring.md) ^0.2.0

## Recent versions

- 1.0.0 (latest) — 2019-07-10
- 0.1.0 — 2018-07-11
- 0.0.5 — 2018-07-11
- 0.0.4 — 2018-07-06
- 0.0.3 — 2018-07-06
- 0.0.2 — 2018-07-06

## README

# Ministry Platform

[![Teamcity Status](<https://ci.crossroads.net/app/rest/builds/buildType:(id:SharedCode_Release_MinistryPlatformNode)/statusIcon.svg>)](https://ci.crossroads.net/viewType.html?buildTypeId=SharedCode_Release_MinistryPlatformNode)

an npm package for interacting with the Ministry Platform Rest API

## Usage

#### Prerequisites

This package uses async/await, so requires a node version > 7.6
 
#### Build a request

currently, only GET requests with select columns, filters, and table in implemented.

```js
const MP = require('ministry-platform');
const mp = new MP();
   
const selectColumns = []
selectColumns.push('User_ID_Table_Contact_ID_Table.[Contact_ID]')
selectColumns.push('Role_ID_Table.[Role_Name]')
selectColumns.push('dp_User_Roles.[User_Role_ID]')
const filter = `User_ID_Table_Contact_ID_Table.[Contact_ID] = 7680320 and Role_ID_Table.[Role_Name] LIKE 'pushpay'` 
const table = 'dp_User_Roles'
const data = await mp.withSelectColumns(selectColumns)
    .withFilter(filter)
    .fromTable(table)
    .get()
console.info("data:", data);
```
> to run the above example, you can run `node example.js`, just remember to set your environment variables.

## Development

#### Install dependencies

```
npm i
```

#### Run tests

```bash
npm test
# or, to run tests as you change files
npm test:watch
```

#### Environment Variables needed

* MP_REST_API_ENDPOINT = "https://adminint.crossroads.net/ministryplatformapi"
* MP_OAUTH_BASE_URL = "https://adminint.crossroads.net/ministryplatformapi/oauth"
* MP_USERNAME = "mpuser"
* MP_PASSWORD = "password1$3"
* MP_CLIENT_ID = "client-id"
* MP_CLIENT_SECRET = "mysecret"

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