@or-sdk/contacts 1.4.0-beta.647.0 → 1.4.0
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/CHANGELOG.md +9 -0
- package/dist/cjs/api/contactApi.js +30 -9
- package/dist/cjs/api/contactApi.js.map +1 -1
- package/dist/cjs/api/contactBookApi.js +47 -7
- package/dist/cjs/api/contactBookApi.js.map +1 -1
- package/dist/esm/Contacts.js +0 -6
- package/dist/esm/Contacts.js.map +1 -1
- package/dist/esm/api/baseApi.js +0 -1
- package/dist/esm/api/baseApi.js.map +1 -1
- package/dist/esm/api/contactApi.js +20 -8
- package/dist/esm/api/contactApi.js.map +1 -1
- package/dist/esm/api/contactBookApi.js +37 -6
- package/dist/esm/api/contactBookApi.js.map +1 -1
- package/dist/types/api/contactApi.d.ts +7 -4
- package/dist/types/api/contactApi.d.ts.map +1 -1
- package/dist/types/api/contactBookApi.d.ts +8 -2
- package/dist/types/api/contactBookApi.d.ts.map +1 -1
- package/dist/types/types.d.ts +13 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/api/contactApi.ts +33 -11
- package/src/api/contactBookApi.ts +64 -8
- package/src/types.ts +16 -0
- package/tsconfig.esm.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.4.0](https://gitlab.com/onereach/platform/or-sdk-next/compare/@or-sdk/contacts@1.3.1...@or-sdk/contacts@1.4.0) (2022-09-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **@or-sdk/contacts:** update contacts sdk ([4a97728](https://gitlab.com/onereach/platform/or-sdk-next/commit/4a977284e2834e1ec8ec59783017742cf898d9cc))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
### [1.3.1](https://gitlab.com/onereach/platform/or-sdk-next/compare/@or-sdk/contacts@1.3.0...@or-sdk/contacts@1.3.1) (2022-09-20)
|
|
7
16
|
|
|
8
17
|
|
|
@@ -14,51 +14,72 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
17
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
29
|
var baseApi_1 = require("./baseApi");
|
|
19
30
|
var ContactApi = (function (_super) {
|
|
20
31
|
__extends(ContactApi, _super);
|
|
21
32
|
function ContactApi() {
|
|
22
|
-
|
|
33
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
+
_this.apiBasePath = 'contact';
|
|
35
|
+
return _this;
|
|
23
36
|
}
|
|
24
37
|
ContactApi.prototype.getContact = function (id, params) {
|
|
25
38
|
return this.apiCall({
|
|
26
39
|
method: 'GET',
|
|
27
|
-
route: "
|
|
40
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
28
41
|
params: params,
|
|
29
42
|
});
|
|
30
43
|
};
|
|
31
44
|
ContactApi.prototype.getContactsList = function (params) {
|
|
32
45
|
return this.apiCall({
|
|
33
46
|
method: 'GET',
|
|
34
|
-
route:
|
|
35
|
-
params: params,
|
|
47
|
+
route: "".concat(this.apiBasePath),
|
|
48
|
+
params: __assign(__assign({}, params), (params.order && { order: "".concat(params.order.field, ":").concat(params.order.order) })),
|
|
36
49
|
});
|
|
37
50
|
};
|
|
38
51
|
ContactApi.prototype.updateContact = function (id, data) {
|
|
39
52
|
return this.apiCall({
|
|
40
53
|
method: 'PATCH',
|
|
41
|
-
route: "
|
|
54
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
55
|
+
data: data,
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
ContactApi.prototype.deleteContact = function (id, data) {
|
|
59
|
+
return this.apiCall({
|
|
60
|
+
method: 'DELETE',
|
|
61
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
42
62
|
data: data,
|
|
43
63
|
});
|
|
44
64
|
};
|
|
45
|
-
ContactApi.prototype.
|
|
65
|
+
ContactApi.prototype.deleteMulti = function (data) {
|
|
46
66
|
return this.apiCall({
|
|
47
67
|
method: 'DELETE',
|
|
48
|
-
route: "
|
|
68
|
+
route: "".concat(this.apiBasePath),
|
|
69
|
+
data: data,
|
|
49
70
|
});
|
|
50
71
|
};
|
|
51
72
|
ContactApi.prototype.createContact = function (data) {
|
|
52
73
|
return this.apiCall({
|
|
53
74
|
method: 'POST',
|
|
54
|
-
route:
|
|
75
|
+
route: "".concat(this.apiBasePath),
|
|
55
76
|
data: data,
|
|
56
77
|
});
|
|
57
78
|
};
|
|
58
79
|
ContactApi.prototype.mergeContacts = function (id, data) {
|
|
59
80
|
return this.apiCall({
|
|
60
81
|
method: 'POST',
|
|
61
|
-
route: "
|
|
82
|
+
route: "".concat(this.apiBasePath, "/").concat(id, "/merge"),
|
|
62
83
|
data: data,
|
|
63
84
|
});
|
|
64
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactApi.js","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contactApi.js","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAapC;IAAwC,8BAAO;IAA/C;QAAA,qEA8FC;QA7FkB,iBAAW,GAAG,SAAS,CAAC;;IA6F3C,CAAC;IAtFC,+BAAU,GAAV,UAAW,EAAU,EAAE,MAAwB;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,CAAE;YAClC,MAAM,QAAA;SACP,CAAC,CAAC;IACL,CAAC;IAMD,oCAAe,GAAf,UAAgB,MAA2B;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;YAC5B,MAAM,wBACD,MAAM,GACN,CAAC,MAAM,CAAC,KAAK,IAAI,EAAC,KAAK,EAAE,UAAG,MAAM,CAAC,KAAK,CAAC,KAAK,cAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,EAAC,CAAC,CAC5E;SACF,CAAC,CAAC;IACL,CAAC;IAOD,kCAAa,GAAb,UAAc,EAAU,EAAE,IAAsB;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,CAAE;YAClC,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAOD,kCAAa,GAAb,UAAc,EAAU,EAAE,IAA4B;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,CAAE;YAClC,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAOD,gCAAW,GAAX,UAAY,IAAiC;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;YAC5B,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAMD,kCAAa,GAAb,UAAc,IAAsB;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;YAC5B,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAOD,kCAAa,GAAb,UAAc,EAAU,EAAE,IAA2B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,WAAQ;YACxC,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IACH,iBAAC;AAAD,CAAC,AA9FD,CAAwC,iBAAO,GA8F9C"}
|
|
@@ -14,43 +14,83 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
17
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
29
|
var baseApi_1 = require("./baseApi");
|
|
19
30
|
var ContactBookApi = (function (_super) {
|
|
20
31
|
__extends(ContactBookApi, _super);
|
|
21
32
|
function ContactBookApi() {
|
|
22
|
-
|
|
33
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
+
_this.apiBasePath = 'contact-book';
|
|
35
|
+
return _this;
|
|
23
36
|
}
|
|
24
37
|
ContactBookApi.prototype.getContactBookList = function (params) {
|
|
25
38
|
return this.apiCall({
|
|
26
39
|
method: 'GET',
|
|
27
|
-
route:
|
|
28
|
-
params: params,
|
|
40
|
+
route: "".concat(this.apiBasePath),
|
|
41
|
+
params: __assign(__assign({}, params), (params.order && { order: "".concat(params.order.field, ":").concat(params.order.order) })),
|
|
29
42
|
});
|
|
30
43
|
};
|
|
31
44
|
ContactBookApi.prototype.getContactBook = function (id) {
|
|
32
45
|
return this.apiCall({
|
|
33
46
|
method: 'GET',
|
|
34
|
-
route: "
|
|
47
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
35
48
|
});
|
|
36
49
|
};
|
|
37
50
|
ContactBookApi.prototype.updateContactBook = function (id, data) {
|
|
38
51
|
return this.apiCall({
|
|
39
52
|
method: 'PATCH',
|
|
40
|
-
route: "
|
|
53
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
41
54
|
data: data,
|
|
42
55
|
});
|
|
43
56
|
};
|
|
44
57
|
ContactBookApi.prototype.deleteContactBook = function (id) {
|
|
45
58
|
return this.apiCall({
|
|
46
59
|
method: 'DELETE',
|
|
47
|
-
route: "
|
|
60
|
+
route: "".concat(this.apiBasePath, "/").concat(id),
|
|
48
61
|
});
|
|
49
62
|
};
|
|
50
63
|
ContactBookApi.prototype.createContactBook = function (data) {
|
|
51
64
|
return this.apiCall({
|
|
52
65
|
method: 'POST',
|
|
53
|
-
route:
|
|
66
|
+
route: "".concat(this.apiBasePath),
|
|
67
|
+
data: data,
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
ContactBookApi.prototype.shareContactBook = function (id, data) {
|
|
71
|
+
return this.apiCall({
|
|
72
|
+
method: 'POST',
|
|
73
|
+
route: "".concat(this.apiBasePath, "/").concat(id, "/share"),
|
|
74
|
+
data: data,
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
ContactBookApi.prototype.getSharedBookMeta = function (params) {
|
|
78
|
+
return this.apiCall({
|
|
79
|
+
method: 'GET',
|
|
80
|
+
route: "".concat(this.apiBasePath, "/shared-book-meta"),
|
|
81
|
+
params: params,
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
ContactBookApi.prototype.approveSharedBook = function (id) {
|
|
85
|
+
return this.apiCall({
|
|
86
|
+
method: 'POST',
|
|
87
|
+
route: "".concat(this.apiBasePath, "/").concat(id, "/approve"),
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
ContactBookApi.prototype.rejectShareBook = function (id, data) {
|
|
91
|
+
return this.apiCall({
|
|
92
|
+
method: 'POST',
|
|
93
|
+
route: "".concat(this.apiBasePath, "/").concat(id, "/reject"),
|
|
54
94
|
data: data,
|
|
55
95
|
});
|
|
56
96
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactBookApi.js","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contactBookApi.js","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,qCAAoC;AAGpC;IAA4C,kCAAO;IAAnD;QAAA,qEAgHC;QA/GkB,iBAAW,GAAG,cAAc,CAAC;;IA+GhD,CAAC;IA1GC,2CAAkB,GAAlB,UAAmB,MAAyB;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;YAC5B,MAAM,wBACD,MAAM,GACN,CAAC,MAAM,CAAC,KAAK,IAAI,EAAC,KAAK,EAAE,UAAG,MAAM,CAAC,KAAK,CAAC,KAAK,cAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAE,EAAC,CAAC,CAC5E;SACF,CAAC,CAAC;IACL,CAAC;IAMD,uCAAc,GAAd,UAAe,EAAU;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,CAAE;SACnC,CAAC,CAAC;IACL,CAAC;IAOD,0CAAiB,GAAjB,UAAkB,EAAU,EAAE,IAA0B;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,CAAE;YAClC,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAMD,0CAAiB,GAAjB,UAAkB,EAAU;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,CAAE;SACnC,CAAC,CAAC;IACL,CAAC;IAMD,0CAAiB,GAAjB,UAAkB,IAA0B;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,CAAE;YAC5B,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAOD,yCAAgB,GAAhB,UAAiB,EAAU,EAAE,IAA+B;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,WAAQ;YACxC,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAMD,0CAAiB,GAAjB,UAAkB,MAA+B;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,sBAAmB;YAC7C,MAAM,QAAA;SACP,CAAC,CAAC;IACL,CAAC;IAMD,0CAAiB,GAAjB,UAAkB,EAAU;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,aAAU;SAC3C,CAAC,CAAC;IACL,CAAC;IAOD,wCAAe,GAAf,UAAgB,EAAU,EAAE,IAA+B;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,EAAE,YAAS;YACzC,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IACH,qBAAC;AAAD,CAAC,AAhHD,CAA4C,iBAAO,GAgHlD"}
|
package/dist/esm/Contacts.js
CHANGED
|
@@ -2,12 +2,6 @@ import { Base } from '@or-sdk/base';
|
|
|
2
2
|
import { CONTACTS_SERVICE_KEY } from './constants';
|
|
3
3
|
import { ContactBookApi, MigrationsApi, ContactApi, FieldSchemaApi, SchemaPresetApi, FilterApi, } from './api';
|
|
4
4
|
export class Contacts extends Base {
|
|
5
|
-
contactBookApi;
|
|
6
|
-
migrationsApi;
|
|
7
|
-
contactApi;
|
|
8
|
-
fieldSchemaApi;
|
|
9
|
-
schemaPresetApi;
|
|
10
|
-
filterApi;
|
|
11
5
|
constructor(params) {
|
|
12
6
|
const { token, discoveryUrl, contactsApiUrl } = params;
|
|
13
7
|
super({
|
package/dist/esm/Contacts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,SAAS,GACV,MAAM,OAAO,CAAC;AASf,MAAM,OAAO,QAAS,SAAQ,IAAI;
|
|
1
|
+
{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,SAAS,GACV,MAAM,OAAO,CAAC;AASf,MAAM,OAAO,QAAS,SAAQ,IAAI;IAchC,YAAY,MAAsB;QAChC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;QACvD,KAAK,CAAC;YACJ,KAAK;YACL,YAAY;YACZ,UAAU,EAAE,oBAAoB;YAChC,UAAU,EAAE,cAAc;SAC3B,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
package/dist/esm/api/baseApi.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseApi.js","sourceRoot":"","sources":["../../../src/api/baseApi.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,OAAO;
|
|
1
|
+
{"version":3,"file":"baseApi.js","sourceRoot":"","sources":["../../../src/api/baseApi.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,OAAO;IAC3B,YAA+B,OAAgD;QAAhD,YAAO,GAAP,OAAO,CAAyC;IAC/E,CAAC;CACF"}
|
|
@@ -1,43 +1,55 @@
|
|
|
1
1
|
import { BaseApi } from './baseApi';
|
|
2
2
|
export default class ContactApi extends BaseApi {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.apiBasePath = 'contact';
|
|
6
|
+
}
|
|
3
7
|
getContact(id, params) {
|
|
4
8
|
return this.apiCall({
|
|
5
9
|
method: 'GET',
|
|
6
|
-
route:
|
|
10
|
+
route: `${this.apiBasePath}/${id}`,
|
|
7
11
|
params,
|
|
8
12
|
});
|
|
9
13
|
}
|
|
10
14
|
getContactsList(params) {
|
|
11
15
|
return this.apiCall({
|
|
12
16
|
method: 'GET',
|
|
13
|
-
route:
|
|
14
|
-
params,
|
|
17
|
+
route: `${this.apiBasePath}`,
|
|
18
|
+
params: Object.assign(Object.assign({}, params), (params.order && { order: `${params.order.field}:${params.order.order}` })),
|
|
15
19
|
});
|
|
16
20
|
}
|
|
17
21
|
updateContact(id, data) {
|
|
18
22
|
return this.apiCall({
|
|
19
23
|
method: 'PATCH',
|
|
20
|
-
route:
|
|
24
|
+
route: `${this.apiBasePath}/${id}`,
|
|
25
|
+
data,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
deleteContact(id, data) {
|
|
29
|
+
return this.apiCall({
|
|
30
|
+
method: 'DELETE',
|
|
31
|
+
route: `${this.apiBasePath}/${id}`,
|
|
21
32
|
data,
|
|
22
33
|
});
|
|
23
34
|
}
|
|
24
|
-
|
|
35
|
+
deleteMulti(data) {
|
|
25
36
|
return this.apiCall({
|
|
26
37
|
method: 'DELETE',
|
|
27
|
-
route:
|
|
38
|
+
route: `${this.apiBasePath}`,
|
|
39
|
+
data,
|
|
28
40
|
});
|
|
29
41
|
}
|
|
30
42
|
createContact(data) {
|
|
31
43
|
return this.apiCall({
|
|
32
44
|
method: 'POST',
|
|
33
|
-
route:
|
|
45
|
+
route: `${this.apiBasePath}`,
|
|
34
46
|
data,
|
|
35
47
|
});
|
|
36
48
|
}
|
|
37
49
|
mergeContacts(id, data) {
|
|
38
50
|
return this.apiCall({
|
|
39
51
|
method: 'POST',
|
|
40
|
-
route:
|
|
52
|
+
route: `${this.apiBasePath}/${id}/merge`,
|
|
41
53
|
data,
|
|
42
54
|
});
|
|
43
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactApi.js","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"contactApi.js","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAA/C;;QACmB,gBAAW,GAAG,SAAS,CAAC;IA6F3C,CAAC;IAtFC,UAAU,CAAC,EAAU,EAAE,MAAwB;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE;YAClC,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAMD,eAAe,CAAC,MAA2B;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;YAC5B,MAAM,kCACD,MAAM,GACN,CAAC,MAAM,CAAC,KAAK,IAAI,EAAC,KAAK,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,EAAC,CAAC,CAC5E;SACF,CAAC,CAAC;IACL,CAAC;IAOD,aAAa,CAAC,EAAU,EAAE,IAAsB;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE;YAClC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAOD,aAAa,CAAC,EAAU,EAAE,IAA4B;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE;YAClC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAOD,WAAW,CAAC,IAAiC;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;YAC5B,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAMD,aAAa,CAAC,IAAsB;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;YAC5B,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAOD,aAAa,CAAC,EAAU,EAAE,IAA2B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,QAAQ;YACxC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,35 +1,66 @@
|
|
|
1
1
|
import { BaseApi } from './baseApi';
|
|
2
2
|
export default class ContactBookApi extends BaseApi {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.apiBasePath = 'contact-book';
|
|
6
|
+
}
|
|
3
7
|
getContactBookList(params) {
|
|
4
8
|
return this.apiCall({
|
|
5
9
|
method: 'GET',
|
|
6
|
-
route:
|
|
7
|
-
params,
|
|
10
|
+
route: `${this.apiBasePath}`,
|
|
11
|
+
params: Object.assign(Object.assign({}, params), (params.order && { order: `${params.order.field}:${params.order.order}` })),
|
|
8
12
|
});
|
|
9
13
|
}
|
|
10
14
|
getContactBook(id) {
|
|
11
15
|
return this.apiCall({
|
|
12
16
|
method: 'GET',
|
|
13
|
-
route:
|
|
17
|
+
route: `${this.apiBasePath}/${id}`,
|
|
14
18
|
});
|
|
15
19
|
}
|
|
16
20
|
updateContactBook(id, data) {
|
|
17
21
|
return this.apiCall({
|
|
18
22
|
method: 'PATCH',
|
|
19
|
-
route:
|
|
23
|
+
route: `${this.apiBasePath}/${id}`,
|
|
20
24
|
data,
|
|
21
25
|
});
|
|
22
26
|
}
|
|
23
27
|
deleteContactBook(id) {
|
|
24
28
|
return this.apiCall({
|
|
25
29
|
method: 'DELETE',
|
|
26
|
-
route:
|
|
30
|
+
route: `${this.apiBasePath}/${id}`,
|
|
27
31
|
});
|
|
28
32
|
}
|
|
29
33
|
createContactBook(data) {
|
|
30
34
|
return this.apiCall({
|
|
31
35
|
method: 'POST',
|
|
32
|
-
route:
|
|
36
|
+
route: `${this.apiBasePath}`,
|
|
37
|
+
data,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
shareContactBook(id, data) {
|
|
41
|
+
return this.apiCall({
|
|
42
|
+
method: 'POST',
|
|
43
|
+
route: `${this.apiBasePath}/${id}/share`,
|
|
44
|
+
data,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
getSharedBookMeta(params) {
|
|
48
|
+
return this.apiCall({
|
|
49
|
+
method: 'GET',
|
|
50
|
+
route: `${this.apiBasePath}/shared-book-meta`,
|
|
51
|
+
params,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
approveSharedBook(id) {
|
|
55
|
+
return this.apiCall({
|
|
56
|
+
method: 'POST',
|
|
57
|
+
route: `${this.apiBasePath}/${id}/approve`,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
rejectShareBook(id, data) {
|
|
61
|
+
return this.apiCall({
|
|
62
|
+
method: 'POST',
|
|
63
|
+
route: `${this.apiBasePath}/${id}/reject`,
|
|
33
64
|
data,
|
|
34
65
|
});
|
|
35
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactBookApi.js","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contactBookApi.js","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IAAnD;;QACmB,gBAAW,GAAG,cAAc,CAAC;IA+GhD,CAAC;IA1GC,kBAAkB,CAAC,MAAyB;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;YAC5B,MAAM,kCACD,MAAM,GACN,CAAC,MAAM,CAAC,KAAK,IAAI,EAAC,KAAK,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,EAAC,CAAC,CAC5E;SACF,CAAC,CAAC;IACL,CAAC;IAMD,cAAc,CAAC,EAAU;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE;SACnC,CAAC,CAAC;IACL,CAAC;IAOD,iBAAiB,CAAC,EAAU,EAAE,IAA0B;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE;YAClC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAMD,iBAAiB,CAAC,EAAU;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE;SACnC,CAAC,CAAC;IACL,CAAC;IAMD,iBAAiB,CAAC,IAA0B;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;YAC5B,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAOD,gBAAgB,CAAC,EAAU,EAAE,IAA+B;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,QAAQ;YACxC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAMD,iBAAiB,CAAC,MAA+B;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,mBAAmB;YAC7C,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAMD,iBAAiB,CAAC,EAAU;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,UAAU;SAC3C,CAAC,CAAC;IACL,CAAC;IAOD,eAAe,CAAC,EAAU,EAAE,IAA+B;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC;YAClB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,SAAS;YACzC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { BaseApi } from './baseApi';
|
|
2
|
-
import { ContactResponseDto, CreateContactDto, UpdateContactDto, ContactParamsDto, ContactListDto,
|
|
2
|
+
import { ContactResponseDto, CreateContactDto, UpdateContactDto, ContactParamsDto, ContactListDto, MergeContactParamsDto, DeleteContactParamsDto, DeleteContactMultiParamsDto } from '@onereach/types-contacts-api';
|
|
3
|
+
import { ContactSearchParams } from "../types";
|
|
3
4
|
export default class ContactApi extends BaseApi {
|
|
5
|
+
private readonly apiBasePath;
|
|
4
6
|
getContact(id: string, params: ContactParamsDto): Promise<ContactResponseDto>;
|
|
5
|
-
getContactsList(params:
|
|
7
|
+
getContactsList(params: ContactSearchParams): Promise<ContactListDto>;
|
|
6
8
|
updateContact(id: string, data: UpdateContactDto): Promise<ContactResponseDto>;
|
|
7
|
-
deleteContact(id: string): Promise<void>;
|
|
9
|
+
deleteContact(id: string, data: DeleteContactParamsDto): Promise<void>;
|
|
10
|
+
deleteMulti(data: DeleteContactMultiParamsDto): Promise<void>;
|
|
8
11
|
createContact(data: CreateContactDto): Promise<ContactResponseDto>;
|
|
9
|
-
mergeContacts(id: string, data: MergeContactParamsDto): Promise<
|
|
12
|
+
mergeContacts(id: string, data: MergeContactParamsDto): Promise<ContactResponseDto>;
|
|
10
13
|
}
|
|
11
14
|
//# sourceMappingURL=contactApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactApi.d.ts","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"contactApi.d.ts","sourceRoot":"","sources":["../../../src/api/contactApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IAOzC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAY7E,eAAe,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAgBrE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAa9E,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAatE,WAAW,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IAY7D,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAalE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAOpF"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { ContactBookListDto, ContactBookResponseDto, CreateContactBookDto, UpdateContactBookDto,
|
|
1
|
+
import { ContactBookListDto, ContactBookResponseDto, CreateContactBookDto, UpdateContactBookDto, SharedBookResponseDto, SharedBookMetaParamsDto, ShareContactBookParamsDto } from '@onereach/types-contacts-api';
|
|
2
2
|
import { BaseApi } from './baseApi';
|
|
3
|
+
import { ContactBookParams } from "../types";
|
|
3
4
|
export default class ContactBookApi extends BaseApi {
|
|
4
|
-
|
|
5
|
+
private readonly apiBasePath;
|
|
6
|
+
getContactBookList(params: ContactBookParams): Promise<ContactBookListDto>;
|
|
5
7
|
getContactBook(id: string): Promise<ContactBookResponseDto>;
|
|
6
8
|
updateContactBook(id: string, data: UpdateContactBookDto): Promise<ContactBookResponseDto>;
|
|
7
9
|
deleteContactBook(id: string): Promise<void>;
|
|
8
10
|
createContactBook(data: CreateContactBookDto): Promise<ContactBookResponseDto>;
|
|
11
|
+
shareContactBook(id: string, data: ShareContactBookParamsDto): Promise<SharedBookResponseDto>;
|
|
12
|
+
getSharedBookMeta(params: SharedBookMetaParamsDto): Promise<SharedBookResponseDto[]>;
|
|
13
|
+
approveSharedBook(id: string): Promise<void>;
|
|
14
|
+
rejectShareBook(id: string, data: ShareContactBookParamsDto): Promise<void>;
|
|
9
15
|
}
|
|
10
16
|
//# sourceMappingURL=contactBookApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactBookApi.d.ts","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"contactBookApi.d.ts","sourceRoot":"","sources":["../../../src/api/contactBookApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkB;IAK9C,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAe1E,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAY3D,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAY1F,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5C,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAa9E,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAY7F,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAYpF,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY5C,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CAO5E"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { Token } from '@or-sdk/base';
|
|
2
|
+
import { ContactBookParamsDto, ContactSearchParamsDto } from "@onereach/types-contacts-api";
|
|
2
3
|
export declare type ContactsConfig = {
|
|
3
4
|
token: Token;
|
|
4
5
|
discoveryUrl?: string;
|
|
5
6
|
contactsApiUrl?: string;
|
|
6
7
|
};
|
|
8
|
+
export interface ContactBookParams extends Omit<ContactBookParamsDto, 'order'> {
|
|
9
|
+
order?: {
|
|
10
|
+
field: 'label' | 'created_at' | 'updated_at';
|
|
11
|
+
order: 'asc' | 'desc';
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface ContactSearchParams extends Omit<ContactSearchParamsDto, 'order'> {
|
|
15
|
+
order?: {
|
|
16
|
+
field: 'created_at' | 'updated_at';
|
|
17
|
+
order: 'asc' | 'desc';
|
|
18
|
+
};
|
|
19
|
+
}
|
|
7
20
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,oBAAoB,EAAE,sBAAsB,EAAC,MAAM,8BAA8B,CAAC;AAE1F,oBAAY,cAAc,GAAG;IAI3B,KAAK,EAAE,KAAK,CAAC;IAIb,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAGF,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC;IAC5E,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,YAAY,CAAA;QAC5C,KAAK,EAAE,KAAK,GAAC,MAAM,CAAA;KACpB,CAAA;CACF;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC;IAChF,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,YAAY,GAAG,YAAY,CAAA;QAClC,KAAK,EAAE,KAAK,GAAC,MAAM,CAAA;KACpB,CAAA;CACF"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.4.0
|
|
2
|
+
"version": "1.4.0",
|
|
3
3
|
"name": "@or-sdk/contacts",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dev": "pnpm build:watch:esm"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@onereach/types-contacts-api": "^1.
|
|
20
|
+
"@onereach/types-contacts-api": "^1.37.5-beta.833.0",
|
|
21
21
|
"concurrently": "^6.4.0",
|
|
22
22
|
"typescript": "^4.4.4"
|
|
23
23
|
},
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@or-sdk/base": "^0.
|
|
29
|
-
}
|
|
28
|
+
"@or-sdk/base": "^0.26.7"
|
|
29
|
+
},
|
|
30
|
+
"gitHead": "aaf18a5ecc16b953049f02633fc338c5270a2f87"
|
|
30
31
|
}
|
package/src/api/contactApi.ts
CHANGED
|
@@ -5,11 +5,15 @@ import {
|
|
|
5
5
|
UpdateContactDto,
|
|
6
6
|
ContactParamsDto,
|
|
7
7
|
ContactListDto,
|
|
8
|
-
ContactSearchParamsDto,
|
|
9
8
|
MergeContactParamsDto,
|
|
9
|
+
DeleteContactParamsDto,
|
|
10
|
+
DeleteContactMultiParamsDto
|
|
10
11
|
} from '@onereach/types-contacts-api';
|
|
12
|
+
import {ContactSearchParams} from "../types";
|
|
11
13
|
|
|
12
14
|
export default class ContactApi extends BaseApi {
|
|
15
|
+
private readonly apiBasePath = 'contact';
|
|
16
|
+
|
|
13
17
|
/**
|
|
14
18
|
* @description Get specific Contact
|
|
15
19
|
* @param params
|
|
@@ -18,7 +22,7 @@ export default class ContactApi extends BaseApi {
|
|
|
18
22
|
getContact(id: string, params: ContactParamsDto): Promise<ContactResponseDto> {
|
|
19
23
|
return this.apiCall({
|
|
20
24
|
method: 'GET',
|
|
21
|
-
route:
|
|
25
|
+
route: `${this.apiBasePath}/${id}`,
|
|
22
26
|
params,
|
|
23
27
|
});
|
|
24
28
|
}
|
|
@@ -27,11 +31,14 @@ export default class ContactApi extends BaseApi {
|
|
|
27
31
|
* @description Get list of Contacts for specific contactBook
|
|
28
32
|
* @param params
|
|
29
33
|
*/
|
|
30
|
-
getContactsList(params:
|
|
34
|
+
getContactsList(params: ContactSearchParams): Promise<ContactListDto> {
|
|
31
35
|
return this.apiCall({
|
|
32
36
|
method: 'GET',
|
|
33
|
-
route:
|
|
34
|
-
params
|
|
37
|
+
route: `${this.apiBasePath}`,
|
|
38
|
+
params: {
|
|
39
|
+
...params,
|
|
40
|
+
...(params.order && {order: `${params.order.field}:${params.order.order}`})
|
|
41
|
+
},
|
|
35
42
|
});
|
|
36
43
|
}
|
|
37
44
|
|
|
@@ -43,19 +50,34 @@ export default class ContactApi extends BaseApi {
|
|
|
43
50
|
updateContact(id: string, data: UpdateContactDto): Promise<ContactResponseDto> {
|
|
44
51
|
return this.apiCall({
|
|
45
52
|
method: 'PATCH',
|
|
46
|
-
route:
|
|
53
|
+
route: `${this.apiBasePath}/${id}`,
|
|
47
54
|
data,
|
|
48
55
|
});
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
/**
|
|
52
59
|
* @description Delete Contact
|
|
60
|
+
* @param data
|
|
53
61
|
* @param id
|
|
54
62
|
*/
|
|
55
|
-
deleteContact(id: string): Promise<void> {
|
|
63
|
+
deleteContact(id: string, data: DeleteContactParamsDto): Promise<void> {
|
|
56
64
|
return this.apiCall({
|
|
57
65
|
method: 'DELETE',
|
|
58
|
-
route:
|
|
66
|
+
route: `${this.apiBasePath}/${id}`,
|
|
67
|
+
data,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @description Delete Contact
|
|
74
|
+
* @param data
|
|
75
|
+
*/
|
|
76
|
+
deleteMulti(data: DeleteContactMultiParamsDto): Promise<void> {
|
|
77
|
+
return this.apiCall({
|
|
78
|
+
method: 'DELETE',
|
|
79
|
+
route: `${this.apiBasePath}`,
|
|
80
|
+
data,
|
|
59
81
|
});
|
|
60
82
|
}
|
|
61
83
|
|
|
@@ -66,7 +88,7 @@ export default class ContactApi extends BaseApi {
|
|
|
66
88
|
createContact(data: CreateContactDto): Promise<ContactResponseDto> {
|
|
67
89
|
return this.apiCall({
|
|
68
90
|
method: 'POST',
|
|
69
|
-
route:
|
|
91
|
+
route: `${this.apiBasePath}`,
|
|
70
92
|
data,
|
|
71
93
|
});
|
|
72
94
|
}
|
|
@@ -76,10 +98,10 @@ export default class ContactApi extends BaseApi {
|
|
|
76
98
|
* @param id Contact id TO which the data will be merged
|
|
77
99
|
* @param data
|
|
78
100
|
*/
|
|
79
|
-
mergeContacts(id: string, data: MergeContactParamsDto) {
|
|
101
|
+
mergeContacts(id: string, data: MergeContactParamsDto): Promise<ContactResponseDto> {
|
|
80
102
|
return this.apiCall({
|
|
81
103
|
method: 'POST',
|
|
82
|
-
route:
|
|
104
|
+
route: `${this.apiBasePath}/${id}/merge`,
|
|
83
105
|
data,
|
|
84
106
|
});
|
|
85
107
|
}
|
|
@@ -3,20 +3,27 @@ import {
|
|
|
3
3
|
ContactBookResponseDto,
|
|
4
4
|
CreateContactBookDto,
|
|
5
5
|
UpdateContactBookDto,
|
|
6
|
-
|
|
6
|
+
SharedBookResponseDto,
|
|
7
|
+
SharedBookMetaParamsDto,
|
|
8
|
+
ShareContactBookParamsDto,
|
|
7
9
|
} from '@onereach/types-contacts-api';
|
|
8
10
|
import { BaseApi } from './baseApi';
|
|
11
|
+
import {ContactBookParams} from "../types";
|
|
9
12
|
|
|
10
13
|
export default class ContactBookApi extends BaseApi {
|
|
14
|
+
private readonly apiBasePath = 'contact-book';
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* @description Get list for ContactsBooks
|
|
14
18
|
*/
|
|
15
|
-
getContactBookList(params:
|
|
19
|
+
getContactBookList(params: ContactBookParams): Promise<ContactBookListDto> {
|
|
16
20
|
return this.apiCall({
|
|
17
21
|
method: 'GET',
|
|
18
|
-
route:
|
|
19
|
-
params
|
|
22
|
+
route: `${this.apiBasePath}`,
|
|
23
|
+
params: {
|
|
24
|
+
...params,
|
|
25
|
+
...(params.order && {order: `${params.order.field}:${params.order.order}`})
|
|
26
|
+
},
|
|
20
27
|
});
|
|
21
28
|
}
|
|
22
29
|
|
|
@@ -27,7 +34,7 @@ export default class ContactBookApi extends BaseApi {
|
|
|
27
34
|
getContactBook(id: string): Promise<ContactBookResponseDto> {
|
|
28
35
|
return this.apiCall({
|
|
29
36
|
method: 'GET',
|
|
30
|
-
route:
|
|
37
|
+
route: `${this.apiBasePath}/${id}`,
|
|
31
38
|
});
|
|
32
39
|
}
|
|
33
40
|
|
|
@@ -39,7 +46,7 @@ export default class ContactBookApi extends BaseApi {
|
|
|
39
46
|
updateContactBook(id: string, data: UpdateContactBookDto): Promise<ContactBookResponseDto> {
|
|
40
47
|
return this.apiCall({
|
|
41
48
|
method: 'PATCH',
|
|
42
|
-
route:
|
|
49
|
+
route: `${this.apiBasePath}/${id}`,
|
|
43
50
|
data,
|
|
44
51
|
});
|
|
45
52
|
}
|
|
@@ -51,7 +58,7 @@ export default class ContactBookApi extends BaseApi {
|
|
|
51
58
|
deleteContactBook(id: string): Promise<void> {
|
|
52
59
|
return this.apiCall({
|
|
53
60
|
method: 'DELETE',
|
|
54
|
-
route:
|
|
61
|
+
route: `${this.apiBasePath}/${id}`,
|
|
55
62
|
});
|
|
56
63
|
}
|
|
57
64
|
|
|
@@ -62,7 +69,56 @@ export default class ContactBookApi extends BaseApi {
|
|
|
62
69
|
createContactBook(data: CreateContactBookDto): Promise<ContactBookResponseDto> {
|
|
63
70
|
return this.apiCall({
|
|
64
71
|
method: 'POST',
|
|
65
|
-
route:
|
|
72
|
+
route: `${this.apiBasePath}`,
|
|
73
|
+
data,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Share ContactBook across account
|
|
79
|
+
* @param id
|
|
80
|
+
* @param data
|
|
81
|
+
*/
|
|
82
|
+
shareContactBook(id: string, data: ShareContactBookParamsDto): Promise<SharedBookResponseDto> {
|
|
83
|
+
return this.apiCall({
|
|
84
|
+
method: 'POST',
|
|
85
|
+
route: `${this.apiBasePath}/${id}/share`,
|
|
86
|
+
data,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get meta info about shared book
|
|
92
|
+
* @param params
|
|
93
|
+
*/
|
|
94
|
+
getSharedBookMeta(params: SharedBookMetaParamsDto): Promise<SharedBookResponseDto[]> {
|
|
95
|
+
return this.apiCall({
|
|
96
|
+
method: 'GET',
|
|
97
|
+
route: `${this.apiBasePath}/shared-book-meta`,
|
|
98
|
+
params,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Approve shared book from target side
|
|
104
|
+
* @param id
|
|
105
|
+
*/
|
|
106
|
+
approveSharedBook(id: string): Promise<void> {
|
|
107
|
+
return this.apiCall({
|
|
108
|
+
method: 'POST',
|
|
109
|
+
route: `${this.apiBasePath}/${id}/approve`,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Reject sharing book for target account
|
|
115
|
+
* @param id
|
|
116
|
+
* @param data
|
|
117
|
+
*/
|
|
118
|
+
rejectShareBook(id: string, data: ShareContactBookParamsDto): Promise<void> {
|
|
119
|
+
return this.apiCall({
|
|
120
|
+
method: 'POST',
|
|
121
|
+
route: `${this.apiBasePath}/${id}/reject`,
|
|
66
122
|
data,
|
|
67
123
|
});
|
|
68
124
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Token } from '@or-sdk/base';
|
|
2
|
+
import {ContactBookParamsDto, ContactSearchParamsDto} from "@onereach/types-contacts-api";
|
|
2
3
|
|
|
3
4
|
export type ContactsConfig = {
|
|
4
5
|
/**
|
|
@@ -14,3 +15,18 @@ export type ContactsConfig = {
|
|
|
14
15
|
*/
|
|
15
16
|
contactsApiUrl?: string;
|
|
16
17
|
};
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export interface ContactBookParams extends Omit<ContactBookParamsDto, 'order'> {
|
|
21
|
+
order?: {
|
|
22
|
+
field: 'label' | 'created_at' | 'updated_at'
|
|
23
|
+
order: 'asc'|'desc'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ContactSearchParams extends Omit<ContactSearchParamsDto, 'order'> {
|
|
28
|
+
order?: {
|
|
29
|
+
field: 'created_at' | 'updated_at'
|
|
30
|
+
order: 'asc'|'desc'
|
|
31
|
+
}
|
|
32
|
+
}
|