@experian-ecs/connected-api-sdk 1.2.0 → 1.4.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.
- package/README.md +187 -1
- package/dist/esm/index.mjs +840 -498
- package/dist/esm/index.mjs.map +1 -1
- package/dist/index.d.ts +723 -54
- package/dist/umd/index.umd.js +1 -1
- package/dist/umd/index.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,6 +102,7 @@ If using the sdk in the browser the `auth.getAccessToken` method will throw an e
|
|
|
102
102
|
at async k.fetchWithAuth (file:/stack/trace/path)
|
|
103
103
|
at async file:/stack/trace/path {
|
|
104
104
|
data: {
|
|
105
|
+
type: AUTHENTICATION_ERROR,
|
|
105
106
|
dev_url: 'https://experian.com/unity/docs/UNAUTHORIZED',
|
|
106
107
|
code: 'UNAUTHORIZED',
|
|
107
108
|
message: 'User Not Authorized'
|
|
@@ -143,21 +144,77 @@ If using the sdk in the browser the `auth.getAccessToken` method will throw an e
|
|
|
143
144
|
|
|
144
145
|
### Credit Attributes
|
|
145
146
|
|
|
147
|
+
The Credit Attributes API supports both v1 and v2 endpoints with different response formats. Use the `version` parameter to specify which API version to use. Leaving blank defaults to `v1`
|
|
148
|
+
|
|
146
149
|
* #### Retrieve attribute data for all historical reports
|
|
147
150
|
|
|
148
151
|
```tsx
|
|
152
|
+
// Defaults to V1
|
|
149
153
|
await sdk.creditAttributes.getCreditAttributes();
|
|
154
|
+
|
|
155
|
+
// V1 API - returns array of CreditAttributes objects
|
|
156
|
+
await sdk.creditAttributes.getCreditAttributes({ version: 'v1' });
|
|
157
|
+
|
|
158
|
+
// V2 API - returns CreditAttributes3B object with items array
|
|
159
|
+
await sdk.creditAttributes.getCreditAttributes({ version: 'v2' });
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### Credit Attribute version response validation
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import { isV1GetCreditAttributesResponse, isV2GetCreditAttributesResponse } from '@experian-ecs/connected-api-sdk'
|
|
166
|
+
|
|
167
|
+
const { data, error } = await sdk.creditAttributes.getCreditAttributes({
|
|
168
|
+
version: 'v2'
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
if (data) {
|
|
172
|
+
if (isV2GetCreditAttributesResponse(data)) {
|
|
173
|
+
// TypeScript now knows data is CreditAttribute3B
|
|
174
|
+
const { items } = data;
|
|
175
|
+
items.forEach(item => {
|
|
176
|
+
console.log(`Attribute ID: ${item.id}`);
|
|
177
|
+
item.bureau_attributes.forEach(attribute => {
|
|
178
|
+
console.log(`Bureau: ${attribute.bureau}, Reported At: ${attribute.reported_at}, Categories: ${attribute.categories}, Attributes: ${attribute.attributes}`);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
} else if (isV1GetCreditAttributesResponse(data)) {
|
|
182
|
+
// TypeScript now knows data is CreditAttribute[]
|
|
183
|
+
data.forEach(attribute => {
|
|
184
|
+
console.log(`Bureau: ${attribute.bureau}, Reported At: ${attribute.reported_at}, Categories: ${attribute.categories}, Attributes: ${attribute.attributes}`);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
} else {
|
|
188
|
+
console.error(error);
|
|
189
|
+
}
|
|
150
190
|
```
|
|
151
191
|
|
|
152
192
|
### Credit Reports
|
|
153
193
|
|
|
194
|
+
The Credit Reports API supports both v1 and v2 endpoints with different response formats. Use the `version` parameter to specify which API version to use. Leaving blank defaults to `v1`
|
|
195
|
+
|
|
154
196
|
* #### Retrieve all historical reports
|
|
155
197
|
|
|
156
198
|
```tsx
|
|
199
|
+
// Defaults to v1
|
|
157
200
|
await sdk.creditReports.getReports({
|
|
158
201
|
product_config_id: 'procfg_01',
|
|
159
202
|
include_fields: 'report_display',
|
|
160
203
|
})
|
|
204
|
+
|
|
205
|
+
// Version specific v1
|
|
206
|
+
await sdk.creditReports.getReports({
|
|
207
|
+
version: 'v1',
|
|
208
|
+
product_config_id: 'procfg_01',
|
|
209
|
+
include_fields: 'report_display',
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// Version specific v2
|
|
213
|
+
await sdk.creditReports.getReports({
|
|
214
|
+
version: 'v2',
|
|
215
|
+
product_config_id: 'procfg_01',
|
|
216
|
+
report_date: '2025-09-01',
|
|
217
|
+
});
|
|
161
218
|
```
|
|
162
219
|
|
|
163
220
|
* #### Retrieve a single report
|
|
@@ -167,18 +224,36 @@ If using the sdk in the browser the `auth.getAccessToken` method will throw an e
|
|
|
167
224
|
id: '',
|
|
168
225
|
include_fields: 'report_display',
|
|
169
226
|
});
|
|
227
|
+
|
|
228
|
+
// Version specific v2
|
|
229
|
+
await sdk.creditReports.getReportById({
|
|
230
|
+
id: '1234',
|
|
231
|
+
version: 'v2'
|
|
232
|
+
});
|
|
170
233
|
```
|
|
171
234
|
|
|
172
235
|
* #### Retrieve all historical report summaries
|
|
173
236
|
|
|
174
237
|
```tsx
|
|
175
238
|
await sdk.creditReports.getReportMeta();
|
|
239
|
+
|
|
240
|
+
// Version specific v2
|
|
241
|
+
await sdk.creditReports.getReportMeta({
|
|
242
|
+
version: 'v2',
|
|
243
|
+
latest_only: true
|
|
244
|
+
});
|
|
176
245
|
```
|
|
177
246
|
|
|
178
247
|
* #### Retrieve a single report summary
|
|
179
248
|
|
|
180
249
|
```tsx
|
|
181
250
|
await sdk.creditReports.getReportMetaById({ id: '' });
|
|
251
|
+
|
|
252
|
+
// Version specific v2
|
|
253
|
+
await sdk.creditReports.getReportMetaById({
|
|
254
|
+
id: '123',
|
|
255
|
+
version: 'v2'
|
|
256
|
+
});
|
|
182
257
|
```
|
|
183
258
|
|
|
184
259
|
* #### Order a new report
|
|
@@ -188,6 +263,12 @@ If using the sdk in the browser the `auth.getAccessToken` method will throw an e
|
|
|
188
263
|
product_config_id: 'procfg_01',
|
|
189
264
|
include_fields: 'report_display',
|
|
190
265
|
});
|
|
266
|
+
|
|
267
|
+
// Version specific v2
|
|
268
|
+
await sdk.creditReports.orderReport({
|
|
269
|
+
version: 'v2',
|
|
270
|
+
product_config_id: 'procfg_01',
|
|
271
|
+
});
|
|
191
272
|
```
|
|
192
273
|
|
|
193
274
|
* #### Mark a report as read
|
|
@@ -197,14 +278,30 @@ If using the sdk in the browser the `auth.getAccessToken` method will throw an e
|
|
|
197
278
|
id: '',
|
|
198
279
|
include_fields: 'report_display',
|
|
199
280
|
});
|
|
281
|
+
|
|
282
|
+
// Version specific v2
|
|
283
|
+
await sdk.creditReports.markReportAsRead({
|
|
284
|
+
version: 'v2',
|
|
285
|
+
id: '1234',
|
|
286
|
+
disposition: { read_status: 'READ' }
|
|
287
|
+
});
|
|
200
288
|
```
|
|
201
289
|
|
|
202
290
|
### Credit Scores
|
|
203
291
|
|
|
292
|
+
The Credit Scores API supports both v1 and v2 endpoints with different response formats. Use the `version` parameter to specify which API version to use. Leaving blank defaults to `v1`
|
|
293
|
+
|
|
204
294
|
* #### Retrieve all historical scores
|
|
205
295
|
|
|
206
296
|
```tsx
|
|
297
|
+
// Defaults to V1
|
|
207
298
|
await sdk.creditScores.getCreditScores();
|
|
299
|
+
|
|
300
|
+
// V1 API - returns array of CreditScore objects
|
|
301
|
+
await sdk.creditScores.getCreditScores({ version: 'v1' });
|
|
302
|
+
|
|
303
|
+
// V2 API - returns CreditScore3B object with items array
|
|
304
|
+
await sdk.creditScores.getCreditScores({ version: 'v2' });
|
|
208
305
|
```
|
|
209
306
|
|
|
210
307
|
* #### Retrieve all historical scores with factors information
|
|
@@ -222,9 +319,46 @@ If using the sdk in the browser the `auth.getAccessToken` method will throw an e
|
|
|
222
319
|
* #### Order a new score
|
|
223
320
|
|
|
224
321
|
```tsx
|
|
322
|
+
// Defaults to V1
|
|
225
323
|
await sdk.creditScores.orderCreditScore({
|
|
226
324
|
product_config_id: 'procfg_01'
|
|
227
325
|
});
|
|
326
|
+
|
|
327
|
+
// V2 API
|
|
328
|
+
await sdk.creditScores.orderCreditScore({
|
|
329
|
+
product_config_id: 'procfg_01',
|
|
330
|
+
version: 'v2'
|
|
331
|
+
});
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
* #### Credit Score version response validation
|
|
335
|
+
|
|
336
|
+
```tsx
|
|
337
|
+
import { isV1GetCreditScoresResponse, isV2GetCreditScoresResponse } from '@experian-ecs/connected-api-sdk'
|
|
338
|
+
|
|
339
|
+
const { data, error } = await sdk.creditScores.getCreditScores({
|
|
340
|
+
version: 'v2'
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
if (data) {
|
|
344
|
+
if (isV2GetCreditScoresResponse(data)) {
|
|
345
|
+
// TypeScript now knows data is CreditScore3B
|
|
346
|
+
const { items } = data;
|
|
347
|
+
items.forEach(item => {
|
|
348
|
+
console.log(`Score ID: ${item.id}`);
|
|
349
|
+
item.bureau_scores.forEach(score => {
|
|
350
|
+
console.log(`Bureau: ${score.bureau}, Score: ${score.score}`);
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
} else if (isV1GetCreditScoresResponse(data)) {
|
|
354
|
+
// TypeScript now knows data is CreditScore[]
|
|
355
|
+
data.forEach(score => {
|
|
356
|
+
console.log(`Score ID: ${score.score_id}, Score: ${score.score}`);
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
360
|
+
console.error(error);
|
|
361
|
+
}
|
|
228
362
|
```
|
|
229
363
|
|
|
230
364
|
### Credit Score Planner
|
|
@@ -533,18 +667,41 @@ If using the sdk in the browser the `auth.getAccessToken` method will throw an e
|
|
|
533
667
|
|
|
534
668
|
### Product Configs
|
|
535
669
|
|
|
670
|
+
The Product Config API supports both v1 and v2 endpoints with different response formats. Use the `version` parameter to specify which API version to use. Leaving blank defaults to `v1`.
|
|
671
|
+
|
|
672
|
+
|
|
536
673
|
* #### Retrieve product configurations for a tenant
|
|
537
674
|
|
|
538
675
|
```tsx
|
|
676
|
+
// Defaults to V1
|
|
539
677
|
await sdk.productConfigs.getProductConfigs();
|
|
678
|
+
|
|
679
|
+
// V1 API - returns product configurations
|
|
680
|
+
await sdk.productConfigs.getProductConfigs({version: 'v1'});
|
|
681
|
+
|
|
682
|
+
// V2 API - Includes Score Ranges and Disclosures array
|
|
683
|
+
await sdk.productConfigs.getProductConfigs({version: 'v2'});
|
|
540
684
|
```
|
|
541
685
|
|
|
542
686
|
* #### Retrieve a single product configuration for a tenant
|
|
543
687
|
|
|
544
688
|
```tsx
|
|
689
|
+
// Defaults to V1
|
|
545
690
|
await sdk.productConfigs.getProductConfigById({
|
|
546
691
|
product_config_id: 'procfg_01'
|
|
547
692
|
});
|
|
693
|
+
|
|
694
|
+
// V1 API
|
|
695
|
+
await sdk.productConfigs.getProductConfigById({
|
|
696
|
+
product_config_id: 'procfg_01',
|
|
697
|
+
version: 'v1'
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
// V2 API - Includes Score Ranges and Disclosures array
|
|
701
|
+
await sdk.productConfigs.getProductConfigById({
|
|
702
|
+
product_config_id: 'procfg_01',
|
|
703
|
+
version: 'v2'
|
|
704
|
+
});
|
|
548
705
|
```
|
|
549
706
|
|
|
550
707
|
### Registrations
|
|
@@ -604,7 +761,7 @@ If using the sdk in the browser the `auth.getAccessToken` method will throw an e
|
|
|
604
761
|
|
|
605
762
|
### Type Guards
|
|
606
763
|
|
|
607
|
-
For typescript users, helper utility functions are exported in order to aid with type narrowing response types that return variable response models. An example use case can be viewed for [simulating a credit score](#simulate-a-scenario---fico-only)
|
|
764
|
+
For typescript users, helper utility functions are exported in order to aid with type narrowing response types that return variable response models. An example use case can be viewed for [simulating a credit score](#simulate-a-scenario---fico-only) and [validating credit score responses](#credit-score-version-response-validation).
|
|
608
765
|
|
|
609
766
|
* Credit Score Planner
|
|
610
767
|
|
|
@@ -628,3 +785,32 @@ For typescript users, helper utility functions are exported in order to aid with
|
|
|
628
785
|
function isFicoScenarioVariation(variation?: ScenarioVariation): variation is FicoScenarioVariation;
|
|
629
786
|
function isVantageScenarioVariation(variation?: ScenarioVariation): variation is VantageScenarioVariation;
|
|
630
787
|
```
|
|
788
|
+
|
|
789
|
+
* Credit Scores
|
|
790
|
+
|
|
791
|
+
```tsx
|
|
792
|
+
function isValidApiVersion(version: string): version is ApiVersion;
|
|
793
|
+
function isCreditScore(data: unknown): data is CreditScore;
|
|
794
|
+
function isCreditScoreV2(data: unknown): data is CreditScore_V2;
|
|
795
|
+
function isBureauScore(data: unknown): data is BureauScore;
|
|
796
|
+
function isValidBureau(bureau: unknown): bureau is Bureau;
|
|
797
|
+
function isCreditScore3B(data: unknown): data is CreditScores_V2;
|
|
798
|
+
function isCreditScoreArray(data: unknown): data is CreditScore[];
|
|
799
|
+
function isV1GetCreditScoresResponse(data: unknown): data is GetCreditScoreResponse<'v1'>;
|
|
800
|
+
function isV2GetCreditScoresResponse(data: unknown): data is GetCreditScoreResponse<'v2'>;
|
|
801
|
+
function isV1PostCreditScoresResponse(data: unknown): data is PostCreditScoreResponse<'v1'>;
|
|
802
|
+
function isV2PostCreditScoresResponse(data: unknown): data is PostCreditScoreResponse<'v2'>;
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
* Credit Attributes
|
|
806
|
+
|
|
807
|
+
```tsx
|
|
808
|
+
function isCreditAttribute(data: unknown): data is CreditAttributes;
|
|
809
|
+
function isCreditAttributeV2(data: unknown): data is CreditAttribute_V2;
|
|
810
|
+
function isBureauAttribute(data: unknown): data is BureauAttribute;
|
|
811
|
+
function isValidBureauAttribute(bureau: unknown): bureau is Bureau;
|
|
812
|
+
function isCreditAttributesV2(data: unknown): data is CreditAttribute_V2;
|
|
813
|
+
function isCreditAttributeArray(data: unknown): data is CreditAttribute[];
|
|
814
|
+
function isV1GetCreditAttributesResponse(data: unknown): data is GetCreditAttributeResponse<'v1'>;
|
|
815
|
+
function isV2GetCreditAttributesResponse(data: unknown): data is GetCreditAttributeResponse<'v2'>;
|
|
816
|
+
```
|