@dc-qash/sdk 1.0.0 → 1.0.1

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/dist/lib.js CHANGED
@@ -26,7 +26,6 @@ export default class QashSDK {
26
26
  this.CBS = new QashCBS(this);
27
27
  }
28
28
  // Get authorized partner
29
- // TODO: Partner type
30
29
  getAuthorizedPartner() {
31
30
  return new Promise(async (resolve, reject) => {
32
31
  try {
@@ -48,7 +47,6 @@ class QashCBS {
48
47
  __classPrivateFieldSet(this, _QashCBS_sdk, sdk, "f");
49
48
  }
50
49
  // Get account holders
51
- // TODO: AccountHolder type
52
50
  // TODO: search query
53
51
  getAccountHolders() {
54
52
  return new Promise(async (resolve, reject) => {
@@ -79,5 +77,19 @@ class QashCBS {
79
77
  }
80
78
  });
81
79
  }
80
+ // Create account holder - Individual
81
+ createIndividualAccountHolder(data) {
82
+ return new Promise(async (resolve, reject) => {
83
+ try {
84
+ let _q = await fetch(`${__classPrivateFieldGet(this, _QashCBS_sdk, "f").environment}/v1/cbs/account-holders`, { method: "POST", body: JSON.stringify(Object.assign({ type: "individual" }, data)), headers: { Authorization: `Basic ${__classPrivateFieldGet(this, _QashCBS_sdk, "f").apiKey}` } }).then(r => r.json());
85
+ if (_q.error || _q.errors)
86
+ throw _q.errors || [_q.error];
87
+ return resolve(_q);
88
+ }
89
+ catch (e) {
90
+ reject(Array.isArray(e) ? e : ["unexpected_issue"]);
91
+ }
92
+ });
93
+ }
82
94
  }
83
95
  _QashCBS_sdk = new WeakMap();
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@dc-qash/sdk",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "description": "SDK for Qash, a DemocracyCraft clearing house",
6
6
  "main": "dist/lib.js",
7
+ "types": "dist/lib.d.ts",
7
8
  "repository": "https://github.com/luzzardik/qash-js-sdk",
8
9
  "author": "Kacy Luzzardi",
9
- "private": false
10
+ "private": false,
11
+ "scripts": {
12
+ "build": "rm -rf ./dist && tsc"
13
+ }
10
14
  }
package/dist/lib.d.ts DELETED
@@ -1,19 +0,0 @@
1
- export declare enum QashAPIEnv {
2
- PRODUCTION = "https://api.qash.cloud",
3
- STAGING = "https://api.staging.qash.cloud",
4
- DEV = "https://api.dev.qash.cloud"
5
- }
6
- export default class QashSDK {
7
- apiKey: string;
8
- environment: QashAPIEnv;
9
- constructor(apiKey: string, environment?: QashAPIEnv);
10
- getAuthorizedPartner(): Promise<any>;
11
- CBS: QashCBS;
12
- }
13
- declare class QashCBS {
14
- #private;
15
- constructor(sdk: QashSDK);
16
- getAccountHolders(): Promise<any[]>;
17
- getAccounts(): Promise<any[]>;
18
- }
19
- export {};