@sweepbright/api-client 0.29.6 → 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.
- package/dist/api-client.cjs.development.js +1322 -0
- package/dist/api-client.cjs.development.js.map +1 -0
- package/dist/api-client.cjs.production.min.js +2 -0
- package/dist/api-client.cjs.production.min.js.map +1 -0
- package/dist/api-client.esm.js +1318 -0
- package/dist/api-client.esm.js.map +1 -0
- package/dist/common/config.d.ts +2 -0
- package/dist/common/currencies.d.ts +50 -0
- package/dist/common/logger.d.ts +27 -0
- package/dist/common/types.d.ts +1 -0
- package/dist/entities/property.d.ts +523 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.js +8 -0
- package/dist/mockServer.js +27 -0
- package/dist/mockServer.js.map +1 -0
- package/dist/resources/channel_accounts.d.ts +15 -0
- package/dist/resources/channels.d.ts +16 -0
- package/dist/resources/companies.d.ts +7 -0
- package/dist/resources/contact_preferences.d.ts +6 -0
- package/dist/resources/contacts.d.ts +14 -0
- package/dist/resources/estates.d.ts +43 -0
- package/dist/resources/leads.d.ts +39 -0
- package/dist/resources/negotiators.d.ts +10 -0
- package/dist/resources/offices.d.ts +6 -0
- package/dist/src/__tests__/auth.test.js +15 -0
- package/dist/src/__tests__/auth.test.js.map +1 -0
- package/dist/src/__tests__/channels.test.js +77 -0
- package/dist/src/__tests__/channels.test.js.map +1 -0
- package/dist/src/__tests__/contacts.test.js +61 -0
- package/dist/src/__tests__/contacts.test.js.map +1 -0
- package/dist/src/__tests__/estates.test.js +43 -0
- package/dist/src/__tests__/estates.test.js.map +1 -0
- package/dist/src/__tests__/leads.test.js +55 -0
- package/dist/src/__tests__/leads.test.js.map +1 -0
- package/dist/src/common/config.js +34 -0
- package/dist/src/common/config.js.map +1 -0
- package/dist/src/common/currencies.js +55 -0
- package/dist/src/common/currencies.js.map +1 -0
- package/dist/src/common/logger.js +50 -0
- package/dist/src/common/logger.js.map +1 -0
- package/dist/src/common/types.js +3 -0
- package/dist/src/common/types.js.map +1 -0
- package/dist/src/entities/office.js +9 -0
- package/dist/src/entities/office.js.map +1 -0
- package/dist/src/entities/property.js +220 -0
- package/dist/src/entities/property.js.map +1 -0
- package/dist/src/index.js +94 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/resources/channel_accounts.js +31 -0
- package/dist/src/resources/channel_accounts.js.map +1 -0
- package/dist/src/resources/channels.js +32 -0
- package/dist/src/resources/channels.js.map +1 -0
- package/dist/src/resources/companies.js +16 -0
- package/dist/src/resources/companies.js.map +1 -0
- package/dist/src/resources/contact_preferences.js +14 -0
- package/dist/src/resources/contact_preferences.js.map +1 -0
- package/dist/src/resources/contacts.js +29 -0
- package/dist/src/resources/contacts.js.map +1 -0
- package/dist/src/resources/estates.js +73 -0
- package/dist/src/resources/estates.js.map +1 -0
- package/dist/src/resources/leads.js +26 -0
- package/dist/src/resources/leads.js.map +1 -0
- package/dist/src/resources/negotiators.js +16 -0
- package/dist/src/resources/negotiators.js.map +1 -0
- package/dist/src/resources/offices.js +12 -0
- package/dist/src/resources/offices.js.map +1 -0
- package/dist/src/types.js +40 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils.js +28 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/types.d.ts +75 -0
- package/dist/utils.d.ts +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenType = exports.EstateInclude = exports.Env = void 0;
|
|
4
|
+
var Env;
|
|
5
|
+
(function (Env) {
|
|
6
|
+
Env["PRODUCTION"] = "production";
|
|
7
|
+
Env["STAGING"] = "staging";
|
|
8
|
+
Env["DEV"] = "dev";
|
|
9
|
+
})(Env || (exports.Env = Env = {}));
|
|
10
|
+
var EstateInclude;
|
|
11
|
+
(function (EstateInclude) {
|
|
12
|
+
EstateInclude["settings"] = "settings";
|
|
13
|
+
EstateInclude["channels"] = "channels";
|
|
14
|
+
EstateInclude["negotiator"] = "negotiator";
|
|
15
|
+
EstateInclude["office.settings"] = "office.settings";
|
|
16
|
+
EstateInclude["project.settings"] = "project.settings";
|
|
17
|
+
EstateInclude["project.office.settings"] = "project.office.settings";
|
|
18
|
+
EstateInclude["project.properties.office.settings"] = "project.properties.office.settings";
|
|
19
|
+
EstateInclude["project.properties.settings"] = "project.properties.settings";
|
|
20
|
+
EstateInclude["properties.settings"] = "properties.settings";
|
|
21
|
+
EstateInclude["properties.office.settings"] = "properties.office.settings";
|
|
22
|
+
EstateInclude["properties.negotiator"] = "properties.negotiator";
|
|
23
|
+
EstateInclude["item.settings"] = "item.settings";
|
|
24
|
+
EstateInclude["item.office.settings"] = "item.office.settings";
|
|
25
|
+
EstateInclude["item.channels"] = "item.channels";
|
|
26
|
+
EstateInclude["item.project.settings"] = "item.project.settings";
|
|
27
|
+
EstateInclude["item.project.office.settings"] = "item.project.office.settings";
|
|
28
|
+
EstateInclude["item.project.properties.office.settings"] = "item.project.properties.office.settings";
|
|
29
|
+
EstateInclude["item.project.properties.settings"] = "item.project.properties.settings";
|
|
30
|
+
EstateInclude["item.properties.settings"] = "item.properties.settings";
|
|
31
|
+
EstateInclude["item.properties.office.settings"] = "item.properties.office.settings";
|
|
32
|
+
EstateInclude["item.negotiator"] = "item.negotiator";
|
|
33
|
+
EstateInclude["item.properties.negotiator"] = "item.properties.negotiator";
|
|
34
|
+
})(EstateInclude || (exports.EstateInclude = EstateInclude = {}));
|
|
35
|
+
var TokenType;
|
|
36
|
+
(function (TokenType) {
|
|
37
|
+
TokenType[TokenType["USER_TOKEN"] = 0] = "USER_TOKEN";
|
|
38
|
+
TokenType[TokenType["API_TOKEN"] = 1] = "API_TOKEN";
|
|
39
|
+
})(TokenType || (exports.TokenType = TokenType = {}));
|
|
40
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAGA,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,gCAAyB,CAAA;IACzB,0BAAmB,CAAA;IACnB,kBAAW,CAAA;AACb,CAAC,EAJW,GAAG,mBAAH,GAAG,QAId;AAED,IAAY,aAuBX;AAvBD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,oDAAqC,CAAA;IACrC,sDAAuC,CAAA;IACvC,oEAAqD,CAAA;IACrD,0FAA2E,CAAA;IAC3E,4EAA6D,CAAA;IAC7D,4DAA6C,CAAA;IAC7C,0EAA2D,CAAA;IAC3D,gEAAiD,CAAA;IACjD,gDAAiC,CAAA;IACjC,8DAA+C,CAAA;IAC/C,gDAAiC,CAAA;IACjC,gEAAiD,CAAA;IACjD,8EAA+D,CAAA;IAC/D,oGAAqF,CAAA;IACrF,sFAAuE,CAAA;IACvE,sEAAuD,CAAA;IACvD,oFAAqE,CAAA;IACrE,oDAAqC,CAAA;IACrC,0EAA2D,CAAA;AAC7D,CAAC,EAvBW,aAAa,6BAAb,aAAa,QAuBxB;AAaD,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,qDAAU,CAAA;IACV,mDAAS,CAAA;AACX,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleRequestFailure = exports.getData = void 0;
|
|
4
|
+
function getData(response) {
|
|
5
|
+
return response.data;
|
|
6
|
+
}
|
|
7
|
+
exports.getData = getData;
|
|
8
|
+
function handleRequestFailure(exception) {
|
|
9
|
+
if (exception.response) {
|
|
10
|
+
const { response: { status, data }, } = exception;
|
|
11
|
+
const error = new Error(`${status}: ${JSON.stringify(data)}`);
|
|
12
|
+
// remove parts of the stack trace so the error message (codeframe) shows up
|
|
13
|
+
// at the code where the actual problem is.
|
|
14
|
+
error.stack = (error.stack || '')
|
|
15
|
+
.split('\n')
|
|
16
|
+
.filter((line) => !line.includes('at handleRequestFailure') &&
|
|
17
|
+
!line.includes('at processTicksAndRejections'))
|
|
18
|
+
.join('\n');
|
|
19
|
+
error.status = status;
|
|
20
|
+
error.data = data;
|
|
21
|
+
return Promise.reject(error);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return Promise.reject(exception);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.handleRequestFailure = handleRequestFailure;
|
|
28
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,OAAO,CAAC,QAAa;IACnC,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AAFD,0BAEC;AAED,SAAgB,oBAAoB,CAAC,SAKpC;IACC,IAAI,SAAS,CAAC,QAAQ,EAAE;QACtB,MAAM,EACJ,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAC3B,GAAG,SAAS,CAAC;QAEd,MAAM,KAAK,GAAQ,IAAI,KAAK,CAAC,GAAG,MAAM,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnE,4EAA4E;QAC5E,2CAA2C;QAC3C,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;aAC9B,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CACL,CAAC,IAAY,EAAE,EAAE,CACf,CAAC,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC;YACzC,CAAC,IAAI,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CACjD;aACA,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACtB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAElB,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAC9B;SAAM;QACL,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;KAClC;AACH,CAAC;AA9BD,oDA8BC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { Property } from './entities/property';
|
|
3
|
+
export declare enum EstateInclude {
|
|
4
|
+
settings = "settings",
|
|
5
|
+
channels = "channels",
|
|
6
|
+
negotiator = "negotiator",
|
|
7
|
+
'office.settings' = "office.settings",
|
|
8
|
+
'project.settings' = "project.settings",
|
|
9
|
+
'project.office.settings' = "project.office.settings",
|
|
10
|
+
'project.properties.office.settings' = "project.properties.office.settings",
|
|
11
|
+
'project.properties.settings' = "project.properties.settings",
|
|
12
|
+
'properties.settings' = "properties.settings",
|
|
13
|
+
'properties.office.settings' = "properties.office.settings",
|
|
14
|
+
'properties.negotiator' = "properties.negotiator",
|
|
15
|
+
'item.settings' = "item.settings",
|
|
16
|
+
'item.office.settings' = "item.office.settings",
|
|
17
|
+
'item.channels' = "item.channels",
|
|
18
|
+
'item.project.settings' = "item.project.settings",
|
|
19
|
+
'item.project.office.settings' = "item.project.office.settings",
|
|
20
|
+
'item.project.properties.office.settings' = "item.project.properties.office.settings",
|
|
21
|
+
'item.project.properties.settings' = "item.project.properties.settings",
|
|
22
|
+
'item.properties.settings' = "item.properties.settings",
|
|
23
|
+
'item.properties.office.settings' = "item.properties.office.settings",
|
|
24
|
+
'item.negotiator' = "item.negotiator",
|
|
25
|
+
'item.properties.negotiator' = "item.properties.negotiator"
|
|
26
|
+
}
|
|
27
|
+
export declare type ClientConf = {
|
|
28
|
+
clientId?: string;
|
|
29
|
+
clientSecret?: string;
|
|
30
|
+
env?: Env;
|
|
31
|
+
version?: string;
|
|
32
|
+
};
|
|
33
|
+
export declare type InitConf = {
|
|
34
|
+
scopes?: string[];
|
|
35
|
+
};
|
|
36
|
+
export declare enum TokenType {
|
|
37
|
+
USER_TOKEN = 0,
|
|
38
|
+
API_TOKEN = 1
|
|
39
|
+
}
|
|
40
|
+
export declare type Auth = {
|
|
41
|
+
token: string;
|
|
42
|
+
expiresIn?: string;
|
|
43
|
+
type: TokenType;
|
|
44
|
+
};
|
|
45
|
+
export declare type Maybe<T> = T | null;
|
|
46
|
+
export declare type ClientCtx = {
|
|
47
|
+
checkAuth: (tokenType: TokenType) => void;
|
|
48
|
+
httpClient: AxiosInstance;
|
|
49
|
+
};
|
|
50
|
+
export declare enum Env {
|
|
51
|
+
PRODUCTION = "production",
|
|
52
|
+
STAGING = "staging",
|
|
53
|
+
DEV = "dev"
|
|
54
|
+
}
|
|
55
|
+
export interface NegotiatorInfo {
|
|
56
|
+
id: number;
|
|
57
|
+
first_name?: string;
|
|
58
|
+
last_name?: string;
|
|
59
|
+
picture_url?: string;
|
|
60
|
+
full_name?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface GetUnitsInput {
|
|
63
|
+
page?: number;
|
|
64
|
+
limit?: number;
|
|
65
|
+
includes?: EstateInclude[];
|
|
66
|
+
}
|
|
67
|
+
export interface UnitsOutput {
|
|
68
|
+
data: Property[];
|
|
69
|
+
}
|
|
70
|
+
export interface PropertyOutput {
|
|
71
|
+
data: Property;
|
|
72
|
+
}
|
|
73
|
+
export interface PropertiesOutput {
|
|
74
|
+
data: Property[];
|
|
75
|
+
}
|
package/dist/utils.d.ts
ADDED
package/package.json
CHANGED