@financeable/aggregation 0.2.5 → 0.3.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.
Files changed (71) hide show
  1. package/FUNCTIONS.md +9 -119
  2. package/README.md +73 -472
  3. package/docs/sdks/applications/README.md +18 -6
  4. package/docs/sdks/financeable/README.md +84 -0
  5. package/funcs/applicationsCreate.d.ts +2 -1
  6. package/funcs/applicationsCreate.d.ts.map +1 -1
  7. package/funcs/applicationsCreate.js +19 -8
  8. package/funcs/applicationsCreate.js.map +1 -1
  9. package/funcs/applicationsGet.d.ts +2 -1
  10. package/funcs/applicationsGet.d.ts.map +1 -1
  11. package/funcs/applicationsGet.js +19 -8
  12. package/funcs/applicationsGet.js.map +1 -1
  13. package/funcs/applicationsList.d.ts +2 -1
  14. package/funcs/applicationsList.d.ts.map +1 -1
  15. package/funcs/applicationsList.js +19 -8
  16. package/funcs/applicationsList.js.map +1 -1
  17. package/funcs/getToken.d.ts +13 -0
  18. package/funcs/getToken.d.ts.map +1 -0
  19. package/funcs/getToken.js +111 -0
  20. package/funcs/getToken.js.map +1 -0
  21. package/jsr.json +1 -1
  22. package/lib/config.d.ts +5 -4
  23. package/lib/config.d.ts.map +1 -1
  24. package/lib/config.js +7 -4
  25. package/lib/config.js.map +1 -1
  26. package/lib/env.d.ts +1 -0
  27. package/lib/env.d.ts.map +1 -1
  28. package/lib/env.js +1 -0
  29. package/lib/env.js.map +1 -1
  30. package/lib/security.d.ts +3 -0
  31. package/lib/security.d.ts.map +1 -1
  32. package/lib/security.js +19 -0
  33. package/lib/security.js.map +1 -1
  34. package/models/components/index.d.ts +3 -0
  35. package/models/components/index.d.ts.map +1 -1
  36. package/models/components/index.js +3 -0
  37. package/models/components/index.js.map +1 -1
  38. package/models/components/security.d.ts +29 -0
  39. package/models/components/security.d.ts.map +1 -0
  40. package/models/components/security.js +69 -0
  41. package/models/components/security.js.map +1 -0
  42. package/models/components/tokenrequest.d.ts +79 -0
  43. package/models/components/tokenrequest.d.ts.map +1 -0
  44. package/models/components/tokenrequest.js +110 -0
  45. package/models/components/tokenrequest.js.map +1 -0
  46. package/models/components/tokenresponse.d.ts +50 -0
  47. package/models/components/tokenresponse.d.ts.map +1 -0
  48. package/models/components/tokenresponse.js +88 -0
  49. package/models/components/tokenresponse.js.map +1 -0
  50. package/package.json +1 -1
  51. package/sdk/sdk.d.ts +6 -1
  52. package/sdk/sdk.d.ts.map +1 -1
  53. package/sdk/sdk.js +8 -0
  54. package/sdk/sdk.js.map +1 -1
  55. package/src/funcs/applicationsCreate.ts +45 -9
  56. package/src/funcs/applicationsGet.ts +45 -9
  57. package/src/funcs/applicationsList.ts +45 -9
  58. package/src/funcs/getToken.ts +153 -0
  59. package/src/lib/config.ts +9 -4
  60. package/src/lib/env.ts +4 -0
  61. package/src/lib/security.ts +27 -0
  62. package/src/models/components/index.ts +3 -0
  63. package/src/models/components/security.ts +62 -0
  64. package/src/models/components/tokenrequest.ts +133 -0
  65. package/src/models/components/tokenresponse.ts +102 -0
  66. package/src/sdk/sdk.ts +18 -1
  67. package/src/types/async.ts +68 -0
  68. package/types/async.d.ts +23 -0
  69. package/types/async.d.ts.map +1 -0
  70. package/types/async.js +44 -0
  71. package/types/async.js.map +1 -0
package/README.md CHANGED
@@ -954,6 +954,7 @@ You can also enable a default debug logger by setting an environment variable `F
954
954
  * [SDK Installation](#sdk-installation-1)
955
955
  * [Requirements](#requirements-1)
956
956
  * [SDK Example Usage](#sdk-example-usage-1)
957
+ * [Authentication](#authentication)
957
958
  * [Available Resources and Operations](#available-resources-and-operations-1)
958
959
  * [Standalone functions](#standalone-functions-1)
959
960
  * [Retries](#retries-1)
@@ -1011,126 +1012,16 @@ For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
1011
1012
  ```typescript
1012
1013
  import { Financeable } from "@financeable/aggregation";
1013
1014
 
1014
- const financeable = new Financeable();
1015
+ const financeable = new Financeable({
1016
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
1017
+ });
1015
1018
 
1016
1019
  async function run() {
1017
- const result = await financeable.applications.create({
1018
- data: {
1019
- type: "applications",
1020
- attributes: {
1021
- purpose: "Purchase of a motor vehicle",
1022
- applicationType: "consumer",
1023
- },
1024
- relationships: {
1025
- loanDetails: {
1026
- data: {
1027
- type: "loan-details",
1028
- attributes: {
1029
- repayments: 12,
1030
- repaymentFrequency: "monthly",
1031
- repaymentStructure: "group-payments",
1032
- loanAmount: "10280.95",
1033
- purpose: "Purchase of a motor vehicle",
1034
- term: 48,
1035
- balloon: 5,
1036
- deposit: "2500",
1037
- originationFee: 200,
1038
- rate: "0.15",
1039
- rateAdjustment: "-0.01",
1040
- },
1041
- },
1042
- },
1043
- customers: {
1044
- data: [
1045
- {
1046
- type: "customers",
1047
- attributes: {
1048
- title: "Mr",
1049
- firstName: "John",
1050
- lastName: "Smith",
1051
- dateOfBirth: "01-01-1990",
1052
- idExpiryDate: "<value>",
1053
- },
1054
- relationships: {
1055
- addresses: {
1056
- data: [
1057
- {
1058
- type: "addresses",
1059
- attributes: {
1060
- addressType: "residential",
1061
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
1062
- city: "Sydney",
1063
- postCode: "2000",
1064
- streetAddress: "42 Wallaby Way",
1065
- addressLine2: "",
1066
- streetNumber: "42",
1067
- streetType: "Way",
1068
- street: "Wallaby",
1069
- state: "NSW",
1070
- country: "Australia",
1071
- status: "current",
1072
- monthsAt: 24,
1073
- yearsAt: 2,
1074
- },
1075
- },
1076
- {
1077
- type: "addresses",
1078
- attributes: {
1079
- addressType: "residential",
1080
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
1081
- city: "Sydney",
1082
- postCode: "2000",
1083
- streetAddress: "42 Wallaby Way",
1084
- addressLine2: "",
1085
- streetNumber: "42",
1086
- streetType: "Way",
1087
- street: "Wallaby",
1088
- state: "NSW",
1089
- country: "Australia",
1090
- status: "current",
1091
- monthsAt: 24,
1092
- yearsAt: 2,
1093
- },
1094
- },
1095
- ],
1096
- },
1097
- },
1098
- },
1099
- ],
1100
- },
1101
- asset: {
1102
- data: {
1103
- type: "asset",
1104
- attributes: {
1105
- ageOfAsset: 3,
1106
- ageOfAssetAtEnd: 8,
1107
- condition: "USED",
1108
- assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
1109
- purpose: "VEHICLE",
1110
- assetValue: "35000.00",
1111
- make: "Toyota",
1112
- assetModel: "Camry",
1113
- registrationNumber: "ABC123",
1114
- registrationState: "VIC",
1115
- vin: "1HGCM82633A123456",
1116
- supplierName: "Mr and Mrs Smith",
1117
- supplierABN: "12345678901",
1118
- supplierAddress: "123 Car Street, Melbourne VIC 3000",
1119
- supplierPhone: "0412345678",
1120
- supplierContactName: "John Smith",
1121
- supplierEmail: "john.smith@mrandmrssmith.com.au",
1122
- privateSale: false,
1123
- typeOfSale: "DEALER",
1124
- description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
1125
- netAssetValue: "32000.00",
1126
- isLuxury: false,
1127
- additionalFees: "995.00",
1128
- additionalTaxes: "0.00",
1129
- },
1130
- },
1131
- },
1132
- },
1133
- },
1020
+ const result = await financeable.getToken({
1021
+ grantType: "client_credentials",
1022
+ clientId: "<id>",
1023
+ clientSecret: "<value>",
1024
+ scope: "<value>",
1134
1025
  });
1135
1026
 
1136
1027
  // Handle the result
@@ -1142,6 +1033,42 @@ run();
1142
1033
  ```
1143
1034
  <!-- End SDK Example Usage [usage] -->
1144
1035
 
1036
+ <!-- Start Authentication [security] -->
1037
+ ## Authentication
1038
+
1039
+ ### Per-Client Security Schemes
1040
+
1041
+ This SDK supports the following security scheme globally:
1042
+
1043
+ | Name | Type | Scheme | Environment Variable |
1044
+ | ------------------- | ------ | ------------ | -------------------------------- |
1045
+ | `clientCredentials` | oauth2 | OAuth2 token | `FINANCEABLE_CLIENT_CREDENTIALS` |
1046
+
1047
+ To authenticate with the API the `clientCredentials` parameter must be set when initializing the SDK client instance. For example:
1048
+ ```typescript
1049
+ import { Financeable } from "@financeable/aggregation";
1050
+
1051
+ const financeable = new Financeable({
1052
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
1053
+ });
1054
+
1055
+ async function run() {
1056
+ const result = await financeable.getToken({
1057
+ grantType: "client_credentials",
1058
+ clientId: "<id>",
1059
+ clientSecret: "<value>",
1060
+ scope: "<value>",
1061
+ });
1062
+
1063
+ // Handle the result
1064
+ console.log(result);
1065
+ }
1066
+
1067
+ run();
1068
+
1069
+ ```
1070
+ <!-- End Authentication [security] -->
1071
+
1145
1072
  <!-- Start Available Resources and Operations [operations] -->
1146
1073
  ## Available Resources and Operations
1147
1074
 
@@ -1154,6 +1081,9 @@ run();
1154
1081
  * [list](docs/sdks/applications/README.md#list) - Retrieve a list of applications
1155
1082
  * [get](docs/sdks/applications/README.md#get) - Retrieve an application by its ID
1156
1083
 
1084
+ ### [Financeable SDK](docs/sdks/financeable/README.md)
1085
+
1086
+ * [getToken](docs/sdks/financeable/README.md#gettoken) - Obtain an OAuth client_credentials token
1157
1087
 
1158
1088
  </details>
1159
1089
  <!-- End Available Resources and Operations [operations] -->
@@ -1176,6 +1106,7 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
1176
1106
  - [`applicationsCreate`](docs/sdks/applications/README.md#create) - Create an application in the Financeable platform.
1177
1107
  - [`applicationsGet`](docs/sdks/applications/README.md#get) - Retrieve an application by its ID
1178
1108
  - [`applicationsList`](docs/sdks/applications/README.md#list) - Retrieve a list of applications
1109
+ - [`getToken`](docs/sdks/financeable/README.md#gettoken) - Obtain an OAuth client_credentials token
1179
1110
 
1180
1111
  </details>
1181
1112
  <!-- End Standalone functions [standalone-funcs] -->
@@ -1189,126 +1120,16 @@ To change the default retry strategy for a single API call, simply provide a ret
1189
1120
  ```typescript
1190
1121
  import { Financeable } from "@financeable/aggregation";
1191
1122
 
1192
- const financeable = new Financeable();
1123
+ const financeable = new Financeable({
1124
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
1125
+ });
1193
1126
 
1194
1127
  async function run() {
1195
- const result = await financeable.applications.create({
1196
- data: {
1197
- type: "applications",
1198
- attributes: {
1199
- purpose: "Purchase of a motor vehicle",
1200
- applicationType: "consumer",
1201
- },
1202
- relationships: {
1203
- loanDetails: {
1204
- data: {
1205
- type: "loan-details",
1206
- attributes: {
1207
- repayments: 12,
1208
- repaymentFrequency: "monthly",
1209
- repaymentStructure: "group-payments",
1210
- loanAmount: "10280.95",
1211
- purpose: "Purchase of a motor vehicle",
1212
- term: 48,
1213
- balloon: 5,
1214
- deposit: "2500",
1215
- originationFee: 200,
1216
- rate: "0.15",
1217
- rateAdjustment: "-0.01",
1218
- },
1219
- },
1220
- },
1221
- customers: {
1222
- data: [
1223
- {
1224
- type: "customers",
1225
- attributes: {
1226
- title: "Mr",
1227
- firstName: "John",
1228
- lastName: "Smith",
1229
- dateOfBirth: "01-01-1990",
1230
- idExpiryDate: "<value>",
1231
- },
1232
- relationships: {
1233
- addresses: {
1234
- data: [
1235
- {
1236
- type: "addresses",
1237
- attributes: {
1238
- addressType: "residential",
1239
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
1240
- city: "Sydney",
1241
- postCode: "2000",
1242
- streetAddress: "42 Wallaby Way",
1243
- addressLine2: "",
1244
- streetNumber: "42",
1245
- streetType: "Way",
1246
- street: "Wallaby",
1247
- state: "NSW",
1248
- country: "Australia",
1249
- status: "current",
1250
- monthsAt: 24,
1251
- yearsAt: 2,
1252
- },
1253
- },
1254
- {
1255
- type: "addresses",
1256
- attributes: {
1257
- addressType: "residential",
1258
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
1259
- city: "Sydney",
1260
- postCode: "2000",
1261
- streetAddress: "42 Wallaby Way",
1262
- addressLine2: "",
1263
- streetNumber: "42",
1264
- streetType: "Way",
1265
- street: "Wallaby",
1266
- state: "NSW",
1267
- country: "Australia",
1268
- status: "current",
1269
- monthsAt: 24,
1270
- yearsAt: 2,
1271
- },
1272
- },
1273
- ],
1274
- },
1275
- },
1276
- },
1277
- ],
1278
- },
1279
- asset: {
1280
- data: {
1281
- type: "asset",
1282
- attributes: {
1283
- ageOfAsset: 3,
1284
- ageOfAssetAtEnd: 8,
1285
- condition: "USED",
1286
- assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
1287
- purpose: "VEHICLE",
1288
- assetValue: "35000.00",
1289
- make: "Toyota",
1290
- assetModel: "Camry",
1291
- registrationNumber: "ABC123",
1292
- registrationState: "VIC",
1293
- vin: "1HGCM82633A123456",
1294
- supplierName: "Mr and Mrs Smith",
1295
- supplierABN: "12345678901",
1296
- supplierAddress: "123 Car Street, Melbourne VIC 3000",
1297
- supplierPhone: "0412345678",
1298
- supplierContactName: "John Smith",
1299
- supplierEmail: "john.smith@mrandmrssmith.com.au",
1300
- privateSale: false,
1301
- typeOfSale: "DEALER",
1302
- description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
1303
- netAssetValue: "32000.00",
1304
- isLuxury: false,
1305
- additionalFees: "995.00",
1306
- additionalTaxes: "0.00",
1307
- },
1308
- },
1309
- },
1310
- },
1311
- },
1128
+ const result = await financeable.getToken({
1129
+ grantType: "client_credentials",
1130
+ clientId: "<id>",
1131
+ clientSecret: "<value>",
1132
+ scope: "<value>",
1312
1133
  }, {
1313
1134
  retries: {
1314
1135
  strategy: "backoff",
@@ -1345,126 +1166,15 @@ const financeable = new Financeable({
1345
1166
  },
1346
1167
  retryConnectionErrors: false,
1347
1168
  },
1169
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
1348
1170
  });
1349
1171
 
1350
1172
  async function run() {
1351
- const result = await financeable.applications.create({
1352
- data: {
1353
- type: "applications",
1354
- attributes: {
1355
- purpose: "Purchase of a motor vehicle",
1356
- applicationType: "consumer",
1357
- },
1358
- relationships: {
1359
- loanDetails: {
1360
- data: {
1361
- type: "loan-details",
1362
- attributes: {
1363
- repayments: 12,
1364
- repaymentFrequency: "monthly",
1365
- repaymentStructure: "group-payments",
1366
- loanAmount: "10280.95",
1367
- purpose: "Purchase of a motor vehicle",
1368
- term: 48,
1369
- balloon: 5,
1370
- deposit: "2500",
1371
- originationFee: 200,
1372
- rate: "0.15",
1373
- rateAdjustment: "-0.01",
1374
- },
1375
- },
1376
- },
1377
- customers: {
1378
- data: [
1379
- {
1380
- type: "customers",
1381
- attributes: {
1382
- title: "Mr",
1383
- firstName: "John",
1384
- lastName: "Smith",
1385
- dateOfBirth: "01-01-1990",
1386
- idExpiryDate: "<value>",
1387
- },
1388
- relationships: {
1389
- addresses: {
1390
- data: [
1391
- {
1392
- type: "addresses",
1393
- attributes: {
1394
- addressType: "residential",
1395
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
1396
- city: "Sydney",
1397
- postCode: "2000",
1398
- streetAddress: "42 Wallaby Way",
1399
- addressLine2: "",
1400
- streetNumber: "42",
1401
- streetType: "Way",
1402
- street: "Wallaby",
1403
- state: "NSW",
1404
- country: "Australia",
1405
- status: "current",
1406
- monthsAt: 24,
1407
- yearsAt: 2,
1408
- },
1409
- },
1410
- {
1411
- type: "addresses",
1412
- attributes: {
1413
- addressType: "residential",
1414
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
1415
- city: "Sydney",
1416
- postCode: "2000",
1417
- streetAddress: "42 Wallaby Way",
1418
- addressLine2: "",
1419
- streetNumber: "42",
1420
- streetType: "Way",
1421
- street: "Wallaby",
1422
- state: "NSW",
1423
- country: "Australia",
1424
- status: "current",
1425
- monthsAt: 24,
1426
- yearsAt: 2,
1427
- },
1428
- },
1429
- ],
1430
- },
1431
- },
1432
- },
1433
- ],
1434
- },
1435
- asset: {
1436
- data: {
1437
- type: "asset",
1438
- attributes: {
1439
- ageOfAsset: 3,
1440
- ageOfAssetAtEnd: 8,
1441
- condition: "USED",
1442
- assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
1443
- purpose: "VEHICLE",
1444
- assetValue: "35000.00",
1445
- make: "Toyota",
1446
- assetModel: "Camry",
1447
- registrationNumber: "ABC123",
1448
- registrationState: "VIC",
1449
- vin: "1HGCM82633A123456",
1450
- supplierName: "Mr and Mrs Smith",
1451
- supplierABN: "12345678901",
1452
- supplierAddress: "123 Car Street, Melbourne VIC 3000",
1453
- supplierPhone: "0412345678",
1454
- supplierContactName: "John Smith",
1455
- supplierEmail: "john.smith@mrandmrssmith.com.au",
1456
- privateSale: false,
1457
- typeOfSale: "DEALER",
1458
- description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
1459
- netAssetValue: "32000.00",
1460
- isLuxury: false,
1461
- additionalFees: "995.00",
1462
- additionalTaxes: "0.00",
1463
- },
1464
- },
1465
- },
1466
- },
1467
- },
1173
+ const result = await financeable.getToken({
1174
+ grantType: "client_credentials",
1175
+ clientId: "<id>",
1176
+ clientSecret: "<value>",
1177
+ scope: "<value>",
1468
1178
  });
1469
1179
 
1470
1180
  // Handle the result
@@ -1495,7 +1205,9 @@ import {
1495
1205
  SDKValidationError,
1496
1206
  } from "@financeable/aggregation/models/errors";
1497
1207
 
1498
- const financeable = new Financeable();
1208
+ const financeable = new Financeable({
1209
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
1210
+ });
1499
1211
 
1500
1212
  async function run() {
1501
1213
  let result;
@@ -1666,132 +1378,21 @@ In some rare cases, the SDK can fail to get a response from the server or even m
1666
1378
 
1667
1379
  ### Override Server URL Per-Client
1668
1380
 
1669
- The default server can also be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
1381
+ The default server can be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
1670
1382
  ```typescript
1671
1383
  import { Financeable } from "@financeable/aggregation";
1672
1384
 
1673
1385
  const financeable = new Financeable({
1674
1386
  serverURL: "https://api.financeable.com.au",
1387
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
1675
1388
  });
1676
1389
 
1677
1390
  async function run() {
1678
- const result = await financeable.applications.create({
1679
- data: {
1680
- type: "applications",
1681
- attributes: {
1682
- purpose: "Purchase of a motor vehicle",
1683
- applicationType: "consumer",
1684
- },
1685
- relationships: {
1686
- loanDetails: {
1687
- data: {
1688
- type: "loan-details",
1689
- attributes: {
1690
- repayments: 12,
1691
- repaymentFrequency: "monthly",
1692
- repaymentStructure: "group-payments",
1693
- loanAmount: "10280.95",
1694
- purpose: "Purchase of a motor vehicle",
1695
- term: 48,
1696
- balloon: 5,
1697
- deposit: "2500",
1698
- originationFee: 200,
1699
- rate: "0.15",
1700
- rateAdjustment: "-0.01",
1701
- },
1702
- },
1703
- },
1704
- customers: {
1705
- data: [
1706
- {
1707
- type: "customers",
1708
- attributes: {
1709
- title: "Mr",
1710
- firstName: "John",
1711
- lastName: "Smith",
1712
- dateOfBirth: "01-01-1990",
1713
- idExpiryDate: "<value>",
1714
- },
1715
- relationships: {
1716
- addresses: {
1717
- data: [
1718
- {
1719
- type: "addresses",
1720
- attributes: {
1721
- addressType: "residential",
1722
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
1723
- city: "Sydney",
1724
- postCode: "2000",
1725
- streetAddress: "42 Wallaby Way",
1726
- addressLine2: "",
1727
- streetNumber: "42",
1728
- streetType: "Way",
1729
- street: "Wallaby",
1730
- state: "NSW",
1731
- country: "Australia",
1732
- status: "current",
1733
- monthsAt: 24,
1734
- yearsAt: 2,
1735
- },
1736
- },
1737
- {
1738
- type: "addresses",
1739
- attributes: {
1740
- addressType: "residential",
1741
- fullAddress: "42 Wallaby Way, Sydney NSW 2000",
1742
- city: "Sydney",
1743
- postCode: "2000",
1744
- streetAddress: "42 Wallaby Way",
1745
- addressLine2: "",
1746
- streetNumber: "42",
1747
- streetType: "Way",
1748
- street: "Wallaby",
1749
- state: "NSW",
1750
- country: "Australia",
1751
- status: "current",
1752
- monthsAt: 24,
1753
- yearsAt: 2,
1754
- },
1755
- },
1756
- ],
1757
- },
1758
- },
1759
- },
1760
- ],
1761
- },
1762
- asset: {
1763
- data: {
1764
- type: "asset",
1765
- attributes: {
1766
- ageOfAsset: 3,
1767
- ageOfAssetAtEnd: 8,
1768
- condition: "USED",
1769
- assetType: "MOTOR_VEHICLE_(<4.5_TONNES)",
1770
- purpose: "VEHICLE",
1771
- assetValue: "35000.00",
1772
- make: "Toyota",
1773
- assetModel: "Camry",
1774
- registrationNumber: "ABC123",
1775
- registrationState: "VIC",
1776
- vin: "1HGCM82633A123456",
1777
- supplierName: "Mr and Mrs Smith",
1778
- supplierABN: "12345678901",
1779
- supplierAddress: "123 Car Street, Melbourne VIC 3000",
1780
- supplierPhone: "0412345678",
1781
- supplierContactName: "John Smith",
1782
- supplierEmail: "john.smith@mrandmrssmith.com.au",
1783
- privateSale: false,
1784
- typeOfSale: "DEALER",
1785
- description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
1786
- netAssetValue: "32000.00",
1787
- isLuxury: false,
1788
- additionalFees: "995.00",
1789
- additionalTaxes: "0.00",
1790
- },
1791
- },
1792
- },
1793
- },
1794
- },
1391
+ const result = await financeable.getToken({
1392
+ grantType: "client_credentials",
1393
+ clientId: "<id>",
1394
+ clientSecret: "<value>",
1395
+ scope: "<value>",
1795
1396
  });
1796
1397
 
1797
1398
  // Handle the result
@@ -18,7 +18,9 @@ Create an application in the Financeable platform.
18
18
  ```typescript
19
19
  import { Financeable } from "@financeable/aggregation";
20
20
 
21
- const financeable = new Financeable();
21
+ const financeable = new Financeable({
22
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
23
+ });
22
24
 
23
25
  async function run() {
24
26
  const result = await financeable.applications.create({
@@ -157,7 +159,9 @@ import { applicationsCreate } from "@financeable/aggregation/funcs/applicationsC
157
159
 
158
160
  // Use `FinanceableCore` for best tree-shaking performance.
159
161
  // You can create one instance of it to use across an application.
160
- const financeable = new FinanceableCore();
162
+ const financeable = new FinanceableCore({
163
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
164
+ });
161
165
 
162
166
  async function run() {
163
167
  const res = await applicationsCreate(financeable, {
@@ -321,7 +325,9 @@ Retrieve a list of applications
321
325
  ```typescript
322
326
  import { Financeable } from "@financeable/aggregation";
323
327
 
324
- const financeable = new Financeable();
328
+ const financeable = new Financeable({
329
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
330
+ });
325
331
 
326
332
  async function run() {
327
333
  const result = await financeable.applications.list({});
@@ -343,7 +349,9 @@ import { applicationsList } from "@financeable/aggregation/funcs/applicationsLis
343
349
 
344
350
  // Use `FinanceableCore` for best tree-shaking performance.
345
351
  // You can create one instance of it to use across an application.
346
- const financeable = new FinanceableCore();
352
+ const financeable = new FinanceableCore({
353
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
354
+ });
347
355
 
348
356
  async function run() {
349
357
  const res = await applicationsList(financeable, {});
@@ -390,7 +398,9 @@ Retrieve an application by its ID
390
398
  ```typescript
391
399
  import { Financeable } from "@financeable/aggregation";
392
400
 
393
- const financeable = new Financeable();
401
+ const financeable = new Financeable({
402
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
403
+ });
394
404
 
395
405
  async function run() {
396
406
  const result = await financeable.applications.get({
@@ -414,7 +424,9 @@ import { applicationsGet } from "@financeable/aggregation/funcs/applicationsGet.
414
424
 
415
425
  // Use `FinanceableCore` for best tree-shaking performance.
416
426
  // You can create one instance of it to use across an application.
417
- const financeable = new FinanceableCore();
427
+ const financeable = new FinanceableCore({
428
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
429
+ });
418
430
 
419
431
  async function run() {
420
432
  const res = await applicationsGet(financeable, {