-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
394 lines (357 loc) · 13.7 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
package main
// https://github.com/reso-workgroups/reso-synd
import (
"encoding/xml"
"gopkg.in/guregu/null.v3"
"time"
)
// 2016-04-12T14:56:20+00:00
type Timestamp struct {
time.Time
}
func (c *Timestamp) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var v string
d.DecodeElement(&v, &start)
parsed, err := time.Parse(time.RFC3339, v)
if err != nil {
return err
}
*c = Timestamp{parsed}
return nil
}
// 2013-10-16T00:00:00Z
type xsDateTime struct {
time.Time
}
func (c *xsDateTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var v string
d.DecodeElement(&v, &start)
parsed, err := time.Parse("2006-01-02T15:04:05Z", v)
if err != nil {
return err
}
*c = xsDateTime{parsed}
return nil
}
type xsDate struct {
time.Time
}
func (c *xsDate) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var v string
d.DecodeElement(&v, &start)
parsed, err := time.Parse("2006-01-02", v)
if err != nil {
return err
}
*c = xsDate{parsed}
return nil
}
type Listings struct {
Version float32 `xml:"version,attr"`
VersionTimestamp xsDateTime `xml:"versionTimestamp,attr"`
ListingsKey string `xml:"listingsKey,attr"`
}
type SecureMoney struct {
Value string `xml:",chardata" json:",omitempty"`
CurrencyCode string `xml:"currencyCode,attr" json:",omitempty"`
}
type FeeWithOptionalFrequency struct {
SecureMoney
CurrencyPeriod string `xml:"currencyPeriod,attr" json:",omitempty"`
}
type PriceWithOptionalFrequency struct {
SecureMoney
CurrencyPeriod string `xml:"currencyPeriod,attr" json:",omitempty"`
}
// commons:simpleTime is a mess
type OpenHouse struct {
Date xsDate
StartTime string `json:",omitempty"`
EndTime string `json:",omitempty"`
Description string `json:",omitempty"`
AppointmentRequiredYN null.Bool
// OpenHouseAdditionalInformation commons:StringValueDescriptionPair
}
type Address struct {
PreferenceOrder null.Int `xml:"preference-order"`
AddressPreferenceOrder null.Int `xml:"address-preference-order"`
category string `json:",omitempty"`
FullStreetAddress string `json:",omitempty"`
StreetDirPrefix string `json:",omitempty"`
StreetName string `json:",omitempty"`
StreetSuffix string `json:",omitempty"`
StreetDirSuffix string `json:",omitempty"`
StreetAdditionalInfo string `json:",omitempty"`
BoxNumber string `json:",omitempty"`
UnitNumber string `json:",omitempty"`
City string `json:",omitempty"`
StateOrProvince string `json:",omitempty"`
PostalCode string `json:",omitempty"`
CarrierRoute string `json:",omitempty"`
Country string `json:",omitempty"`
PrivacyType string `xml:"privacyType,attr" json:",omitempty"`
}
type Business struct {
Name string
BusinessId string `json:",omitempty"`
Phone string `json:",omitempty"`
Fax string `json:",omitempty"`
Email string `json:",omitempty"`
BusinessLeadRoutingEmail string `json:",omitempty"`
WebsiteURL string `json:",omitempty"`
LogoURL string `json:",omitempty"`
Address *Address `json:",omitempty"`
BusinessAdditionalInformation string `json:",omitempty"`
}
type Area struct {
Value float32 `xml:",chardata"`
AreaUnits string `xml:"areaUnits,attr" json:",omitempty"`
MeasurementSource string `xml:"measurementSource,attr" json:",omitempty"`
}
type OfficeCode struct {
OfficeCodeId string
OfficeCodeDescription string `json:",omitempty"`
}
type Office struct {
OfficeKey string `json:",omitempty"`
OfficeId string `json:",omitempty"`
Level string `json:",omitempty"`
OfficeCode *OfficeCode `json:",omitempty"`
Name string `json:",omitempty"`
CorporateName string `json:",omitempty"`
BrokerId string `json:",omitempty"`
MainOfficeId string `json:",omitempty"`
PhoneNumber string `json:",omitempty"`
Fax string `json:",omitempty"`
Address *Address `json:",omitempty"`
OfficeEmail string `json:",omitempty"`
Website string `json:",omitempty"`
OfficeLogoURL string `json:",omitempty"`
// OfficeAdditionalInformation pair?
}
type AlternatePrice struct {
AlternateListPrice *PriceWithOptionalFrequency
AlternateListPriceLow *PriceWithOptionalFrequency
}
type SchoolDistrict struct {
DistrictName string `json:",omitempty"`
// Elementary null.String
// Middle null.String
// JuniorHigh null.String
// High null.String
// DistrictURL null.String
// DistrictPhoneNumber null.String
}
type Money struct {
CurrencyCode string `xml:"currencyCode,attr" json:",omitempty"`
Value null.Float `xml:",chardata"`
}
type License struct {
LicenseExpDate xsDateTime `json:",omitempty"`
LicenseAmount null.Float `json:",omitempty"`
LicenseNumber string `json:",omitempty"`
LicenseCategory string `json:",omitempty"`
}
type ParticipantCode struct {
ParticipantCodeId string
ParticipantCodeDescription string `json:",omitempty"`
}
type Participant struct {
ParticipantKey string
ParticipantId string `json:",omitempty"`
ParticipantCode *ParticipantCode `json:",omitempty"`
FirstName string `json:",omitempty"`
LastName string `json:",omitempty"`
Role string `json:",omitempty"`
PrimaryContactPhone string `json:",omitempty"`
OfficePhone string `json:",omitempty"`
MobilePhone string `json:",omitempty"`
Email string `json:",omitempty"`
Fax string `json:",omitempty"`
WebsiteURL string `json:",omitempty"`
PhotoURL string `json:",omitempty"`
Address *Address `json:",omitempty"`
Licenses []*License `xml:"Licenses>License"`
}
type ValueWithOtherDescription struct {
Value string `xml:",chardata"`
OtherDescription string `xml:"otherDescription,attr" json:",omitempty"`
}
type ArchitectureStyle struct {
ValueWithOtherDescription
}
type PropertyType struct {
ValueWithOtherDescription
}
type Media struct {
MediaModificationTimestamp Timestamp
MediaURL string
MediaCaption string `json:",omitempty"`
MediaDescription string `json:",omitempty"`
MediaOrderNumber null.Int
MediaClassification string `json:",omitempty"`
}
type Tax struct {
Year string `json:",omitempty"`
Amount *Money `json:",omitempty"`
TaxDescription string `json:",omitempty"`
}
type Expense struct {
ExpenseCategory string `json:",omitempty"`
ExpenseValue FeeWithOptionalFrequency
}
type MarketingInformation struct {
PermitInternet null.Bool
PermitAddressOnInternet null.Bool
PermitPictureOnInternet null.Bool
PermitSignOnProperty null.Bool
HasSignOnProperty null.Bool
VOWEntireListingDisplay null.Bool
VOWAddressDisplay null.Bool
VOWAutomatedValuationDisplay null.Bool
VOWConsumerComment null.Bool
}
type DetailedCharacteristics struct {
Appliances []string `xml:"Appliances>Appliance" json:",omitempty"`
ArchitectureStyle *ArchitectureStyle
HasAttic null.Bool
HasBarbecueArea null.Bool
HasBasement null.Bool
BuildingUnitCount null.Int
IsCableReady null.Bool
HasCeilingFan null.Bool
CondoFloorNum null.Int
CoolingSystems []string `xml:"CoolingSystems>CoolingSystem"`
HasDeck null.Bool
HasDisabledAccess null.Bool
HasDock null.Bool
HasDoorman null.Bool
HasDoublePaneWindows null.Bool
HasElevator null.Bool
ExteriorTypes []string `xml:"ExteriorTypes>ExteriorType"`
HasFireplace null.Bool
FloorCoverings []string `xml:"FloorCoverings>FloorCovering"`
HasGarden null.Bool
HasGatedEntry null.Bool
HasGreenhouse null.Bool
HeatingFuels []string `xml:"HeatingFuels>HeatingFuel"`
HeatingSystems []string `xml:"HeatingSystems>HeatingSystem"`
HasHotTubSpa null.Bool
Intercom null.Bool
HasJettedBathTub null.Bool
HasLawn null.Bool
LegalDescription string
HasMotherInLaw null.Bool
IsNewConstruction null.Bool
NumFloors null.Float
NumParkingSpaces null.Int
ParkingTypes []string `xml:"ParkingTypes>ParkingType"`
HasPatio null.Bool
HasPond null.Bool
HasPool null.Bool
HasPorch null.Bool
RoofTypes []string `xml:"RoofTypes>RoofType"`
RoomCount null.Int
Rooms []string `xml:"Rooms>Room"`
HasRVParking null.Bool
HasSauna null.Bool
HasSecuritySystem null.Bool
HasSkylight null.Bool
HasSportsCourt null.Bool
HasSprinklerSystem null.Bool
HasVaultedCeiling null.Bool
ViewTypes []string `xml:"ViewTypes>ViewType"`
IsWaterfront null.Bool
HasWetBar null.Bool
WhatOwnerLoves null.String
IsWired null.Bool
YearUpdated string `json:",omitempty"`
AdditionalInformation string `json:",omitempty"`
}
type School struct {
Name string `json:",omitempty"`
SchoolCategory string `json:",omitempty"`
District string `json:",omitempty"`
Description string `json:",omitempty"`
}
type Community struct {
Subdivision string `json:",omitempty"`
Schools []*School `xml:"Schools>School" json:",omitempty"`
}
type Neighborhood struct {
Name string `json:",omitempty"`
Description string `json:",omitempty"`
}
type Location struct {
Latitude string `json:",omitempty"`
Longitude string `json:",omitempty"`
Elevation string `json:",omitempty"`
MapCoordinate string `json:",omitempty"`
Directions string `json:",omitempty"`
GeocodeOptions string `json:",omitempty"`
County string `json:",omitempty"`
StreetIntersection string `json:",omitempty"`
ParcelId string `json:",omitempty"`
Community *Community `json:",omitempty"`
CommunityAmenities string `json:",omitempty"`
CommunityAddress *Address `json:",omitempty"`
TotalNumFloors null.Int
Zoning string `json:",omitempty"`
BuildingAmenities string `json:",omitempty"`
BuildingUnitCount null.Int
Neighborhoods []*Neighborhood `xml:"Neighborhoods>Neighborhood" json:",omitempty"`
}
type Listing struct {
Id string `xml:"ListingKey" json:"id"`
Address *Address `json:",omitempty"`
ListPrice *PriceWithOptionalFrequency `json:",omitempty"`
ListPriceLow *PriceWithOptionalFrequency `json:",omitempty"`
AlternatePrices []*AlternatePrice `xml:"AlternatePrices>AlternatePrice" json:",omitempty"`
ListingURL string
ProviderName string
ProviderURL string
ProviderCategory string
LeadRoutingEmail string `json:",omitempty"`
Bedrooms null.Int
Bathrooms null.Int
PropertyType *PropertyType `json:",omitempty"`
PropertySubType *PropertyType `json:",omitempty"`
ListingCategory string `json:",omitempty"`
ListingStatus string `json:",omitempty"`
MlsStatus string `json:",omitempty"`
MarketingInformation MarketingInformation
Photos []*Media `xml:"Photos>Photo" json:",omitempty"`
DiscloseAddress null.Bool `json:",omitempty"`
ShortSale null.Bool `json:",omitempty"`
ListingDescription string `json:",omitempty"`
MlsId string `json:",omitempty"`
MlsName string `json:",omitempty"`
MlsNumber string `json:",omitempty"`
LivingArea *Area `json:",omitempty"`
LotSize *Area `json:",omitempty"`
YearBuilt string `json:",omitempty"`
ListingDate xsDate
TrackingItem string `json:",omitempty"`
ListingTitle string `json:",omitempty"`
FullBathrooms null.Int
ThreeQuarterBathrooms null.Int
HalfBathrooms null.Int
OneQuarterBathrooms null.Int
PartialBathrooms null.Int
ForeclosureStatus string `json:",omitempty"`
ListingParticipants []*Participant `xml:"ListingParticipants>Participant" json:",omitempty"`
VirtualTours []*Media `xml:"VirtualTours>VirtualTour" json:",omitempty"`
Videos []*Media `xml:"Videos>Video" json:",omitempty"`
Offices []*Office `xml:"Offices>Office" json:",omitempty"`
Brokerage *Business `json:",omitempty"`
Location *Location `json:",omitempty"`
Franchise *Business `json:",omitempty"`
Builder *Business `json:",omitempty"`
PropertyManager *Business `json:",omitempty"`
OpenHouses []*OpenHouse `xml:"OpenHouses>OpenHouse" json:",omitempty"`
Taxes []*Tax `xml:"Taxes>Tax" json:",omitempty"`
Expenses []*Expense `xml:"Expenses>Expense" json:",omitempty"`
DetailedCharacteristics DetailedCharacteristics
ModificationTimestamp Timestamp
Disclaimer string
}