Skip to content

Commit cc71fb2

Browse files
authored
Merge pull request #2 from mxenabled/mc/update_readme
Update README
2 parents 0a21af2 + 1c720b8 commit cc71fb2

1 file changed

Lines changed: 36 additions & 20 deletions

File tree

README.md

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,23 @@
22

33
## MX Platform Node
44

5-
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
5+
A Node.js library for the [MX Platform API](https://www.mx.com/products/platform-api).
6+
7+
### Documentation
8+
9+
See the [documentation](https://docs.mx.com/api).
10+
11+
### Install
12+
13+
To build and compile the typescript sources to javascript use:
14+
15+
```shell
16+
$ npm install mx-platform-node
17+
```
18+
19+
### Getting Started
20+
21+
The [openapi-generator](https://github.com/OpenAPITools/openapi-generator) creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
622

723
Environment
824
* Node.js
@@ -17,31 +33,31 @@ Module system
1733
* CommonJS
1834
* ES6 module system
1935

20-
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
21-
22-
### Building
23-
24-
To build and compile the typescript sources to javascript use:
25-
```
26-
npm install
27-
npm run build
28-
```
36+
In order to make requests, you will need to [sign up](https://dashboard.mx.com/sign_up) for the MX Platform API and get a `Client ID` and `API Key`.
2937

30-
### Publishing
38+
```javascript
39+
import { Configuration, MxPlatformApi } from 'mx-platform-node'
3140

32-
First build the package then run ```npm publish```
41+
const configuration = new Configuration({
42+
basePath: 'https://int-api.mx.com',
43+
username: 'Client ID',
44+
password: 'API Key',
45+
baseOptions: {
46+
headers: {
47+
Accept: 'application/vnd.mx.api.v1+json'
48+
}
49+
}
50+
});
3351

34-
### Consuming
52+
const client = new MxPlatformApi(configuration);
3553

36-
navigate to the folder of your consuming project and run one of the following commands.
54+
const userGuid = 'USR-123';
3755

38-
_published:_
56+
const response = await client.readUser(userGuid);
3957

40-
```
41-
npm install mx-platform-node@0.1.0 --save
58+
console.log(response.data);
4259
```
4360

44-
_unPublished (not recommended):_
61+
## Contributing
4562

46-
```
47-
npm install PATH_TO_GENERATED_PACKAGE --save
63+
Bug reports and pull requests are welcome on [GitHub](https://github.com/mxenabled/mx-platform-node).

0 commit comments

Comments
 (0)