Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "method-node",
"version": "1.1.5",
"version": "1.1.6",
"description": "Node.js library for the Method API",
"main": "dist/index.ts",
"module": "dist/index.mjs",
Expand Down
40 changes: 40 additions & 0 deletions src/resources/Entity/Vehicles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import Resource, { IResourceListOpts } from '../../resource';
import Configuration, { IResponse } from '../../configuration';
import type { IEntityVehicles } from './types';

export default class EntityVehicles extends Resource {
constructor(config: Configuration) {
super(config.addPath('vehicles'));
}

/**
* Retrieves a Vehicle record for an Entity.
*
* @param evhl_id ID of the Vehicle
* @returns Returns an Entity’s Vehicle object.
*/

async retrieve(evhl_id: string) {
return super._getWithId<IResponse<IEntityVehicles>>(evhl_id);
}

/**
* Retrieves a list of Vehicle objects for an entity.
*
* @returns Returns a list of Vehicle objects.
*/

async list(opts?: IResourceListOpts) {
return super._list<IResponse<IEntityVehicles>>(opts);
}

/**
* Creates a new Vehicle request to retrieve the Entity’s vehicle.
*
* @returns Returns an Entity’s Vehicle object.
*/

async create() {
return super._create<IResponse<IEntityVehicles>, {}>({});
}
};
3 changes: 3 additions & 0 deletions src/resources/Entity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import EntityProducts from './Products';
import EntityIdentities from './Identities';
import EntityCreditScores from './CreditScores';
import EntityAttributes from './Attributes';
import EntityVehicles from './Vehicles';
import EntitySubscriptions from './Subscriptions';
import EntityVerificationSession from './VerificationSessions';
import type {
Expand All @@ -22,6 +23,7 @@ export class EntitySubResources {
creditScores: EntityCreditScores;
identities: EntityIdentities;
attributes: EntityAttributes;
vehicles: EntityVehicles;
products: EntityProducts;
subscriptions: EntitySubscriptions;
verificationSessions: EntityVerificationSession;
Expand All @@ -31,6 +33,7 @@ export class EntitySubResources {
this.creditScores = new EntityCreditScores(config.addPath(id));
this.identities = new EntityIdentities(config.addPath(id));
this.attributes = new EntityAttributes(config.addPath(id));
this.vehicles = new EntityVehicles(config.addPath(id));
this.products = new EntityProducts(config.addPath(id));
this.subscriptions = new EntitySubscriptions(config.addPath(id));
this.verificationSessions = new EntityVerificationSession(config.addPath(id));
Expand Down
26 changes: 26 additions & 0 deletions src/resources/Entity/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,26 @@ export interface IEntityAttributes {
updated_at: string;
}

export interface IEntityVehiclesType {
vin: string | null;
year: string | null;
make: string | null;
model: string | null;
series: string | null;
major_color: string | null;
style: string | null;
};

export interface IEntityVehicles {
id: string;
entity_id: string;
status: TResourceStatus;
vehicles: IEntityVehiclesType[] | null;
error: IResourceError | null;
created_at: string;
updated_at: string;
};

export interface IEntityIdentity {
id: string;
entity_id: string;
Expand All @@ -201,6 +221,8 @@ export const EntityProductType = {
credit_score: 'credit_score',
identity: 'identity',
attribute: 'attribute',
vehicle: 'vehicle',
manual_connect: 'manual_connect',
} as const;

export type TEntityProductType = keyof typeof EntityProductType;
Expand All @@ -221,6 +243,8 @@ export interface IEntityProductListResponse {
credit_score?: IEntityProduct;
identity?: IEntityProduct;
attribute?: IEntityProduct;
vehicle?: IEntityProduct;
manual_connect?: IEntityProduct;
};

export const EntitySubscriptionNames = {
Expand Down Expand Up @@ -360,6 +384,7 @@ export const EntityExpandableFields = {
connect: 'connect',
credit_score: 'credit_score',
attribute: 'attribute',
vehicle: 'vehicle',
identity_latest_verification_session: 'identity_latest_verification_session',
phone_latest_verification_session: 'phone_latest_verification_session',
} as const;
Expand Down Expand Up @@ -417,6 +442,7 @@ export interface IEntity {
connect?: string | IEntityConnect | null;
credit_score?: string| IEntityCreditScores | null;
attribute?: string | IEntityAttributes | null;
vehicle?: string | IEntityVehicles | null;
created_at: string;
updated_at: string;
};
Loading
Loading