Skip to content
Open
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
This SDK provides convenient access to the Price Engine REST API from TypeScript or JavaScript.
<br/>

**[Unstable v1](https://dd360.mx/)**
**[Stable v2](https://dd360.mx/)**

[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/dd3tech/pe-sdk)
[![npm latest package](https://img.shields.io/npm/v/pe-sdk/latest.svg)](https://www.npmjs.com/package/pe-sdk)
Expand Down
12 changes: 11 additions & 1 deletion src/apis/appraisal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import type {
AppraisalRequestInputVariable,
AppraisalRequestOutput,
AppraisalOutputCoverage,
CommonRequestInput
CommonRequestInput,
Comparable
} from '../types'
/*
* This is the API Client to interact with our Price Engine API.
Expand All @@ -21,6 +22,15 @@ export class Appraisal extends BaseFetcher {
super(props)
}

public async getComparables(
body: AppraisalRequestInput
): Promise<Comparable> {
return this.request(`/${API_RESOURCES_PATH.APPRAISALS}/comparables`, {
method: 'POST',
body: JSON.stringify(body)
})
}

public async getAppraisalCoverage(
request: CommonRequestInput
): Promise<AppraisalOutputCoverage> {
Expand Down
16 changes: 15 additions & 1 deletion src/types/appraisal.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/** Appraisals types */
export type Comparable = {
export interface Comparable {
id?: string
urlAd?: string
propertyId?: string
propertyCode?: string
latitude?: number
longitude?: number
surfaceTotal?: number
terrainSurface?: number
builtYear?: number
Expand All @@ -11,6 +15,11 @@ export type Comparable = {
isNewPropertyProb?: number
pricePerSquareMeter?: number
dissimilarityToTarget?: number
title?: string
street?: string
neighborhood?: string
state?: string
municipality?: string
}

export interface AppraisalRequestOutput {
Expand Down Expand Up @@ -71,6 +80,11 @@ export type AppraisalRequestInput = {
m2PrivateTerrace?: number
hasView?: number
developmentAmenities?: DevelopmentAmenities
isNewPropertyProb?: number
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name of the property is more like a Boolean type value

-isNewPropertyProb?: number
+ isNewPropertyProb?: boolean

isHouse?: number
isSale?: number
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can align it as it is currently used in the other products and leave it as operationType

floorNumber?: number
bedrooms?: number
}

export type AppraisalRequestInputVariable = Omit<
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const APPRAISAL_PROPERTY_TYPES = {

export const API_RESOURCES_PATH = {
APPRAISALS: 'appraisals',
METRICS: 'metrics'
METRICS: 'metrics',
} as const

export const METRIC_RESOURCES_PATH = {
Expand Down