@sweepbright/api-client 0.29.4 → 0.29.8

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.
Files changed (64) hide show
  1. package/dist/api-client.cjs.development.js +44 -3
  2. package/dist/api-client.cjs.development.js.map +1 -1
  3. package/dist/api-client.cjs.production.min.js +1 -1
  4. package/dist/api-client.cjs.production.min.js.map +1 -1
  5. package/dist/api-client.esm.js +44 -3
  6. package/dist/api-client.esm.js.map +1 -1
  7. package/dist/common/config.d.ts +2 -0
  8. package/dist/common/currencies.d.ts +50 -0
  9. package/dist/common/logger.d.ts +27 -0
  10. package/dist/common/types.d.ts +1 -0
  11. package/dist/entities/property.d.ts +523 -0
  12. package/dist/index.d.ts +9 -7
  13. package/dist/mockServer.js +27 -0
  14. package/dist/mockServer.js.map +1 -0
  15. package/dist/resources/estates.d.ts +5 -9
  16. package/dist/resources/offices.d.ts +6 -0
  17. package/dist/src/__tests__/auth.test.js +15 -0
  18. package/dist/src/__tests__/auth.test.js.map +1 -0
  19. package/dist/src/__tests__/channels.test.js +77 -0
  20. package/dist/src/__tests__/channels.test.js.map +1 -0
  21. package/dist/src/__tests__/contacts.test.js +61 -0
  22. package/dist/src/__tests__/contacts.test.js.map +1 -0
  23. package/dist/src/__tests__/estates.test.js +43 -0
  24. package/dist/src/__tests__/estates.test.js.map +1 -0
  25. package/dist/src/__tests__/leads.test.js +55 -0
  26. package/dist/src/__tests__/leads.test.js.map +1 -0
  27. package/dist/src/common/config.js +34 -0
  28. package/dist/src/common/config.js.map +1 -0
  29. package/dist/src/common/currencies.js +55 -0
  30. package/dist/src/common/currencies.js.map +1 -0
  31. package/dist/src/common/logger.js +50 -0
  32. package/dist/src/common/logger.js.map +1 -0
  33. package/dist/src/common/types.js +3 -0
  34. package/dist/src/common/types.js.map +1 -0
  35. package/dist/src/entities/office.js +9 -0
  36. package/dist/src/entities/office.js.map +1 -0
  37. package/dist/src/entities/property.js +220 -0
  38. package/dist/src/entities/property.js.map +1 -0
  39. package/dist/src/index.js +94 -0
  40. package/dist/src/index.js.map +1 -0
  41. package/dist/src/resources/channel_accounts.js +31 -0
  42. package/dist/src/resources/channel_accounts.js.map +1 -0
  43. package/dist/src/resources/channels.js +32 -0
  44. package/dist/src/resources/channels.js.map +1 -0
  45. package/dist/src/resources/companies.js +16 -0
  46. package/dist/src/resources/companies.js.map +1 -0
  47. package/dist/src/resources/contact_preferences.js +14 -0
  48. package/dist/src/resources/contact_preferences.js.map +1 -0
  49. package/dist/src/resources/contacts.js +29 -0
  50. package/dist/src/resources/contacts.js.map +1 -0
  51. package/dist/src/resources/estates.js +73 -0
  52. package/dist/src/resources/estates.js.map +1 -0
  53. package/dist/src/resources/leads.js +26 -0
  54. package/dist/src/resources/leads.js.map +1 -0
  55. package/dist/src/resources/negotiators.js +16 -0
  56. package/dist/src/resources/negotiators.js.map +1 -0
  57. package/dist/src/resources/offices.js +12 -0
  58. package/dist/src/resources/offices.js.map +1 -0
  59. package/dist/src/types.js +40 -0
  60. package/dist/src/types.js.map +1 -0
  61. package/dist/src/utils.js +28 -0
  62. package/dist/src/utils.js.map +1 -0
  63. package/dist/types.d.ts +39 -0
  64. package/package.json +11 -10
@@ -0,0 +1,523 @@
1
+ /// <reference types="node" />
2
+ import * as fs from "fs";
3
+ import { Currency } from "../common/currencies";
4
+ import { Maybe } from "../common/types";
5
+ export declare enum ADScale {
6
+ A = "A",
7
+ B = "B",
8
+ C = "C",
9
+ D = "D"
10
+ }
11
+ export declare enum Amenity {
12
+ Attic = "attic",
13
+ Balcony = "balcony",
14
+ Basement = "basement",
15
+ ClimateControl = "climate_control",
16
+ Code = "code",
17
+ CoolingRoom = "cooling_room",
18
+ DisplayWindow = "display_window",
19
+ Drainage = "drainage",
20
+ ElectricalGate = "electrical_gate",
21
+ ExteriorParking = "exterior_parking",
22
+ Fence = "fence",
23
+ Fenced = "fenced",
24
+ Garden = "garden",
25
+ Guesthouse = "guesthouse",
26
+ InteriorParking = "interior_parking",
27
+ KeyCard = "key_card",
28
+ Lift = "lift",
29
+ ManualGate = "manual_gate",
30
+ Parking = "parking",
31
+ Pool = "pool",
32
+ PrintAndCopyArea = "print_and_copy_area",
33
+ ReceptionArea = "reception_area",
34
+ RoadAccess = "road_access",
35
+ ServerRoom = "server_room",
36
+ SewerAccess = "sewer_access",
37
+ StorageSpace = "storage_space",
38
+ Terrace = "terrace",
39
+ UtilitiesAccess = "utilities_access",
40
+ WaitingArea = "waiting_area",
41
+ WaterAccess = "water_access"
42
+ }
43
+ export declare enum UnitOfMeasurement {
44
+ cm = "cm",
45
+ inch = "inch",
46
+ sq_m = "sq_m",
47
+ sq_ft = "sq_ft"
48
+ }
49
+ export declare enum MeasurementSystem {
50
+ Metric = "metric",
51
+ Imperial = "imperial"
52
+ }
53
+ export declare enum AreaType {
54
+ Bathrooms = "bathrooms",
55
+ Bedrooms = "bedrooms",
56
+ ClosedOfficeSpaces = "closed_office_spaces",
57
+ ConferenceRooms = "conference_rooms",
58
+ Floors = "floors",
59
+ Kitchens = "kitchens",
60
+ LivingRoom = "living_room",
61
+ ManufacturingAreas = "manufacturing_areas",
62
+ MeetingRooms = "meeting_rooms",
63
+ OpenOfficeSpaces = "open_office_spaces",
64
+ ParkingSpaces = "parking_spaces",
65
+ Showrooms = "showrooms",
66
+ StorageRooms = "storage_rooms",
67
+ Toilets = "toilets"
68
+ }
69
+ export declare enum PropertyStatus {
70
+ prospect = "prospect",
71
+ lost = "lost",
72
+ available = "available",
73
+ rented = "rented",
74
+ sold = "sold",
75
+ bid = "bid",
76
+ option = "option",
77
+ under_contract = "under_contract"
78
+ }
79
+ export declare enum PropertySubType {
80
+ duplex = "duplex",
81
+ agricultural = "agricultural",
82
+ pasture_land = "pasture_land",
83
+ private_garage = "private_garage",
84
+ loft = "loft",
85
+ recreational = "recreational",
86
+ investment_property = "investment_property",
87
+ mansion = "mansion",
88
+ terraced = "terraced",
89
+ townhouse = "townhouse",
90
+ condo = "condo",
91
+ penthouse = "penthouse",
92
+ farm = "farm",
93
+ cottage = "cottage",
94
+ buildable = "buildable",
95
+ villa = "villa",
96
+ retail = "retail",
97
+ covered_outdoor_space = "covered_outdoor_space",
98
+ indoor_parking_space = "indoor_parking_space",
99
+ flex_office = "flex_office",
100
+ open_office = "open_office",
101
+ industrial = "industrial",
102
+ restaurant_and_cafe = "restaurant_and_cafe",
103
+ student_accommodation = "student_accommodation",
104
+ leisure_and_sports = "leasure_and_sports",
105
+ outdoor_parking_space = "outdoor_parking_space",
106
+ coworking = "coworking",
107
+ warehouse = "warehouse",
108
+ shop = "shop",
109
+ semi_detached = "semi_detached",
110
+ healthcare = "healthcare",
111
+ detached = "detached",
112
+ bungalow = "bungalow"
113
+ }
114
+ export declare enum PropertyType {
115
+ apartment = "apartment",
116
+ house = "house",
117
+ land = "land",
118
+ office = "office",
119
+ parking = "parking",
120
+ commercial = "commercial"
121
+ }
122
+ export declare enum Negotiation {
123
+ sale = "sale",
124
+ let = "let"
125
+ }
126
+ export declare enum Condition {
127
+ new = "new",
128
+ good = "good",
129
+ mint = "mint",
130
+ poor = "poor",
131
+ fair = "fair"
132
+ }
133
+ export declare enum Orientation {
134
+ N = "N",
135
+ S = "S",
136
+ E = "E",
137
+ W = "W",
138
+ NE = "NE",
139
+ NW = "NW",
140
+ SE = "SE",
141
+ SW = "SW"
142
+ }
143
+ export declare enum EnergyCategory {
144
+ A = "A",
145
+ B = "B",
146
+ C = "C",
147
+ D = "D",
148
+ E = "E",
149
+ F = "F",
150
+ G = "G"
151
+ }
152
+ export declare enum EnergyCategoryExtended {
153
+ A_PLUS_PLUS = "A++",
154
+ A_PLUS = "A+",
155
+ A = "A",
156
+ B = "B",
157
+ C = "C",
158
+ D = "D",
159
+ E = "E",
160
+ F = "F",
161
+ G = "G"
162
+ }
163
+ export declare enum EnergyReport {
164
+ conform = "conform",
165
+ not_conform = "not_conform",
166
+ no_report = "no_report",
167
+ not_applicable = "not_applicable"
168
+ }
169
+ export declare enum FloodRisk {
170
+ no_flood_risk_area = "no_flood_risk_area",
171
+ potential_flood_sensitive_area = "potential_flood_sensitive_area",
172
+ effective_flood_sensitive_area = "effective_flood_sensitive_area"
173
+ }
174
+ export declare enum Shape {
175
+ flat = "flat",
176
+ sloped = "sloped",
177
+ wooded = "wooded",
178
+ has_rivers_lakes_or_ponds = "has_rivers_lakes_or_ponds",
179
+ single = "single",
180
+ double = "double"
181
+ }
182
+ export declare enum LandUseDesignation {
183
+ residential = "residential",
184
+ mixed_residential = "mixed_residential",
185
+ industrial = "industrial",
186
+ recreational = "recreational",
187
+ park = "park",
188
+ area_with_economical_activity = "area_with_economical_activity",
189
+ forest_area = "forest_area",
190
+ agricultural = "agricultural",
191
+ nature_area = "nature_area",
192
+ natural_reserve = "natural_reserve",
193
+ residential_area_with_cultural_historical_value = "residential_area_with_cultural_historical_value",
194
+ industrial_area_for_sme = "industrial_area_for_sme",
195
+ day_recreation_area = "day_recreation_area",
196
+ other = "other"
197
+ }
198
+ export interface Area {
199
+ size: number;
200
+ units?: Maybe<UnitOfMeasurement>;
201
+ size_description: string;
202
+ }
203
+ export interface Regulations {
204
+ heritage_list?: Maybe<boolean>;
205
+ as_build_report?: Maybe<boolean>;
206
+ building_permit?: Maybe<boolean>;
207
+ expropriation_plan?: Maybe<boolean>;
208
+ registered_building?: Maybe<boolean>;
209
+ urban_planning_breach?: Maybe<boolean>;
210
+ site_untapped_activity?: Maybe<boolean>;
211
+ priority_purchase_right?: Maybe<boolean>;
212
+ subdivision_authorisation?: Maybe<boolean>;
213
+ urban_planning_certificate?: Maybe<boolean>;
214
+ pending_legal_proceedings?: Maybe<boolean>;
215
+ asbestos_certificate?: Maybe<boolean>;
216
+ asbestos_certificate_reference?: Maybe<string>;
217
+ zone_subject_to_rent_control?: Maybe<boolean>;
218
+ ongoing_litigation?: Maybe<boolean>;
219
+ renovation_obligation?: Maybe<boolean>;
220
+ }
221
+ export interface PropertyAndLand {
222
+ flood_risk?: Maybe<FloodRisk>;
223
+ purchased_year?: Maybe<number | string>;
224
+ cadastral_income?: Maybe<number>;
225
+ land_use_designation?: Maybe<LandUseDesignation>;
226
+ flood_risk_plot_score?: Maybe<ADScale>;
227
+ flood_risk_building_score?: Maybe<ADScale>;
228
+ }
229
+ export interface Energy {
230
+ epc_value?: Maybe<number>;
231
+ epc_category?: Maybe<EnergyCategoryExtended>;
232
+ epc_reference?: Maybe<string>;
233
+ co2_emissions?: Maybe<number>;
234
+ e_level?: Maybe<number>;
235
+ report_electricity_gas?: Maybe<EnergyReport>;
236
+ report_fuel_tank?: Maybe<EnergyReport>;
237
+ total_epc_value?: Maybe<number>;
238
+ dpe?: Maybe<EnergyCategory>;
239
+ greenhouse_emissions?: Maybe<EnergyCategory>;
240
+ }
241
+ export interface LegalAttributes {
242
+ energy?: Maybe<Energy>;
243
+ regulations?: Maybe<Regulations>;
244
+ legal_mentions?: Maybe<Record<string, string>>;
245
+ property_and_land?: Maybe<PropertyAndLand>;
246
+ }
247
+ export interface Price {
248
+ amount: number;
249
+ currency: Currency;
250
+ }
251
+ export interface PropertyPrice {
252
+ costs?: Maybe<Record<string, string>>;
253
+ taxes?: Maybe<Record<string, string>>;
254
+ current_price?: Maybe<Price>;
255
+ published_price?: Maybe<Price>;
256
+ yearly_budgeted_building_costs?: Maybe<Price>;
257
+ recurring_costs?: Maybe<Price>;
258
+ property_tax?: Maybe<Price>;
259
+ vat_regime?: Maybe<number>;
260
+ guarantee?: Maybe<Price>;
261
+ }
262
+ export interface RenovationAttributes {
263
+ year?: Maybe<number | string>;
264
+ description?: Maybe<string>;
265
+ }
266
+ export interface ConstructionAttributes {
267
+ year?: Maybe<number | string>;
268
+ architect?: Maybe<string>;
269
+ residential_lots?: Maybe<number>;
270
+ }
271
+ export interface BuildingAttributes {
272
+ renovation?: Maybe<RenovationAttributes>;
273
+ construction?: Maybe<ConstructionAttributes>;
274
+ units_of_building?: Maybe<number>;
275
+ }
276
+ export interface EnergyFeatures {
277
+ gas?: Maybe<boolean>;
278
+ electricity?: Maybe<boolean>;
279
+ fuel?: Maybe<boolean>;
280
+ heat_pump?: Maybe<boolean>;
281
+ }
282
+ export interface ComfortFeatures {
283
+ sauna?: Maybe<boolean>;
284
+ fireplace?: Maybe<boolean>;
285
+ fitness_room?: Maybe<boolean>;
286
+ furnished?: Maybe<boolean>;
287
+ home_automation?: Maybe<boolean>;
288
+ home_cinema?: Maybe<boolean>;
289
+ wine_cellar?: Maybe<boolean>;
290
+ walk_in_closet?: Maybe<boolean>;
291
+ water_softener?: Maybe<boolean>;
292
+ }
293
+ export interface EcologyFeatures {
294
+ solar_boiler?: Maybe<boolean>;
295
+ solar_panels?: Maybe<boolean>;
296
+ double_glazing?: Maybe<boolean>;
297
+ rainwater_harvesting?: Maybe<boolean>;
298
+ insulated_roof?: Maybe<boolean>;
299
+ }
300
+ export interface SecurityFeatures {
301
+ alarm?: Maybe<boolean>;
302
+ concierge?: Maybe<boolean>;
303
+ video_surveillance?: Maybe<boolean>;
304
+ }
305
+ export interface HeatingCoolingFeatures {
306
+ air_conditioning?: Maybe<boolean>;
307
+ central_heating?: Maybe<boolean>;
308
+ floor_heating?: Maybe<boolean>;
309
+ individual_heating?: Maybe<boolean>;
310
+ }
311
+ export interface FeaturesAttributes {
312
+ energy?: Maybe<EnergyFeatures>;
313
+ comfort?: Maybe<ComfortFeatures>;
314
+ ecology?: Maybe<EcologyFeatures>;
315
+ security?: Maybe<SecurityFeatures>;
316
+ heating_cooling?: Maybe<HeatingCoolingFeatures>;
317
+ }
318
+ export interface GeoData {
319
+ latitude: number;
320
+ longitude: number;
321
+ }
322
+ export interface LocationAttributes {
323
+ country?: Maybe<string>;
324
+ box?: Maybe<string>;
325
+ geo?: Maybe<GeoData>;
326
+ city?: Maybe<string>;
327
+ floor?: Maybe<string>;
328
+ number?: Maybe<string>;
329
+ street?: Maybe<string>;
330
+ addition?: Maybe<string>;
331
+ street_2?: Maybe<string>;
332
+ postal_code?: Maybe<string | number>;
333
+ province_or_state?: Maybe<string>;
334
+ borough_or_district?: Maybe<string>;
335
+ }
336
+ export interface OfficeSettings {
337
+ reference?: Maybe<string>;
338
+ }
339
+ export interface MandateSettings {
340
+ end_date?: Maybe<string>;
341
+ start_date?: Maybe<string>;
342
+ number?: Maybe<string>;
343
+ exclusive?: Maybe<boolean>;
344
+ }
345
+ export interface AgencyCommission {
346
+ fixed_fee?: Maybe<number>;
347
+ percentage?: Maybe<number>;
348
+ }
349
+ export interface AgencyCommissions {
350
+ buyer?: Maybe<AgencyCommission>;
351
+ seller?: Maybe<AgencyCommission>;
352
+ }
353
+ export interface PropertySettings {
354
+ office?: Maybe<OfficeSettings>;
355
+ mandate?: Maybe<MandateSettings>;
356
+ current_rent?: Maybe<Price>;
357
+ internal_note?: Maybe<string>;
358
+ agency_commission?: Maybe<AgencyCommissions>;
359
+ }
360
+ export interface OccupancyAttributes {
361
+ vacant?: Maybe<boolean>;
362
+ occupied?: Maybe<boolean>;
363
+ contact_details?: Maybe<string>;
364
+ available_from?: Maybe<string>;
365
+ }
366
+ export interface PropertyRoomAttributes {
367
+ size: number | string;
368
+ type: string;
369
+ units: UnitOfMeasurement;
370
+ ordinal: Maybe<number>;
371
+ size_description: string;
372
+ }
373
+ export interface Area {
374
+ size: number;
375
+ units?: Maybe<UnitOfMeasurement>;
376
+ size_description: string;
377
+ }
378
+ export interface PropertyStructure {
379
+ rooms?: Maybe<Record<string, PropertyRoomAttributes>>;
380
+ toilets?: Maybe<number>;
381
+ bedrooms?: Maybe<number>;
382
+ bathrooms?: Maybe<number>;
383
+ kitchens?: Maybe<number>;
384
+ floors?: Maybe<number>;
385
+ living_room?: Maybe<number>;
386
+ showrooms?: Maybe<number>;
387
+ shower_rooms?: Maybe<number>;
388
+ manufacturing_areas?: Maybe<number>;
389
+ storage_rooms?: Maybe<number>;
390
+ parking_spaces?: Maybe<number>;
391
+ meeting_rooms?: Maybe<number>;
392
+ open_office_spaces?: Maybe<number>;
393
+ closed_office_spaces?: Maybe<number>;
394
+ conference_rooms?: Maybe<number>;
395
+ liveable_area?: Maybe<Area>;
396
+ gross_area?: Maybe<Area>;
397
+ net_area?: Maybe<Area>;
398
+ plot_area?: Maybe<Area>;
399
+ display_window_length?: Maybe<Area>;
400
+ ceiling_height?: Maybe<Area>;
401
+ loi_carrez_area?: Maybe<Area>;
402
+ }
403
+ export interface PropertyConditions {
404
+ kitchen?: Maybe<Condition>;
405
+ bathroom?: Maybe<Condition>;
406
+ }
407
+ export interface PropertyDescription {
408
+ title: Record<string, string>;
409
+ description: Record<string, string>;
410
+ }
411
+ export interface PropertyOrientation {
412
+ balcony?: Maybe<Orientation>;
413
+ garden?: Maybe<Orientation>;
414
+ terrace?: Maybe<Orientation>;
415
+ }
416
+ export interface PropertyAccessibility {
417
+ alarm?: Maybe<boolean>;
418
+ alarm_code?: Maybe<number | string>;
419
+ key_available?: Maybe<boolean>;
420
+ }
421
+ export interface PropertyDocument {
422
+ private: boolean;
423
+ filename: string;
424
+ extension: string;
425
+ description?: Maybe<string>;
426
+ uploaded_at: string;
427
+ "content-type": string;
428
+ }
429
+ export interface FloorPlan {
430
+ private: boolean;
431
+ filename: string;
432
+ extension: string;
433
+ description: Maybe<string>;
434
+ uploaded_at: string;
435
+ "content-type": string;
436
+ }
437
+ export interface Image {
438
+ ordinal: number;
439
+ private: boolean;
440
+ filename: string;
441
+ extension: string;
442
+ description?: Maybe<string>;
443
+ equirectangular?: Maybe<boolean>;
444
+ uploaded_at: string;
445
+ "content-type": string;
446
+ }
447
+ export interface PropertyPermissions {
448
+ construction?: Maybe<boolean>;
449
+ farming?: Maybe<boolean>;
450
+ fishing?: Maybe<boolean>;
451
+ planning?: Maybe<boolean>;
452
+ }
453
+ export interface TenantContract {
454
+ start_date?: Maybe<string>;
455
+ end_date?: Maybe<string>;
456
+ }
457
+ export interface PropertyAttributes {
458
+ legal?: Maybe<LegalAttributes>;
459
+ price?: Maybe<PropertyPrice>;
460
+ images?: Maybe<Record<string, Image>>;
461
+ status?: Maybe<PropertyStatus>;
462
+ building?: Maybe<BuildingAttributes>;
463
+ features?: Maybe<FeaturesAttributes>;
464
+ location?: Maybe<LocationAttributes>;
465
+ settings?: Maybe<PropertySettings>;
466
+ sub_type?: Maybe<PropertySubType[]>;
467
+ amenities?: Maybe<Amenity[]>;
468
+ documents?: Maybe<Record<string, PropertyDocument>>;
469
+ occupancy?: Maybe<OccupancyAttributes>;
470
+ structure?: Maybe<PropertyStructure>;
471
+ conditions?: Maybe<PropertyConditions>;
472
+ description?: Maybe<PropertyDescription>;
473
+ floor_plans?: Maybe<Record<string, FloorPlan>>;
474
+ orientation?: Maybe<PropertyOrientation>;
475
+ accessibility?: Maybe<PropertyAccessibility>;
476
+ tenant_contract?: Maybe<TenantContract>;
477
+ general_condition?: Maybe<Condition>;
478
+ permissions?: Maybe<PropertyPermissions>;
479
+ shape?: Maybe<Shape>;
480
+ video?: Maybe<string>;
481
+ virtual_tour?: Maybe<string>;
482
+ }
483
+ export interface Property {
484
+ id: string;
485
+ type: PropertyType;
486
+ negotiation: Negotiation;
487
+ is_project: boolean;
488
+ project_id?: Maybe<string>;
489
+ office_id: string;
490
+ negotiator_id: string;
491
+ attributes: PropertyAttributes;
492
+ archived_at?: Maybe<string>;
493
+ created_at?: Maybe<string>;
494
+ updated_at?: Maybe<string>;
495
+ }
496
+ export declare type Resource = FloorPlan | PropertyDocument | Image;
497
+ export declare type FileUploadStream = fs.ReadStream;
498
+ export interface LanguageWithDefaultValue {
499
+ language: string;
500
+ default_value: string;
501
+ }
502
+ export interface RoomData {
503
+ name: AreaType;
504
+ value: number;
505
+ }
506
+ export declare type LocalizedStringMap = {
507
+ [key: string]: string;
508
+ };
509
+ export interface UserDefaults {
510
+ measurementSystem: MeasurementSystem;
511
+ currency: Currency;
512
+ defaultLanguage: string[];
513
+ country: string;
514
+ }
515
+ export declare enum InternalType {
516
+ project = "project",
517
+ unit = "unit",
518
+ standalone = "standalone"
519
+ }
520
+ export interface PropertyForSnsEvent extends Property {
521
+ is_archived: boolean;
522
+ internal_type: InternalType;
523
+ }
package/dist/index.d.ts CHANGED
@@ -48,18 +48,15 @@ declare function createClient(conf: ClientConf): {
48
48
  getOne: (attributes: {
49
49
  estateId: string;
50
50
  companyId: string;
51
- includes?: ("settings" | "office.settings" | "channels" | "project.settings" | "project.office.settings" | "project.properties.office.settings" | "project.properties.settings" | "properties.settings" | "properties.office.settings" | "negotiator" | "properties.negotiator" | "item.settings" | "item.office.settings" | "item.channels" | "item.project.settings" | "item.project.office.settings" | "item.project.properties.office.settings" | "item.project.properties.settings" | "item.properties.settings" | "item.properties.office.settings" | "item.negotiator" | "item.properties.negotiator")[] | undefined;
52
- }) => Promise<any>;
51
+ includes?: import("./types").EstateInclude[] | undefined;
52
+ }) => Promise<import("./entities/property").Property>;
53
53
  getAll: (attributes: {
54
54
  companyId: string;
55
55
  page?: number | undefined;
56
56
  limit?: number | undefined;
57
57
  archived?: boolean | undefined;
58
- }) => Promise<import("axios").AxiosResponse<any>>;
59
- getUnits: (projectId: string, { page, limit }?: {
60
- page?: number | undefined;
61
- limit?: number | undefined;
62
- }) => Promise<import("axios").AxiosResponse<any>>;
58
+ }) => Promise<import("./types").PropertiesOutput>;
59
+ getUnits: (projectId: string, { page, limit, includes }?: import("./types").GetUnitsInput) => Promise<import("./types").UnitsOutput>;
63
60
  createPublication: (attributes: {
64
61
  estateId: string;
65
62
  channelAccountId: string;
@@ -134,6 +131,11 @@ declare function createClient(conf: ClientConf): {
134
131
  data: import("./types").NegotiatorInfo[];
135
132
  }>;
136
133
  };
134
+ offices: {
135
+ getOffice: (attributes: {
136
+ officeId: string;
137
+ }) => Promise<import("axios").AxiosResponse<any>>;
138
+ };
137
139
  };
138
140
  interface Client extends ReturnType<typeof createClient> {
139
141
  }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handlers = exports.rest = exports.server = void 0;
4
+ const msw_1 = require("msw");
5
+ Object.defineProperty(exports, "rest", { enumerable: true, get: function () { return msw_1.rest; } });
6
+ const node_1 = require("msw/node");
7
+ const server = (0, node_1.setupServer)(msw_1.rest.post('*', (req, res, ctx) => {
8
+ return res(ctx.status(500), ctx.json({ error: 'Mock this request ' + req.url.toString() }));
9
+ }), msw_1.rest.get('*', (req, res, ctx) => {
10
+ return res(ctx.status(500), ctx.json({ error: 'Mock this request ' + req.url.toString() }));
11
+ }), msw_1.rest.put('*', (req, res, ctx) => {
12
+ return res(ctx.status(500), ctx.json({ error: 'Mock this request ' + req.url.toString() }));
13
+ }));
14
+ exports.server = server;
15
+ beforeAll(() => server.listen());
16
+ afterAll(() => server.close());
17
+ beforeEach(() => server.resetHandlers());
18
+ const handlers = {
19
+ authHandler: msw_1.rest.post('https://api.sweepbright.com/auth/access-token', (_req, res, ctx) => {
20
+ return res(ctx.status(200), ctx.json({
21
+ access_token: 'FAKE_TOKEN',
22
+ expires_in: Date.now(),
23
+ }));
24
+ }),
25
+ };
26
+ exports.handlers = handlers;
27
+ //# sourceMappingURL=mockServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockServer.js","sourceRoot":"","sources":["../mockServer.ts"],"names":[],"mappings":";;;AAAA,6BAA2B;AA2CV,qFA3CR,UAAI,OA2CQ;AA1CrB,mCAAuC;AAEvC,MAAM,MAAM,GAAG,IAAA,kBAAW,EACxB,UAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAC/B,OAAO,GAAG,CACR,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EACf,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,oBAAoB,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAC/D,CAAC;AACJ,CAAC,CAAC,EACF,UAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAC9B,OAAO,GAAG,CACR,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EACf,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,oBAAoB,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAC/D,CAAC;AACJ,CAAC,CAAC,EACF,UAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAC9B,OAAO,GAAG,CACR,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EACf,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,oBAAoB,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAC/D,CAAC;AACJ,CAAC,CAAC,CACH,CAAC;AAqBO,wBAAM;AAnBf,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AACjC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AAC/B,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;AAEzC,MAAM,QAAQ,GAAG;IACf,WAAW,EAAE,UAAI,CAAC,IAAI,CACpB,+CAA+C,EAC/C,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QACjB,OAAO,GAAG,CACR,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EACf,GAAG,CAAC,IAAI,CAAC;YACP,YAAY,EAAE,YAAY;YAC1B,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;SACvB,CAAC,CACH,CAAC;IACJ,CAAC,CACF;CACF,CAAC;AAEqB,4BAAQ"}
@@ -1,21 +1,18 @@
1
- import { ClientCtx } from '../types';
2
- declare type EstateInclude = 'settings' | 'office.settings' | 'channels' | 'project.settings' | 'project.office.settings' | 'project.properties.office.settings' | 'project.properties.settings' | 'properties.settings' | 'properties.office.settings' | 'negotiator' | 'properties.negotiator' | 'item.settings' | 'item.office.settings' | 'item.channels' | 'item.project.settings' | 'item.project.office.settings' | 'item.project.properties.office.settings' | 'item.project.properties.settings' | 'item.properties.settings' | 'item.properties.office.settings' | 'item.negotiator' | 'item.properties.negotiator';
1
+ import { Property } from '../entities/property';
2
+ import { ClientCtx, EstateInclude, GetUnitsInput, PropertiesOutput, UnitsOutput } from '../types';
3
3
  export default function (ctx: ClientCtx): {
4
4
  getOne: (attributes: {
5
5
  estateId: string;
6
6
  companyId: string;
7
7
  includes?: EstateInclude[];
8
- }) => Promise<any>;
8
+ }) => Promise<Property>;
9
9
  getAll: (attributes: {
10
10
  companyId: string;
11
11
  page?: number;
12
12
  limit?: number;
13
13
  archived?: boolean;
14
- }) => Promise<import("axios").AxiosResponse<any>>;
15
- getUnits: (projectId: string, { page, limit }?: {
16
- page?: number | undefined;
17
- limit?: number | undefined;
18
- }) => Promise<import("axios").AxiosResponse<any>>;
14
+ }) => Promise<PropertiesOutput>;
15
+ getUnits: (projectId: string, { page, limit, includes }?: GetUnitsInput) => Promise<UnitsOutput>;
19
16
  createPublication: (attributes: {
20
17
  estateId: string;
21
18
  channelAccountId: string;
@@ -44,4 +41,3 @@ export default function (ctx: ClientCtx): {
44
41
  url: string;
45
42
  }) => Promise<import("axios").AxiosResponse<any>>;
46
43
  };
47
- export {};
@@ -0,0 +1,6 @@
1
+ import { ClientCtx } from '../types';
2
+ export default function (ctx: ClientCtx): {
3
+ getOffice: (attributes: {
4
+ officeId: string;
5
+ }) => Promise<import("axios").AxiosResponse<any>>;
6
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const __1 = require("../");
4
+ const mockServer_1 = require("../../mockServer");
5
+ describe('authorization', () => {
6
+ it('can fetch an auth token', async () => {
7
+ const client = (0, __1.createClient)({
8
+ clientId: 'FAKE_ID',
9
+ clientSecret: 'FAKE_SECRET',
10
+ });
11
+ mockServer_1.server.use(mockServer_1.handlers.authHandler);
12
+ await client.authorize({});
13
+ });
14
+ });
15
+ //# sourceMappingURL=auth.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.test.js","sourceRoot":"","sources":["../../../src/__tests__/auth.test.ts"],"names":[],"mappings":";;AAAA,2BAAmC;AACnC,iDAAoD;AAEpD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,MAAM,GAAG,IAAA,gBAAY,EAAC;YAC1B,QAAQ,EAAE,SAAS;YACnB,YAAY,EAAE,aAAa;SAC5B,CAAC,CAAC;QAEH,mBAAM,CAAC,GAAG,CAAC,qBAAQ,CAAC,WAAW,CAAC,CAAC;QACjC,MAAM,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}