Skip to content

Commit 30ffd17

Browse files
feat: add metadata and point to v2
1 parent b522f96 commit 30ffd17

7 files changed

Lines changed: 65 additions & 37 deletions

File tree

README.md

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,48 +38,59 @@ main().catch(err => {
3838

3939
## Documentation for API Endpoints
4040

41-
All URIs are relative to *https://api.passbase.com/verification/v1*
41+
All URIs are relative to *https://api.passbase.com/verification/v2*
42+
43+
Class | Method | HTTP request | Description
44+
------------ | ------------- | ------------- | -------------
45+
*VerificationApi.IdentityApi* | [**getIdentityById**](docs/IdentityApi.md#getIdentityById) | **GET** /identities/{id} | Get identity
46+
*VerificationApi.IdentityApi* | [**getIdentityResourceById**](docs/IdentityApi.md#getIdentityResourceById) | **GET** /identity/{id}/resources/{resource_id} | Get resource
47+
*VerificationApi.IdentityApi* | [**getIdentityResourceFileById**](docs/IdentityApi.md#getIdentityResourceFileById) | **GET** /identity/{id}/resources/{resource_id}/resource_files/{resource_file_id} | Get resource file
48+
*VerificationApi.IdentityApi* | [**listIdentities**](docs/IdentityApi.md#listIdentities) | **GET** /identities | List identities
49+
*VerificationApi.IdentityApi* | [**listIdentityResources**](docs/IdentityApi.md#listIdentityResources) | **GET** /identity/{id}/resources | List resources
50+
*VerificationApi.ProjectApi* | [**getSettings**](docs/ProjectApi.md#getSettings) | **GET** /settings | Get project settings
4251

43-
| Class | Method | HTTP request | Description |
44-
| ----------------------------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------- |
45-
| _VerificationApi.IdentityApi_ | [**getIdentityById**](docs/IdentityApi.md#getIdentityById) | **GET** /identities/{id} | Get identity |
46-
| _VerificationApi.IdentityApi_ | [**getIdentityResourceById**](docs/IdentityApi.md#getIdentityResourceById) | **GET** /identity/{id}/resources/{resource_id} | Get resource |
47-
| _VerificationApi.IdentityApi_ | [**getIdentityResourceFileById**](docs/IdentityApi.md#getIdentityResourceFileById) | **GET** /identity/{id}/resources/{resource_id}/resource_files/{resource_file_id} | Get resource file |
48-
| _VerificationApi.IdentityApi_ | [**listIdentities**](docs/IdentityApi.md#listIdentities) | **GET** /identities | List identities |
49-
| _VerificationApi.IdentityApi_ | [**listIdentityResources**](docs/IdentityApi.md#listIdentityResources) | **GET** /identity/{id}/resources | List resources |
50-
| _VerificationApi.ProjectApi_ | [**getSettings**](docs/ProjectApi.md#getSettings) | **GET** /settings | Get project settings |
5152

5253
## Documentation for Models
5354

54-
- [VerificationApi.Cursor](docs/Cursor.md)
55-
- [VerificationApi.Identity](docs/Identity.md)
56-
- [VerificationApi.IdentityOwner](docs/IdentityOwner.md)
57-
- [VerificationApi.IdentityResource](docs/IdentityResource.md)
58-
- [VerificationApi.PaginatedIdentities](docs/PaginatedIdentities.md)
59-
- [VerificationApi.PaginatedResources](docs/PaginatedResources.md)
60-
- [VerificationApi.ProjectSettings](docs/ProjectSettings.md)
61-
- [VerificationApi.ProjectSettingsCustomizations](docs/ProjectSettingsCustomizations.md)
62-
- [VerificationApi.ProjectSettingsVerificationSteps](docs/ProjectSettingsVerificationSteps.md)
63-
- [VerificationApi.Resource](docs/Resource.md)
64-
- [VerificationApi.ResourceFile](docs/ResourceFile.md)
65-
- [VerificationApi.ResourceInput](docs/ResourceInput.md)
66-
- [VerificationApi.User](docs/User.md)
67-
- [VerificationApi.WatchlistResponse](docs/WatchlistResponse.md)
55+
- [VerificationApi.Cursor](docs/Cursor.md)
56+
- [VerificationApi.Identity](docs/Identity.md)
57+
- [VerificationApi.IdentityOwner](docs/IdentityOwner.md)
58+
- [VerificationApi.IdentityResource](docs/IdentityResource.md)
59+
- [VerificationApi.PaginatedIdentities](docs/PaginatedIdentities.md)
60+
- [VerificationApi.PaginatedResources](docs/PaginatedResources.md)
61+
- [VerificationApi.ProjectSettings](docs/ProjectSettings.md)
62+
- [VerificationApi.ProjectSettingsCustomizations](docs/ProjectSettingsCustomizations.md)
63+
- [VerificationApi.ProjectSettingsVerificationSteps](docs/ProjectSettingsVerificationSteps.md)
64+
- [VerificationApi.Resource](docs/Resource.md)
65+
- [VerificationApi.ResourceFile](docs/ResourceFile.md)
66+
- [VerificationApi.ResourceInput](docs/ResourceInput.md)
67+
- [VerificationApi.User](docs/User.md)
68+
- [VerificationApi.WatchlistResponse](docs/WatchlistResponse.md)
69+
6870

6971
## Documentation for Authorization
7072

73+
74+
7175
### IdentityAccessToken
7276

7377
- **Type**: Bearer authentication (JWT)
7478

79+
80+
7581
### PublishableApiKey
7682

83+
7784
- **Type**: API key
7885
- **API key parameter name**: X-API-KEY
7986
- **Location**: HTTP header
8087

88+
89+
8190
### SecretApiKey
8291

92+
8393
- **Type**: API key
8494
- **API key parameter name**: X-API-KEY
8595
- **Location**: HTTP header
96+

docs/IdentityApi.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# VerificationApi.IdentityApi
22

3-
All URIs are relative to *https://api.passbase.com/verification/v1*
3+
All URIs are relative to *https://api.passbase.com/verification/v2*
44

55
| Method | HTTP request | Description |
66
| ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ----------------- |
@@ -153,15 +153,15 @@ client.getIdentityResourceFileById(id, resourceId, resourcefileId).then(
153153

154154
### Parameters
155155

156-
| Name | Type | Description | Notes |
157-
| ------------------ | ---------- | --------------- | ----- |
158-
| **id** | **String** | Identity id |
159-
| **resourceId** | **String** | Resource id |
160-
| **resourceFileId** | **String** | ResourceFile id |
156+
| Name | Type | Description | Notes |
157+
| ------------------ | ---------- | ---------------- | ----- |
158+
| **id** | **String** | Identity id |
159+
| **resourceId** | **String** | Resource id |
160+
| **resourceFileId** | **String** | Resource file id |
161161

162162
### Return type
163163

164-
[**Resource**](Resource.md)
164+
[**ResourceFile**](ResourceFile.md)
165165

166166
### Authorization
167167

docs/ProjectApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# VerificationApi.ProjectApi
22

3-
All URIs are relative to *https://api.passbase.com/verification/v1*
3+
All URIs are relative to *https://api.passbase.com/verification/v2*
44

55
| Method | HTTP request | Description |
66
| -------------------------------------------- | ----------------- | -------------------- |

src/__tests__/configuration.test.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ describe("can be initialized", () => {
1010
});
1111

1212
it("errors if the api key is not provided", () => {
13-
expect(() => {
14-
new PassbaseConfiguration();
15-
}).toThrow(/apiKey/);
13+
expect(() => new PassbaseConfiguration()).toThrow(/missing apiKey/);
1614
});
1715

1816
xit("checks if the format is present", () => {
@@ -36,13 +34,22 @@ describe("can be initialized", () => {
3634
});
3735
expect(configuration.basePath).toBe("test_base_path");
3836
});
37+
it("version can be configured", () => {
38+
const configuration = new PassbaseConfiguration({
39+
apiKey: "123",
40+
version: "v1",
41+
});
42+
expect(configuration.basePath).toBe(
43+
"https://api.passbase.com/verification/v1",
44+
);
45+
});
3946

4047
it("defaults the basePath to prod if not present", () => {
4148
const configuration = new PassbaseConfiguration({
4249
apiKey: "123",
4350
});
4451
expect(configuration.basePath).toBe(
45-
"https://api.passbase.com/verification/v1",
52+
"https://api.passbase.com/verification/v2",
4653
);
4754
});
4855
});

src/__tests__/integration.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/* tslint: disable */
22
import {PassbaseConfiguration, PassbaseClient} from "../";
33

4+
if (!process.env.PASSBASE_SECRET_API_KEY) {
5+
throw new Error(
6+
"Please run the integration tests with the PASSBASE_SECRET_API_KEY environment variable defined.",
7+
);
8+
}
9+
410
const configuration = new PassbaseConfiguration({
511
apiKey: process.env.PASSBASE_SECRET_API_KEY,
612
});

src/configuration.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface ConfigurationParameters {
66
apiKey: string;
77
format?: ResponseFormats;
88
basePath?: string;
9+
version?: string;
910
}
1011

1112
export enum ResponseFormats {
@@ -19,7 +20,7 @@ export class PassbaseConfiguration {
1920
readonly format: ResponseFormats;
2021
readonly basePath: string;
2122

22-
constructor(param: ConfigurationParameters) {
23+
constructor(param: ConfigurationParameters = {apiKey: ""}) {
2324
if (!param.apiKey) {
2425
throw new PassbaseError("missing apiKey");
2526
}
@@ -33,7 +34,8 @@ export class PassbaseConfiguration {
3334

3435
this.apiKey = param.apiKey;
3536
this.format = param.format || ResponseFormats.Json;
37+
const apiVersion = param.version || "v2";
3638
this.basePath =
37-
param.basePath || "https://api.passbase.com/verification/v1";
39+
param.basePath || `https://api.passbase.com/verification/${apiVersion}`;
3840
}
3941
}

src/models/Identity.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export class Identity {
2121
owner: IdentityOwner | null;
2222
score: number;
2323
resources: IdentityResource[];
24+
metadata: {[x: string]: any} | null;
2425
watchlist: Watchlist | null;
2526

2627
constructor(obj: any) {
@@ -33,6 +34,7 @@ export class Identity {
3334
this.resources = (obj.resources || []).map(
3435
(resource: any) => new IdentityResource(resource),
3536
);
37+
this.metadata = obj.metadata;
3638
this.watchlist = obj.watchlist ? new Watchlist(obj.watchlist) : null;
3739
}
3840
}

0 commit comments

Comments
 (0)