@2bad/bitrix 2.5.0 → 2.5.1
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/README.md +9 -7
- package/build/main/bitrix.d.ts +2 -2
- package/build/main/bitrix.js +4 -1
- package/build/module/bitrix.d.ts +2 -2
- package/build/module/bitrix.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,6 +29,8 @@ Init client with Bitrix API endpoint and access token and use the client to ease
|
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
31
|
import Bitrix from '@2bad/bitrix'
|
|
32
|
+
// or for ESM
|
|
33
|
+
import { Bitrix } from '@2bad/bitrix'
|
|
32
34
|
|
|
33
35
|
const bitrix = Bitrix('https://PORTAL_NAME.bitrix24.ru/rest', 'ACCESS_TOKEN')
|
|
34
36
|
|
|
@@ -171,6 +173,13 @@ bitrix.list('some.new.list' as any, { select: ["TITLE"] })
|
|
|
171
173
|
|
|
172
174
|
Use the `batch` method. It will handle all routine:
|
|
173
175
|
|
|
176
|
+
```typescript
|
|
177
|
+
bitrix.batch({
|
|
178
|
+
lead: { method: Method.GET_LEAD, params: { ID: '77' } },
|
|
179
|
+
deals: { method: Method.LIST_DEALS, params: {} }
|
|
180
|
+
})
|
|
181
|
+
```
|
|
182
|
+
|
|
174
183
|
> I'm using a self-signed SSL certificate and I'm getting a `[RequestError]: self signed certificate`. What should I do?
|
|
175
184
|
|
|
176
185
|
Override [`got options`](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md) in constructor:
|
|
@@ -179,13 +188,6 @@ Override [`got options`](https://github.com/sindresorhus/got/blob/main/documenta
|
|
|
179
188
|
const bitrix = Bitrix('https://PORTAL_NAME.bitrix24.ru/rest', 'ACCESS_TOKEN', {https: { rejectUnauthorized: false }})
|
|
180
189
|
```
|
|
181
190
|
|
|
182
|
-
```typescript
|
|
183
|
-
bitrix.batch({
|
|
184
|
-
lead: { method: Method.GET_LEAD, params: { ID: '77' } },
|
|
185
|
-
deals: { method: Method.LIST_DEALS, params: {} }
|
|
186
|
-
})
|
|
187
|
-
```
|
|
188
|
-
|
|
189
191
|
### Development
|
|
190
192
|
|
|
191
193
|
- `npm test` — run all tests and collect full coverage report
|
package/build/main/bitrix.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { ExtendOptions } from 'got';
|
|
|
7
7
|
* @param clientOptions an object that will overwrite underlying configuration for HTTP client,
|
|
8
8
|
* see `https://github.com/sindresorhus/got/blob/main/documentation/2-options.md`.
|
|
9
9
|
*/
|
|
10
|
-
declare const
|
|
10
|
+
export declare const Bitrix: (restURI: string, accessToken?: string, clientOptions?: ExtendOptions) => {
|
|
11
11
|
call: import("./client/methods/call").Call;
|
|
12
12
|
batch: import("./client/methods/batch").Batch;
|
|
13
13
|
list: import("./client/methods/list").List;
|
|
@@ -101,7 +101,7 @@ declare const _default: (restURI: string, accessToken?: string, clientOptions?:
|
|
|
101
101
|
get: (id?: string | undefined) => Promise<import("./payloads").GetPayload<readonly import("./services/users/entities").User[]>>;
|
|
102
102
|
};
|
|
103
103
|
};
|
|
104
|
-
export default
|
|
104
|
+
export default Bitrix;
|
|
105
105
|
export * from './methods';
|
|
106
106
|
export * from './commands';
|
|
107
107
|
export * from './services/common';
|
package/build/main/bitrix.js
CHANGED
|
@@ -17,6 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.Bitrix = void 0;
|
|
20
21
|
const client_1 = __importDefault(require("./client"));
|
|
21
22
|
const companies_1 = __importDefault(require("./services/companies"));
|
|
22
23
|
const contacts_1 = __importDefault(require("./services/contacts"));
|
|
@@ -32,7 +33,7 @@ const users_1 = __importDefault(require("./services/users"));
|
|
|
32
33
|
* @param clientOptions an object that will overwrite underlying configuration for HTTP client,
|
|
33
34
|
* see `https://github.com/sindresorhus/got/blob/main/documentation/2-options.md`.
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
|
+
const Bitrix = (restURI, accessToken, clientOptions) => {
|
|
36
37
|
const { call, batch, list } = (0, client_1.default)(restURI, accessToken, clientOptions);
|
|
37
38
|
return {
|
|
38
39
|
call,
|
|
@@ -46,6 +47,8 @@ exports.default = (restURI, accessToken, clientOptions) => {
|
|
|
46
47
|
users: (0, users_1.default)({ call })
|
|
47
48
|
};
|
|
48
49
|
};
|
|
50
|
+
exports.Bitrix = Bitrix;
|
|
51
|
+
exports.default = exports.Bitrix;
|
|
49
52
|
__exportStar(require("./methods"), exports);
|
|
50
53
|
__exportStar(require("./commands"), exports);
|
|
51
54
|
__exportStar(require("./services/common"), exports);
|
package/build/module/bitrix.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { ExtendOptions } from 'got';
|
|
|
7
7
|
* @param clientOptions an object that will overwrite underlying configuration for HTTP client,
|
|
8
8
|
* see `https://github.com/sindresorhus/got/blob/main/documentation/2-options.md`.
|
|
9
9
|
*/
|
|
10
|
-
declare const
|
|
10
|
+
export declare const Bitrix: (restURI: string, accessToken?: string, clientOptions?: ExtendOptions) => {
|
|
11
11
|
call: import("./client/methods/call").Call;
|
|
12
12
|
batch: import("./client/methods/batch").Batch;
|
|
13
13
|
list: import("./client/methods/list").List;
|
|
@@ -101,7 +101,7 @@ declare const _default: (restURI: string, accessToken?: string, clientOptions?:
|
|
|
101
101
|
get: (id?: string | undefined) => Promise<import("./payloads").GetPayload<readonly import("./services/users/entities").User[]>>;
|
|
102
102
|
};
|
|
103
103
|
};
|
|
104
|
-
export default
|
|
104
|
+
export default Bitrix;
|
|
105
105
|
export * from './methods';
|
|
106
106
|
export * from './commands';
|
|
107
107
|
export * from './services/common';
|
package/build/module/bitrix.js
CHANGED
|
@@ -13,7 +13,7 @@ import UsersService from './services/users';
|
|
|
13
13
|
* @param clientOptions an object that will overwrite underlying configuration for HTTP client,
|
|
14
14
|
* see `https://github.com/sindresorhus/got/blob/main/documentation/2-options.md`.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export const Bitrix = (restURI, accessToken, clientOptions) => {
|
|
17
17
|
const { call, batch, list } = Client(restURI, accessToken, clientOptions);
|
|
18
18
|
return {
|
|
19
19
|
call,
|
|
@@ -27,6 +27,7 @@ export default (restURI, accessToken, clientOptions) => {
|
|
|
27
27
|
users: UsersService({ call })
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
+
export default Bitrix;
|
|
30
31
|
export * from './methods';
|
|
31
32
|
export * from './commands';
|
|
32
33
|
export * from './services/common';
|