@iblai/iblai-api 4.261.1-core → 4.262.0-core
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/index.cjs.js +943 -123
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +941 -124
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +943 -123
- package/dist/index.umd.js.map +1 -1
- package/dist/types/index.d.ts +16 -0
- package/dist/types/models/LifecycleStageEnum.d.ts +14 -0
- package/dist/types/models/Organization.d.ts +34 -0
- package/dist/types/models/PaginatedOrganizationList.d.ts +7 -0
- package/dist/types/models/PaginatedPersonList.d.ts +7 -0
- package/dist/types/models/PatchedOrganization.d.ts +34 -0
- package/dist/types/models/PatchedPerson.d.ts +73 -0
- package/dist/types/models/Person.d.ts +73 -0
- package/dist/types/models/PersonInviteConflict.d.ts +12 -0
- package/dist/types/models/PersonInviteRequest.d.ts +18 -0
- package/dist/types/models/PersonInviteResponse.d.ts +37 -0
- package/dist/types/models/PersonLinkUserRequest.d.ts +6 -0
- package/dist/types/models/PersonMergeRequest.d.ts +10 -0
- package/dist/types/models/PersonMergeResponse.d.ts +17 -0
- package/dist/types/services/CrmService.d.ts +222 -0
- package/dist/types/services/OrganizationsService.d.ts +83 -0
- package/dist/types/services/PersonsService.d.ts +142 -0
- package/package.json +1 -1
- package/sdk_schema.yml +1803 -1
- package/src/core/OpenAPI.ts +1 -1
- package/src/index.ts +16 -0
- package/src/models/LifecycleStageEnum.ts +18 -0
- package/src/models/Organization.ts +39 -0
- package/src/models/PaginatedOrganizationList.ts +12 -0
- package/src/models/PaginatedPersonList.ts +12 -0
- package/src/models/PatchedOrganization.ts +39 -0
- package/src/models/PatchedPerson.ts +78 -0
- package/src/models/Person.ts +78 -0
- package/src/models/PersonInviteConflict.ts +17 -0
- package/src/models/PersonInviteRequest.ts +23 -0
- package/src/models/PersonInviteResponse.ts +42 -0
- package/src/models/PersonLinkUserRequest.ts +11 -0
- package/src/models/PersonMergeRequest.ts +15 -0
- package/src/models/PersonMergeResponse.ts +22 -0
- package/src/services/CrmService.ts +481 -0
- package/src/services/OrganizationsService.ts +186 -0
- package/src/services/PersonsService.ts +304 -0
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
import type { Organization } from '../models/Organization';
|
|
6
|
+
import type { PaginatedOrganizationList } from '../models/PaginatedOrganizationList';
|
|
7
|
+
import type { PaginatedPersonList } from '../models/PaginatedPersonList';
|
|
8
|
+
import type { PatchedOrganization } from '../models/PatchedOrganization';
|
|
9
|
+
import type { PatchedPerson } from '../models/PatchedPerson';
|
|
10
|
+
import type { Person } from '../models/Person';
|
|
11
|
+
import type { PersonInviteRequest } from '../models/PersonInviteRequest';
|
|
12
|
+
import type { PersonInviteResponse } from '../models/PersonInviteResponse';
|
|
13
|
+
import type { PersonLinkUserRequest } from '../models/PersonLinkUserRequest';
|
|
14
|
+
import type { PersonMergeRequest } from '../models/PersonMergeRequest';
|
|
15
|
+
import type { PersonMergeResponse } from '../models/PersonMergeResponse';
|
|
16
|
+
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
17
|
+
import { OpenAPI } from '../core/OpenAPI';
|
|
18
|
+
import { request as __request } from '../core/request';
|
|
19
|
+
export class CrmService {
|
|
20
|
+
/**
|
|
21
|
+
* List organizations
|
|
22
|
+
* Returns a paginated list of organizations in your Platform. Supports filtering by `owner` and by `name` (case-insensitive substring match).
|
|
23
|
+
*
|
|
24
|
+
* **Required permission:** `Ibl.CRM/Organizations/list`.
|
|
25
|
+
* @returns PaginatedOrganizationList
|
|
26
|
+
* @throws ApiError
|
|
27
|
+
*/
|
|
28
|
+
public static crmOrganizationsList({
|
|
29
|
+
name,
|
|
30
|
+
owner,
|
|
31
|
+
page,
|
|
32
|
+
pageSize,
|
|
33
|
+
}: {
|
|
34
|
+
name?: string,
|
|
35
|
+
owner?: number,
|
|
36
|
+
/**
|
|
37
|
+
* A page number within the paginated result set.
|
|
38
|
+
*/
|
|
39
|
+
page?: number,
|
|
40
|
+
/**
|
|
41
|
+
* Number of results to return per page.
|
|
42
|
+
*/
|
|
43
|
+
pageSize?: number,
|
|
44
|
+
}): CancelablePromise<PaginatedOrganizationList> {
|
|
45
|
+
return __request(OpenAPI, {
|
|
46
|
+
method: 'GET',
|
|
47
|
+
url: '/api/crm/organizations/',
|
|
48
|
+
query: {
|
|
49
|
+
'name': name,
|
|
50
|
+
'owner': owner,
|
|
51
|
+
'page': page,
|
|
52
|
+
'page_size': pageSize,
|
|
53
|
+
},
|
|
54
|
+
errors: {
|
|
55
|
+
401: `Authentication required.`,
|
|
56
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/list\`.`,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create an organization
|
|
62
|
+
* Creates a new organization in your Platform. The Platform is inferred from your credentials. `name` must be unique within your Platform.
|
|
63
|
+
*
|
|
64
|
+
* **Required permission:** `Ibl.CRM/Organizations/write`.
|
|
65
|
+
* @returns Organization
|
|
66
|
+
* @throws ApiError
|
|
67
|
+
*/
|
|
68
|
+
public static crmOrganizationsCreate({
|
|
69
|
+
requestBody,
|
|
70
|
+
}: {
|
|
71
|
+
requestBody: Organization,
|
|
72
|
+
}): CancelablePromise<Organization> {
|
|
73
|
+
return __request(OpenAPI, {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
url: '/api/crm/organizations/',
|
|
76
|
+
body: requestBody,
|
|
77
|
+
mediaType: 'application/json',
|
|
78
|
+
errors: {
|
|
79
|
+
400: `Validation error (for example, duplicate name).`,
|
|
80
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Retrieve an organization
|
|
86
|
+
* Returns a single organization by id.
|
|
87
|
+
*
|
|
88
|
+
* **Required permission:** `Ibl.CRM/Organizations/read`.
|
|
89
|
+
* @returns Organization
|
|
90
|
+
* @throws ApiError
|
|
91
|
+
*/
|
|
92
|
+
public static crmOrganizationsRetrieve({
|
|
93
|
+
id,
|
|
94
|
+
}: {
|
|
95
|
+
id: string,
|
|
96
|
+
}): CancelablePromise<Organization> {
|
|
97
|
+
return __request(OpenAPI, {
|
|
98
|
+
method: 'GET',
|
|
99
|
+
url: '/api/crm/organizations/{id}/',
|
|
100
|
+
path: {
|
|
101
|
+
'id': id,
|
|
102
|
+
},
|
|
103
|
+
errors: {
|
|
104
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/read\`.`,
|
|
105
|
+
404: `Organization not found.`,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Replace an organization
|
|
111
|
+
* Replaces all editable fields on the organization.
|
|
112
|
+
*
|
|
113
|
+
* **Required permission:** `Ibl.CRM/Organizations/write`.
|
|
114
|
+
* @returns Organization
|
|
115
|
+
* @throws ApiError
|
|
116
|
+
*/
|
|
117
|
+
public static crmOrganizationsUpdate({
|
|
118
|
+
id,
|
|
119
|
+
requestBody,
|
|
120
|
+
}: {
|
|
121
|
+
id: string,
|
|
122
|
+
requestBody: Organization,
|
|
123
|
+
}): CancelablePromise<Organization> {
|
|
124
|
+
return __request(OpenAPI, {
|
|
125
|
+
method: 'PUT',
|
|
126
|
+
url: '/api/crm/organizations/{id}/',
|
|
127
|
+
path: {
|
|
128
|
+
'id': id,
|
|
129
|
+
},
|
|
130
|
+
body: requestBody,
|
|
131
|
+
mediaType: 'application/json',
|
|
132
|
+
errors: {
|
|
133
|
+
400: `Validation error.`,
|
|
134
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`,
|
|
135
|
+
404: `Organization not found.`,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Update an organization
|
|
141
|
+
* Updates only the supplied fields on the organization.
|
|
142
|
+
*
|
|
143
|
+
* **Required permission:** `Ibl.CRM/Organizations/write`.
|
|
144
|
+
* @returns Organization
|
|
145
|
+
* @throws ApiError
|
|
146
|
+
*/
|
|
147
|
+
public static crmOrganizationsPartialUpdate({
|
|
148
|
+
id,
|
|
149
|
+
requestBody,
|
|
150
|
+
}: {
|
|
151
|
+
id: string,
|
|
152
|
+
requestBody?: PatchedOrganization,
|
|
153
|
+
}): CancelablePromise<Organization> {
|
|
154
|
+
return __request(OpenAPI, {
|
|
155
|
+
method: 'PATCH',
|
|
156
|
+
url: '/api/crm/organizations/{id}/',
|
|
157
|
+
path: {
|
|
158
|
+
'id': id,
|
|
159
|
+
},
|
|
160
|
+
body: requestBody,
|
|
161
|
+
mediaType: 'application/json',
|
|
162
|
+
errors: {
|
|
163
|
+
400: `Validation error.`,
|
|
164
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`,
|
|
165
|
+
404: `Organization not found.`,
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Delete an organization
|
|
171
|
+
* Deletes the organization. Any persons linked to it are kept; their organization reference is cleared.
|
|
172
|
+
*
|
|
173
|
+
* **Required permission:** `Ibl.CRM/Organizations/delete`.
|
|
174
|
+
* @returns void
|
|
175
|
+
* @throws ApiError
|
|
176
|
+
*/
|
|
177
|
+
public static crmOrganizationsDestroy({
|
|
178
|
+
id,
|
|
179
|
+
}: {
|
|
180
|
+
id: string,
|
|
181
|
+
}): CancelablePromise<void> {
|
|
182
|
+
return __request(OpenAPI, {
|
|
183
|
+
method: 'DELETE',
|
|
184
|
+
url: '/api/crm/organizations/{id}/',
|
|
185
|
+
path: {
|
|
186
|
+
'id': id,
|
|
187
|
+
},
|
|
188
|
+
errors: {
|
|
189
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/delete\`.`,
|
|
190
|
+
404: `Organization not found.`,
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* List persons
|
|
196
|
+
* Returns a paginated list of persons in your Platform. Supports filtering by `lifecycle_stage`, `owner`, `organization`, `created_at__gte`/`created_at__lte`, and `metadata__has_key`.
|
|
197
|
+
*
|
|
198
|
+
* **Required permission:** `Ibl.CRM/Persons/list`.
|
|
199
|
+
* @returns PaginatedPersonList
|
|
200
|
+
* @throws ApiError
|
|
201
|
+
*/
|
|
202
|
+
public static crmPersonsList({
|
|
203
|
+
createdAtGte,
|
|
204
|
+
createdAtLte,
|
|
205
|
+
lifecycleStage,
|
|
206
|
+
metadataHasKey,
|
|
207
|
+
organization,
|
|
208
|
+
owner,
|
|
209
|
+
page,
|
|
210
|
+
pageSize,
|
|
211
|
+
}: {
|
|
212
|
+
createdAtGte?: string,
|
|
213
|
+
createdAtLte?: string,
|
|
214
|
+
/**
|
|
215
|
+
* Funnel position. Free-form transitions in v0.
|
|
216
|
+
*
|
|
217
|
+
* * `lead` - Lead
|
|
218
|
+
* * `qualified` - Qualified
|
|
219
|
+
* * `opportunity` - Opportunity
|
|
220
|
+
* * `customer` - Customer
|
|
221
|
+
* * `churned` - Churned
|
|
222
|
+
*/
|
|
223
|
+
lifecycleStage?: 'churned' | 'customer' | 'lead' | 'opportunity' | 'qualified',
|
|
224
|
+
metadataHasKey?: string,
|
|
225
|
+
organization?: string,
|
|
226
|
+
owner?: number,
|
|
227
|
+
/**
|
|
228
|
+
* A page number within the paginated result set.
|
|
229
|
+
*/
|
|
230
|
+
page?: number,
|
|
231
|
+
/**
|
|
232
|
+
* Number of results to return per page.
|
|
233
|
+
*/
|
|
234
|
+
pageSize?: number,
|
|
235
|
+
}): CancelablePromise<PaginatedPersonList> {
|
|
236
|
+
return __request(OpenAPI, {
|
|
237
|
+
method: 'GET',
|
|
238
|
+
url: '/api/crm/persons/',
|
|
239
|
+
query: {
|
|
240
|
+
'created_at__gte': createdAtGte,
|
|
241
|
+
'created_at__lte': createdAtLte,
|
|
242
|
+
'lifecycle_stage': lifecycleStage,
|
|
243
|
+
'metadata__has_key': metadataHasKey,
|
|
244
|
+
'organization': organization,
|
|
245
|
+
'owner': owner,
|
|
246
|
+
'page': page,
|
|
247
|
+
'page_size': pageSize,
|
|
248
|
+
},
|
|
249
|
+
errors: {
|
|
250
|
+
401: `Authentication required.`,
|
|
251
|
+
403: `Missing required permission \`Ibl.CRM/Persons/list\`.`,
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Create a person
|
|
257
|
+
* Creates a new person in your Platform. The Platform is inferred from your credentials. If `organization` is supplied, it must reference an organization in your Platform.
|
|
258
|
+
*
|
|
259
|
+
* **Required permission:** `Ibl.CRM/Persons/write`.
|
|
260
|
+
* @returns Person
|
|
261
|
+
* @throws ApiError
|
|
262
|
+
*/
|
|
263
|
+
public static crmPersonsCreate({
|
|
264
|
+
requestBody,
|
|
265
|
+
}: {
|
|
266
|
+
requestBody: Person,
|
|
267
|
+
}): CancelablePromise<Person> {
|
|
268
|
+
return __request(OpenAPI, {
|
|
269
|
+
method: 'POST',
|
|
270
|
+
url: '/api/crm/persons/',
|
|
271
|
+
body: requestBody,
|
|
272
|
+
mediaType: 'application/json',
|
|
273
|
+
errors: {
|
|
274
|
+
400: `Validation error.`,
|
|
275
|
+
403: `Missing required permission \`Ibl.CRM/Persons/write\`.`,
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Retrieve a person
|
|
281
|
+
* Returns a single person by id.
|
|
282
|
+
*
|
|
283
|
+
* **Required permission:** `Ibl.CRM/Persons/read`.
|
|
284
|
+
* @returns Person
|
|
285
|
+
* @throws ApiError
|
|
286
|
+
*/
|
|
287
|
+
public static crmPersonsRetrieve({
|
|
288
|
+
id,
|
|
289
|
+
}: {
|
|
290
|
+
id: string,
|
|
291
|
+
}): CancelablePromise<Person> {
|
|
292
|
+
return __request(OpenAPI, {
|
|
293
|
+
method: 'GET',
|
|
294
|
+
url: '/api/crm/persons/{id}/',
|
|
295
|
+
path: {
|
|
296
|
+
'id': id,
|
|
297
|
+
},
|
|
298
|
+
errors: {
|
|
299
|
+
403: `Missing required permission \`Ibl.CRM/Persons/read\`.`,
|
|
300
|
+
404: `Person not found.`,
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Replace a person
|
|
306
|
+
* Replaces all editable fields on the person.
|
|
307
|
+
*
|
|
308
|
+
* **Required permission:** `Ibl.CRM/Persons/write`.
|
|
309
|
+
* @returns Person
|
|
310
|
+
* @throws ApiError
|
|
311
|
+
*/
|
|
312
|
+
public static crmPersonsUpdate({
|
|
313
|
+
id,
|
|
314
|
+
requestBody,
|
|
315
|
+
}: {
|
|
316
|
+
id: string,
|
|
317
|
+
requestBody: Person,
|
|
318
|
+
}): CancelablePromise<Person> {
|
|
319
|
+
return __request(OpenAPI, {
|
|
320
|
+
method: 'PUT',
|
|
321
|
+
url: '/api/crm/persons/{id}/',
|
|
322
|
+
path: {
|
|
323
|
+
'id': id,
|
|
324
|
+
},
|
|
325
|
+
body: requestBody,
|
|
326
|
+
mediaType: 'application/json',
|
|
327
|
+
errors: {
|
|
328
|
+
400: `Validation error.`,
|
|
329
|
+
403: `Missing required permission \`Ibl.CRM/Persons/write\`.`,
|
|
330
|
+
404: `Person not found.`,
|
|
331
|
+
},
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Update a person
|
|
336
|
+
* Updates only the supplied fields on the person.
|
|
337
|
+
*
|
|
338
|
+
* **Required permission:** `Ibl.CRM/Persons/write`.
|
|
339
|
+
* @returns Person
|
|
340
|
+
* @throws ApiError
|
|
341
|
+
*/
|
|
342
|
+
public static crmPersonsPartialUpdate({
|
|
343
|
+
id,
|
|
344
|
+
requestBody,
|
|
345
|
+
}: {
|
|
346
|
+
id: string,
|
|
347
|
+
requestBody?: PatchedPerson,
|
|
348
|
+
}): CancelablePromise<Person> {
|
|
349
|
+
return __request(OpenAPI, {
|
|
350
|
+
method: 'PATCH',
|
|
351
|
+
url: '/api/crm/persons/{id}/',
|
|
352
|
+
path: {
|
|
353
|
+
'id': id,
|
|
354
|
+
},
|
|
355
|
+
body: requestBody,
|
|
356
|
+
mediaType: 'application/json',
|
|
357
|
+
errors: {
|
|
358
|
+
400: `Validation error.`,
|
|
359
|
+
403: `Missing required permission \`Ibl.CRM/Persons/write\`.`,
|
|
360
|
+
404: `Person not found.`,
|
|
361
|
+
},
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Delete a person
|
|
366
|
+
* Deletes the person.
|
|
367
|
+
*
|
|
368
|
+
* **Required permission:** `Ibl.CRM/Persons/delete`.
|
|
369
|
+
* @returns void
|
|
370
|
+
* @throws ApiError
|
|
371
|
+
*/
|
|
372
|
+
public static crmPersonsDestroy({
|
|
373
|
+
id,
|
|
374
|
+
}: {
|
|
375
|
+
id: string,
|
|
376
|
+
}): CancelablePromise<void> {
|
|
377
|
+
return __request(OpenAPI, {
|
|
378
|
+
method: 'DELETE',
|
|
379
|
+
url: '/api/crm/persons/{id}/',
|
|
380
|
+
path: {
|
|
381
|
+
'id': id,
|
|
382
|
+
},
|
|
383
|
+
errors: {
|
|
384
|
+
403: `Missing required permission \`Ibl.CRM/Persons/delete\`.`,
|
|
385
|
+
404: `Person not found.`,
|
|
386
|
+
},
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Invite a person to the platform
|
|
391
|
+
* Sends a platform invitation to the person's `primary_email`. On acceptance, the invitee joins your Platform with the privileges configured in the request body.
|
|
392
|
+
*
|
|
393
|
+
* Returns `409 Conflict` if an active invitation already exists for this email in your Platform, and `422 Unprocessable Entity` if the person is already linked to a platform user.
|
|
394
|
+
*
|
|
395
|
+
* **Required permission:** `Ibl.CRM/Invite/action`.
|
|
396
|
+
* @returns PersonInviteResponse
|
|
397
|
+
* @throws ApiError
|
|
398
|
+
*/
|
|
399
|
+
public static crmPersonsInviteCreate({
|
|
400
|
+
id,
|
|
401
|
+
requestBody,
|
|
402
|
+
}: {
|
|
403
|
+
id: string,
|
|
404
|
+
requestBody?: PersonInviteRequest,
|
|
405
|
+
}): CancelablePromise<PersonInviteResponse> {
|
|
406
|
+
return __request(OpenAPI, {
|
|
407
|
+
method: 'POST',
|
|
408
|
+
url: '/api/crm/persons/{id}/invite/',
|
|
409
|
+
path: {
|
|
410
|
+
'id': id,
|
|
411
|
+
},
|
|
412
|
+
body: requestBody,
|
|
413
|
+
mediaType: 'application/json',
|
|
414
|
+
errors: {
|
|
415
|
+
400: `Person has no \`primary_email\`; cannot invite.`,
|
|
416
|
+
403: `Missing required permission \`Ibl.CRM/Invite/action\`.`,
|
|
417
|
+
404: `Person not found.`,
|
|
418
|
+
422: `Person is already linked to a platform user.`,
|
|
419
|
+
},
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Bind a person to an existing platform user
|
|
424
|
+
* Links this person to an existing platform user. The target user must already be a member of your Platform — if they are not, send them an invitation via `POST /persons/{id}/invite/` instead.
|
|
425
|
+
*
|
|
426
|
+
* This call is idempotent: linking a person that is already bound to the same user is a no-op. Re-linking a person that is already bound to a *different* user is refused; the existing binding is preserved and the unchanged person is returned.
|
|
427
|
+
*
|
|
428
|
+
* **Required permission:** `Ibl.CRM/Persons/write`.
|
|
429
|
+
* @returns Person
|
|
430
|
+
* @throws ApiError
|
|
431
|
+
*/
|
|
432
|
+
public static crmPersonsLinkUserCreate({
|
|
433
|
+
id,
|
|
434
|
+
requestBody,
|
|
435
|
+
}: {
|
|
436
|
+
id: string,
|
|
437
|
+
requestBody: PersonLinkUserRequest,
|
|
438
|
+
}): CancelablePromise<Person> {
|
|
439
|
+
return __request(OpenAPI, {
|
|
440
|
+
method: 'POST',
|
|
441
|
+
url: '/api/crm/persons/{id}/link-user/',
|
|
442
|
+
path: {
|
|
443
|
+
'id': id,
|
|
444
|
+
},
|
|
445
|
+
body: requestBody,
|
|
446
|
+
mediaType: 'application/json',
|
|
447
|
+
errors: {
|
|
448
|
+
400: `Validation error.`,
|
|
449
|
+
403: `Missing required permission \`Ibl.CRM/Persons/write\`, or the target user is not a member of your Platform.`,
|
|
450
|
+
404: `Person or user not found.`,
|
|
451
|
+
},
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Merge duplicate persons into a primary
|
|
456
|
+
* Marks each person in `duplicate_ids` as inactive and reports how many related records (deals, activities, tags) were re-parented onto `primary_id`.
|
|
457
|
+
*
|
|
458
|
+
* All ids — both the primary and every duplicate — must belong to your Platform. `primary_id` may not appear in `duplicate_ids`.
|
|
459
|
+
*
|
|
460
|
+
* **Required permission:** `Ibl.CRM/Persons/write`.
|
|
461
|
+
* @returns PersonMergeResponse
|
|
462
|
+
* @throws ApiError
|
|
463
|
+
*/
|
|
464
|
+
public static crmPersonsMergeCreate({
|
|
465
|
+
requestBody,
|
|
466
|
+
}: {
|
|
467
|
+
requestBody: PersonMergeRequest,
|
|
468
|
+
}): CancelablePromise<PersonMergeResponse> {
|
|
469
|
+
return __request(OpenAPI, {
|
|
470
|
+
method: 'POST',
|
|
471
|
+
url: '/api/crm/persons/merge/',
|
|
472
|
+
body: requestBody,
|
|
473
|
+
mediaType: 'application/json',
|
|
474
|
+
errors: {
|
|
475
|
+
400: `Validation error: the primary appears in duplicates, or one or more ids belong to another Platform.`,
|
|
476
|
+
403: `Missing required permission \`Ibl.CRM/Persons/write\`.`,
|
|
477
|
+
404: `Primary person not found.`,
|
|
478
|
+
},
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
import type { Organization } from '../models/Organization';
|
|
6
|
+
import type { PaginatedOrganizationList } from '../models/PaginatedOrganizationList';
|
|
7
|
+
import type { PatchedOrganization } from '../models/PatchedOrganization';
|
|
8
|
+
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
9
|
+
import { OpenAPI } from '../core/OpenAPI';
|
|
10
|
+
import { request as __request } from '../core/request';
|
|
11
|
+
export class OrganizationsService {
|
|
12
|
+
/**
|
|
13
|
+
* List organizations
|
|
14
|
+
* Returns a paginated list of organizations in your Platform. Supports filtering by `owner` and by `name` (case-insensitive substring match).
|
|
15
|
+
*
|
|
16
|
+
* **Required permission:** `Ibl.CRM/Organizations/list`.
|
|
17
|
+
* @returns PaginatedOrganizationList
|
|
18
|
+
* @throws ApiError
|
|
19
|
+
*/
|
|
20
|
+
public static organizationsList({
|
|
21
|
+
name,
|
|
22
|
+
owner,
|
|
23
|
+
page,
|
|
24
|
+
pageSize,
|
|
25
|
+
}: {
|
|
26
|
+
name?: string,
|
|
27
|
+
owner?: number,
|
|
28
|
+
/**
|
|
29
|
+
* A page number within the paginated result set.
|
|
30
|
+
*/
|
|
31
|
+
page?: number,
|
|
32
|
+
/**
|
|
33
|
+
* Number of results to return per page.
|
|
34
|
+
*/
|
|
35
|
+
pageSize?: number,
|
|
36
|
+
}): CancelablePromise<PaginatedOrganizationList> {
|
|
37
|
+
return __request(OpenAPI, {
|
|
38
|
+
method: 'GET',
|
|
39
|
+
url: '/organizations/',
|
|
40
|
+
query: {
|
|
41
|
+
'name': name,
|
|
42
|
+
'owner': owner,
|
|
43
|
+
'page': page,
|
|
44
|
+
'page_size': pageSize,
|
|
45
|
+
},
|
|
46
|
+
errors: {
|
|
47
|
+
401: `Authentication required.`,
|
|
48
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/list\`.`,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create an organization
|
|
54
|
+
* Creates a new organization in your Platform. The Platform is inferred from your credentials. `name` must be unique within your Platform.
|
|
55
|
+
*
|
|
56
|
+
* **Required permission:** `Ibl.CRM/Organizations/write`.
|
|
57
|
+
* @returns Organization
|
|
58
|
+
* @throws ApiError
|
|
59
|
+
*/
|
|
60
|
+
public static organizationsCreate({
|
|
61
|
+
requestBody,
|
|
62
|
+
}: {
|
|
63
|
+
requestBody: Organization,
|
|
64
|
+
}): CancelablePromise<Organization> {
|
|
65
|
+
return __request(OpenAPI, {
|
|
66
|
+
method: 'POST',
|
|
67
|
+
url: '/organizations/',
|
|
68
|
+
body: requestBody,
|
|
69
|
+
mediaType: 'application/json',
|
|
70
|
+
errors: {
|
|
71
|
+
400: `Validation error (for example, duplicate name).`,
|
|
72
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Retrieve an organization
|
|
78
|
+
* Returns a single organization by id.
|
|
79
|
+
*
|
|
80
|
+
* **Required permission:** `Ibl.CRM/Organizations/read`.
|
|
81
|
+
* @returns Organization
|
|
82
|
+
* @throws ApiError
|
|
83
|
+
*/
|
|
84
|
+
public static organizationsRetrieve({
|
|
85
|
+
id,
|
|
86
|
+
}: {
|
|
87
|
+
id: string,
|
|
88
|
+
}): CancelablePromise<Organization> {
|
|
89
|
+
return __request(OpenAPI, {
|
|
90
|
+
method: 'GET',
|
|
91
|
+
url: '/organizations/{id}/',
|
|
92
|
+
path: {
|
|
93
|
+
'id': id,
|
|
94
|
+
},
|
|
95
|
+
errors: {
|
|
96
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/read\`.`,
|
|
97
|
+
404: `Organization not found.`,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Replace an organization
|
|
103
|
+
* Replaces all editable fields on the organization.
|
|
104
|
+
*
|
|
105
|
+
* **Required permission:** `Ibl.CRM/Organizations/write`.
|
|
106
|
+
* @returns Organization
|
|
107
|
+
* @throws ApiError
|
|
108
|
+
*/
|
|
109
|
+
public static organizationsUpdate({
|
|
110
|
+
id,
|
|
111
|
+
requestBody,
|
|
112
|
+
}: {
|
|
113
|
+
id: string,
|
|
114
|
+
requestBody: Organization,
|
|
115
|
+
}): CancelablePromise<Organization> {
|
|
116
|
+
return __request(OpenAPI, {
|
|
117
|
+
method: 'PUT',
|
|
118
|
+
url: '/organizations/{id}/',
|
|
119
|
+
path: {
|
|
120
|
+
'id': id,
|
|
121
|
+
},
|
|
122
|
+
body: requestBody,
|
|
123
|
+
mediaType: 'application/json',
|
|
124
|
+
errors: {
|
|
125
|
+
400: `Validation error.`,
|
|
126
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`,
|
|
127
|
+
404: `Organization not found.`,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Update an organization
|
|
133
|
+
* Updates only the supplied fields on the organization.
|
|
134
|
+
*
|
|
135
|
+
* **Required permission:** `Ibl.CRM/Organizations/write`.
|
|
136
|
+
* @returns Organization
|
|
137
|
+
* @throws ApiError
|
|
138
|
+
*/
|
|
139
|
+
public static organizationsPartialUpdate({
|
|
140
|
+
id,
|
|
141
|
+
requestBody,
|
|
142
|
+
}: {
|
|
143
|
+
id: string,
|
|
144
|
+
requestBody?: PatchedOrganization,
|
|
145
|
+
}): CancelablePromise<Organization> {
|
|
146
|
+
return __request(OpenAPI, {
|
|
147
|
+
method: 'PATCH',
|
|
148
|
+
url: '/organizations/{id}/',
|
|
149
|
+
path: {
|
|
150
|
+
'id': id,
|
|
151
|
+
},
|
|
152
|
+
body: requestBody,
|
|
153
|
+
mediaType: 'application/json',
|
|
154
|
+
errors: {
|
|
155
|
+
400: `Validation error.`,
|
|
156
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/write\`.`,
|
|
157
|
+
404: `Organization not found.`,
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Delete an organization
|
|
163
|
+
* Deletes the organization. Any persons linked to it are kept; their organization reference is cleared.
|
|
164
|
+
*
|
|
165
|
+
* **Required permission:** `Ibl.CRM/Organizations/delete`.
|
|
166
|
+
* @returns void
|
|
167
|
+
* @throws ApiError
|
|
168
|
+
*/
|
|
169
|
+
public static organizationsDestroy({
|
|
170
|
+
id,
|
|
171
|
+
}: {
|
|
172
|
+
id: string,
|
|
173
|
+
}): CancelablePromise<void> {
|
|
174
|
+
return __request(OpenAPI, {
|
|
175
|
+
method: 'DELETE',
|
|
176
|
+
url: '/organizations/{id}/',
|
|
177
|
+
path: {
|
|
178
|
+
'id': id,
|
|
179
|
+
},
|
|
180
|
+
errors: {
|
|
181
|
+
403: `Missing required permission \`Ibl.CRM/Organizations/delete\`.`,
|
|
182
|
+
404: `Organization not found.`,
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|