forked from 2BAD/bitrix
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bitrix.ts
42 lines (38 loc) · 1.49 KB
/
bitrix.ts
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
// tslint:disable:object-literal-sort-keys
import Client from './client'
import CompaniesService from './services/companies'
import ContactsService from './services/contacts'
import DealsService from './services/deals'
import LeadsService from './services/leads'
import StatusesService from './services/statuses'
import UsersService from './services/users'
/**
* Construct a Bitrix client with generic methods
* @param restURI REST endpoint, like a `https://hello.bitrix24.ua/rest` or an inbound webhook endpoint,
* like a `https://hello.bitrix24.ua/rest/1/WEBHOOK_TOKEN`.
* @param accessToken Bitrix application Access Token. Do not specify in case inbound webhook endpoint used.
*/
export default (restURI: string, accessToken?: string) => {
const { call, batch, list } = Client(restURI, accessToken)
return {
call,
batch,
list,
companies: CompaniesService({ call, list }),
contacts: ContactsService({ call, list }),
deals: DealsService({ call, list }),
leads: LeadsService({ call, list }),
statuses: StatusesService({ call }),
users: UsersService({ call })
}
}
export * from './methods'
export * from './commands'
export * from './services/common'
export * from './services/companies/entities'
export * from './services/contacts/entities'
export * from './services/currencies/entities'
export * from './services/deals/entities'
export * from './services/leads/entities'
export * from './services/statuses/entities'
export * from './services/users/entities'