@mft/moneyhub-api-client 4.18.0 → 5.0.0-0

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.
Files changed (342) hide show
  1. package/dist/src/exchange-code-for-token.d.ts +9 -0
  2. package/dist/src/exchange-code-for-token.d.ts.map +1 -0
  3. package/dist/src/exchange-code-for-token.js +91 -0
  4. package/dist/src/exchange-code-for-token.js.map +1 -0
  5. package/dist/src/get-auth-urls.d.ts +130 -0
  6. package/dist/src/get-auth-urls.d.ts.map +1 -0
  7. package/dist/src/get-auth-urls.js +397 -0
  8. package/dist/src/get-auth-urls.js.map +1 -0
  9. package/dist/src/index.d.ts +25 -0
  10. package/dist/src/index.d.ts.map +1 -0
  11. package/dist/src/index.js +70 -0
  12. package/dist/src/index.js.map +1 -0
  13. package/dist/src/request.d.ts +8 -0
  14. package/dist/src/request.d.ts.map +1 -0
  15. package/dist/src/request.js +52 -0
  16. package/dist/src/request.js.map +1 -0
  17. package/dist/src/requests/accounts.d.ts +5 -0
  18. package/dist/src/requests/accounts.d.ts.map +1 -0
  19. package/dist/src/requests/accounts.js +99 -0
  20. package/dist/src/requests/accounts.js.map +1 -0
  21. package/dist/src/requests/auth-requests.d.ts +5 -0
  22. package/dist/src/requests/auth-requests.d.ts.map +1 -0
  23. package/dist/src/requests/auth-requests.js +52 -0
  24. package/dist/src/requests/auth-requests.js.map +1 -0
  25. package/dist/src/requests/beneficiaries.d.ts +5 -0
  26. package/dist/src/requests/beneficiaries.d.ts.map +1 -0
  27. package/dist/src/requests/beneficiaries.js +27 -0
  28. package/dist/src/requests/beneficiaries.js.map +1 -0
  29. package/dist/src/requests/categories.d.ts +5 -0
  30. package/dist/src/requests/categories.d.ts.map +1 -0
  31. package/dist/src/requests/categories.js +46 -0
  32. package/dist/src/requests/categories.js.map +1 -0
  33. package/dist/src/requests/index.d.ts +5 -0
  34. package/dist/src/requests/index.d.ts.map +1 -0
  35. package/dist/src/requests/index.js +52 -0
  36. package/dist/src/requests/index.js.map +1 -0
  37. package/dist/src/requests/payees.d.ts +5 -0
  38. package/dist/src/requests/payees.d.ts.map +1 -0
  39. package/dist/src/requests/payees.js +26 -0
  40. package/dist/src/requests/payees.js.map +1 -0
  41. package/dist/src/requests/payments.d.ts +5 -0
  42. package/dist/src/requests/payments.d.ts.map +1 -0
  43. package/dist/src/requests/payments.js +30 -0
  44. package/dist/src/requests/payments.js.map +1 -0
  45. package/dist/src/requests/projects.d.ts +5 -0
  46. package/dist/src/requests/projects.d.ts.map +1 -0
  47. package/dist/src/requests/projects.js +45 -0
  48. package/dist/src/requests/projects.js.map +1 -0
  49. package/dist/src/requests/recurring-payments.d.ts +5 -0
  50. package/dist/src/requests/recurring-payments.d.ts.map +1 -0
  51. package/dist/src/requests/recurring-payments.js +32 -0
  52. package/dist/src/requests/recurring-payments.js.map +1 -0
  53. package/dist/src/requests/regular-transactions.d.ts +5 -0
  54. package/dist/src/requests/regular-transactions.d.ts.map +1 -0
  55. package/dist/src/requests/regular-transactions.js +15 -0
  56. package/dist/src/requests/regular-transactions.js.map +1 -0
  57. package/dist/src/requests/rental-records.d.ts +5 -0
  58. package/dist/src/requests/rental-records.d.ts.map +1 -0
  59. package/dist/src/requests/rental-records.js +33 -0
  60. package/dist/src/requests/rental-records.js.map +1 -0
  61. package/dist/src/requests/savings-goals.d.ts +5 -0
  62. package/dist/src/requests/savings-goals.d.ts.map +1 -0
  63. package/dist/src/requests/savings-goals.js +46 -0
  64. package/dist/src/requests/savings-goals.js.map +1 -0
  65. package/dist/src/requests/spending-analysis.d.ts +5 -0
  66. package/dist/src/requests/spending-analysis.d.ts.map +1 -0
  67. package/dist/src/requests/spending-analysis.js +18 -0
  68. package/dist/src/requests/spending-analysis.js.map +1 -0
  69. package/dist/src/requests/spending-goals.d.ts +5 -0
  70. package/dist/src/requests/spending-goals.d.ts.map +1 -0
  71. package/dist/src/requests/spending-goals.js +46 -0
  72. package/dist/src/requests/spending-goals.js.map +1 -0
  73. package/dist/src/requests/standing-orders.d.ts +5 -0
  74. package/dist/src/requests/standing-orders.d.ts.map +1 -0
  75. package/dist/src/requests/standing-orders.js +20 -0
  76. package/dist/src/requests/standing-orders.js.map +1 -0
  77. package/dist/src/requests/sync.d.ts +5 -0
  78. package/dist/src/requests/sync.d.ts.map +1 -0
  79. package/dist/src/requests/sync.js +41 -0
  80. package/dist/src/requests/sync.js.map +1 -0
  81. package/dist/src/requests/tax.d.ts +5 -0
  82. package/dist/src/requests/tax.d.ts.map +1 -0
  83. package/dist/src/requests/tax.js +39 -0
  84. package/dist/src/requests/tax.js.map +1 -0
  85. package/dist/src/requests/transaction-files.d.ts +5 -0
  86. package/dist/src/requests/transaction-files.d.ts.map +1 -0
  87. package/dist/src/requests/transaction-files.js +44 -0
  88. package/dist/src/requests/transaction-files.js.map +1 -0
  89. package/dist/src/requests/transaction-splits.d.ts +5 -0
  90. package/dist/src/requests/transaction-splits.d.ts.map +1 -0
  91. package/dist/src/requests/transaction-splits.js +38 -0
  92. package/dist/src/requests/transaction-splits.js.map +1 -0
  93. package/dist/src/requests/transactions.d.ts +5 -0
  94. package/dist/src/requests/transactions.d.ts.map +1 -0
  95. package/dist/src/requests/transactions.js +54 -0
  96. package/dist/src/requests/transactions.js.map +1 -0
  97. package/dist/src/requests/unauthenticated.d.ts +5 -0
  98. package/dist/src/requests/unauthenticated.d.ts.map +1 -0
  99. package/dist/src/requests/unauthenticated.js +16 -0
  100. package/dist/src/requests/unauthenticated.js.map +1 -0
  101. package/dist/src/requests/users-and-connections.d.ts +5 -0
  102. package/dist/src/requests/users-and-connections.d.ts.map +1 -0
  103. package/dist/src/requests/users-and-connections.js +72 -0
  104. package/dist/src/requests/users-and-connections.js.map +1 -0
  105. package/dist/src/tokens.d.ts +24 -0
  106. package/dist/src/tokens.d.ts.map +1 -0
  107. package/dist/src/tokens.js +64 -0
  108. package/dist/src/tokens.js.map +1 -0
  109. package/dist/types/config.d.ts +23 -0
  110. package/dist/types/config.d.ts.map +1 -0
  111. package/dist/types/config.js +3 -0
  112. package/dist/types/config.js.map +1 -0
  113. package/dist/types/get-auth-urls.d.ts +118 -0
  114. package/dist/types/get-auth-urls.d.ts.map +1 -0
  115. package/dist/types/get-auth-urls.js +3 -0
  116. package/dist/types/get-auth-urls.js.map +1 -0
  117. package/dist/types/index.d.ts +30 -0
  118. package/dist/types/index.d.ts.map +1 -0
  119. package/dist/types/index.js +3 -0
  120. package/dist/types/index.js.map +1 -0
  121. package/dist/types/request.d.ts +39 -0
  122. package/dist/types/request.d.ts.map +1 -0
  123. package/dist/types/request.js +3 -0
  124. package/dist/types/request.js.map +1 -0
  125. package/dist/types/requests/accounts.d.ts +68 -0
  126. package/dist/types/requests/accounts.d.ts.map +1 -0
  127. package/dist/types/requests/accounts.js +3 -0
  128. package/dist/types/requests/accounts.js.map +1 -0
  129. package/dist/types/requests/auth-requests.d.ts +42 -0
  130. package/dist/types/requests/auth-requests.d.ts.map +1 -0
  131. package/dist/types/requests/auth-requests.js +9 -0
  132. package/dist/types/requests/auth-requests.js.map +1 -0
  133. package/dist/types/requests/beneficiaries.d.ts +21 -0
  134. package/dist/types/requests/beneficiaries.d.ts.map +1 -0
  135. package/dist/types/requests/beneficiaries.js +3 -0
  136. package/dist/types/requests/beneficiaries.js.map +1 -0
  137. package/dist/types/requests/categories.d.ts +28 -0
  138. package/dist/types/requests/categories.d.ts.map +1 -0
  139. package/dist/types/requests/categories.js +3 -0
  140. package/dist/types/requests/categories.js.map +1 -0
  141. package/dist/types/requests/payees.d.ts +16 -0
  142. package/dist/types/requests/payees.d.ts.map +1 -0
  143. package/dist/types/requests/payees.js +3 -0
  144. package/dist/types/requests/payees.js.map +1 -0
  145. package/dist/types/requests/payments.d.ts +12 -0
  146. package/dist/types/requests/payments.d.ts.map +1 -0
  147. package/dist/types/requests/payments.js +3 -0
  148. package/dist/types/requests/payments.js.map +1 -0
  149. package/dist/types/requests/projects.d.ts +26 -0
  150. package/dist/types/requests/projects.d.ts.map +1 -0
  151. package/dist/types/requests/projects.js +3 -0
  152. package/dist/types/requests/projects.js.map +1 -0
  153. package/dist/types/requests/recurring-payments.d.ts +16 -0
  154. package/dist/types/requests/recurring-payments.d.ts.map +1 -0
  155. package/dist/types/requests/recurring-payments.js +3 -0
  156. package/dist/types/requests/recurring-payments.js.map +1 -0
  157. package/dist/types/requests/regular-transactions.d.ts +9 -0
  158. package/dist/types/requests/regular-transactions.d.ts.map +1 -0
  159. package/dist/types/requests/regular-transactions.js +3 -0
  160. package/dist/types/requests/regular-transactions.js.map +1 -0
  161. package/dist/types/requests/rental-records.d.ts +16 -0
  162. package/dist/types/requests/rental-records.d.ts.map +1 -0
  163. package/dist/types/requests/rental-records.js +3 -0
  164. package/dist/types/requests/rental-records.js.map +1 -0
  165. package/dist/types/requests/savings-goals.d.ts +40 -0
  166. package/dist/types/requests/savings-goals.d.ts.map +1 -0
  167. package/dist/types/requests/savings-goals.js +3 -0
  168. package/dist/types/requests/savings-goals.js.map +1 -0
  169. package/dist/types/requests/spending-analysis.d.ts +18 -0
  170. package/dist/types/requests/spending-analysis.d.ts.map +1 -0
  171. package/dist/types/requests/spending-analysis.js +3 -0
  172. package/dist/types/requests/spending-analysis.js.map +1 -0
  173. package/dist/types/requests/spending-goals.d.ts +35 -0
  174. package/dist/types/requests/spending-goals.d.ts.map +1 -0
  175. package/dist/types/requests/spending-goals.js +8 -0
  176. package/dist/types/requests/spending-goals.js.map +1 -0
  177. package/dist/types/requests/standing-orders.d.ts +9 -0
  178. package/dist/types/requests/standing-orders.d.ts.map +1 -0
  179. package/dist/types/requests/standing-orders.js +3 -0
  180. package/dist/types/requests/standing-orders.js.map +1 -0
  181. package/dist/types/requests/sync.d.ts +18 -0
  182. package/dist/types/requests/sync.d.ts.map +1 -0
  183. package/dist/types/requests/sync.js +8 -0
  184. package/dist/types/requests/sync.js.map +1 -0
  185. package/dist/types/requests/tax.d.ts +9 -0
  186. package/dist/types/requests/tax.d.ts.map +1 -0
  187. package/dist/types/requests/tax.js +3 -0
  188. package/dist/types/requests/tax.js.map +1 -0
  189. package/dist/types/requests/transaction-files.d.ts +25 -0
  190. package/dist/types/requests/transaction-files.d.ts.map +1 -0
  191. package/dist/types/requests/transaction-files.js +3 -0
  192. package/dist/types/requests/transaction-files.js.map +1 -0
  193. package/dist/types/requests/transaction-splits.d.ts +24 -0
  194. package/dist/types/requests/transaction-splits.d.ts.map +1 -0
  195. package/dist/types/requests/transaction-splits.js +3 -0
  196. package/dist/types/requests/transaction-splits.js.map +1 -0
  197. package/dist/types/requests/transactions.d.ts +35 -0
  198. package/dist/types/requests/transactions.d.ts.map +1 -0
  199. package/dist/types/requests/transactions.js +3 -0
  200. package/dist/types/requests/transactions.js.map +1 -0
  201. package/dist/types/requests/unauthenticated.d.ts +12 -0
  202. package/dist/types/requests/unauthenticated.d.ts.map +1 -0
  203. package/dist/types/requests/unauthenticated.js +3 -0
  204. package/dist/types/requests/unauthenticated.js.map +1 -0
  205. package/dist/types/requests/users-and-connections.d.ts +39 -0
  206. package/dist/types/requests/users-and-connections.d.ts.map +1 -0
  207. package/dist/types/requests/users-and-connections.js +3 -0
  208. package/dist/types/requests/users-and-connections.js.map +1 -0
  209. package/dist/types/schema/account.d.ts +102 -0
  210. package/dist/types/schema/account.d.ts.map +1 -0
  211. package/dist/types/schema/account.js +35 -0
  212. package/dist/types/schema/account.js.map +1 -0
  213. package/dist/types/schema/auth-request.d.ts +31 -0
  214. package/dist/types/schema/auth-request.d.ts.map +1 -0
  215. package/dist/types/schema/auth-request.js +10 -0
  216. package/dist/types/schema/auth-request.js.map +1 -0
  217. package/dist/types/schema/balance.d.ts +11 -0
  218. package/dist/types/schema/balance.d.ts.map +1 -0
  219. package/dist/types/schema/balance.js +3 -0
  220. package/dist/types/schema/balance.js.map +1 -0
  221. package/dist/types/schema/beneficiary.d.ts +19 -0
  222. package/dist/types/schema/beneficiary.d.ts.map +1 -0
  223. package/dist/types/schema/beneficiary.js +3 -0
  224. package/dist/types/schema/beneficiary.js.map +1 -0
  225. package/dist/types/schema/category.d.ts +15 -0
  226. package/dist/types/schema/category.d.ts.map +1 -0
  227. package/dist/types/schema/category.js +3 -0
  228. package/dist/types/schema/category.js.map +1 -0
  229. package/dist/types/schema/connection.d.ts +39 -0
  230. package/dist/types/schema/connection.d.ts.map +1 -0
  231. package/dist/types/schema/connection.js +3 -0
  232. package/dist/types/schema/connection.js.map +1 -0
  233. package/dist/types/schema/counterparty.d.ts +33 -0
  234. package/dist/types/schema/counterparty.d.ts.map +1 -0
  235. package/dist/types/schema/counterparty.js +8 -0
  236. package/dist/types/schema/counterparty.js.map +1 -0
  237. package/dist/types/schema/holding.d.ts +55 -0
  238. package/dist/types/schema/holding.d.ts.map +1 -0
  239. package/dist/types/schema/holding.js +9 -0
  240. package/dist/types/schema/holding.js.map +1 -0
  241. package/dist/types/schema/payee.d.ts +13 -0
  242. package/dist/types/schema/payee.d.ts.map +1 -0
  243. package/dist/types/schema/payee.js +3 -0
  244. package/dist/types/schema/payee.js.map +1 -0
  245. package/dist/types/schema/payment.d.ts +156 -0
  246. package/dist/types/schema/payment.d.ts.map +1 -0
  247. package/dist/types/schema/payment.js +68 -0
  248. package/dist/types/schema/payment.js.map +1 -0
  249. package/dist/types/schema/project.d.ts +25 -0
  250. package/dist/types/schema/project.d.ts.map +1 -0
  251. package/dist/types/schema/project.js +9 -0
  252. package/dist/types/schema/project.js.map +1 -0
  253. package/dist/types/schema/regular-transaction.d.ts +40 -0
  254. package/dist/types/schema/regular-transaction.d.ts.map +1 -0
  255. package/dist/types/schema/regular-transaction.js +16 -0
  256. package/dist/types/schema/regular-transaction.js.map +1 -0
  257. package/dist/types/schema/rental-record.d.ts +44 -0
  258. package/dist/types/schema/rental-record.d.ts.map +1 -0
  259. package/dist/types/schema/rental-record.js +9 -0
  260. package/dist/types/schema/rental-record.js.map +1 -0
  261. package/dist/types/schema/savings-goal.d.ts +15 -0
  262. package/dist/types/schema/savings-goal.d.ts.map +1 -0
  263. package/dist/types/schema/savings-goal.js +3 -0
  264. package/dist/types/schema/savings-goal.js.map +1 -0
  265. package/dist/types/schema/spending-analysis.d.ts +14 -0
  266. package/dist/types/schema/spending-analysis.d.ts.map +1 -0
  267. package/dist/types/schema/spending-analysis.js +3 -0
  268. package/dist/types/schema/spending-analysis.js.map +1 -0
  269. package/dist/types/schema/spending-goal.d.ts +20 -0
  270. package/dist/types/schema/spending-goal.d.ts.map +1 -0
  271. package/dist/types/schema/spending-goal.js +8 -0
  272. package/dist/types/schema/spending-goal.js.map +1 -0
  273. package/dist/types/schema/standing-order.d.ts +80 -0
  274. package/dist/types/schema/standing-order.d.ts.map +1 -0
  275. package/dist/types/schema/standing-order.js +24 -0
  276. package/dist/types/schema/standing-order.js.map +1 -0
  277. package/dist/types/schema/sync.d.ts +16 -0
  278. package/dist/types/schema/sync.d.ts.map +1 -0
  279. package/dist/types/schema/sync.js +3 -0
  280. package/dist/types/schema/sync.js.map +1 -0
  281. package/dist/types/schema/tax.d.ts +35 -0
  282. package/dist/types/schema/tax.d.ts.map +1 -0
  283. package/dist/types/schema/tax.js +3 -0
  284. package/dist/types/schema/tax.js.map +1 -0
  285. package/dist/types/schema/transaction.d.ts +127 -0
  286. package/dist/types/schema/transaction.d.ts.map +1 -0
  287. package/dist/types/schema/transaction.js +3 -0
  288. package/dist/types/schema/transaction.js.map +1 -0
  289. package/dist/types/schema/user.d.ts +15 -0
  290. package/dist/types/schema/user.d.ts.map +1 -0
  291. package/dist/types/schema/user.js +3 -0
  292. package/dist/types/schema/user.js.map +1 -0
  293. package/dist/types/tokens.d.ts +40 -0
  294. package/dist/types/tokens.d.ts.map +1 -0
  295. package/dist/types/tokens.js +3 -0
  296. package/dist/types/tokens.js.map +1 -0
  297. package/package.json +20 -6
  298. package/readme.md +464 -253
  299. package/.eslintrc +0 -9
  300. package/.github/workflows/main.yml +0 -24
  301. package/resources/sample.jpg +0 -0
  302. package/resources/scripts/pre-commit.sh +0 -43
  303. package/src/__tests__/accounts.js +0 -76
  304. package/src/__tests__/auth-requests.js +0 -33
  305. package/src/__tests__/auth-urls.js +0 -104
  306. package/src/__tests__/categories.js +0 -92
  307. package/src/__tests__/index.js +0 -152
  308. package/src/__tests__/payees.js +0 -39
  309. package/src/__tests__/payments.js +0 -34
  310. package/src/__tests__/projects.js +0 -56
  311. package/src/__tests__/regular-transactions.js +0 -20
  312. package/src/__tests__/rental-records.js +0 -90
  313. package/src/__tests__/sync.js +0 -29
  314. package/src/__tests__/tax.js +0 -29
  315. package/src/__tests__/token.js +0 -25
  316. package/src/__tests__/transaction-files.js +0 -55
  317. package/src/__tests__/transaction-splits.js +0 -95
  318. package/src/__tests__/transactions.js +0 -110
  319. package/src/__tests__/users.js +0 -39
  320. package/src/exchange-code-for-token.js +0 -115
  321. package/src/get-auth-urls.js +0 -522
  322. package/src/index.js +0 -82
  323. package/src/request.js +0 -58
  324. package/src/requests/accounts.js +0 -146
  325. package/src/requests/auth-requests.js +0 -61
  326. package/src/requests/beneficiaries.js +0 -31
  327. package/src/requests/categories.js +0 -55
  328. package/src/requests/payees.js +0 -29
  329. package/src/requests/payments.js +0 -35
  330. package/src/requests/projects.js +0 -51
  331. package/src/requests/recurring-payments.js +0 -37
  332. package/src/requests/regular-transactions.js +0 -17
  333. package/src/requests/rental-records.js +0 -41
  334. package/src/requests/standing-orders.js +0 -21
  335. package/src/requests/sync.js +0 -23
  336. package/src/requests/tax.js +0 -16
  337. package/src/requests/transaction-files.js +0 -54
  338. package/src/requests/transaction-splits.js +0 -57
  339. package/src/requests/transactions.js +0 -58
  340. package/src/requests/unauthenticated.js +0 -17
  341. package/src/requests/users-and-connections.js +0 -79
  342. package/src/tokens.js +0 -72
package/readme.md CHANGED
@@ -31,18 +31,30 @@ Currently this library supports `client_secret_basic`, `client_secret_jwt` and `
31
31
 
32
32
  The breaking changes when upgrading are outlined below:
33
33
 
34
- * Normalisation of all methods to use object destructuring to pass parameters. Please refer to the docs of each method when migrating to this version
34
+ - Normalisation of all methods to use object destructuring to pass parameters. Please refer to the docs of each method when migrating to this version
35
35
 
36
- * Delete methods only return the status code when succesful
36
+ - Delete methods only return the status code when succesful
37
37
 
38
- * All methods to retrieve data return the body response as json, on previous versions some methods were returning the full response from the got library.
38
+ - All methods to retrieve data return the body response as json, on previous versions some methods were returning the full response from the got library.
39
39
 
40
- * When our API response code is not 2xx an HTTP error is thrown. Includes a response property with more information.
40
+ - When our API response code is not 2xx an HTTP error is thrown. Includes a response property with more information.
41
41
 
42
- * Removal of all the methods with the suffix `WithToken`. To migrate to this version you can use the method with the same name but without the suffix. e.g `getUserConnectionsWithToken()` => `getUserConnections()`
42
+ - Removal of all the methods with the suffix `WithToken`. To migrate to this version you can use the method with the same name but without the suffix. e.g `getUserConnectionsWithToken()` => `getUserConnections()`
43
43
 
44
44
  For the full list of changes please refer to the [changelog](CHANGELOG.md)
45
45
 
46
+ ### Upgrading from 4.x
47
+
48
+ The major upgrade from version 4.x is that the library now caters for TypeScript. To allow for this, the factory method that creates the client instance is now a named export rather than a default export.
49
+
50
+ ```js
51
+ // v4.x
52
+ const Moneyhub = require("@mft/moneyhub-api-client")
53
+
54
+ // v5.x
55
+ const {Moneyhub} = require("@mft/moneyhub-api-client")
56
+ ```
57
+
46
58
  ### Changelog
47
59
 
48
60
  [Learn about the latest improvements and breaking changes](CHANGELOG.md).
@@ -64,7 +76,7 @@ To use this API client you will need:
64
76
  This module exposes a single factory function that accepts the following configuration:
65
77
 
66
78
  ```javascript
67
- const Moneyhub = require("@mft/moneyhub-api-client")
79
+ const {Moneyhub} = require("@mft/moneyhub-api-client")
68
80
  const moneyhub = await Moneyhub({
69
81
  resourceServerUrl: "https://api.moneyhub.co.uk/v2.0",
70
82
  identityServiceUrl: "https://identity.moneyhub.co.uk",
@@ -89,7 +101,9 @@ const moneyhub = await Moneyhub({
89
101
  Once the api client has been initialised it provides a simple promise based interface with the following methods:
90
102
 
91
103
  ### Auth API
104
+
92
105
  The options below can be set on the following URL generating methods:
106
+
93
107
  - `getAuthorizeUrl`
94
108
  - `getAuthorizeUrlForCreatedUser`
95
109
  - `getReauthAuthorizeUrlForCreatedUser`
@@ -98,9 +112,10 @@ The options below can be set on the following URL generating methods:
98
112
  The `expirationDateTime` and `transactionFromDateTime` options can be set according to the [AIS Consents documentation](https://docs.moneyhubenterprise.com/docs/ais-consents)
99
113
 
100
114
  Set `enableAsync` to true if you wish to make an AIS connection that won't wait for accounts and transactions to be fetched.
115
+
101
116
  #### `getAuthorizeUrl`
102
117
 
103
- This method returns an authorize url for your API client. You can redirect a user to this url, after which they will be redirected back to your `redirect_uri`.
118
+ This method returns an authorize url for your API client. You can redirect a user to this url, after which they will be redirected back to your `redirect_uri`.
104
119
 
105
120
  [Financial institutions](https://docs.moneyhubenterprise.com/docs/bank-connections)
106
121
 
@@ -108,7 +123,6 @@ This method returns an authorize url for your API client. You can redirect a use
108
123
 
109
124
  [Claims](https://docs.moneyhubenterprise.com/docs/claims)
110
125
 
111
-
112
126
  ```javascript
113
127
  const url = await moneyhub.getAuthorizeUrl({
114
128
  scope: "openid bank-id-scope other-data-scopes",
@@ -118,8 +132,8 @@ const url = await moneyhub.getAuthorizeUrl({
118
132
  permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth URL
119
133
  expirationDateTime: "2022-09-01T00:00:00.000Z", // optional
120
134
  transactionFromDateTime: "2020-09-01T00:00:00.000Z", // optional,
121
- enableAsync: false // optional
122
- })
135
+ enableAsync: false, // optional
136
+ });
123
137
 
124
138
  // Default claims if none are provided
125
139
  const defaultClaims = {
@@ -131,7 +145,7 @@ const defaultClaims = {
131
145
  essential: true,
132
146
  },
133
147
  },
134
- }
148
+ };
135
149
  ```
136
150
 
137
151
  #### `getAuthorizeUrlForCreatedUser`
@@ -152,11 +166,11 @@ const url = await moneyhub.getAuthorizeUrlForCreatedUser({
152
166
  nonce: "your nonce value", // optional
153
167
  claims: claimsObject, // optional
154
168
  permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth URL
155
- enableAsync: false // optional
156
- })
169
+ enableAsync: false, // optional
170
+ });
157
171
 
158
172
  // Scope used with the bankId provided
159
- const scope = `id:${bankId} openid`
173
+ const scope = `id:${bankId} openid`;
160
174
 
161
175
  // Default claims if none are provided
162
176
  const defaultClaims = {
@@ -169,7 +183,7 @@ const defaultClaims = {
169
183
  essential: true,
170
184
  },
171
185
  },
172
- }
186
+ };
173
187
  ```
174
188
 
175
189
  #### `getReauthAuthorizeUrlForCreatedUser`
@@ -183,8 +197,8 @@ const url = await moneyhub.getReauthAuthorizeUrlForCreatedUser({
183
197
  state: "your state value", // optional
184
198
  nonce: "your nonce value", // optional
185
199
  claims: claimsObject, // optional
186
- enableAsync: false // optional
187
- })
200
+ enableAsync: false, // optional
201
+ });
188
202
 
189
203
  // Default claims if none are provided
190
204
  const defaultClaims = {
@@ -198,7 +212,7 @@ const defaultClaims = {
198
212
  value: connectionId, // connectionId provided
199
213
  },
200
214
  },
201
- }
215
+ };
202
216
  ```
203
217
 
204
218
  #### `getRefreshAuthorizeUrlForCreatedUser`
@@ -212,8 +226,8 @@ const url = await moneyhub.getRefreshAuthorizeUrlForCreatedUser({
212
226
  state: "your state value", // optional
213
227
  nonce: "your nonce value", // optional
214
228
  claims: claimsObject, // optional
215
- enableAsync: false // optional
216
- })
229
+ enableAsync: false, // optional
230
+ });
217
231
 
218
232
  // Default claims if none are provided
219
233
  const defaultClaims = {
@@ -227,7 +241,7 @@ const defaultClaims = {
227
241
  value: connectionId, // connectionId provided
228
242
  },
229
243
  },
230
- }
244
+ };
231
245
  ```
232
246
 
233
247
  #### `exchangeCodeForTokensLegacy`
@@ -241,7 +255,7 @@ const tokens = await moneyhub.exchangeCodeForTokens({
241
255
  nonce: "your nonce value", // optional
242
256
  state: "your state value", // optional
243
257
  id_token: "your id token", // optional
244
- })
258
+ });
245
259
  ```
246
260
 
247
261
  #### `exchangeCodeForTokens`
@@ -252,8 +266,9 @@ The signature for this method changed in v3.
252
266
  The previous function is available at 'exchangeCodeForTokensLegacy'
253
267
 
254
268
  This method requires an object with two properties:
255
- - `paramsFromCallback` : an object with all the params received at your redirect uri
256
- - `localParams` : an object with params that you have in the local session for the user.
269
+
270
+ - `paramsFromCallback` : an object with all the params received at your redirect uri
271
+ - `localParams` : an object with params that you have in the local session for the user.
257
272
 
258
273
  ```javascript
259
274
  const tokens = await moneyhub.exchangeCodeForTokens({
@@ -281,7 +296,7 @@ Use this to get a client credentials access token.
281
296
  const tokens = await moneyhub.getClientCredentialTokens({
282
297
  scope: "the-required-scope",
283
298
  sub: "the user id", // optional
284
- })
299
+ });
285
300
  ```
286
301
 
287
302
  #### `refreshTokens`
@@ -291,7 +306,7 @@ Use this to get a new access token using a refresh token
291
306
  ```javascript
292
307
  const tokens = await moneyhub.refreshTokens({
293
308
  refreshToken: "refresh-token",
294
- })
309
+ });
295
310
  ```
296
311
 
297
312
  ### Auth Request URI
@@ -306,7 +321,7 @@ const tokens = await moneyhub.requestObject({
306
321
  state: "state",
307
322
  nonce: "nonce",
308
323
  claims: claimsObject,
309
- })
324
+ });
310
325
  ```
311
326
 
312
327
  #### `getRequestUri`
@@ -314,9 +329,7 @@ const tokens = await moneyhub.requestObject({
314
329
  Use this to create a request uri from a request object
315
330
 
316
331
  ```javascript
317
- const tokens = await moneyhub.getRequestUri(
318
- requestObject
319
- )
332
+ const requestUri = await moneyhub.getRequestUri(requestObject);
320
333
  ```
321
334
 
322
335
  #### `getAuthorizeUrlFromRequestUri`
@@ -324,9 +337,9 @@ const tokens = await moneyhub.getRequestUri(
324
337
  Use this to retrieve an authorization url from a request uri
325
338
 
326
339
  ```javascript
327
- const tokens = await moneyhub.getAuthorizeUrlFromRequestUri({
328
- requestUri: "request-uri"
329
- })
340
+ const url = await moneyhub.getAuthorizeUrlFromRequestUri({
341
+ requestUri: "request-uri",
342
+ });
330
343
  ```
331
344
 
332
345
  ### Auth Requests
@@ -339,10 +352,10 @@ Creates a connection auth request
339
352
  const tokens = await moneyhub.createAuthRequest({
340
353
  redirectUri: "redirect-uri",
341
354
  userId: "user-id",
342
- scope:"openid 1ffe704d39629a929c8e293880fb449a", // replace bank id with the bank you want to connect to
355
+ scope: "openid 1ffe704d39629a929c8e293880fb449a", // replace bank id with the bank you want to connect to
343
356
  categorisationType: "personal", // optional - defaults to personal
344
- permissions: ["ReadBeneficiariesDetail"] // optional - set of extra permissions to set for auth request
345
- })
357
+ permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth request
358
+ });
346
359
  ```
347
360
 
348
361
  Creates a reauth auth request
@@ -352,8 +365,8 @@ const tokens = await moneyhub.createAuthRequest({
352
365
  redirectUri: "redirect-uri",
353
366
  userId: "user-id",
354
367
  connectionId: "connection-id",
355
- scope:"openid reauth",
356
- })
368
+ scope: "openid reauth",
369
+ });
357
370
  ```
358
371
 
359
372
  Creates a refresh auth request
@@ -363,8 +376,8 @@ const tokens = await moneyhub.createAuthRequest({
363
376
  redirectUri: "redirect-uri",
364
377
  userId: "user-id",
365
378
  connectionId: "connection-id",
366
- scope:"openid refresh",
367
- })
379
+ scope: "openid refresh",
380
+ });
368
381
  ```
369
382
 
370
383
  Creates a payment auth request
@@ -374,14 +387,14 @@ const tokens = await moneyhub.createAuthRequest({
374
387
  redirectUri: "redirect-uri",
375
388
  userId: "user-id",
376
389
  connectionId: "connection-id",
377
- scope:"openid payment",
390
+ scope: "openid payment",
378
391
  payment: {
379
392
  payeeId: "payee-id",
380
393
  amount: 200,
381
394
  payeeRef: "Payee ref",
382
- payerRef: "Payer ref"
395
+ payerRef: "Payer ref",
383
396
  },
384
- })
397
+ });
385
398
  ```
386
399
 
387
400
  Creates a reverse payment auth request
@@ -391,11 +404,11 @@ const tokens = await moneyhub.createAuthRequest({
391
404
  redirectUri: "redirect-uri",
392
405
  userId: "user-id",
393
406
  connectionId: "connection-id",
394
- scope:"openid reverse_payment",
407
+ scope: "openid reverse_payment",
395
408
  reversePayment: {
396
- paymentId: "payment-id"
409
+ paymentId: "payment-id",
397
410
  },
398
- })
411
+ });
399
412
  ```
400
413
 
401
414
  #### `completeAuthRequest`
@@ -420,10 +433,11 @@ const tokens = await moneyhub.completeAuthRequest({
420
433
  id: "auth-request-id",
421
434
  authParams: {
422
435
  error: "error-code",
423
- "error_description": "error description"
424
- }
425
- })
436
+ error_description: "error description",
437
+ },
438
+ });
426
439
  ```
440
+
427
441
  #### `getAllAuthRequests`
428
442
 
429
443
  Retrieves auth requests
@@ -431,8 +445,8 @@ Retrieves auth requests
431
445
  ```javascript
432
446
  const tokens = await moneyhub.getAllAuthRequests({
433
447
  limit: 10, // optional
434
- offset: 0 // optional
435
- })
448
+ offset: 0, // optional
449
+ });
436
450
  ```
437
451
 
438
452
  #### `getAuthRequest`
@@ -441,8 +455,8 @@ Retrieve a single auth request
441
455
 
442
456
  ```javascript
443
457
  const tokens = await moneyhub.getAuthRequest({
444
- id: "auth-request-id"
445
- })
458
+ id: "auth-request-id",
459
+ });
446
460
  ```
447
461
 
448
462
  ### User Management
@@ -453,8 +467,8 @@ Helper method that gets the correct client credentials access token and then reg
453
467
 
454
468
  ```javascript
455
469
  const user = await moneyhub.registerUser({
456
- clientUserId: "your user id" // optional
457
- })
470
+ clientUserId: "your user id", // optional
471
+ });
458
472
  ```
459
473
 
460
474
  #### `getUsers`
@@ -465,8 +479,8 @@ Returns all the users registered for your api-client
465
479
  const users = await moneyhub.getUsers({
466
480
  limit,
467
481
  offset,
468
- isDemo
469
- })
482
+ isDemo,
483
+ });
470
484
  ```
471
485
 
472
486
  #### `getUser`
@@ -475,8 +489,8 @@ Get a single user by their id
475
489
 
476
490
  ```javascript
477
491
  const user = await moneyhub.getUser({
478
- userId: "user-id"
479
- })
492
+ userId: "user-id",
493
+ });
480
494
  ```
481
495
 
482
496
  #### `deleteUser`
@@ -485,11 +499,10 @@ Helper method that gets the correct client credentials access token and then del
485
499
 
486
500
  ```javascript
487
501
  const user = await moneyhub.deleteUser({
488
- userId: "user-id"}
489
- )
502
+ userId: "user-id",
503
+ });
490
504
  ```
491
505
 
492
-
493
506
  ### User Connections
494
507
 
495
508
  #### `getUserConnections`
@@ -498,8 +511,8 @@ Helper method that gets the correct client credentials access token and then get
498
511
 
499
512
  ```javascript
500
513
  const user = await moneyhub.getUserConnections({
501
- userId: "user-id"
502
- })
514
+ userId: "user-id",
515
+ });
503
516
  ```
504
517
 
505
518
  #### `syncUserConnection`
@@ -512,7 +525,7 @@ const tokens = await moneyhub.syncUserConnection({
512
525
  connectionId,
513
526
  customerIpAddress, // optional
514
527
  customerLastLoggedTime, // optional
515
- })
528
+ });
516
529
  ```
517
530
 
518
531
  #### `deleteUserConnection`
@@ -522,32 +535,46 @@ Helper method that gets the correct client credentials access token and then del
522
535
  ```javascript
523
536
  const user = await moneyhub.deleteUserConnection({
524
537
  userId: "user-id",
525
- connectionId: "connection-id"
526
- })
538
+ connectionId: "connection-id",
539
+ });
527
540
  ```
528
541
 
529
542
  #### `getConnectionSyncs`
530
543
 
531
544
  Retrieve the syncs for a given connection ID.
545
+
532
546
  ```javascript
533
547
  const syncs = await moneyhub.getConnectionSyncs({
534
548
  userId: "user-id",
535
549
  connectionId: "connection-id",
536
550
  params: {
537
551
  limit: 10,
538
- offset: 0
539
- }
540
- })
552
+ offset: 0,
553
+ },
554
+ });
541
555
  ```
542
556
 
543
557
  #### `getSync`
544
558
 
545
559
  Retrieve the syncs for the given sync ID.
560
+
546
561
  ```javascript
547
562
  const syncs = await moneyhub.getSync({
548
563
  userId: "user-id",
549
- syncId: "sync-id"
550
- })
564
+ syncId: "sync-id",
565
+ });
566
+ ```
567
+
568
+ #### `updateUserConnection`
569
+
570
+ Helper method that updates a connection. Requires scope `user:update`. Currently only the consent can be updated by updating the `expiresAt` field. This field should be a valid date-time ISO string and not be more than 90 days away. This method can only be used by those clients that have bypassed consent (the `Enforce user consent` option in the Admin Portal). If successful returns a 204.
571
+
572
+ ```javascript
573
+ const user = await moneyhub.updateUserConnection({
574
+ userId: "user-id",
575
+ connectionId: "connection-id",
576
+ expiresAt: "2022-06-26T09:43:16.318+00:00"
577
+ })
551
578
  ```
552
579
 
553
580
  ### Data API
@@ -557,11 +584,11 @@ const syncs = await moneyhub.getSync({
557
584
  Get all accounts for a user. This function uses the scope `accounts:read`.
558
585
 
559
586
  ```javascript
560
- const queryParams = {limit: 10, offset: 5}
587
+ const queryParams = { limit: 10, offset: 5 };
561
588
  const accounts = await moneyhub.getAccounts({
562
589
  userId: "userId",
563
590
  params: queryParams,
564
- })
591
+ });
565
592
  ```
566
593
 
567
594
  #### `getAccountsWithDetails`
@@ -569,11 +596,11 @@ const accounts = await moneyhub.getAccounts({
569
596
  Get all accounts for a user including extra details (sort code, account number, account holder name). This function uses the scopes `accounts:read accounts_details:read`.
570
597
 
571
598
  ```javascript
572
- const queryParams = {limit: 10, offset: 5}
599
+ const queryParams = { limit: 10, offset: 5 };
573
600
  const accounts = await moneyhub.getAccountsWithDetails({
574
601
  userId: "userId",
575
- params: queryParams
576
- })
602
+ params: queryParams,
603
+ });
577
604
  ```
578
605
 
579
606
  #### `getAccount`
@@ -583,8 +610,8 @@ Get a single account for a user by the accountId. This function uses the scope `
583
610
  ```javascript
584
611
  const account = await moneyhub.getAccount({
585
612
  userId: "userId",
586
- accountId: "accountId"
587
- })
613
+ accountId: "accountId",
614
+ });
588
615
  ```
589
616
 
590
617
  #### `getAccountWithDetails`
@@ -594,9 +621,9 @@ Get a single account for a user by the accountId including extra details (sort c
594
621
  ```javascript
595
622
  const account = await moneyhub.getAccountWithDetails({
596
623
  userId: "userId",
597
- accountId: "accountId"
598
- })
599
- ```
624
+ accountId: "accountId",
625
+ });
626
+ ```
600
627
 
601
628
  #### `getAccountBalances`
602
629
 
@@ -605,8 +632,8 @@ Get account balances for a user. This function uses the scope `accounts:read`.
605
632
  ```javascript
606
633
  const account = await moneyhub.getAccountBalances({
607
634
  userId: "userId",
608
- accountId: "accountId"
609
- })
635
+ accountId: "accountId",
636
+ });
610
637
  ```
611
638
 
612
639
  #### `getAccountHoldings`
@@ -616,8 +643,8 @@ Get account holdings for a user. This function uses the scope `accounts:read`.
616
643
  ```javascript
617
644
  const account = await moneyhub.getAccountHoldings({
618
645
  userId: "userId",
619
- accountId: "accountId"
620
- })
646
+ accountId: "accountId",
647
+ });
621
648
  ```
622
649
 
623
650
  #### `getAccountHoldingsWithMatches`
@@ -627,8 +654,8 @@ Get account holdings with ISIN codes matchers for a user. This function uses the
627
654
  ```javascript
628
655
  const account = await moneyhub.getAccountHoldingsWithMatches({
629
656
  userId: "userId",
630
- accountId: "accountId"
631
- })
657
+ accountId: "accountId",
658
+ });
632
659
  ```
633
660
 
634
661
  #### `getAccountHolding`
@@ -639,8 +666,8 @@ Get a single holding from a user's account. This function uses the scope `accoun
639
666
  const account = await moneyhub.getAccountHolding({
640
667
  userId: "userId",
641
668
  accountId: "accountId",
642
- holdingId: "holdingId"
643
- })
669
+ holdingId: "holdingId",
670
+ });
644
671
  ```
645
672
 
646
673
  #### `getAccountCounterparties`
@@ -650,8 +677,8 @@ Get account counterparties for a user. This function uses the scope `accounts:re
650
677
  ```javascript
651
678
  const account = await moneyhub.getAccountCounterparties({
652
679
  userId: "userId",
653
- accountId: "accountId"
654
- })
680
+ accountId: "accountId",
681
+ });
655
682
  ```
656
683
 
657
684
  #### `getAccountRecurringTransactions`
@@ -661,8 +688,8 @@ Get account recurring transactions for a user. This function uses the scope `acc
661
688
  ```javascript
662
689
  const account = await moneyhub.getAccountRecurringTransactions({
663
690
  userId: "userId",
664
- accountId: "accountId"
665
- })
691
+ accountId: "accountId",
692
+ });
666
693
  ```
667
694
 
668
695
  #### `getAccountStandingOrders`
@@ -672,8 +699,8 @@ Get the standing orders for an account. This function uses the scope `standing_o
672
699
  ```javascript
673
700
  const standingOrders = await moneyhub.getAccountStandingOrders({
674
701
  userId: "userId",
675
- accountId: "accountId"
676
- })
702
+ accountId: "accountId",
703
+ });
677
704
  ```
678
705
 
679
706
  #### `getAccountStandingOrdersWithDetail`
@@ -683,8 +710,8 @@ Get the standing orders with detail (payee information) for an account. This fun
683
710
  ```javascript
684
711
  const standingOrders = await moneyhub.getAccountStandingOrdersWithDetail({
685
712
  userId: "userId",
686
- accountId: "accountId"
687
- })
713
+ accountId: "accountId",
714
+ });
688
715
  ```
689
716
 
690
717
  #### `createAccount`
@@ -702,11 +729,11 @@ const account = await moneyhub.createAccount({
702
729
  balance: {
703
730
  date: "2018-08-12",
704
731
  amount: {
705
- value: 300023
706
- }
707
- }
708
- }
709
- })
732
+ value: 300023,
733
+ },
734
+ },
735
+ },
736
+ });
710
737
  ```
711
738
 
712
739
  #### `deleteAccount`
@@ -716,8 +743,8 @@ Delete a manual account for a user. This function uses the scope `accounts:write
716
743
  ```javascript
717
744
  const result = await moneyhub.deleteAccount({
718
745
  userId: "userId",
719
- accountId: "accountId"
720
- })
746
+ accountId: "accountId",
747
+ });
721
748
  ```
722
749
 
723
750
  #### `getTransactions`
@@ -725,11 +752,11 @@ const result = await moneyhub.deleteAccount({
725
752
  Get all transactions for a user. This function uses the scope `transactions:read:all`..
726
753
 
727
754
  ```javascript
728
- const queryParams = {limit: 10, offset: 5}
755
+ const queryParams = { limit: 10, offset: 5 };
729
756
  const transactions = await moneyhub.getTransactions({
730
757
  userId: "userId",
731
- params: queryParams
732
- })
758
+ params: queryParams,
759
+ });
733
760
  ```
734
761
 
735
762
  #### `getTransaction`
@@ -739,8 +766,8 @@ Get a transaction by ID for a user. This function uses the scope `transactions:r
739
766
  ```javascript
740
767
  const transactions = await moneyhub.getTransaction({
741
768
  userId: "userId",
742
- transactionId: "transactionId"
743
- })
769
+ transactionId: "transactionId",
770
+ });
744
771
  ```
745
772
 
746
773
  #### `updateTransaction`
@@ -753,10 +780,10 @@ const transactions = await moneyhub.updateTransaction({
753
780
  transactionId: "transactionId",
754
781
  transaction: {
755
782
  amount: {
756
- value: 10
757
- }
758
- }
759
- })
783
+ value: 10,
784
+ },
785
+ },
786
+ });
760
787
  ```
761
788
 
762
789
  #### `addTransaction`
@@ -768,10 +795,10 @@ const transactions = await moneyhub.addTransaction({
768
795
  userId: "userId",
769
796
  transaction: {
770
797
  amount: {
771
- value: 10
772
- }
773
- }
774
- })
798
+ value: 10,
799
+ },
800
+ },
801
+ });
775
802
  ```
776
803
 
777
804
  #### `addTransactions`
@@ -784,19 +811,19 @@ const transactions = await moneyhub.addTransactions({
784
811
  transactions: [
785
812
  {
786
813
  amount: {
787
- value: 10
788
- }
814
+ value: 10,
815
+ },
789
816
  },
790
817
  {
791
818
  amount: {
792
- value: 25
793
- }
794
- }
819
+ value: 25,
820
+ },
821
+ },
795
822
  ],
796
823
  params: {
797
- categorise: true // optional - enable categorisatio for transactions
798
- }
799
- })
824
+ categorise: true, // optional - enable categorisatio for transactions
825
+ },
826
+ });
800
827
  ```
801
828
 
802
829
  #### `deleteTransaction`
@@ -806,8 +833,8 @@ Delete a transaction for a user. This function uses the scopes `transactions:wri
806
833
  ```javascript
807
834
  const result = await moneyhub.deleteTransaction({
808
835
  userId: "userId",
809
- id: "transactionId"
810
- })
836
+ id: "transactionId",
837
+ });
811
838
  ```
812
839
 
813
840
  #### `getBeneficiaries`
@@ -815,11 +842,11 @@ const result = await moneyhub.deleteTransaction({
815
842
  Get all beneficiaries for a user. This function uses the scope `beneficiaries:read`
816
843
 
817
844
  ```javascript
818
- const queryParams = {limit: 10, offset: 5}
845
+ const queryParams = { limit: 10, offset: 5 };
819
846
  const beneficiaries = await moneyhub.getBeneficiaries({
820
847
  userId: "userId",
821
- params: queryParams
822
- })
848
+ params: queryParams,
849
+ });
823
850
  ```
824
851
 
825
852
  #### `getBeneficiariesWithDetail`
@@ -827,11 +854,11 @@ const beneficiaries = await moneyhub.getBeneficiaries({
827
854
  Get all beneficiaries for a user, including beneficiary detail. This function uses the scope `beneficiaries_detail:read`
828
855
 
829
856
  ```javascript
830
- const queryParams = {limit: 10, offset: 5}
857
+ const queryParams = { limit: 10, offset: 5 };
831
858
  const beneficiaries = await moneyhub.getBeneficiariesWithDetail({
832
859
  userId: "userId",
833
- params: queryParams
834
- })
860
+ params: queryParams,
861
+ });
835
862
  ```
836
863
 
837
864
  #### `getBeneficiary`
@@ -841,8 +868,8 @@ Get a beneficiary for a user. This function uses the scope `beneficiaries:read`
841
868
  ```javascript
842
869
  const beneficiary = await moneyhub.getBeneficiary({
843
870
  userId: "userId",
844
- id: "beneficiaryId"
845
- })
871
+ id: "beneficiaryId",
872
+ });
846
873
  ```
847
874
 
848
875
  #### `getBeneficiaryWithDetail`
@@ -852,8 +879,8 @@ Get a beneficiary for a user, including beneficiary detail. This function uses t
852
879
  ```javascript
853
880
  const beneficiary = await moneyhub.getBeneficiaryWithDetail({
854
881
  userId: "userId",
855
- id: "beneficiaryId"
856
- })
882
+ id: "beneficiaryId",
883
+ });
857
884
  ```
858
885
 
859
886
  #### `addFileToTransaction`
@@ -862,11 +889,11 @@ Add an attachment to a transaction. This call requires an access token with a sc
862
889
 
863
890
  ```javascript
864
891
  const file = await money.addFileToTransaction({
865
- userId: "userId" ,
892
+ userId: "userId",
866
893
  transactionId: "transactionId",
867
894
  fileName: "file-name",
868
895
  fileData: fs.createReadStream("path/to/file.png"),
869
- })
896
+ });
870
897
  ```
871
898
 
872
899
  #### `getTransactionFiles`
@@ -875,9 +902,9 @@ Get all attachments associated with a transaction. This call requires an access
875
902
 
876
903
  ```javascript
877
904
  const files = await money.getTransactionFiles({
878
- userId: "userId" ,
905
+ userId: "userId",
879
906
  transactionId: "transactionId",
880
- })
907
+ });
881
908
  ```
882
909
 
883
910
  #### `getTransactionFile`
@@ -886,10 +913,10 @@ Get an attachment associated with a transaction. This call requires an access to
886
913
 
887
914
  ```javascript
888
915
  const files = await money.getTransactionFile({
889
- userId: "userId" ,
916
+ userId: "userId",
890
917
  transactionId: "transactionId",
891
918
  fileId: "fileId",
892
- })
919
+ });
893
920
  ```
894
921
 
895
922
  #### `deleteTransactionFile`
@@ -898,61 +925,69 @@ Delete an attachment associated with a transaction. This call requires an access
898
925
 
899
926
  ```javascript
900
927
  await money.deleteTransactionFile({
901
- userId: "userId" ,
928
+ userId: "userId",
902
929
  transactionId: "transactionId",
903
930
  fileId: "fileId",
904
- })
931
+ });
905
932
  ```
906
933
 
907
934
  #### `splitTransaction`
935
+
908
936
  Split up a transaction into different categories and/or projects.
937
+
909
938
  ```javascript
910
939
  const splits = await moneyhub.splitTransaction({
911
- userId: "userId",
912
- transactionId: "transactionId",
913
- splits: [
914
- {
915
- "categoryId": "std:5a7ff1f3-cd2c-4676-a368-caf09f2ca35a",
916
- "description": "Split 1",
917
- "amount": -6000
918
- },
919
- {
920
- "categoryId": "std:eac238ec-3899-49ff-8cce-e3b9f4b1aede",
921
- "description": "Split 2",
922
- "amount": -4000
923
- }
924
- ]
925
- })
940
+ userId: "userId",
941
+ transactionId: "transactionId",
942
+ splits: [
943
+ {
944
+ categoryId: "std:5a7ff1f3-cd2c-4676-a368-caf09f2ca35a",
945
+ description: "Split 1",
946
+ amount: -6000,
947
+ },
948
+ {
949
+ categoryId: "std:eac238ec-3899-49ff-8cce-e3b9f4b1aede",
950
+ description: "Split 2",
951
+ amount: -4000,
952
+ },
953
+ ],
954
+ });
926
955
  ```
927
956
 
928
957
  #### `getTransactionSplits`
958
+
929
959
  Get a transactions splits.
960
+
930
961
  ```javascript
931
962
  const splits = await moneyhub.getTransactionSplits({
932
- userId: "userId",
933
- transactionId: "transactionId"
934
- })
963
+ userId: "userId",
964
+ transactionId: "transactionId",
965
+ });
935
966
  ```
936
967
 
937
968
  #### `patchTransactionSplit`
969
+
938
970
  Update a transaction's split's description, categoryId or projectId.
971
+
939
972
  ```javascript
940
973
  const splits = await moneyhub.patchTransactionSplit({
941
- userId: "userId",
942
- transactionId: "transactionId",
943
- split: {
944
- description: "New description"
945
- }
946
- })
974
+ userId: "userId",
975
+ transactionId: "transactionId",
976
+ split: {
977
+ description: "New description",
978
+ },
979
+ });
947
980
  ```
948
981
 
949
982
  #### `deleteTransactionSplits`
983
+
950
984
  Delete a transaction's splits and merge them back together.
985
+
951
986
  ```javascript
952
987
  const splits = await moneyhub.deleteTransactionSplits({
953
- userId: "userId",
954
- transactionId: "transactionId"
955
- })
988
+ userId: "userId",
989
+ transactionId: "transactionId",
990
+ });
956
991
  ```
957
992
 
958
993
  #### `getGlobalCounterparties`
@@ -960,23 +995,20 @@ const splits = await moneyhub.deleteTransactionSplits({
960
995
  Get global counterparties.
961
996
 
962
997
  ```javascript
963
-
964
- const accounts = await moneyhub.getGlobalCounterparties()
998
+ const accounts = await moneyhub.getGlobalCounterparties();
965
999
  ```
966
1000
 
967
-
968
1001
  #### `getCategories`
969
1002
 
970
1003
  Get all categories for a user. This function uses the scope `categories:read`.
971
1004
 
972
1005
  ```javascript
973
-
974
1006
  const categories = await moneyhub.getCategories({
975
1007
  userId: "userId",
976
1008
  params: {
977
- type: "personal" // optional personal|business
978
- },
979
- })
1009
+ type: "personal", // optional personal|business
1010
+ },
1011
+ });
980
1012
  ```
981
1013
 
982
1014
  #### `getCategory`
@@ -986,8 +1018,8 @@ Get a single category for a user. This function uses the scope `categories:read`
986
1018
  ```javascript
987
1019
  const category = await moneyhub.getCategory({
988
1020
  userId: "userId",
989
- categoryId: "categoryId"
990
- })
1021
+ categoryId: "categoryId",
1022
+ });
991
1023
  ```
992
1024
 
993
1025
  #### `getCategoryGroups`
@@ -995,13 +1027,12 @@ const category = await moneyhub.getCategory({
995
1027
  Get all category groups for a user. This function uses the scope `categories:read`.
996
1028
 
997
1029
  ```javascript
998
-
999
1030
  const categoryGroups = await moneyhub.getCategoryGroups({
1000
1031
  userId: "userId",
1001
1032
  params: {
1002
- type: "personal" // optional personal|business
1003
- },
1004
- })
1033
+ type: "personal", // optional personal|business
1034
+ },
1035
+ });
1005
1036
  ```
1006
1037
 
1007
1038
  #### `getStandardCategories`
@@ -1009,12 +1040,11 @@ const categoryGroups = await moneyhub.getCategoryGroups({
1009
1040
  Get standard categories.
1010
1041
 
1011
1042
  ```javascript
1012
-
1013
1043
  const categories = await moneyhub.getStandardCategories({
1014
1044
  params: {
1015
- type: "personal" // optional personal|business|all
1016
- },
1017
- })
1045
+ type: "personal", // optional personal|business|all
1046
+ },
1047
+ });
1018
1048
  ```
1019
1049
 
1020
1050
  #### `getStandardCategoryGroups`
@@ -1022,13 +1052,13 @@ const categories = await moneyhub.getStandardCategories({
1022
1052
  Get standard categories.
1023
1053
 
1024
1054
  ```javascript
1025
-
1026
1055
  const categoryGroups = await moneyhub.getStandardCategoryGroups({
1027
1056
  params: {
1028
- type: "personal" // optional personal|business|all
1029
- },
1030
- })
1057
+ type: "personal", // optional personal|business|all
1058
+ },
1059
+ });
1031
1060
  ```
1061
+
1032
1062
  #### `createCustomCategory`
1033
1063
 
1034
1064
  Create a custom category. This function uses the scopes `categories:read categories:write`.
@@ -1044,6 +1074,32 @@ const category = await moneyhub.createCustomCategory({
1044
1074
  })
1045
1075
  ```
1046
1076
 
1077
+ ### Spending analysis
1078
+
1079
+ #### `getSpendingAnalysis`
1080
+
1081
+ This method returns the spending analysis for the given dates. This function uses the scope `spending_analysis:read`
1082
+
1083
+ ```javascript
1084
+ const projects = await moneyhub.getSpendingAnalysis({
1085
+ userId: "userId",
1086
+ dates: [
1087
+ {
1088
+ name: "currentMonth",
1089
+ from: "2018-10-01",
1090
+ to: "2018-10-31",
1091
+ },
1092
+ {
1093
+ name: "previousMonth",
1094
+ from: "2018-09-01",
1095
+ to: "2018-09-30",
1096
+ },
1097
+ ],
1098
+ accountIds: ["ac9bd177-d01e-449c-9f29-d3656d2edc2e"], // optional
1099
+ categoryIds: ["std:338d2636-7f88-491d-8129-255c98da1eb8"], // optional
1100
+ });
1101
+ ```
1102
+
1047
1103
  ### Projects
1048
1104
 
1049
1105
  #### `getProjects`
@@ -1051,13 +1107,13 @@ const category = await moneyhub.createCustomCategory({
1051
1107
  This method returns a list of projects. This function uses the scope `projects:read`
1052
1108
 
1053
1109
  ```javascript
1054
- const projects = await moneyhub.getProjects({x
1110
+ const projects = await moneyhub.getProjects({
1055
1111
  userId: "userId",
1056
1112
  params: {
1057
1113
  limit: "limit", // optional
1058
1114
  offset: "offset", // optional
1059
- } // optional
1060
- })
1115
+ }, // optional
1116
+ });
1061
1117
  ```
1062
1118
 
1063
1119
  #### `getProject`
@@ -1067,8 +1123,8 @@ Get a single project for a user by the projectId. This function uses the scope `
1067
1123
  ```javascript
1068
1124
  const project = await moneyhub.getProject({
1069
1125
  userId: "userId",
1070
- projectId: "projectId"
1071
- })
1126
+ projectId: "projectId",
1127
+ });
1072
1128
  ```
1073
1129
 
1074
1130
  #### `addProject`
@@ -1082,8 +1138,8 @@ const project = await moneyhub.addProject({
1082
1138
  name: "Project Name",
1083
1139
  accountIds: "id1,id2", // comma-separated list of account IDs
1084
1140
  type: "PropertyProject",
1085
- }
1086
- })
1141
+ },
1142
+ });
1087
1143
  ```
1088
1144
 
1089
1145
  #### `updateProject`
@@ -1099,23 +1155,25 @@ const project = await moneyhub.updateProject({
1099
1155
  accountIds: "id1,id2", // comma-separated list of account IDs
1100
1156
  type: "PropertyProject",
1101
1157
  archived: false,
1102
- }
1103
- })
1158
+ },
1159
+ });
1104
1160
  ```
1105
1161
 
1106
1162
  #### `deleteProject`
1163
+
1107
1164
  Delete a project for a user given a project ID. This function uses the scope `projects.delete`.
1108
1165
 
1109
1166
  ```javascript
1110
1167
  const result = await moneyhub.deleteProject({
1111
1168
  userId: "userId",
1112
- projectId: "projectId"
1113
- })
1169
+ projectId: "projectId",
1170
+ });
1114
1171
  ```
1115
1172
 
1116
1173
  ### Tax Return
1117
1174
 
1118
1175
  #### `getTaxReturn`
1176
+
1119
1177
  Get a tax return object for a subset of transactions. This makes use of the `enhancedCategories` on transactions. This functions uses the scope `tax:read`
1120
1178
 
1121
1179
  ```javascript
@@ -1126,11 +1184,10 @@ const result = await moneyhub.getTaxReturn({
1126
1184
  endDate: "2020-02-01",
1127
1185
  accountId: "accountId",
1128
1186
  projectId: "projectId",
1129
- }
1130
- })
1187
+ },
1188
+ });
1131
1189
  ```
1132
1190
 
1133
-
1134
1191
  ### Payments
1135
1192
 
1136
1193
  #### `getPaymentAuthorizeUrl`
@@ -1154,10 +1211,10 @@ const url = await moneyhub.getPaymentAuthorizeUrl({
1154
1211
  context: "Payment context [Other,BillPayment,PartyToParty]", // optional - defaults to PartyToParty
1155
1212
  userId: "Moneyhub API User ID you wish to attach to the payment", // optional
1156
1213
  claims: claimsObject, // optional
1157
- })
1214
+ });
1158
1215
 
1159
1216
  // Scope used with the bankId provided
1160
- const scope = `payment openid id:${bankId}`
1217
+ const scope = `payment openid id:${bankId}`;
1161
1218
 
1162
1219
  // Default claims if none are provided
1163
1220
  const defaultClaims = {
@@ -1180,7 +1237,7 @@ const defaultClaims = {
1180
1237
  },
1181
1238
  },
1182
1239
  },
1183
- }
1240
+ };
1184
1241
  ```
1185
1242
 
1186
1243
  #### `getReversePaymentAuthorizeUrl`
@@ -1230,7 +1287,7 @@ const payee = await moneyhub.addPayee({
1230
1287
  sortCode: "your sort code",
1231
1288
  name: "name of Payee",
1232
1289
  externalId: "your external id",
1233
- })
1290
+ });
1234
1291
  ```
1235
1292
 
1236
1293
  #### `getPayees`
@@ -1241,7 +1298,7 @@ This method returns a list of registered payees. This function uses the scope `p
1241
1298
  const payees = await moneyhub.getPayees({
1242
1299
  limit: "limit", // optional
1243
1300
  offset: "offset", // optional
1244
- })
1301
+ });
1245
1302
  ```
1246
1303
 
1247
1304
  #### `getPayments`
@@ -1256,7 +1313,7 @@ const payments = await moneyhub.getPayments({
1256
1313
  payeeId: "payee-id", // optional
1257
1314
  startDate: "2020-01-01", // optional
1258
1315
  endDate: "2020-12-31", // optional
1259
- })
1316
+ });
1260
1317
  ```
1261
1318
 
1262
1319
  #### `getPayment`
@@ -1266,7 +1323,7 @@ Get a single payment by its id . This function uses the scope `payment:read`
1266
1323
  ```javascript
1267
1324
  const paymentData = await moneyhub.getPayment({
1268
1325
  id: "payment-id",
1269
- })
1326
+ });
1270
1327
  ```
1271
1328
 
1272
1329
  #### `getPaymentFromIDToken`
@@ -1276,8 +1333,8 @@ you will receive back an ID Token that contains the payment id. This is a utilit
1276
1333
 
1277
1334
  ```javascript
1278
1335
  const paymentData = await moneyhub.getPaymentFromIDToken({
1279
- idToken: "eyJhbGciOiJSUz..."
1280
- })
1336
+ idToken: "eyJhbGciOiJSUz...",
1337
+ });
1281
1338
  ```
1282
1339
 
1283
1340
  ### Standing Orders
@@ -1359,7 +1416,7 @@ const standingOrders = await moneyhub.getStandingOrders({
1359
1416
  payeeId: "payee-id", // optional
1360
1417
  startDate: "2020-01-01", // optional
1361
1418
  endDate: "2020-12-31", // optional
1362
- })
1419
+ });
1363
1420
  ```
1364
1421
 
1365
1422
  #### `getStandingOrder`
@@ -1369,7 +1426,7 @@ Get a single standing order request by its id. This function uses the scope `pay
1369
1426
  ```javascript
1370
1427
  const standingOrder = await moneyhub.getStandingOrder({
1371
1428
  id: "standing-order-id",
1372
- })
1429
+ });
1373
1430
  ```
1374
1431
 
1375
1432
  ### Recurring Payments (VRP)
@@ -1386,7 +1443,7 @@ const url = await moneyhub.getRecurringPaymentAuthorizeUrl({
1386
1443
  payerId: "Id of payer", // requird only if payerType is defined
1387
1444
  payerType: "Payer type [mh-user-account]", // required only if payerId is used
1388
1445
  reference: "The reference for recurring payment",
1389
- validFromDate: "The date from which the authorisation is effective" , // should be in an international format, e.g. 15-MAR-2021 or ISO date
1446
+ validFromDate: "The date from which the authorisation is effective", // should be in an international format, e.g. 15-MAR-2021 or ISO date
1390
1447
  validToDate: "The date to which the authorisation is effective", // should be in an international format, e.g. 15-MAR-2021 or ISO date
1391
1448
  maximumIndividualAmount: "The maimum single amount that will be allowed", // the valid in whole minor units (i.e. pence)
1392
1449
  currency: "The currency code for the maxiumum recurring payment amount [GBP]",
@@ -1394,22 +1451,24 @@ const url = await moneyhub.getRecurringPaymentAuthorizeUrl({
1394
1451
  {
1395
1452
  amount: "The maximum amount for this recurring payment limit", // the valid in whole minor units (i.e. pence)
1396
1453
  currency: "The currency code for this recurring payment limit [GBP]",
1397
- periodType: "The period over which the limit is effective [Day, Week, Fortnight, Month, Half-year, Year]",
1398
- periodAlignment: "Specifies whether the period starts on the date of consent creation or lines up with a calendar [Consent, Calendar]",
1399
- }
1454
+ periodType:
1455
+ "The period over which the limit is effective [Day, Week, Fortnight, Month, Half-year, Year]",
1456
+ periodAlignment:
1457
+ "Specifies whether the period starts on the date of consent creation or lines up with a calendar [Consent, Calendar]",
1458
+ },
1400
1459
  ],
1401
- type: [
1460
+ type: [
1402
1461
  "Sweeping", // Specifies that the recurring payment is for the purpose of sweeping payments
1403
- "Other" // Specifies that the recurring payment is for other payments of another purpose
1462
+ "Other", // Specifies that the recurring payment is for other payments of another purpose
1404
1463
  ],
1405
1464
  context: "Payment context [Other,BillPayment,PartyToParty]", // optional - defaults to PartyToParty
1406
1465
  state: "your state value",
1407
1466
  nonce: "your nonce value", // optional
1408
1467
  claims: claimsObject, // optional
1409
- })
1468
+ });
1410
1469
 
1411
1470
  // Scope used with the bankId provided
1412
- const scope = `recurring_payment:create openid id:${bankId}`
1471
+ const scope = `recurring_payment:create openid id:${bankId}`;
1413
1472
 
1414
1473
  // Default claims if none are provided
1415
1474
  const defaultClaims = {
@@ -1434,7 +1493,7 @@ const defaultClaims = {
1434
1493
  },
1435
1494
  },
1436
1495
  },
1437
- }
1496
+ };
1438
1497
  ```
1439
1498
 
1440
1499
  #### `getRecurringPayments`
@@ -1449,7 +1508,7 @@ const recurringPayments = await moneyhub.getRecurringPayments({
1449
1508
  payeeId: "payee-id", // optional
1450
1509
  startDate: "2020-01-01", // optional
1451
1510
  endDate: "2020-12-31", // optional
1452
- })
1511
+ });
1453
1512
  ```
1454
1513
 
1455
1514
  #### `getRecurringPayment`
@@ -1458,8 +1517,8 @@ This method gets a recurring payment consent. This function uses the scope `recu
1458
1517
 
1459
1518
  ```javascript
1460
1519
  const recurringPayment = await moneyhub.getRecurringPayment({
1461
- recurringPaymentId: "Id of the recurring payment consent"
1462
- })
1520
+ recurringPaymentId: "Id of the recurring payment consent",
1521
+ });
1463
1522
  ```
1464
1523
 
1465
1524
  #### `makeRecurringPayment`
@@ -1473,9 +1532,9 @@ const recurringPayments = await moneyhub.getRecurringPayments({
1473
1532
  payeeId: "payee-id", // optional
1474
1533
  amount: 200,
1475
1534
  payeeRef: "Payee ref",
1476
- payerRef: "Payer ref"
1477
- }
1478
- })
1535
+ payerRef: "Payer ref",
1536
+ },
1537
+ });
1479
1538
  ```
1480
1539
 
1481
1540
  #### `revokeRecurringPayment`
@@ -1484,8 +1543,8 @@ This method revokes a recurring payment consent. This function uses the scope `r
1484
1543
 
1485
1544
  ```javascript
1486
1545
  const revokedRecurringPayment = await moneyhub.revokeRecurringPayment({
1487
- recurringPaymentId: "Id of the recurring payment consent"
1488
- })
1546
+ recurringPaymentId: "Id of the recurring payment consent",
1547
+ });
1489
1548
  ```
1490
1549
 
1491
1550
  #### `getRegularTransactions`
@@ -1493,11 +1552,11 @@ const revokedRecurringPayment = await moneyhub.revokeRecurringPayment({
1493
1552
  Get all the regular transactions for a user, there is an option to pass an account ID as a parameter as a filter. This function uses the scope `accounts:read`, `transactions:read:all` and `regular_transactions:read`
1494
1553
 
1495
1554
  ```javascript
1496
- const queryParams = {accountID}
1555
+ const queryParams = { accountID };
1497
1556
  const regulartransactions = await moneyhub.getRegularTransactions({
1498
1557
  userId: "userId",
1499
1558
  params: queryParams,
1500
- })
1559
+ });
1501
1560
  ```
1502
1561
 
1503
1562
  ### Rental records
@@ -1508,9 +1567,9 @@ This method will return the rental record for the user. Requires the scope `rent
1508
1567
 
1509
1568
  ```javascript
1510
1569
  const getRentalRecordResponse = await moneyhub.getRentalRecords({
1511
- userId: "user-id"
1512
- })
1513
- const rentalRecord = getRentalRecordResponse.data[0]
1570
+ userId: "user-id",
1571
+ });
1572
+ const rentalRecord = getRentalRecordResponse.data[0];
1514
1573
  ```
1515
1574
 
1516
1575
  #### `createRentalRecord`
@@ -1532,12 +1591,12 @@ const createRentalRecordResponse = await moneyhub.createRentalRecord({
1532
1591
  postalCode: "CA12345",
1533
1592
  tenancyStartDate: "2020-11-19",
1534
1593
  rentalAmount: {
1535
- value: 10000
1594
+ value: 10000,
1536
1595
  },
1537
1596
  rentalFrequency: "monthly",
1538
- }
1539
- })
1540
- const createdRentalRecord = createRentalRecordResponse.data
1597
+ },
1598
+ });
1599
+ const createdRentalRecord = createRentalRecordResponse.data;
1541
1600
  ```
1542
1601
 
1543
1602
  #### `deleteRentalRecord`
@@ -1547,8 +1606,138 @@ This method deletes the rental record for a user.
1547
1606
  ```javascript
1548
1607
  await moneyhub.deleteRentalRecord({
1549
1608
  userId: "user-id",
1550
- rentalId: "rental-id"
1551
- })
1609
+ rentalId: "rental-id",
1610
+ });
1611
+ ```
1612
+
1613
+ ### Spending Goals
1614
+
1615
+ #### `createSpendingGoal`
1616
+
1617
+ This method will create a single spending goal for the user. Requires the scopes`spending_goals:read` and `spending_goals:write:all`.
1618
+
1619
+ ```javascript
1620
+ const spendingGoal = await moneyhub.createSpendingGoal({
1621
+ categoryId: "std:all",
1622
+ amount: { value: 200 },
1623
+ periodStart: "20",
1624
+ periodType: "monthly",
1625
+ userId: "user-id",
1626
+ });
1627
+ ```
1628
+
1629
+ #### `getSpendingGoals`
1630
+
1631
+ This method will return the spending goals for the user. Requires the scope `spending_goals:read`.
1632
+
1633
+ ```javascript
1634
+ const spendingGoals = await moneyhub.getSpendingGoals({
1635
+ userId: "user-id",
1636
+ limit: 1,
1637
+ offset: 0,
1638
+ });
1639
+ const spendingGoal = spendingGoals.data[0];
1640
+ ```
1641
+
1642
+ #### `getSpendingGoal`
1643
+
1644
+ This method will return the specified spending goal for the user. Requires the scope `spending_goals:read`.
1645
+
1646
+ ```javascript
1647
+ const spendingGoals = await moneyhub.getSpendingGoal({
1648
+ userId: "user-id",
1649
+ goalId: "goal-id",
1650
+ });
1651
+ ```
1652
+
1653
+ #### `updateSpendingGoal`
1654
+
1655
+ This method will update the specified spending goal for the user. Requires the scopes `spending_goals:read` and `spending_goals:write`.
1656
+
1657
+ ```javascript
1658
+ const spendingGoals = await moneyhub.updateSpendingGoal({
1659
+ userId: "user-id",
1660
+ goalId: "goal-id",
1661
+ categoryId: "id",
1662
+ amount: { value: 302 },
1663
+ });
1664
+ ```
1665
+
1666
+ #### `deleteSpendingGoal`
1667
+
1668
+ This method will delete the specified spending goal for the user. Requires the scope `spending_goals:write:all`.
1669
+
1670
+ ```javascript
1671
+ const spendingGoals = await moneyhub.deleteSpendingGoal({
1672
+ userId: "user-id",
1673
+ goalId: "goal-id",
1674
+ });
1675
+ ```
1676
+
1677
+ ### Savings Goals
1678
+
1679
+ #### `createSavingsGoal`
1680
+
1681
+ This method will create a single savings goal for the user. Requires the scopes`savings_goals:read` and `savings_goals:write:all`.
1682
+
1683
+ ```javascript
1684
+ const savingsGoal = await moneyhub.createSavingsGoal({
1685
+ name: "savings",
1686
+ amount: { value: 200 },
1687
+ imageUrl: "https://myimage.com",
1688
+ notes: "lots'o'money",
1689
+ userId: "user-id",
1690
+ accounts: [{ id: "1234" }],
1691
+ });
1692
+ ```
1693
+
1694
+ #### `getSavingsGoals`
1695
+
1696
+ This method will return the savings goals for the user. Requires the scope `savings_goals:read`.
1697
+
1698
+ ```javascript
1699
+ const savingsGoals = await moneyhub.getSavingsGoals({
1700
+ userId: "user-id",
1701
+ limit: 1,
1702
+ offset: 0,
1703
+ });
1704
+ const savingsGoal = savingsGoals.data[0];
1705
+ ```
1706
+
1707
+ #### `getSavingsGoal`
1708
+
1709
+ This method will return the specified savings goal for the user. Requires the scope `savings_goals:read`.
1710
+
1711
+ ```javascript
1712
+ const savingsGoals = await moneyhub.getSavingsGoal({
1713
+ userId: "user-id",
1714
+ goalId: "goal-id",
1715
+ });
1716
+ ```
1717
+
1718
+ #### `updateSavingsGoal`
1719
+
1720
+ This method will update the specified savings goal for the user. Requires the scopes `savings_goals:read` and `savings_goals:write`.
1721
+
1722
+ ```javascript
1723
+ const savingsGoals = await moneyhub.updateSavingsGoal({
1724
+ userId: "user-id",
1725
+ goalId: "goal-id",
1726
+ name: "new-name",
1727
+ amount: { value: 302 },
1728
+ accounts: [{ id: "1234" }],
1729
+ });
1730
+ ```
1731
+
1732
+ #### `deleteSavingsGoal`
1733
+
1734
+ This method will delete the specified savings goal for the user. Requires the scope `savings_goals:write:all`.
1735
+
1736
+ ```javascript
1737
+ const savingsGoals = await moneyhub.deleteSavingsGoal({
1738
+ userId: "user-id",
1739
+ goalId: "goal-id",
1740
+ });
1552
1741
  ```
1553
1742
 
1554
1743
  ### Financial Connections
@@ -1558,7 +1747,7 @@ await moneyhub.deleteRentalRecord({
1558
1747
  This method will resolve with a list of all the available connections (banks, etc.) that a user can connect to.
1559
1748
 
1560
1749
  ```javascript
1561
- const availableConnections = await moneyhub.listConnections()
1750
+ const availableConnections = await moneyhub.listConnections();
1562
1751
  ```
1563
1752
 
1564
1753
  #### `listAPIConnections`
@@ -1566,7 +1755,7 @@ const availableConnections = await moneyhub.listConnections()
1566
1755
  This method will resolve with a list of all the API connections that a user can connect to.
1567
1756
 
1568
1757
  ```javascript
1569
- const availableConnections = await moneyhub.listAPIConnections()
1758
+ const availableConnections = await moneyhub.listAPIConnections();
1570
1759
  ```
1571
1760
 
1572
1761
  #### `listTestConnections`
@@ -1574,7 +1763,15 @@ const availableConnections = await moneyhub.listAPIConnections()
1574
1763
  This method will resolve with a list of all the Test connections that a user can connect to.
1575
1764
 
1576
1765
  ```javascript
1577
- const availableConnections = await moneyhub.listTestConnections()
1766
+ const availableConnections = await moneyhub.listTestConnections();
1767
+ ```
1768
+
1769
+ #### `listBetaConnections`
1770
+
1771
+ This method will resolve with a list of all the Beta connections that a user can connect to.
1772
+
1773
+ ```javascript
1774
+ const availableConnections = await moneyhub.listBetaConnections();
1578
1775
  ```
1579
1776
 
1580
1777
  ### OpenID Config
@@ -1584,14 +1781,28 @@ const availableConnections = await moneyhub.listTestConnections()
1584
1781
  This method will resolve with our open id configuration.
1585
1782
 
1586
1783
  ```javascript
1587
- const availableConnections = await moneyhub.getOpenIdConfig()
1784
+ const availableConnections = await moneyhub.getOpenIdConfig();
1588
1785
  ```
1589
1786
 
1590
-
1591
1787
  ### Examples
1592
1788
 
1593
- We have a couple of examples under the `/examples` folder that can be helpful to start using our client.
1789
+ We have a couple of examples under the `/examples` folder that can be helpful to start using our client. To run them, you'll need to use `ts-node`. If you haven't got it globally installed, you can run examples by executing within the library `npm run ts-node -- <script path here> <options>`
1594
1790
 
1595
1791
  ### Running Tests
1596
1792
 
1597
1793
  Instructions on how to run the integration tests for the API client can be found [here](https://www.notion.so/moneyhub/Moneyhub-API-Client-Tests-Config-0bef6e3cb922425b88f0268c1a999917)
1794
+
1795
+ ## TypeScript
1796
+ If you wish to use the client library with TypeScript, we allow you to make use of the types that are returned from our methods. Below is an example usage to get started:
1797
+
1798
+ ```ts
1799
+ import {Moneyhub, ApiClientConfig} from "@mft/moneyhub-api-client"
1800
+ const config: ApiClientConfig = {} // your config goes here and is strongly typed
1801
+
1802
+ const getAccounts = ({userId}) => {
1803
+ const moneyhub = await Moneyhub(config)
1804
+ const accounts = await moneyhub.getAccounts({userId})
1805
+ }
1806
+ ```
1807
+
1808
+ The default export is of the Moneyhub constructor that takes in an argument of the config. You can use `ApiClientConfig` to type that config. The client object that is returned from the constructor can then be used to make API calls. The methods are available with arguments and returns typed.