-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
210 lines (173 loc) · 4.89 KB
/
index.d.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
// Type definitions for JS SDK REST API Bitrix24
// Project: https://training.bitrix24.com/rest_help/
// Definitions by: Vladimir Tyrtov <https://bitbucket.org/b24help/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace BX24 {
export namespace Entity.IBlock {
interface Element {
ID: string
NAME: string
XML_ID: string
CODE: string
PREVIEW_TEXT: string
DETAIL_TEXT: string
DATE_CREATE: string
CREATED_BY: string
}
}
export namespace Entity.CRM {
interface FM {
ID?: string
VALUE_TYPE: string
VALUE: string
TYPE_ID?: string
}
interface Deal {
ID: string
TITLE: string
STAGE_ID: string
CATEGORY_ID: string
COMPANY_ID: string
ASSIGNED_BY_ID: string
}
interface Contact {
ID: string
LAST_NAME: string
NAME: string
SECOND_NAME: string
POST: string
COMPANY_ID: string
ASSIGNED_BY_ID: string
HAS_PHONE: string
HAS_EMAIL: string
PHONE: Array<FM>
EMAIL: Array<FM>
}
interface Company {
ID: string
TITLE: string
ASSIGNED_BY_ID: string
}
}
interface UserProfile {
ADMIN: boolean
ID: string
LAST_NAME: string
NAME: string
PERSONAL_GENDER: string
PERSONAL_PHOTO: string
TIME_ZONE: string
TIME_ZONE_OFFSET: number
}
interface ListsParams {
FIELDS: object
IBLOCK_CODE: string
IBLOCK_TYPE_ID: string
ELEMENT_ID?: string | number
ELEMENT_CODE?: string
}
interface Result {
error(): boolean | string
data(): Object[]
more(): boolean
next(): boolean
total(): number
}
interface ResultError {
ex: {
error: string
error_description: string
}
status: number
}
interface ResultObject {
error(): undefined | ResultError
data(): Object
}
type BatchItem = [string, Object]
type BatchResult = Result[]
interface PlacementOptions {
ID: string
ENTITY_ID: string
ENTITY_VALUE_ID: string
}
interface PlacementOptionsCard {
ID: number
}
interface PlacementOptionsUserFieldType extends PlacementOptions {
FIELD_NAME: string
MANDATORY: string
MODE: "edit" | "view"
MULTIPLE: "Y" | "N"
VALUE: string[] | string
XML_ID: string
}
interface PlacementUserFieldType {
DESCRIPTION: string
HANDLER: string
TITLE: string
USER_TYPE_ID: string
}
interface PlacementSetItem {
DESCRIPTION: string
HANDLER: string
PLACEMENT: string
TITLE: string
}
interface PlacementGetItem {
description: string
handler: string
placement: string
title: string
}
interface PlacementResult {
placement: string
options: PlacementOptionsCard | PlacementOptions | PlacementOptionsUserFieldType
}
interface SelectUserResult {
id: string
name: string
sub: boolean
sup: boolean
position: string
photo: string
}
interface Api {
placement: {
info(): PlacementResult
call(method: string, result: string | string[] | Function, callback?: Function): void
}
appOption: {
set(name: string, value: string, callback?: Function): void
get(name: string): string | undefined
}
init(callback?: Function): void
callMethod(method: string, params: Object, callback: Function): void
callBatch(calls: Object | BatchItem[], callback: Function, bHaltOnError?: boolean): void
fitWindow(): void
isAdmin(): boolean
getDomain(): string
getLang(): string
selectCRM(
params: {
entityType: string[]
multiple?: Boolean
value?: Object
},
callback: Function
): void
selectUser(callback: (user: SelectUserResult) => void): void
selectUsers(callback: (user: SelectUserResult[]) => void): void
resizeWindow(width: number, height: number, callback?: Function): void
getScrollSize(): { scrollWidth: number; scrollHeight: number }
closeApplication(): void
openApplication(params: object, closeCallback?: Function): void
setTitle(title: string, callback?: Function): void
reloadWindow(): void
}
interface Utils { }
}
declare interface Window {
BX24: BX24.Api
BX24Utils: BX24.Utils
}