@moneylion/engine-api 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,5 +4,79 @@ This is a Javascript interface to the [Engine](https://engine.tech/docs/api-refe
4
4
 
5
5
  ## Getting Started
6
6
 
7
- 1. `npm install`
8
- 2. `npm build`
7
+ Install the library
8
+
9
+ ```
10
+ npm add @moneylion/engine-api
11
+ ```
12
+
13
+ Request an authentication token and API endpoint from Engine.
14
+
15
+ ### Creating a Client Instance
16
+
17
+ Normally you won't have to create a client instance, but you can do so if you want to make a request that this library doesn't support.
18
+
19
+ ```
20
+ import { Client } from "@moneylion/engine-api";
21
+
22
+ new Client(endpoint, authentication_token);
23
+ ```
24
+
25
+ This provides `get`, `post`, and `patch` methods that accept a REST endpoint and a request body.
26
+ The request body will be serialized to JSON before being sent.
27
+ If you want to pass a body as a string or use a different HTTP method, use the `request` method.
28
+
29
+ ```
30
+ client.request("/endpoint", "DELETE", "body as a string");
31
+ ```
32
+
33
+ ### Creating a Lead
34
+
35
+ To create a lead, you can do the following:
36
+
37
+ ```
38
+ import { Lead } from "@moneylion/engine-api";
39
+
40
+ new Lead(endpoint, authentication_token).create(lead);
41
+ ```
42
+
43
+ This will return a promise that resolves with an AsyncRateTable.
44
+ You can use the `AsyncRateTable.resolve()` method to turn it into a real RateTable.
45
+ You can also use `createBlocking` which will resolve with a RateTable, but you will potentially spend longer waiting for network requests.
46
+
47
+ ### Updating a Lead
48
+
49
+ To update a lead, you can do the following:
50
+
51
+ ```
52
+ import { Lead } from "@moneylion/engine-api";
53
+
54
+ new Lead(endpoint, authentication_token).update(leadUuid, updatedLead);
55
+ ```
56
+
57
+ This returns a promise but will *not* resolve with a rate table and will instead resolve the lead UUID back to you when it finishes.
58
+
59
+ ### Rate Tables
60
+
61
+ Rate tables are returned when you create a lead.
62
+ If you would like to retrieve a rate table manually you can request it by its UUID.
63
+
64
+ ```
65
+ import { AsyncRateTable } from "@moneylion/engine-api";
66
+
67
+ new AsyncRateTable({ uuid: rateTableUuid, host: endpoint, api_token: authentication_token }).resolve();
68
+
69
+ // You can also pass a pre-created client instead of endpoint and token
70
+ new AsyncRateTable({ uuid: rateTableUuid, client: client }).resolve();
71
+
72
+ // You can also pass a RateTable object instead of a uuid.
73
+ new AsyncRateTable({ rateTable: rateTable, client: client }).resolve();
74
+ ```
75
+
76
+ ## For Contributors
77
+
78
+ This is a relatively normal NPM and Typescript project.
79
+
80
+ 1. `npm install` to install dependencies
81
+ 2. `npm run build` to build the project
82
+ 3. `npm test` to run the tests
@@ -0,0 +1,2 @@
1
+ import { components } from "./generated/schema";
2
+ export type ClientTags = components["schemas"]["ClientTags"];
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { Client } from "./client.js";
2
2
  export * from "./leads.js";
3
3
  export * from "./rate_tables.js";
4
+ export * from "./client_tags.js";
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { Client } from "./client.js";
2
2
  export * from "./leads.js";
3
3
  export * from "./rate_tables.js";
4
+ export * from "./client_tags.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneylion/engine-api",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Interface to engine.tech API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",