@livespace/api 0.0.0-stage → 0.1.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.
@@ -0,0 +1,3844 @@
1
+ export type CurrentUserEnvelope = {
2
+ meta: EnvelopeMeta;
3
+ data: CurrentUser;
4
+ /**
5
+ * Always present. Empty on this operation — a JSON object `{}`, never `[]`.
6
+ */
7
+ extra: Record<string, never>;
8
+ };
9
+ export type EmailHistoryEnvelope = {
10
+ meta: EnvelopeMeta;
11
+ data: EmailHistoryItem[];
12
+ extra: PagingExtra;
13
+ };
14
+ export type EmailHistoryItem = {
15
+ id: string;
16
+ from: string;
17
+ /**
18
+ * Recipient addresses in the order the message lists them, without blind-copy recipients. A long list can come back shorter.
19
+ */
20
+ to: string[];
21
+ /**
22
+ * Copy recipient addresses, empty when the message names none. A long list can come back shorter.
23
+ */
24
+ cc: string[];
25
+ subject: string;
26
+ content: string;
27
+ /**
28
+ * `outgoing` for an email sent from a Livespace mailbox, `incoming` for one received into it.
29
+ */
30
+ direction: "incoming" | "outgoing";
31
+ /**
32
+ * Id of the email this one replies to, as the parent carries it in `id`. `null` when the email is not a reply or the parent is not visible on the same timeline.
33
+ */
34
+ inReplyTo: string | null;
35
+ /**
36
+ * Absolute URL of the record in the account. Use the returned value and do not build the path yourself.
37
+ */
38
+ url: string | null;
39
+ /**
40
+ * When the email was sent or received, as a UTC instant. An email without a date carries the moment it was created.
41
+ */
42
+ date: string;
43
+ /**
44
+ * Deprecated alias of `date`, always the same value. It is kept until the next major version.
45
+ *
46
+ * @deprecated
47
+ */
48
+ createdAt: string;
49
+ };
50
+ export type RelatedId = {
51
+ /**
52
+ * Related record public id as a UUID string.
53
+ */
54
+ id: string;
55
+ };
56
+ export type EnvelopeMeta = {
57
+ version: "2.0.0";
58
+ };
59
+ export type CurrentUser = {
60
+ id: string;
61
+ login: string;
62
+ firstName: string | null;
63
+ lastName: string | null;
64
+ email: string | null;
65
+ /**
66
+ * The time zone the user works in. Dates without a time, such as `expectedCloseDate`, are in this zone.
67
+ */
68
+ timeZone: string;
69
+ /**
70
+ * The language the user works in Livespace. Write to this user in this language.
71
+ */
72
+ language: string;
73
+ /**
74
+ * The default language of the Livespace account the user belongs to.
75
+ */
76
+ tenantLanguage: string;
77
+ };
78
+ /**
79
+ * An RFC 9457 problem; see [Errors](/errors/) for every type. `violations`, `conflicts` and `supported` appear only on the problem types that use them.
80
+ */
81
+ export type Problem = {
82
+ type: "https://api.livespace.io/problems/authentication-required" | "https://api.livespace.io/problems/insufficient-scope" | "https://api.livespace.io/problems/forbidden" | "https://api.livespace.io/problems/package-restriction" | "https://api.livespace.io/problems/not-found" | "https://api.livespace.io/problems/method-not-allowed" | "https://api.livespace.io/problems/not-acceptable" | "https://api.livespace.io/problems/unsupported-media-type" | "https://api.livespace.io/problems/request-validation" | "https://api.livespace.io/problems/domain-validation" | "https://api.livespace.io/problems/too-many-requests" | "https://api.livespace.io/problems/service-unavailable" | "https://api.livespace.io/problems/internal-error" | "https://api.livespace.io/problems/http-error" | "https://api.livespace.io/problems/conflict" | "https://api.livespace.io/problems/idempotency-key-reused";
83
+ title: string;
84
+ status: number;
85
+ detail: string;
86
+ /**
87
+ * Trace id of this request, 32 lowercase hex. On the rare failure where the trace itself could not be read, this is the literal `unavailable`.
88
+ */
89
+ requestId: string;
90
+ /**
91
+ * Each key is an RFC 6901 JSON Pointer to the refused input, into the body (`/owner/id`, `""` for the whole body) or into the path and query parameters (`/perPage`). A refused header is keyed by its name.
92
+ */
93
+ violations?: Record<string, string>;
94
+ /**
95
+ * State conflicts that refused the write, as `resources[]` (each with `resource`, `reason`, `data`) and `properties[]`. Present on conflict, as an object, empty when there is no state to name.
96
+ */
97
+ conflicts?: Record<string, unknown>;
98
+ /**
99
+ * Media types this operation can serve (not-acceptable) or take as a request body (unsupported-media-type).
100
+ */
101
+ supported?: string[];
102
+ };
103
+ /**
104
+ * The creating user: `id` and `name`, the first and last name joined by a space.
105
+ */
106
+ export type CreatedByUser = {
107
+ id: PublicId;
108
+ name: string;
109
+ };
110
+ /**
111
+ * Paging echo for a list. A JSON object, never `[]`.
112
+ */
113
+ export type PagingExtra = {
114
+ page: number;
115
+ perPage: number;
116
+ /**
117
+ * Exact number of items this list returns across all pages.
118
+ */
119
+ totalCount: number;
120
+ };
121
+ /**
122
+ * Always present. Empty on this operation — a JSON object `{}`, never `[]`.
123
+ */
124
+ export type EmptyExtra = Record<string, never>;
125
+ /**
126
+ * Additional-field permissions indexed by public field id. An empty map is a JSON object `{}`, never `[]`.
127
+ */
128
+ export type AdditionalFieldPermissions = Record<string, "read-only" | "read-write">;
129
+ export type RecordPermissions = {
130
+ accessLevel: "full" | "basic";
131
+ additionalFields: AdditionalFieldPermissions;
132
+ };
133
+ export type RecordPermissionsExtra = {
134
+ permissions: RecordPermissions;
135
+ };
136
+ /**
137
+ * Public identifier in 128-bit hexadecimal text form. Historical values are accepted without RFC UUID version or variant restrictions.
138
+ */
139
+ export type PublicId = string;
140
+ export type NamedReference = {
141
+ id: PublicId;
142
+ name: string;
143
+ };
144
+ export type RelationObjectType = "person" | "company" | "deal" | "user";
145
+ export type Relation = {
146
+ /**
147
+ * Identifier of the configured relation. For a copy link this equals `related.id`, because a copy link has no identifier of its own.
148
+ */
149
+ id: PublicId;
150
+ name: string;
151
+ type: NamedReference;
152
+ objectType: RelationObjectType;
153
+ related: NamedReference;
154
+ };
155
+ export type CreateRelationRequest = {
156
+ type: {
157
+ /**
158
+ * A relation type id from `GET /dictionaries/relation-types`.
159
+ */
160
+ id: PublicId;
161
+ };
162
+ from: RelationEndRef;
163
+ to: RelationEndRef;
164
+ };
165
+ export type RelationEndRef = {
166
+ type: RelationObjectType;
167
+ id: PublicId;
168
+ };
169
+ export type RelationRecordEnd = {
170
+ type: RelationObjectType;
171
+ id: PublicId;
172
+ /**
173
+ * The display name of the record, as `relations[].related.name` names it.
174
+ */
175
+ name: string;
176
+ };
177
+ export type RelationRecord = {
178
+ id: PublicId;
179
+ /**
180
+ * The relation type id and its system name, as `relations[].type`.
181
+ */
182
+ type: NamedReference;
183
+ /**
184
+ * The type's name seen from the `from` record.
185
+ */
186
+ nameFrom: string;
187
+ /**
188
+ * The type's name seen from the `to` record.
189
+ */
190
+ nameTo: string;
191
+ from: RelationRecordEnd;
192
+ to: RelationRecordEnd;
193
+ createdAt: string | null;
194
+ createdBy: {
195
+ id: PublicId;
196
+ name: string;
197
+ } | null;
198
+ };
199
+ export type RelationEnvelope = {
200
+ meta: EnvelopeMeta;
201
+ data: RelationRecord;
202
+ extra: EmptyExtra;
203
+ };
204
+ export type RecordVisibility = "public" | "notPublic" | "hidden";
205
+ export type Communication = {
206
+ phoneMobile: string[];
207
+ phoneLandline: string[];
208
+ fax: string[];
209
+ email: string[];
210
+ facebook: string[];
211
+ linkedin: string[];
212
+ goldenline: string[];
213
+ instagram: string[];
214
+ website: string[];
215
+ };
216
+ export type PublicAdditionalFieldOption = {
217
+ id: PublicId;
218
+ name: string;
219
+ };
220
+ export type PublicAdditionalField = {
221
+ id: PublicId;
222
+ group: NamedReference;
223
+ name: string;
224
+ /**
225
+ * The field type. A radio field reads and writes like a select field: one option of the field.
226
+ */
227
+ type: "text" | "textarea" | "numeric" | "integer" | "date" | "date_time" | "checkbox" | "select" | "radio" | "multiselect" | "multicheckbox";
228
+ /**
229
+ * The answer in the type of the field: a boolean, an integer, a number, `YYYY-MM-DD`, a UTC instant or text; an empty answer is `null`, or `[]` for a multi-choice field. A value that does not fit its type is returned as text.
230
+ */
231
+ value: string | number | boolean | PublicAdditionalFieldOption | PublicAdditionalFieldOption[] | null;
232
+ };
233
+ /**
234
+ * The value by field type: an option id or option object (or a list of them on a multi-choice field), an integer, a number, a boolean, `YYYY-MM-DD`, an RFC 3339 instant, or plain text of at most 255 characters (`text`) or 50 000 (`textarea`). `null` and `""` mean no value; an option name or an earlier numeric option id is still accepted in place of an id.
235
+ */
236
+ export type AdditionalFieldWriteValue = string | number | boolean | null | AdditionalFieldOptionRef | (string | AdditionalFieldOptionRef)[];
237
+ /**
238
+ * An option of a choice field in the shape a read returns. The `id` selects the option, by the same matching as a plain value; `name` is ignored.
239
+ */
240
+ export type AdditionalFieldOptionRef = {
241
+ id: string | number;
242
+ name?: string | null;
243
+ };
244
+ /**
245
+ * Custom-field values, at most 100, each field listed once, with ids from `GET /dictionaries/{people|companies|deals|tasks}/fields`. A create needs a value for every required field; an update changes only the listed fields, and a read-only field cannot be changed.
246
+ */
247
+ export type AdditionalFieldWriteList = {
248
+ id: PublicId;
249
+ value: AdditionalFieldWriteValue;
250
+ }[];
251
+ /**
252
+ * Custom-field values of this address, under the rules of every `additionalFields` list, with ids from `GET /dictionaries/addresses/fields`. Addresses are replaced whole, so every required field is sent on every address, and a read-only field keeps its current value.
253
+ */
254
+ export type AddressAdditionalFieldWriteList = {
255
+ id: PublicId;
256
+ value: AdditionalFieldWriteValue;
257
+ }[];
258
+ export type PublicAddress = {
259
+ name: string | null;
260
+ streetLines: string[];
261
+ region: string | null;
262
+ city: string | null;
263
+ postcode: string | null;
264
+ country: string | null;
265
+ /**
266
+ * True for at most one address of the record.
267
+ */
268
+ isMain: boolean;
269
+ additionalFields: PublicAdditionalField[];
270
+ };
271
+ export type Person = {
272
+ id: PublicId;
273
+ firstName: string;
274
+ /**
275
+ * The person's middle name. Present only when the account uses middle names.
276
+ */
277
+ middleName?: string | null;
278
+ lastName: string;
279
+ company: NamedReference | null;
280
+ createdBy: CreatedByUser | null;
281
+ updatedBy: CreatedByUser | null;
282
+ /**
283
+ * The user whose activity last touched the record. `null` when there is none, or when you see the record at the limited access level.
284
+ */
285
+ lastActiveBy: CreatedByUser | null;
286
+ /**
287
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
288
+ */
289
+ createdAt: string | null;
290
+ /**
291
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
292
+ */
293
+ updatedAt: string | null;
294
+ description: string | null;
295
+ source: NamedReference | null;
296
+ position: NamedReference | null;
297
+ /**
298
+ * The user holding the owner role. null when no user holds it (no owner, or a team owner listed under `owners.teams`).
299
+ */
300
+ owner: NamedReference | null;
301
+ owners: RecordOwners;
302
+ /**
303
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
304
+ */
305
+ lastActivity: string | null;
306
+ visibility: RecordVisibility;
307
+ groups: NamedReference[];
308
+ tags: string[];
309
+ communication: Communication;
310
+ addresses: PublicAddress[];
311
+ relations: Relation[];
312
+ additionalFields: PublicAdditionalField[];
313
+ url: string;
314
+ };
315
+ export type PersonEnvelope = {
316
+ meta: EnvelopeMeta;
317
+ data: Person;
318
+ extra: RecordPermissionsExtra;
319
+ };
320
+ export type Company = {
321
+ id: PublicId;
322
+ name: string;
323
+ /**
324
+ * Trimmed, with separators kept. A search on `taxId` ignores spaces and dashes and still returns the value as written.
325
+ */
326
+ taxId: string | null;
327
+ /**
328
+ * Without spaces and dashes.
329
+ */
330
+ regon: string | null;
331
+ createdBy: CreatedByUser | null;
332
+ updatedBy: CreatedByUser | null;
333
+ /**
334
+ * The user whose activity last touched the record. `null` when there is none, or when you see the record at the limited access level.
335
+ */
336
+ lastActiveBy: CreatedByUser | null;
337
+ /**
338
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
339
+ */
340
+ createdAt: string | null;
341
+ /**
342
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
343
+ */
344
+ updatedAt: string | null;
345
+ description: string | null;
346
+ source: NamedReference | null;
347
+ /**
348
+ * The user holding the owner role. null when no user holds it (no owner, or a team owner listed under `owners.teams`).
349
+ */
350
+ owner: NamedReference | null;
351
+ owners: RecordOwners;
352
+ /**
353
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
354
+ */
355
+ lastActivity: string | null;
356
+ visibility: RecordVisibility;
357
+ groups: NamedReference[];
358
+ tags: string[];
359
+ communication: Communication;
360
+ addresses: PublicAddress[];
361
+ relations: Relation[];
362
+ additionalFields: PublicAdditionalField[];
363
+ url: string;
364
+ };
365
+ export type CompanyEnvelope = {
366
+ meta: EnvelopeMeta;
367
+ data: Company;
368
+ extra: RecordPermissionsExtra;
369
+ };
370
+ export type DealBudget = {
371
+ value: number | null;
372
+ cost: number | null;
373
+ currency: string;
374
+ };
375
+ export type DealReason = {
376
+ id: PublicId;
377
+ name: string;
378
+ note: string | null;
379
+ };
380
+ /**
381
+ * Permanent copy-type ids: `6f1a0c01-c0de-4a11-8c00-000000000001` is copiedFrom and `6f1a0c01-c0de-4a11-8c00-000000000002` is copy.
382
+ */
383
+ export type WellKnownCopyRelationTypeId = "6f1a0c01-c0de-4a11-8c00-000000000001" | "6f1a0c01-c0de-4a11-8c00-000000000002";
384
+ export type Deal = {
385
+ id: string;
386
+ name: string;
387
+ /**
388
+ * `null` when the caller has limited access to the deal.
389
+ */
390
+ status: "open" | "won" | "lost" | "outdated" | null;
391
+ number: string | null;
392
+ /**
393
+ * Formatted text. A mention of a user is removed, and so is other HTML.
394
+ */
395
+ description: string | null;
396
+ /**
397
+ * A UTC instant. `null` at limited access.
398
+ */
399
+ createdAt: string | null;
400
+ createdBy: NamedReference | null;
401
+ /**
402
+ * A UTC instant. `null` at limited access.
403
+ */
404
+ updatedAt: string | null;
405
+ updatedBy: NamedReference | null;
406
+ /**
407
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
408
+ */
409
+ lastActivity: string | null;
410
+ lastActiveBy: NamedReference | null;
411
+ /**
412
+ * When the status last changed, as a UTC instant. `null` until the status first changes.
413
+ */
414
+ statusChangedAt: string | null;
415
+ /**
416
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
417
+ */
418
+ stageChangedAt: string | null;
419
+ /**
420
+ * The calendar day in the caller's time zone, the user's setting or else the account's, as `YYYY-MM-DD`.
421
+ */
422
+ expectedCloseDate: string | null;
423
+ /**
424
+ * The calendar day in the caller's time zone, the user's setting or else the account's, as `YYYY-MM-DD`.
425
+ */
426
+ autoCloseDate: string | null;
427
+ visibility: RecordVisibility;
428
+ company: NamedReference | null;
429
+ person: NamedReference | null;
430
+ /**
431
+ * The user holding the owner role. null when no user holds it (no owner, or a team owner listed under `owners.teams`).
432
+ */
433
+ owner: NamedReference | null;
434
+ /**
435
+ * The owner role. At limited access the deal lists its owner users and hides the owner teams: `teams` is empty.
436
+ */
437
+ owners: RecordOwners;
438
+ budget: DealBudget | null;
439
+ /**
440
+ * The chance of winning the deal, in percent. Present only when the account uses deal probability. null when the deal has no probability or when the caller sees the deal at basic access.
441
+ */
442
+ probability?: number | null;
443
+ source: NamedReference | null;
444
+ process: NamedReference | null;
445
+ /**
446
+ * The main stage the deal is on. A deal that has reached no stage yet reports the first active stage of its process. null only when the deal has no process or its process has no active stage.
447
+ */
448
+ currentStage: NamedReference | null;
449
+ wonReason: DealReason | null;
450
+ lostReason: DealReason | null;
451
+ outdatedReason: DealReason | null;
452
+ groups: NamedReference[];
453
+ /**
454
+ * Each tag name as it was written, such as `r&d`.
455
+ */
456
+ tags: string[];
457
+ /**
458
+ * Whether the deal was created as a copy of another deal.
459
+ */
460
+ copied: boolean;
461
+ relations: Relation[];
462
+ additionalFields: PublicAdditionalField[];
463
+ url: string;
464
+ };
465
+ /**
466
+ * Users and teams that hold the owner role on the record. At limited access the record lists its owner users and hides the owner teams: `teams` is empty.
467
+ */
468
+ export type RecordOwners = {
469
+ users: NamedReference[];
470
+ teams: NamedReference[];
471
+ };
472
+ export type DealEnvelope = {
473
+ meta: EnvelopeMeta;
474
+ data: Deal;
475
+ extra: RecordPermissionsExtra;
476
+ };
477
+ export type UserListItem = {
478
+ id: PublicId;
479
+ firstName: string | null;
480
+ lastName: string | null;
481
+ email: string | null;
482
+ createdAt: string | null;
483
+ /**
484
+ * The user's main team, the same pair a user search hit returns. `null` when the user has none.
485
+ */
486
+ team: SearchRelated | null;
487
+ };
488
+ export type UserListEnvelope = {
489
+ meta: EnvelopeMeta;
490
+ data: UserListItem[];
491
+ extra: DictionaryListExtra;
492
+ };
493
+ /**
494
+ * A user of the account.
495
+ */
496
+ export type PublicUser = {
497
+ id: string;
498
+ login: string;
499
+ firstName: string | null;
500
+ lastName: string | null;
501
+ email: string | null;
502
+ avatar: RelatedId | null;
503
+ };
504
+ export type PublicUserEnvelope = {
505
+ meta: EnvelopeMeta;
506
+ data: PublicUser;
507
+ /**
508
+ * Always present. Empty on this operation — a JSON object `{}`, never `[]`.
509
+ */
510
+ extra: EmptyExtra;
511
+ };
512
+ /**
513
+ * A note. It has no `href`, `link` or `attachments`.
514
+ */
515
+ export type Note = {
516
+ /**
517
+ * The note's public id. Shared with the nested notes lists, the Location header of POST and search hits.
518
+ */
519
+ id: string;
520
+ /**
521
+ * A mention of a user reads as `@` followed by the name.
522
+ */
523
+ content: string;
524
+ visibility: "all" | "forMe" | "forMeAndManagers";
525
+ /**
526
+ * Each tag name as it was written, such as `r&d`.
527
+ */
528
+ tags: string[];
529
+ /**
530
+ * The note's own date, set on create, as a UTC instant. Equal to `createdAt` when the client sent no date.
531
+ */
532
+ date: string;
533
+ /**
534
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
535
+ */
536
+ createdAt: string;
537
+ createdBy: CreatedByUser;
538
+ /**
539
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
540
+ */
541
+ updatedAt: string;
542
+ /**
543
+ * The active people, companies and deals the note belongs to that the caller sees in full, `type` then `id` ascending. `[]` when there is none, as for a dashboard note.
544
+ */
545
+ parents: NoteParentRef[];
546
+ /**
547
+ * Absolute URL of the record in the account. Use the returned value and do not build the path yourself.
548
+ */
549
+ url: string | null;
550
+ };
551
+ /**
552
+ * A note as it is read.
553
+ */
554
+ export type NoteRead = {
555
+ /**
556
+ * The note's public id. Shared with nested note lists, create Location headers and search hits.
557
+ */
558
+ id: string;
559
+ /**
560
+ * A mention of a user reads as `@` followed by the name.
561
+ */
562
+ content: string;
563
+ visibility: "all" | "forMe" | "forMeAndManagers";
564
+ /**
565
+ * Each tag name as it was written, such as `r&d`.
566
+ */
567
+ tags: string[];
568
+ /**
569
+ * The note's own date as a UTC instant with a trailing `Z`.
570
+ */
571
+ date: string;
572
+ /**
573
+ * UTC instant with a trailing `Z`.
574
+ */
575
+ createdAt: string;
576
+ createdBy: CreatedByUser;
577
+ /**
578
+ * UTC instant with a trailing `Z`.
579
+ */
580
+ updatedAt: string;
581
+ /**
582
+ * The active people, companies and deals the note belongs to that the caller sees in full, by `type` then `id`; `[]` when there is none, as for a dashboard note. The lists of notes nested in a record leave it out.
583
+ */
584
+ parents?: NoteParentRef[];
585
+ /**
586
+ * Absolute URL of the record in the account. Use the returned value and do not build the path yourself.
587
+ */
588
+ url: string | null;
589
+ };
590
+ /**
591
+ * A record the note hangs on.
592
+ */
593
+ export type NoteParentRef = {
594
+ type: "person" | "company" | "deal";
595
+ id: PublicId;
596
+ };
597
+ export type NoteEnvelope = {
598
+ meta: EnvelopeMeta;
599
+ data: Note;
600
+ /**
601
+ * Always present. Empty on this operation — a JSON object `{}`, never `[]`.
602
+ */
603
+ extra: EmptyExtra;
604
+ };
605
+ export type NoteReadEnvelope = {
606
+ meta: EnvelopeMeta;
607
+ data: NoteRead;
608
+ /**
609
+ * Always present. Empty on this operation — a JSON object `{}`, never `[]`.
610
+ */
611
+ extra: EmptyExtra;
612
+ };
613
+ export type NoteListEnvelope = {
614
+ meta: EnvelopeMeta;
615
+ data: NoteRead[];
616
+ extra: PagingExtra;
617
+ };
618
+ /**
619
+ * Extra properties (including `attachments`) are 400. Author is the integration user bound to the key, never a body field.
620
+ */
621
+ export type CreateNoteRequest = {
622
+ content: {
623
+ /**
624
+ * At most 50 000 bytes. Some characters count as more than one towards the limit.
625
+ */
626
+ value: string;
627
+ };
628
+ visibility: "all" | "forMe" | "forMeAndManagers";
629
+ tags?: string[];
630
+ /**
631
+ * Optional ISO-8601. Omitted ⇒ now.
632
+ */
633
+ date?: string;
634
+ };
635
+ /**
636
+ * Every property is optional, and an empty object changes nothing. `tags: []` clears the tags and `date: null` clears the date; `null` on `content`, `visibility` or `tags` is refused.
637
+ */
638
+ export type UpdateNoteRequest = {
639
+ content?: null | {
640
+ /**
641
+ * At most 50 000 bytes. Some characters count as more than one towards the limit.
642
+ */
643
+ value: string;
644
+ };
645
+ visibility?: null | "all" | "forMe" | "forMeAndManagers";
646
+ tags?: null | string[];
647
+ /**
648
+ * `null` clears the date; leaving the key out keeps it.
649
+ */
650
+ date?: string | null;
651
+ };
652
+ /**
653
+ * A call. `recordingUrl` is the recording link shown on the call's timeline entry, and `recordingExpiresOn` the last day that link works when the phone system reported one.
654
+ */
655
+ export type Call = {
656
+ id: string;
657
+ /**
658
+ * When the call took place, as a UTC instant. A call without a date carries the moment it was created.
659
+ */
660
+ date: string;
661
+ /**
662
+ * Deprecated alias of `date`, always the same value. It is kept until the next major version.
663
+ *
664
+ * @deprecated
665
+ */
666
+ createdAt: string;
667
+ /**
668
+ * The user the call is attributed to. `null` when that user no longer exists.
669
+ */
670
+ createdBy: CreatedByUser | null;
671
+ number: string;
672
+ /**
673
+ * Duration in seconds.
674
+ */
675
+ duration: number;
676
+ direction: "incoming" | "outgoing";
677
+ /**
678
+ * The call's note. A call logged without a note carries a short phrase in the language of the user it is attributed to.
679
+ */
680
+ note: string;
681
+ /**
682
+ * Who may see the call: everyone who sees the parent, the attributed user only, or that user and their managers.
683
+ */
684
+ visibility: "all" | "forMe" | "forMeAndManagers";
685
+ /**
686
+ * The link of the call recording, or `null`.
687
+ */
688
+ recordingUrl: string | null;
689
+ /**
690
+ * The last day the recording link works, when the phone system that wrote it reported one, otherwise `null`.
691
+ */
692
+ recordingExpiresOn: string | null;
693
+ };
694
+ export type CallListEnvelope = {
695
+ meta: EnvelopeMeta;
696
+ data: Call[];
697
+ extra: PagingExtra;
698
+ };
699
+ export type NestedEmailListEnvelope = {
700
+ meta: EnvelopeMeta;
701
+ data: EmailHistoryItem[];
702
+ extra: PagingExtra;
703
+ };
704
+ /**
705
+ * Extra properties are refused (400).
706
+ */
707
+ export type CreateNotificationRequest = {
708
+ /**
709
+ * Required plain text of at most 700 characters. A value with no text left is refused.
710
+ */
711
+ content: string;
712
+ /**
713
+ * Optional link shown with the notification: an absolute http or https URL, or a Livespace app path starting with one slash. At most 255 characters, without whitespace or control characters.
714
+ */
715
+ url?: string;
716
+ recipient?: {
717
+ /**
718
+ * Id of the user to notify. Without a recipient, the integration user of the key is notified.
719
+ */
720
+ id: string;
721
+ };
722
+ };
723
+ /**
724
+ * `id` is a decimal string, not a UUID. A notification cannot be read back by id.
725
+ */
726
+ export type CreatedNotification = {
727
+ /**
728
+ * Created notification id as a decimal string.
729
+ */
730
+ id: string;
731
+ };
732
+ export type CreatedNotificationEnvelope = {
733
+ meta: EnvelopeMeta;
734
+ data: CreatedNotification;
735
+ /**
736
+ * Always present. Empty on this operation — a JSON object `{}`, never `[]`.
737
+ */
738
+ extra: EmptyExtra;
739
+ };
740
+ /**
741
+ * A related record reduced to its public id and display name.
742
+ */
743
+ export type SearchRelated = {
744
+ id: string;
745
+ /**
746
+ * Display name of the related record.
747
+ */
748
+ name: string | null;
749
+ };
750
+ /**
751
+ * The record the note hangs off. `null` when the note has no parent with a public identity.
752
+ */
753
+ export type SearchNoteReferer = {
754
+ id: string;
755
+ type: "person" | "company" | "deal" | "space";
756
+ /**
757
+ * Display name of the parent record.
758
+ */
759
+ name: string | null;
760
+ };
761
+ export type SearchPersonHit = {
762
+ /**
763
+ * The record's public id as a UUID string.
764
+ */
765
+ id: string;
766
+ type: "person";
767
+ /**
768
+ * Given name.
769
+ */
770
+ firstName: string | null;
771
+ /**
772
+ * Family name.
773
+ */
774
+ lastName: string | null;
775
+ /**
776
+ * Plain-text note on the person. `null` when the caller's visibility of this record is limited.
777
+ */
778
+ description: string | null;
779
+ /**
780
+ * The person's company as `{id, name}`, also when the caller's visibility of the person is limited. `null` when the person has no company, or the company has no public identity.
781
+ */
782
+ company: SearchRelated | null;
783
+ /**
784
+ * The record's owners. Empty when the caller may not see them.
785
+ */
786
+ owners: SearchRelated[];
787
+ /**
788
+ * Absolute URL of the record in the account. Use the returned value and do not build the path yourself.
789
+ */
790
+ url: string | null;
791
+ };
792
+ export type SearchCompanyHit = {
793
+ /**
794
+ * The record's public id as a UUID string.
795
+ */
796
+ id: string;
797
+ type: "company";
798
+ /**
799
+ * Company name.
800
+ */
801
+ name: string | null;
802
+ /**
803
+ * Tax identification number. `null` when the caller's visibility of this record is limited.
804
+ */
805
+ tin: string | null;
806
+ /**
807
+ * Statistical number. `null` when the caller's visibility of this record is limited.
808
+ */
809
+ regon: string | null;
810
+ /**
811
+ * Plain-text description of the company. `null` when the caller's visibility of this record is limited.
812
+ */
813
+ description: string | null;
814
+ /**
815
+ * The record's owners. Empty when the caller may not see them.
816
+ */
817
+ owners: SearchRelated[];
818
+ /**
819
+ * Absolute URL of the record in the account. Use the returned value and do not build the path yourself.
820
+ */
821
+ url: string | null;
822
+ };
823
+ export type SearchDealHit = {
824
+ /**
825
+ * The record's public id as a UUID string.
826
+ */
827
+ id: string;
828
+ type: "deal";
829
+ /**
830
+ * Deal name.
831
+ */
832
+ name: string | null;
833
+ /**
834
+ * Deal status. `null` when the caller's visibility of this record is limited.
835
+ */
836
+ status: "open" | "won" | "lost" | "outdated" | null;
837
+ /**
838
+ * Deal number.
839
+ */
840
+ number: string | null;
841
+ /**
842
+ * Creation time in ISO-8601 UTC. `null` when the caller's visibility of this record is limited.
843
+ */
844
+ createdAt: string | null;
845
+ /**
846
+ * The deal's company. `null` when the caller's visibility of this record is limited, or it has no public identity.
847
+ */
848
+ company: SearchRelated | null;
849
+ /**
850
+ * The deal's contact person. `null` when the caller's visibility of this record is limited, or it has no public identity.
851
+ */
852
+ person: SearchRelated | null;
853
+ /**
854
+ * The record's owners. Empty when the caller may not see them.
855
+ */
856
+ owners: SearchRelated[];
857
+ /**
858
+ * Absolute URL of the record in the account. Use the returned value and do not build the path yourself.
859
+ */
860
+ url: string | null;
861
+ };
862
+ export type SearchNoteHit = {
863
+ /**
864
+ * The record's public id as a UUID string.
865
+ */
866
+ id: string;
867
+ type: "note";
868
+ /**
869
+ * The note content as plain text. A mention of a user reads as `@` followed by the name.
870
+ */
871
+ content: string | null;
872
+ /**
873
+ * Tags on the note, each as written (`r&d`).
874
+ */
875
+ tags: string[];
876
+ /**
877
+ * Creation time in ISO-8601 UTC.
878
+ */
879
+ createdAt: string | null;
880
+ /**
881
+ * The record the note hangs off, or `null`.
882
+ */
883
+ referer: SearchNoteReferer | null;
884
+ /**
885
+ * Absolute URL of the record in the account. Use the returned value and do not build the path yourself.
886
+ */
887
+ url: string | null;
888
+ };
889
+ export type SearchSpaceHit = {
890
+ /**
891
+ * The record's public id as a UUID string.
892
+ */
893
+ id: string;
894
+ type: "space";
895
+ /**
896
+ * Space name.
897
+ */
898
+ name: string | null;
899
+ /**
900
+ * Space number.
901
+ */
902
+ number: string | null;
903
+ /**
904
+ * Plain-text description. `null` when the caller's visibility of this record is limited.
905
+ */
906
+ description: string | null;
907
+ /**
908
+ * The record's owners. Empty when the caller may not see them.
909
+ */
910
+ owners: SearchRelated[];
911
+ /**
912
+ * Absolute URL of the record in the account. Use the returned value and do not build the path yourself.
913
+ */
914
+ url: string | null;
915
+ };
916
+ export type SearchUserHit = {
917
+ /**
918
+ * The record's public id as a UUID string.
919
+ */
920
+ id: string;
921
+ type: "user";
922
+ /**
923
+ * Given name.
924
+ */
925
+ firstName: string | null;
926
+ /**
927
+ * Family name.
928
+ */
929
+ lastName: string | null;
930
+ /**
931
+ * Work e-mail address.
932
+ */
933
+ email: string | null;
934
+ /**
935
+ * Login name.
936
+ */
937
+ login: string | null;
938
+ /**
939
+ * The user's main team. `null` when the user has none.
940
+ */
941
+ team: SearchRelated | null;
942
+ /**
943
+ * Absolute URL of the record in the account. Use the returned value and do not build the path yourself.
944
+ */
945
+ url: string | null;
946
+ };
947
+ /**
948
+ * One search hit. `type` selects the variant; every `id` at every depth is a public UUID.
949
+ */
950
+ export type SearchHit = SearchPersonHit | SearchCompanyHit | SearchDealHit | SearchNoteHit | SearchSpaceHit | SearchUserHit;
951
+ /**
952
+ * Paging echo for this search. A JSON object, never `[]`.
953
+ */
954
+ export type SearchListExtra = {
955
+ page: number;
956
+ perPage: number;
957
+ /**
958
+ * Approximate number of hits this query can return. Not an exact count.
959
+ */
960
+ totalCount: number;
961
+ };
962
+ export type SearchListEnvelope = {
963
+ meta: EnvelopeMeta;
964
+ data: SearchHit[];
965
+ extra: SearchListExtra;
966
+ };
967
+ /**
968
+ * Paging facts of a dictionary list, always an object. `totalCount` is exact.
969
+ */
970
+ export type DictionaryListExtra = {
971
+ page: number;
972
+ perPage: number;
973
+ /**
974
+ * Exact number of entries this list can return.
975
+ */
976
+ totalCount: number;
977
+ };
978
+ export type DictionarySource = {
979
+ id: PublicId;
980
+ name: string;
981
+ parent: NamedReference | null;
982
+ /**
983
+ * `true` when the source is active and may be sent as `source.id` on a person write.
984
+ */
985
+ selectable: boolean;
986
+ };
987
+ export type DictionarySourceListEnvelope = {
988
+ meta: EnvelopeMeta;
989
+ data: DictionarySource[];
990
+ extra: DictionaryListExtra;
991
+ };
992
+ export type DictionarySourceEnvelope = {
993
+ meta: EnvelopeMeta;
994
+ data: DictionarySource;
995
+ extra: EmptyExtra;
996
+ };
997
+ export type DictionaryConsentStatus = {
998
+ id: PublicId;
999
+ name: string | null;
1000
+ /**
1001
+ * `true` for the four system statuses, which cannot be renamed or deleted.
1002
+ */
1003
+ system: boolean;
1004
+ /**
1005
+ * The fixed meaning of a system status, which a rename does not change; `null` for a custom status.
1006
+ */
1007
+ meaning: "given" | "not_given" | "unknown" | "withdrawn" | null;
1008
+ /**
1009
+ * The label of `meaning` in the language of the account, English when that language has none; `null` when `meaning` is `null`.
1010
+ */
1011
+ meaningLabel: string | null;
1012
+ /**
1013
+ * `true` when the status is active and may be given to a consent.
1014
+ */
1015
+ selectable: boolean;
1016
+ };
1017
+ export type DictionaryConsentStatusListEnvelope = {
1018
+ meta: EnvelopeMeta;
1019
+ data: DictionaryConsentStatus[];
1020
+ extra: DictionaryListExtra;
1021
+ };
1022
+ export type DictionaryConsentStatusEnvelope = {
1023
+ meta: EnvelopeMeta;
1024
+ data: DictionaryConsentStatus;
1025
+ extra: EmptyExtra;
1026
+ };
1027
+ export type DictionaryTeam = {
1028
+ id: PublicId;
1029
+ name: string;
1030
+ parent: NamedReference | null;
1031
+ /**
1032
+ * Depth in the team tree; the root of the structure is `0`.
1033
+ */
1034
+ level: number;
1035
+ /**
1036
+ * `true` when the team is active and may be sent as a team owner; the whole-company team never is. A team that is not selectable can still be read by id.
1037
+ */
1038
+ selectable: boolean;
1039
+ };
1040
+ export type DictionaryTeamListEnvelope = {
1041
+ meta: EnvelopeMeta;
1042
+ data: DictionaryTeam[];
1043
+ extra: DictionaryListExtra;
1044
+ };
1045
+ export type DictionaryTagListEnvelope = {
1046
+ meta: EnvelopeMeta;
1047
+ data: string[];
1048
+ extra: DictionaryListExtra;
1049
+ };
1050
+ export type DictionaryTeamEnvelope = {
1051
+ meta: EnvelopeMeta;
1052
+ data: DictionaryTeam;
1053
+ extra: EmptyExtra;
1054
+ };
1055
+ /**
1056
+ * Record-type names in published order. `space` is listed only when Spaces is switched on for the account.
1057
+ */
1058
+ export type DictionaryRoleRecordType = "person" | "company" | "deal" | "task" | "space";
1059
+ export type DictionaryRole = {
1060
+ id: PublicId;
1061
+ /**
1062
+ * The stable technical key of the role.
1063
+ */
1064
+ name: string;
1065
+ /**
1066
+ * The display label, `null` when the account set none.
1067
+ */
1068
+ title: string | null;
1069
+ /**
1070
+ * `true` when the role is active and may be sent as an owner role; a non-selectable role still answers GET one with `200`.
1071
+ */
1072
+ selectable: boolean;
1073
+ /**
1074
+ * The record types the role may be assigned on, each once.
1075
+ */
1076
+ recordTypes: DictionaryRoleRecordType[];
1077
+ /**
1078
+ * More than one holder is allowed.
1079
+ */
1080
+ multiple: boolean;
1081
+ /**
1082
+ * A team may hold the role.
1083
+ */
1084
+ teams: boolean;
1085
+ /**
1086
+ * Types on which the role is required. Empty when the role is required on no published type.
1087
+ */
1088
+ required: DictionaryRoleRecordType[];
1089
+ };
1090
+ export type DictionaryRoleListEnvelope = {
1091
+ meta: EnvelopeMeta;
1092
+ data: DictionaryRole[];
1093
+ extra: DictionaryListExtra;
1094
+ };
1095
+ export type DictionaryRoleEnvelope = {
1096
+ meta: EnvelopeMeta;
1097
+ data: DictionaryRole;
1098
+ extra: EmptyExtra;
1099
+ };
1100
+ export type DictionaryField = {
1101
+ id: PublicId;
1102
+ name: string;
1103
+ /**
1104
+ * The input rendered for the custom field. A radio field reads and writes like a select field: one option of the field.
1105
+ */
1106
+ type: "text" | "textarea" | "numeric" | "integer" | "date" | "date_time" | "checkbox" | "select" | "radio" | "multiselect" | "multicheckbox";
1107
+ /**
1108
+ * The form section the field is shown under.
1109
+ */
1110
+ group: NamedReference | null;
1111
+ /**
1112
+ * `true` when the record form requires a value; a write that omits it answers `422`.
1113
+ */
1114
+ required: boolean;
1115
+ /**
1116
+ * `true` when the field is read-only on the record form, or when no role of the caller may edit it. A role held on one record (owner, member) can still allow a write on that record.
1117
+ */
1118
+ readOnly: boolean;
1119
+ /**
1120
+ * `true` when the field is offered on record create and edit. A field that is not selectable can still be read by id, so existing values stay readable.
1121
+ */
1122
+ selectable: boolean;
1123
+ /**
1124
+ * An array only for `select`, `radio`, `multiselect` and `multicheckbox`, and `null` for every other type. A retired option is omitted.
1125
+ */
1126
+ options: NamedReference[] | null;
1127
+ };
1128
+ export type DictionaryFieldListEnvelope = {
1129
+ meta: EnvelopeMeta;
1130
+ data: DictionaryField[];
1131
+ extra: DictionaryListExtra;
1132
+ };
1133
+ export type DictionaryFieldEnvelope = {
1134
+ meta: EnvelopeMeta;
1135
+ data: DictionaryField;
1136
+ extra: EmptyExtra;
1137
+ };
1138
+ export type DictionaryDealField = {
1139
+ id: PublicId;
1140
+ name: string;
1141
+ /**
1142
+ * The input rendered for the custom field. A radio field reads and writes like a select field: one option of the field.
1143
+ */
1144
+ type: "text" | "textarea" | "numeric" | "integer" | "date" | "date_time" | "checkbox" | "select" | "radio" | "multiselect" | "multicheckbox";
1145
+ /**
1146
+ * The form section the field is shown under.
1147
+ */
1148
+ group: NamedReference | null;
1149
+ /**
1150
+ * `true` when the record form requires a value; a write that omits it answers `422`.
1151
+ */
1152
+ required: boolean;
1153
+ /**
1154
+ * `true` when the field is read-only on the record form, or when no role of the caller may edit it. A role held on one record (owner, member) can still allow a write on that record.
1155
+ */
1156
+ readOnly: boolean;
1157
+ /**
1158
+ * `true` when the field is offered on record create and edit. A field that is not selectable can still be read by id, so existing values stay readable.
1159
+ */
1160
+ selectable: boolean;
1161
+ /**
1162
+ * An array only for `select`, `radio`, `multiselect` and `multicheckbox`, and `null` for every other type. A retired option is omitted.
1163
+ */
1164
+ options: NamedReference[] | null;
1165
+ /**
1166
+ * `true` when marking the deal won requires a value.
1167
+ */
1168
+ requiredForWin: boolean;
1169
+ };
1170
+ export type DictionaryDealFieldListEnvelope = {
1171
+ meta: EnvelopeMeta;
1172
+ data: DictionaryDealField[];
1173
+ extra: DictionaryListExtra;
1174
+ };
1175
+ export type DictionaryDealFieldEnvelope = {
1176
+ meta: EnvelopeMeta;
1177
+ data: DictionaryDealField;
1178
+ extra: EmptyExtra;
1179
+ };
1180
+ export type DictionaryPosition = {
1181
+ id: PublicId;
1182
+ name: string;
1183
+ /**
1184
+ * `true` on every published position, because this catalog has no archived state.
1185
+ */
1186
+ selectable: boolean;
1187
+ };
1188
+ export type DictionaryPositionListEnvelope = {
1189
+ meta: EnvelopeMeta;
1190
+ data: DictionaryPosition[];
1191
+ extra: DictionaryListExtra;
1192
+ };
1193
+ export type DictionaryPositionEnvelope = {
1194
+ meta: EnvelopeMeta;
1195
+ data: DictionaryPosition;
1196
+ extra: EmptyExtra;
1197
+ };
1198
+ export type DictionaryDealReason = {
1199
+ id: PublicId;
1200
+ name: string;
1201
+ /**
1202
+ * The deal status this reason is for. A `won` reason is the one a deal write accepts as `wonReason.id`.
1203
+ */
1204
+ kind: "won" | "lost" | "outdated";
1205
+ /**
1206
+ * `false` on a retired reason. A deal can still reference it by id.
1207
+ */
1208
+ selectable: boolean;
1209
+ };
1210
+ export type DictionaryDealReasonListEnvelope = {
1211
+ meta: EnvelopeMeta;
1212
+ data: DictionaryDealReason[];
1213
+ extra: DictionaryListExtra;
1214
+ };
1215
+ export type DictionaryDealReasonEnvelope = {
1216
+ meta: EnvelopeMeta;
1217
+ data: DictionaryDealReason;
1218
+ extra: EmptyExtra;
1219
+ };
1220
+ export type DictionaryCurrency = {
1221
+ /**
1222
+ * The currency code. It is not a UUID.
1223
+ */
1224
+ id: string;
1225
+ name: string;
1226
+ /**
1227
+ * `true` for the default currency of the account.
1228
+ */
1229
+ default: boolean;
1230
+ /**
1231
+ * `true` when an administrator switched the currency on, so a deal write accepts the code as `budget.currency`.
1232
+ */
1233
+ selectable: boolean;
1234
+ };
1235
+ export type DictionaryCurrencyListEnvelope = {
1236
+ meta: EnvelopeMeta;
1237
+ data: DictionaryCurrency[];
1238
+ extra: DictionaryListExtra;
1239
+ };
1240
+ export type DictionaryCurrencyEnvelope = {
1241
+ meta: EnvelopeMeta;
1242
+ data: DictionaryCurrency;
1243
+ extra: EmptyExtra;
1244
+ };
1245
+ export type DictionaryRelationType = {
1246
+ id: PublicId;
1247
+ /**
1248
+ * The label read from the `from` side.
1249
+ */
1250
+ nameFrom: string;
1251
+ /**
1252
+ * The label read from the `to` side.
1253
+ */
1254
+ nameTo: string;
1255
+ /**
1256
+ * A side the public relation API can name.
1257
+ */
1258
+ from: "person" | "company" | "deal" | "user";
1259
+ /**
1260
+ * A side the public relation API can name.
1261
+ */
1262
+ to: "person" | "company" | "deal" | "user";
1263
+ /**
1264
+ * `false` on a deleted type and on a system type; neither can be chosen for a new relation. An existing relation can still name it by id.
1265
+ */
1266
+ selectable: boolean;
1267
+ };
1268
+ export type DictionaryRelationTypeListEnvelope = {
1269
+ meta: EnvelopeMeta;
1270
+ data: DictionaryRelationType[];
1271
+ extra: DictionaryListExtra;
1272
+ };
1273
+ export type DictionaryRelationTypeEnvelope = {
1274
+ meta: EnvelopeMeta;
1275
+ data: DictionaryRelationType;
1276
+ extra: EmptyExtra;
1277
+ };
1278
+ export type RelationTypeCreateRequest = {
1279
+ /**
1280
+ * The label read from the `from` side. 1 to 25 characters after surrounding whitespace is trimmed.
1281
+ */
1282
+ nameFrom: string;
1283
+ /**
1284
+ * The label read from the `to` side. 1 to 25 characters after surrounding whitespace is trimmed.
1285
+ */
1286
+ nameTo: string;
1287
+ from: "person" | "company" | "deal";
1288
+ to: "person" | "company" | "deal" | "user";
1289
+ };
1290
+ /**
1291
+ * At least one label. `from` and `to` cannot be sent.
1292
+ */
1293
+ export type RelationTypeUpdateRequest = {
1294
+ /**
1295
+ * The label read from the `from` side. 1 to 25 characters after surrounding whitespace is trimmed.
1296
+ */
1297
+ nameFrom?: string;
1298
+ /**
1299
+ * The label read from the `to` side. 1 to 25 characters after surrounding whitespace is trimmed.
1300
+ */
1301
+ nameTo?: string;
1302
+ };
1303
+ export type DictionaryTeamMember = {
1304
+ id: PublicId;
1305
+ /**
1306
+ * The user's display name. Empty when both names are blank.
1307
+ */
1308
+ name: string;
1309
+ /**
1310
+ * `true` when this team is the user's main team. When two teams are marked main, the API reports one of them as main.
1311
+ */
1312
+ isMain: boolean;
1313
+ };
1314
+ export type DictionaryTeamMemberListEnvelope = {
1315
+ meta: EnvelopeMeta;
1316
+ data: DictionaryTeamMember[];
1317
+ extra: DictionaryListExtra;
1318
+ };
1319
+ export type DictionaryTaskType = {
1320
+ id: PublicId;
1321
+ name: string;
1322
+ /**
1323
+ * The number of the icon the Livespace task pickers show, or `null` when the type has none. A write here accepts 1 to 35, and a value outside that range comes from a type saved elsewhere in Livespace.
1324
+ */
1325
+ icon: number | null;
1326
+ /**
1327
+ * `true` for a built-in type the account did not create.
1328
+ */
1329
+ system: boolean;
1330
+ /**
1331
+ * `false` on a retired type. A task can still reference it by id.
1332
+ */
1333
+ selectable: boolean;
1334
+ };
1335
+ export type DictionaryTaskTypeListEnvelope = {
1336
+ meta: EnvelopeMeta;
1337
+ data: DictionaryTaskType[];
1338
+ extra: DictionaryListExtra;
1339
+ };
1340
+ export type DictionaryTaskTypeEnvelope = {
1341
+ meta: EnvelopeMeta;
1342
+ data: DictionaryTaskType;
1343
+ extra: EmptyExtra;
1344
+ };
1345
+ export type TaskTypeCreateRequest = {
1346
+ /**
1347
+ * The name, 2 to 200 characters once the surrounding whitespace is removed.
1348
+ */
1349
+ name: string;
1350
+ /**
1351
+ * The number of the icon the Livespace task pickers show; `1` when left out.
1352
+ */
1353
+ icon?: number;
1354
+ };
1355
+ export type TaskTypeUpdateRequest = {
1356
+ /**
1357
+ * The name, 2 to 200 characters once the surrounding whitespace is removed.
1358
+ */
1359
+ name?: string;
1360
+ /**
1361
+ * The number of the icon the Livespace task pickers show.
1362
+ */
1363
+ icon?: number;
1364
+ };
1365
+ export type TaskStatusCreateRequest = {
1366
+ /**
1367
+ * The name, 2 to 200 characters once the surrounding whitespace is removed.
1368
+ */
1369
+ name: string;
1370
+ /**
1371
+ * Six hexadecimal digits without "#", read back lowercase; `null` or leaving it out means no colour.
1372
+ */
1373
+ color?: string | null;
1374
+ };
1375
+ export type TaskStatusUpdateRequest = {
1376
+ /**
1377
+ * The name, 2 to 200 characters once the surrounding whitespace is removed.
1378
+ */
1379
+ name?: string;
1380
+ /**
1381
+ * Six hexadecimal digits without "#", read back lowercase; `null` removes the colour.
1382
+ */
1383
+ color?: string | null;
1384
+ };
1385
+ export type DictionaryTaskStatus = {
1386
+ id: PublicId;
1387
+ name: string;
1388
+ /**
1389
+ * Six hexadecimal digits without `#`, `null` when the status has no colour.
1390
+ */
1391
+ color: string | null;
1392
+ /**
1393
+ * `false` on a retired status, and on every status when task statuses are switched off for the account.
1394
+ */
1395
+ selectable: boolean;
1396
+ };
1397
+ export type DictionaryTaskStatusListEnvelope = {
1398
+ meta: EnvelopeMeta;
1399
+ data: DictionaryTaskStatus[];
1400
+ extra: DictionaryListExtra;
1401
+ };
1402
+ export type DictionaryTaskStatusEnvelope = {
1403
+ meta: EnvelopeMeta;
1404
+ data: DictionaryTaskStatus;
1405
+ extra: EmptyExtra;
1406
+ };
1407
+ export type DictionaryPersonGroup = {
1408
+ id: PublicId;
1409
+ name: string;
1410
+ /**
1411
+ * Always `true`: every group either operation returns can be assigned on a person write.
1412
+ */
1413
+ selectable: boolean;
1414
+ };
1415
+ export type DictionaryPersonGroupListEnvelope = {
1416
+ meta: EnvelopeMeta;
1417
+ data: DictionaryPersonGroup[];
1418
+ extra: DictionaryListExtra;
1419
+ };
1420
+ export type DictionaryPersonGroupEnvelope = {
1421
+ meta: EnvelopeMeta;
1422
+ data: DictionaryPersonGroup;
1423
+ extra: EmptyExtra;
1424
+ };
1425
+ export type DictionaryDealGroup = {
1426
+ id: PublicId;
1427
+ name: string;
1428
+ /**
1429
+ * Always `true`: every group either operation returns can be assigned on a deal write.
1430
+ */
1431
+ selectable: boolean;
1432
+ };
1433
+ export type DictionaryDealGroupListEnvelope = {
1434
+ meta: EnvelopeMeta;
1435
+ data: DictionaryDealGroup[];
1436
+ extra: DictionaryListExtra;
1437
+ };
1438
+ export type DictionaryDealGroupEnvelope = {
1439
+ meta: EnvelopeMeta;
1440
+ data: DictionaryDealGroup;
1441
+ extra: EmptyExtra;
1442
+ };
1443
+ export type CreatePersonRequest = {
1444
+ /**
1445
+ * Plain text.
1446
+ */
1447
+ firstName: string;
1448
+ /**
1449
+ * Plain text.
1450
+ */
1451
+ lastName: string;
1452
+ company?: null | {
1453
+ id: PublicId;
1454
+ };
1455
+ source?: null | {
1456
+ id: PublicId;
1457
+ };
1458
+ position?: null | {
1459
+ id: PublicId;
1460
+ };
1461
+ /**
1462
+ * Left out or `null`, the account's owner default for people applies: nobody, the caller, a named user or a team. A sent owner is used as given and needs a main team.
1463
+ */
1464
+ owner?: null | {
1465
+ id: PublicId;
1466
+ };
1467
+ /**
1468
+ * How the record is shared; the values offered depend on the account's visibility settings and package. Left out on create, the account default applies; on update the current value always passes.
1469
+ */
1470
+ visibility?: "public" | "notPublic" | "hidden";
1471
+ /**
1472
+ * Formatted text. Other HTML is removed, a mention of a user is removed, and the maximum length counts the value as sent.
1473
+ */
1474
+ description?: string | null;
1475
+ groups?: {
1476
+ id: PublicId;
1477
+ }[];
1478
+ /**
1479
+ * A tag that does not exist yet needs the user's permission to add tags. Existing tags, listed by `GET /dictionaries/tags`, need none.
1480
+ */
1481
+ tags?: string[];
1482
+ communication?: {
1483
+ phoneMobile?: string[];
1484
+ phoneLandline?: string[];
1485
+ fax?: string[];
1486
+ email?: string[];
1487
+ facebook?: string[];
1488
+ linkedin?: string[];
1489
+ goldenline?: string[];
1490
+ instagram?: string[];
1491
+ website?: string[];
1492
+ };
1493
+ addresses?: {
1494
+ /**
1495
+ * Plain text.
1496
+ */
1497
+ name?: string | null;
1498
+ streetLines?: string[];
1499
+ /**
1500
+ * Plain text.
1501
+ */
1502
+ region?: string | null;
1503
+ /**
1504
+ * Plain text.
1505
+ */
1506
+ city?: string | null;
1507
+ /**
1508
+ * Plain text.
1509
+ */
1510
+ postcode?: string | null;
1511
+ /**
1512
+ * Plain text.
1513
+ */
1514
+ country?: string | null;
1515
+ /**
1516
+ * At most one address in the list may carry true. A second true answers 422 on addresses/{index}/isMain.
1517
+ */
1518
+ isMain?: boolean;
1519
+ additionalFields?: AddressAdditionalFieldWriteList;
1520
+ }[];
1521
+ additionalFields?: AdditionalFieldWriteList;
1522
+ };
1523
+ /**
1524
+ * The body that creates a person together with a new company, sent to `POST /people` with `Content-Type: application/vnd.ls-api.person-with-company.v2+json`. `company` takes the fields of `CreateCompanyRequest`, and the person is linked to the company it creates.
1525
+ */
1526
+ export type CreatePersonWithCompanyRequest = {
1527
+ /**
1528
+ * Plain text.
1529
+ */
1530
+ firstName: string;
1531
+ /**
1532
+ * Plain text.
1533
+ */
1534
+ lastName: string;
1535
+ company: CreateCompanyRequest;
1536
+ source?: null | {
1537
+ id: PublicId;
1538
+ };
1539
+ position?: null | {
1540
+ id: PublicId;
1541
+ };
1542
+ /**
1543
+ * Left out or `null`, the account's owner default for people applies: nobody, the caller, a named user or a team. A sent owner is used as given and needs a main team.
1544
+ */
1545
+ owner?: null | {
1546
+ id: PublicId;
1547
+ };
1548
+ /**
1549
+ * How the record is shared; the values offered depend on the account's visibility settings and package. Left out on create, the account default applies; on update the current value always passes.
1550
+ */
1551
+ visibility?: "public" | "notPublic" | "hidden";
1552
+ /**
1553
+ * Formatted text. Other HTML is removed, a mention of a user is removed, and the maximum length counts the value as sent.
1554
+ */
1555
+ description?: string | null;
1556
+ groups?: {
1557
+ id: PublicId;
1558
+ }[];
1559
+ /**
1560
+ * A tag that does not exist yet needs the user's permission to add tags. Existing tags, listed by `GET /dictionaries/tags`, need none.
1561
+ */
1562
+ tags?: string[];
1563
+ communication?: {
1564
+ phoneMobile?: string[];
1565
+ phoneLandline?: string[];
1566
+ fax?: string[];
1567
+ email?: string[];
1568
+ facebook?: string[];
1569
+ linkedin?: string[];
1570
+ goldenline?: string[];
1571
+ instagram?: string[];
1572
+ website?: string[];
1573
+ };
1574
+ addresses?: {
1575
+ /**
1576
+ * Plain text.
1577
+ */
1578
+ name?: string | null;
1579
+ streetLines?: string[];
1580
+ /**
1581
+ * Plain text.
1582
+ */
1583
+ region?: string | null;
1584
+ /**
1585
+ * Plain text.
1586
+ */
1587
+ city?: string | null;
1588
+ /**
1589
+ * Plain text.
1590
+ */
1591
+ postcode?: string | null;
1592
+ /**
1593
+ * Plain text.
1594
+ */
1595
+ country?: string | null;
1596
+ /**
1597
+ * At most one address in the list may carry true. A second true answers 422 on addresses/{index}/isMain.
1598
+ */
1599
+ isMain?: boolean;
1600
+ additionalFields?: AddressAdditionalFieldWriteList;
1601
+ }[];
1602
+ additionalFields?: AdditionalFieldWriteList;
1603
+ };
1604
+ export type CreateCompanyRequest = {
1605
+ /**
1606
+ * Plain text.
1607
+ */
1608
+ name: string;
1609
+ /**
1610
+ * Trimmed, with separators kept: letters, digits, space, `.`, `/` and `-`; a value that starts with `PL` must pass the Polish NIP checksum once spaces and dashes are removed, and `null` clears the field. On create, a tax id that an active company already holds is refused with `409` unless the account allows companies with the same tax id, comparing without case, without any character that is not a letter or a digit, and without a `PL` before the digits.
1611
+ */
1612
+ taxId?: string | null;
1613
+ /**
1614
+ * 9 or 14 digits with a valid checksum, saved without spaces and dashes, and `null` clears the field. On create, a REGON that an active company already holds is refused with `409`, ignoring spaces and dashes.
1615
+ */
1616
+ regon?: string | null;
1617
+ /**
1618
+ * Formatted text. Other HTML is removed, a mention of a user is removed, and the maximum length counts the value as sent.
1619
+ */
1620
+ description?: string | null;
1621
+ /**
1622
+ * How the record is shared; the values offered depend on the account's visibility settings and package. Left out on create, the account default applies; on update the current value always passes.
1623
+ */
1624
+ visibility?: "public" | "notPublic" | "hidden";
1625
+ source?: null | {
1626
+ id: PublicId;
1627
+ };
1628
+ /**
1629
+ * Left out or `null`, the account's owner default for companies applies: nobody, the caller, a named user or a team. A sent owner is used as given and needs a main team.
1630
+ */
1631
+ owner?: null | {
1632
+ id: PublicId;
1633
+ };
1634
+ groups?: {
1635
+ id: PublicId;
1636
+ }[];
1637
+ /**
1638
+ * A tag that does not exist yet needs the user's permission to add tags. Existing tags, listed by `GET /dictionaries/tags`, need none.
1639
+ */
1640
+ tags?: string[];
1641
+ communication?: {
1642
+ phoneMobile?: string[];
1643
+ phoneLandline?: string[];
1644
+ fax?: string[];
1645
+ email?: string[];
1646
+ facebook?: string[];
1647
+ linkedin?: string[];
1648
+ goldenline?: string[];
1649
+ instagram?: string[];
1650
+ website?: string[];
1651
+ };
1652
+ addresses?: {
1653
+ /**
1654
+ * Plain text.
1655
+ */
1656
+ name?: string | null;
1657
+ streetLines?: string[];
1658
+ /**
1659
+ * Plain text.
1660
+ */
1661
+ region?: string | null;
1662
+ /**
1663
+ * Plain text.
1664
+ */
1665
+ city?: string | null;
1666
+ /**
1667
+ * Plain text.
1668
+ */
1669
+ postcode?: string | null;
1670
+ /**
1671
+ * Plain text.
1672
+ */
1673
+ country?: string | null;
1674
+ /**
1675
+ * At most one address in the list may carry true. A second true answers 422 on addresses/{index}/isMain.
1676
+ */
1677
+ isMain?: boolean;
1678
+ additionalFields?: AddressAdditionalFieldWriteList;
1679
+ }[];
1680
+ additionalFields?: AdditionalFieldWriteList;
1681
+ };
1682
+ export type UpdatePersonRequest = {
1683
+ /**
1684
+ * Plain text.
1685
+ */
1686
+ firstName?: string;
1687
+ /**
1688
+ * Plain text.
1689
+ */
1690
+ lastName?: string;
1691
+ company?: null | {
1692
+ id: PublicId;
1693
+ };
1694
+ source?: null | {
1695
+ id: PublicId;
1696
+ };
1697
+ position?: null | {
1698
+ id: PublicId;
1699
+ };
1700
+ /**
1701
+ * Left out, the owner stays. `null` clears it, unless the account requires an owner for people.
1702
+ */
1703
+ owner?: null | {
1704
+ id: PublicId;
1705
+ };
1706
+ /**
1707
+ * How the record is shared; the values offered depend on the account's visibility settings and package. Left out on create, the account default applies; on update the current value always passes.
1708
+ */
1709
+ visibility?: "public" | "notPublic" | "hidden";
1710
+ /**
1711
+ * Formatted text. Other HTML is removed, a mention of a user is removed, and the maximum length counts the value as sent.
1712
+ */
1713
+ description?: string | null;
1714
+ groups?: {
1715
+ id: PublicId;
1716
+ }[];
1717
+ /**
1718
+ * A tag that does not exist yet needs the user's permission to add tags. Existing tags, listed by `GET /dictionaries/tags`, need none.
1719
+ */
1720
+ tags?: string[];
1721
+ communication?: {
1722
+ phoneMobile?: string[];
1723
+ phoneLandline?: string[];
1724
+ fax?: string[];
1725
+ email?: string[];
1726
+ facebook?: string[];
1727
+ linkedin?: string[];
1728
+ goldenline?: string[];
1729
+ instagram?: string[];
1730
+ website?: string[];
1731
+ };
1732
+ /**
1733
+ * Replaces every address together with its custom-field values, so resend the values to keep them. A read-only field, or one the caller cannot see or edit, keeps its value at the same position.
1734
+ */
1735
+ addresses?: {
1736
+ /**
1737
+ * Plain text.
1738
+ */
1739
+ name?: string | null;
1740
+ streetLines?: string[];
1741
+ /**
1742
+ * Plain text.
1743
+ */
1744
+ region?: string | null;
1745
+ /**
1746
+ * Plain text.
1747
+ */
1748
+ city?: string | null;
1749
+ /**
1750
+ * Plain text.
1751
+ */
1752
+ postcode?: string | null;
1753
+ /**
1754
+ * Plain text.
1755
+ */
1756
+ country?: string | null;
1757
+ /**
1758
+ * At most one address in the list may carry true. A second true answers 422 on addresses/{index}/isMain.
1759
+ */
1760
+ isMain?: boolean;
1761
+ additionalFields?: AddressAdditionalFieldWriteList;
1762
+ }[];
1763
+ additionalFields?: AdditionalFieldWriteList;
1764
+ };
1765
+ export type UpdateCompanyRequest = {
1766
+ /**
1767
+ * Plain text.
1768
+ */
1769
+ name?: string;
1770
+ /**
1771
+ * Trimmed, with separators kept: letters, digits, space, `.`, `/` and `-`; a value that starts with `PL` must pass the Polish NIP checksum once spaces and dashes are removed, and `null` clears the field. A changed tax id that another active company already holds is refused with `409` unless the account allows companies with the same tax id, comparing without case, without any character that is not a letter or a digit, and without a `PL` before the digits.
1772
+ */
1773
+ taxId?: string | null;
1774
+ /**
1775
+ * 9 or 14 digits with a valid checksum, saved without spaces and dashes, and `null` clears the field. A changed REGON that another active company already holds is refused with `409`, ignoring spaces and dashes.
1776
+ */
1777
+ regon?: string | null;
1778
+ /**
1779
+ * Formatted text. Other HTML is removed, a mention of a user is removed, and the maximum length counts the value as sent.
1780
+ */
1781
+ description?: string | null;
1782
+ /**
1783
+ * How the record is shared; the values offered depend on the account's visibility settings and package. Left out on create, the account default applies; on update the current value always passes.
1784
+ */
1785
+ visibility?: "public" | "notPublic" | "hidden";
1786
+ source?: null | {
1787
+ id: PublicId;
1788
+ };
1789
+ /**
1790
+ * Left out, the owner stays. `null` clears it, unless the account requires an owner for companies.
1791
+ */
1792
+ owner?: null | {
1793
+ id: PublicId;
1794
+ };
1795
+ groups?: {
1796
+ id: PublicId;
1797
+ }[];
1798
+ /**
1799
+ * A tag that does not exist yet needs the user's permission to add tags. Existing tags, listed by `GET /dictionaries/tags`, need none.
1800
+ */
1801
+ tags?: string[];
1802
+ communication?: {
1803
+ phoneMobile?: string[];
1804
+ phoneLandline?: string[];
1805
+ fax?: string[];
1806
+ email?: string[];
1807
+ facebook?: string[];
1808
+ linkedin?: string[];
1809
+ goldenline?: string[];
1810
+ instagram?: string[];
1811
+ website?: string[];
1812
+ };
1813
+ /**
1814
+ * Replaces every address together with its custom-field values, so resend the values to keep them. A read-only field, or one the caller cannot see or edit, keeps its value at the same position.
1815
+ */
1816
+ addresses?: {
1817
+ /**
1818
+ * Plain text.
1819
+ */
1820
+ name?: string | null;
1821
+ streetLines?: string[];
1822
+ /**
1823
+ * Plain text.
1824
+ */
1825
+ region?: string | null;
1826
+ /**
1827
+ * Plain text.
1828
+ */
1829
+ city?: string | null;
1830
+ /**
1831
+ * Plain text.
1832
+ */
1833
+ postcode?: string | null;
1834
+ /**
1835
+ * Plain text.
1836
+ */
1837
+ country?: string | null;
1838
+ /**
1839
+ * At most one address in the list may carry true. A second true answers 422 on addresses/{index}/isMain.
1840
+ */
1841
+ isMain?: boolean;
1842
+ additionalFields?: AddressAdditionalFieldWriteList;
1843
+ }[];
1844
+ additionalFields?: AdditionalFieldWriteList;
1845
+ };
1846
+ /**
1847
+ * The create body. A new deal is `open` on the first active stage of `process`, with the account defaults for owner, visibility and currency; `status`, the reasons, `currentStage`, `relations`, `owners`, `number` and `budget.cost` cannot be sent.
1848
+ */
1849
+ export type CreateDealRequest = {
1850
+ /**
1851
+ * Plain text. A value with no text left is refused with 400.
1852
+ */
1853
+ name: string;
1854
+ process: {
1855
+ id: PublicId;
1856
+ };
1857
+ /**
1858
+ * Formatted text of at most 10000 characters as sent. A mention of a user is removed, and so is other HTML.
1859
+ */
1860
+ description?: string | null;
1861
+ company?: null | {
1862
+ id: PublicId;
1863
+ };
1864
+ person?: null | {
1865
+ id: PublicId;
1866
+ };
1867
+ /**
1868
+ * Left out or `null`, the account's owner default for deals applies: nobody, the caller, a named user or a team. A sent owner is used as given and needs a main team.
1869
+ */
1870
+ owner?: null | {
1871
+ id: PublicId;
1872
+ };
1873
+ source?: null | {
1874
+ id: PublicId;
1875
+ };
1876
+ /**
1877
+ * The deal value in the deal's currency; its figure in the default currency is derived at today's exchange rate.
1878
+ */
1879
+ budget?: {
1880
+ value?: number;
1881
+ /**
1882
+ * ISO 4217 code of an active currency of the account.
1883
+ */
1884
+ currency?: string;
1885
+ };
1886
+ /**
1887
+ * A day, `YYYY-MM-DD`, or an RFC 3339 date-time reduced to its day in the caller's time zone; `null` sets no date. Left out, the date is today plus the default length of the process, if it has one.
1888
+ */
1889
+ expectedCloseDate?: null | string;
1890
+ /**
1891
+ * How the record is shared; the values offered depend on the account's visibility settings and package. Left out on create, the account default applies; on update the current value always passes.
1892
+ */
1893
+ visibility?: "public" | "notPublic" | "hidden";
1894
+ groups?: {
1895
+ id: PublicId;
1896
+ }[];
1897
+ /**
1898
+ * A tag that does not exist yet needs the user's permission to add tags. Existing tags, listed by `GET /dictionaries/tags`, need none.
1899
+ */
1900
+ tags?: string[];
1901
+ additionalFields?: AdditionalFieldWriteList;
1902
+ };
1903
+ /**
1904
+ * The body of the deal copy, sent to `POST /deals` with `Content-Type: application/vnd.ls-api.deal-copy.v2+json`. The open copy is named `<process name> - <deal name>` and takes over the owners, company, person, description, visibility, source, currency, custom fields and relations, but no product or cost lines, no stage and no expected close date.
1905
+ */
1906
+ export type CopyDealRequest = {
1907
+ /**
1908
+ * The deal to copy; the caller must be able to read it.
1909
+ */
1910
+ source: {
1911
+ id: PublicId;
1912
+ };
1913
+ /**
1914
+ * The selectable sales process the copy lands in.
1915
+ */
1916
+ process: {
1917
+ id: PublicId;
1918
+ };
1919
+ };
1920
+ /**
1921
+ * A partial body: a key left out stays, `null` clears a nullable field, and `groups` and `tags` replace the whole set. `process` must stay the current one; the stage moves through `PATCH /deals/{id}/process` and the status through `ChangeDealStatusRequest`.
1922
+ */
1923
+ export type UpdateDealRequest = {
1924
+ /**
1925
+ * Plain text. A value with no text left is refused with 400.
1926
+ */
1927
+ name?: string;
1928
+ /**
1929
+ * Must name the current process of the deal, which stays accepted after an administrator switched it off.
1930
+ */
1931
+ process?: {
1932
+ id: PublicId;
1933
+ };
1934
+ /**
1935
+ * Formatted text of at most 10000 characters as sent. A mention of a user is removed, and so is other HTML.
1936
+ */
1937
+ description?: string | null;
1938
+ /**
1939
+ * A body that leaves the deal with neither a company nor a person is refused on `/company`.
1940
+ */
1941
+ company?: null | {
1942
+ id: PublicId;
1943
+ };
1944
+ /**
1945
+ * A body that leaves the deal with neither a company nor a person is refused on `/company`.
1946
+ */
1947
+ person?: null | {
1948
+ id: PublicId;
1949
+ };
1950
+ /**
1951
+ * Left out, the owner stays; a sent user replaces the previous owner user, and other holders of the owner role stay. `null` clears every holder, unless the account requires an owner for deals.
1952
+ */
1953
+ owner?: null | {
1954
+ id: PublicId;
1955
+ };
1956
+ source?: null | {
1957
+ id: PublicId;
1958
+ };
1959
+ /**
1960
+ * The deal value in the deal's currency; its figure in the default currency is derived at today's exchange rate. A deal with product or cost lines takes its value from them and refuses this field.
1961
+ */
1962
+ budget?: {
1963
+ value?: number;
1964
+ /**
1965
+ * ISO 4217 code of an active currency of the account.
1966
+ */
1967
+ currency?: string;
1968
+ };
1969
+ /**
1970
+ * A day, `YYYY-MM-DD`, or an RFC 3339 date-time reduced to its day in the caller's time zone. `null` clears the date unless the account requires one, and leaving the key out keeps it.
1971
+ */
1972
+ expectedCloseDate?: null | string;
1973
+ /**
1974
+ * How the record is shared; the values offered depend on the account's visibility settings and package. Left out on create, the account default applies; on update the current value always passes.
1975
+ */
1976
+ visibility?: "public" | "notPublic" | "hidden";
1977
+ groups?: {
1978
+ id: PublicId;
1979
+ }[];
1980
+ /**
1981
+ * A tag that does not exist yet needs the user's permission to add tags. Existing tags, listed by `GET /dictionaries/tags`, need none.
1982
+ */
1983
+ tags?: string[];
1984
+ additionalFields?: AdditionalFieldWriteList;
1985
+ };
1986
+ /**
1987
+ * The body of the status change, sent to `PATCH /deals/{id}` with `Content-Type: application/vnd.ls-api.deal-status.v2+json`. `status` is required, a reason fits only its own status, and a move to `open` clears the reasons.
1988
+ */
1989
+ export type ChangeDealStatusRequest = {
1990
+ /**
1991
+ * Re-sending the current status changes nothing. A user needs the right to set the deal status; a service key does not.
1992
+ */
1993
+ status: "open" | "won" | "lost" | "outdated";
1994
+ wonReason?: null | {
1995
+ id: PublicId;
1996
+ /**
1997
+ * Plain text.
1998
+ */
1999
+ note?: string | null;
2000
+ };
2001
+ lostReason?: null | {
2002
+ id: PublicId;
2003
+ /**
2004
+ * Plain text.
2005
+ */
2006
+ note?: string | null;
2007
+ };
2008
+ outdatedReason?: null | {
2009
+ id: PublicId;
2010
+ /**
2011
+ * Plain text.
2012
+ */
2013
+ note?: string | null;
2014
+ };
2015
+ };
2016
+ /**
2017
+ * A partial body: `steps` updates each listed step and leaves the others as they are. Nothing else of the process can be written.
2018
+ */
2019
+ export type UpdateDealProcessRequest = {
2020
+ /**
2021
+ * The steps to change, limited to 100 items per request. A step id is unique within the process and listed once.
2022
+ */
2023
+ steps?: {
2024
+ id: PublicId;
2025
+ /**
2026
+ * `true` completes the step. `false` reopens a completed step; on a step that is not completed it changes nothing.
2027
+ */
2028
+ completed: boolean;
2029
+ }[];
2030
+ };
2031
+ /**
2032
+ * The minimal person: identity, company, visibility and the record URL. Limited access never adds a field to it.
2033
+ */
2034
+ export type PersonMinimal = {
2035
+ id: PublicId;
2036
+ firstName: string;
2037
+ lastName: string;
2038
+ company: NamedReference | null;
2039
+ visibility: RecordVisibility;
2040
+ url: string;
2041
+ };
2042
+ /**
2043
+ * The minimal company: identity, visibility and the record URL.
2044
+ */
2045
+ export type CompanyMinimal = {
2046
+ id: PublicId;
2047
+ name: string;
2048
+ visibility: RecordVisibility;
2049
+ url: string;
2050
+ };
2051
+ /**
2052
+ * The minimal deal: identity, status, process, current stage, audit stamps, owner, visibility and the record URL. At limited access `status` and the audit stamps are `null`, while `owner`, `process` and `currentStage` stay.
2053
+ */
2054
+ export type DealMinimal = {
2055
+ id: string;
2056
+ name: string;
2057
+ /**
2058
+ * `null` when the caller has limited access to the deal.
2059
+ */
2060
+ status: "open" | "won" | "lost" | "outdated" | null;
2061
+ process: NamedReference | null;
2062
+ /**
2063
+ * The main stage the deal is on. A deal that has reached no stage yet reports the first active stage of its process. null only when the deal has no process or its process has no active stage.
2064
+ */
2065
+ currentStage: NamedReference | null;
2066
+ /**
2067
+ * A UTC instant. `null` at limited access.
2068
+ */
2069
+ createdAt: string | null;
2070
+ createdBy: NamedReference | null;
2071
+ /**
2072
+ * A UTC instant. `null` at limited access.
2073
+ */
2074
+ updatedAt: string | null;
2075
+ updatedBy: NamedReference | null;
2076
+ owner: NamedReference | null;
2077
+ visibility: RecordVisibility;
2078
+ url: string;
2079
+ };
2080
+ export type PersonMinimalEnvelope = {
2081
+ meta: EnvelopeMeta;
2082
+ data: PersonMinimal;
2083
+ extra: RecordPermissionsExtra;
2084
+ };
2085
+ export type CompanyMinimalEnvelope = {
2086
+ meta: EnvelopeMeta;
2087
+ data: CompanyMinimal;
2088
+ extra: RecordPermissionsExtra;
2089
+ };
2090
+ export type DealMinimalEnvelope = {
2091
+ meta: EnvelopeMeta;
2092
+ data: DealMinimal;
2093
+ extra: RecordPermissionsExtra;
2094
+ };
2095
+ /**
2096
+ * The parent deal's access level. It carries no additional-field map: the subresource carries no additional fields.
2097
+ */
2098
+ export type DealSubresourceExtra = {
2099
+ permissions: {
2100
+ accessLevel: "full" | "basic";
2101
+ };
2102
+ };
2103
+ /**
2104
+ * Paging echo for a deal's product or cost lines and the parent deal's access level. A JSON object, never `[]`.
2105
+ */
2106
+ export type DealLineListExtra = {
2107
+ page: number;
2108
+ perPage: number;
2109
+ /**
2110
+ * Exact number of lines this list returns across all pages; 0 under limited access to the deal.
2111
+ */
2112
+ totalCount: number;
2113
+ permissions: {
2114
+ accessLevel: "full" | "basic";
2115
+ };
2116
+ };
2117
+ /**
2118
+ * One active revenue line of the deal. Every line of a recurring cycle is its own line.
2119
+ */
2120
+ export type DealProductLine = {
2121
+ id: PublicId;
2122
+ /**
2123
+ * The catalog product, or `null` when the line names none.
2124
+ */
2125
+ product: NamedReference | null;
2126
+ /**
2127
+ * Number of units; `null` when the line records none.
2128
+ */
2129
+ quantity: number | null;
2130
+ /**
2131
+ * Price of one unit; `null` when the line records none.
2132
+ */
2133
+ unitPrice: number | null;
2134
+ /**
2135
+ * The line value after discount.
2136
+ */
2137
+ totalValue: number;
2138
+ /**
2139
+ * ISO 4217 code of the line's currency, or the default currency of the account when the line names none.
2140
+ */
2141
+ currency: string;
2142
+ /**
2143
+ * Quantity times unit price, before discount.
2144
+ */
2145
+ value: number;
2146
+ /**
2147
+ * The line discount, or `null` when the line has none.
2148
+ */
2149
+ discount: DealLineDiscount | null;
2150
+ /**
2151
+ * The margin percent, or `null` when the line has none.
2152
+ */
2153
+ marginPercent: number | null;
2154
+ /**
2155
+ * The margin computed on the value after discount.
2156
+ */
2157
+ marginValue: number;
2158
+ /**
2159
+ * `true` for a forecast line, `false` for an executed one.
2160
+ */
2161
+ isForecast: boolean;
2162
+ /**
2163
+ * The line day in the caller's time zone, or `null`.
2164
+ */
2165
+ date: string | null;
2166
+ /**
2167
+ * Free text of the line, as plain text.
2168
+ */
2169
+ description: string | null;
2170
+ /**
2171
+ * UTC instant the line was created.
2172
+ */
2173
+ createdAt: string;
2174
+ /**
2175
+ * UTC instant the line was last changed.
2176
+ */
2177
+ updatedAt: string;
2178
+ /**
2179
+ * The line's place in a recurring cycle, or `null` when the line is in no cycle.
2180
+ */
2181
+ cycle: DealProductLineCycle | null;
2182
+ };
2183
+ /**
2184
+ * A new product line. Unknown keys are `400`.
2185
+ */
2186
+ export type DealProductLineCreate = {
2187
+ /**
2188
+ * An active product of the product catalog. An unknown id, a cost or a deleted product is `422` on `/product/id`.
2189
+ */
2190
+ product: {
2191
+ id: PublicId;
2192
+ };
2193
+ /**
2194
+ * Number of units, `1` when left out on create. `0` is refused (remove a line with `DELETE`), and so is a different quantity on the main line of a recurring cycle.
2195
+ */
2196
+ quantity?: number;
2197
+ /**
2198
+ * Price of one unit, the product's default price when left out on create. A product with `priceLocked` accepts only its default price.
2199
+ */
2200
+ unitPrice?: number;
2201
+ /**
2202
+ * ISO 4217 code. A line takes the currency of its deal: an unknown code or a code other than the deal's is `422` on `/currency`.
2203
+ */
2204
+ currency?: string;
2205
+ /**
2206
+ * The line discount; `null` clears it.
2207
+ */
2208
+ discount?: DealLineDiscount | null;
2209
+ /**
2210
+ * The margin percent; `null` or `0` clears it.
2211
+ */
2212
+ marginPercent?: number | null;
2213
+ /**
2214
+ * `true` (the default on create) for a forecast line, `false` for an executed one.
2215
+ */
2216
+ isForecast?: boolean;
2217
+ /**
2218
+ * The line day (`YYYY-MM-DD`) in the caller's time zone; `null` clears it.
2219
+ */
2220
+ date?: string | null;
2221
+ /**
2222
+ * Free text of the line, as plain text. `null` clears it.
2223
+ */
2224
+ description?: string | null;
2225
+ };
2226
+ /**
2227
+ * Several product lines, added together in body order or not at all.
2228
+ */
2229
+ export type DealProductLinesBatchRequest = {
2230
+ lines: DealProductLineCreate[];
2231
+ };
2232
+ /**
2233
+ * A partial change of a product line: only the keys present are written, and an empty body writes nothing. `product` and `currency` cannot change and are unknown keys (`400`).
2234
+ */
2235
+ export type DealProductLineUpdate = {
2236
+ /**
2237
+ * Number of units. `0` is refused (remove a line with `DELETE`), and so is a different quantity on the main line of a recurring cycle.
2238
+ */
2239
+ quantity?: number;
2240
+ /**
2241
+ * Price of one unit. A product with `priceLocked` accepts only its default price.
2242
+ */
2243
+ unitPrice?: number;
2244
+ /**
2245
+ * The line discount; `null` clears it.
2246
+ */
2247
+ discount?: DealLineDiscount | null;
2248
+ /**
2249
+ * The margin percent; `null` or `0` clears it.
2250
+ */
2251
+ marginPercent?: number | null;
2252
+ /**
2253
+ * `true` (the default on create) for a forecast line, `false` for an executed one.
2254
+ */
2255
+ isForecast?: boolean;
2256
+ /**
2257
+ * The line day (`YYYY-MM-DD`) in the caller's time zone; `null` clears it.
2258
+ */
2259
+ date?: string | null;
2260
+ /**
2261
+ * Free text of the line, as plain text. `null` clears it.
2262
+ */
2263
+ description?: string | null;
2264
+ };
2265
+ /**
2266
+ * A line discount: `percent` takes an `amount` from 0 to 100, and `value` an absolute `amount` up to the line value. A zero `amount` means no discount.
2267
+ */
2268
+ export type DealLineDiscount = {
2269
+ type: "percent" | "value";
2270
+ amount: number;
2271
+ };
2272
+ /**
2273
+ * A line of a recurring cycle. The `main` line is addressable on its own id but keeps its `quantity` and is not removed (`422`), while a `later` line, one the cycle repeats, is listed only and answers `404` on its own id.
2274
+ */
2275
+ export type DealProductLineCycle = {
2276
+ role: "main" | "later";
2277
+ /**
2278
+ * The id of the cycle's main line, the line's own id on the main line, or `null` when the main line is no longer active.
2279
+ */
2280
+ mainLineId: PublicId | null;
2281
+ };
2282
+ export type DealProductLineEnvelope = {
2283
+ meta: EnvelopeMeta;
2284
+ data: DealProductLine;
2285
+ extra: DealSubresourceExtra;
2286
+ };
2287
+ export type DealProductLinesBatchEnvelope = {
2288
+ meta: EnvelopeMeta;
2289
+ /**
2290
+ * The created lines in body order.
2291
+ */
2292
+ data: DealProductLine[];
2293
+ extra: DealSubresourceExtra;
2294
+ };
2295
+ export type DealProductLineListEnvelope = {
2296
+ meta: EnvelopeMeta;
2297
+ data: DealProductLine[];
2298
+ extra: DealLineListExtra;
2299
+ };
2300
+ /**
2301
+ * One active cost line of the deal. Every line of a recurring cycle is its own line.
2302
+ */
2303
+ export type DealCostLine = {
2304
+ id: PublicId;
2305
+ /**
2306
+ * The catalog cost, or `null` when the line names none or names an entry that is not a cost.
2307
+ */
2308
+ cost: NamedReference | null;
2309
+ /**
2310
+ * Number of units; `null` when the line records none.
2311
+ */
2312
+ quantity: number | null;
2313
+ /**
2314
+ * Price of one unit; `null` when the line records none.
2315
+ */
2316
+ unitPrice: number | null;
2317
+ /**
2318
+ * The line value after discount.
2319
+ */
2320
+ totalValue: number;
2321
+ /**
2322
+ * ISO 4217 code of the line's currency, or the default currency of the account when the line names none.
2323
+ */
2324
+ currency: string;
2325
+ /**
2326
+ * Quantity times unit price, before discount.
2327
+ */
2328
+ value: number;
2329
+ /**
2330
+ * The line discount, or `null` when the line has none.
2331
+ */
2332
+ discount: DealLineDiscount | null;
2333
+ /**
2334
+ * `true` for a forecast line, `false` for an executed one.
2335
+ */
2336
+ isForecast: boolean;
2337
+ /**
2338
+ * The line day in the caller's time zone, or `null`.
2339
+ */
2340
+ date: string | null;
2341
+ /**
2342
+ * Free text of the line, as plain text.
2343
+ */
2344
+ description: string | null;
2345
+ /**
2346
+ * UTC instant the line was created.
2347
+ */
2348
+ createdAt: string;
2349
+ /**
2350
+ * UTC instant the line was last changed.
2351
+ */
2352
+ updatedAt: string;
2353
+ };
2354
+ /**
2355
+ * A new cost line. Unknown keys, `marginPercent` among them, are `400`.
2356
+ */
2357
+ export type DealCostLineCreate = {
2358
+ /**
2359
+ * An active cost of the cost catalog. An unknown id, a product or a deleted cost is `422` on `/cost/id`.
2360
+ */
2361
+ cost: {
2362
+ id: PublicId;
2363
+ };
2364
+ /**
2365
+ * Number of units, `1` when left out on create. `0` is refused (remove a line with `DELETE`), and so is a different quantity on the main line of a recurring cycle.
2366
+ */
2367
+ quantity?: number;
2368
+ /**
2369
+ * Price of one unit, required because a cost has no catalog price. `priceLocked` does not apply to a cost.
2370
+ */
2371
+ unitPrice?: number;
2372
+ /**
2373
+ * ISO 4217 code. A line takes the currency of its deal: an unknown code or a code other than the deal's is `422` on `/currency`.
2374
+ */
2375
+ currency?: string;
2376
+ /**
2377
+ * The line discount; `null` clears it.
2378
+ */
2379
+ discount?: DealLineDiscount | null;
2380
+ /**
2381
+ * `true` (the default on create) for a forecast line, `false` for an executed one.
2382
+ */
2383
+ isForecast?: boolean;
2384
+ /**
2385
+ * The line day (`YYYY-MM-DD`) in the caller's time zone; `null` clears it.
2386
+ */
2387
+ date?: string | null;
2388
+ /**
2389
+ * Free text of the line, as plain text. `null` clears it.
2390
+ */
2391
+ description?: string | null;
2392
+ };
2393
+ /**
2394
+ * Several cost lines, added together in body order or not at all.
2395
+ */
2396
+ export type DealCostLinesBatchRequest = {
2397
+ lines: DealCostLineCreate[];
2398
+ };
2399
+ /**
2400
+ * A partial change of a cost line: only the keys present are written, and an empty body writes nothing. `cost`, `currency` and `marginPercent` are unknown keys (`400`).
2401
+ */
2402
+ export type DealCostLineUpdate = {
2403
+ /**
2404
+ * Number of units. `0` is refused (remove a line with `DELETE`), and so is a different quantity on the main line of a recurring cycle.
2405
+ */
2406
+ quantity?: number;
2407
+ /**
2408
+ * Price of one unit. `priceLocked` does not apply to a cost.
2409
+ */
2410
+ unitPrice?: number;
2411
+ /**
2412
+ * The line discount; `null` clears it.
2413
+ */
2414
+ discount?: DealLineDiscount | null;
2415
+ /**
2416
+ * `true` (the default on create) for a forecast line, `false` for an executed one.
2417
+ */
2418
+ isForecast?: boolean;
2419
+ /**
2420
+ * The line day (`YYYY-MM-DD`) in the caller's time zone; `null` clears it.
2421
+ */
2422
+ date?: string | null;
2423
+ /**
2424
+ * Free text of the line, as plain text. `null` clears it.
2425
+ */
2426
+ description?: string | null;
2427
+ };
2428
+ export type DealCostLineEnvelope = {
2429
+ meta: EnvelopeMeta;
2430
+ data: DealCostLine;
2431
+ extra: DealSubresourceExtra;
2432
+ };
2433
+ export type DealCostLinesBatchEnvelope = {
2434
+ meta: EnvelopeMeta;
2435
+ /**
2436
+ * The created lines in body order.
2437
+ */
2438
+ data: DealCostLine[];
2439
+ extra: DealSubresourceExtra;
2440
+ };
2441
+ export type DealCostLineListEnvelope = {
2442
+ meta: EnvelopeMeta;
2443
+ data: DealCostLine[];
2444
+ extra: DealLineListExtra;
2445
+ };
2446
+ export type DealBudgetSummary = {
2447
+ /**
2448
+ * The deal's currency code; `null` when the currency has no code.
2449
+ */
2450
+ currency: string | null;
2451
+ revenue: DealBudgetSummaryMoneyPair;
2452
+ cost: DealBudgetSummaryMoneyPair;
2453
+ margin: DealBudgetSummaryMoneyPair;
2454
+ /**
2455
+ * Revenue lines only. 0 or 1 when the account does not record amounts.
2456
+ */
2457
+ quantity: {
2458
+ forecast: number;
2459
+ executed: number;
2460
+ };
2461
+ };
2462
+ export type DealBudgetSummaryMoneyPair = {
2463
+ forecast: number;
2464
+ executed: number;
2465
+ };
2466
+ export type DealBudgetSummaryEnvelope = {
2467
+ meta: EnvelopeMeta;
2468
+ data: DealBudgetSummary | null;
2469
+ extra: DealSubresourceExtra;
2470
+ };
2471
+ export type DealProcessStep = {
2472
+ id: PublicId;
2473
+ name: string;
2474
+ /**
2475
+ * The step must be completed to win the deal.
2476
+ */
2477
+ required: boolean;
2478
+ /**
2479
+ * The deal has completed the step. `PATCH /deals/{id}/process` completes it.
2480
+ */
2481
+ completed: boolean;
2482
+ /**
2483
+ * When the step was last completed, in UTC. `null` when the step is not completed or the time is unknown.
2484
+ */
2485
+ completedAt: string | null;
2486
+ /**
2487
+ * The user who completed the step; an automation or integration completes it as the user it acts for. `null` when the step is not completed or the user is unknown.
2488
+ */
2489
+ completedBy: NamedReference | null;
2490
+ };
2491
+ export type DealProcessStage = {
2492
+ id: PublicId;
2493
+ name: string;
2494
+ /**
2495
+ * One-based rank of the stage among the active stages of the process.
2496
+ */
2497
+ position: number;
2498
+ /**
2499
+ * Stages before `currentStage` are `completed`, `currentStage` is `current`, the stages after it are `pending`. The deal status does not change it.
2500
+ */
2501
+ state: "completed" | "current" | "pending";
2502
+ /**
2503
+ * When the deal last entered this stage, in UTC. `null` for a pending stage, for a stage the deal skipped, and for a stage without a recorded entry.
2504
+ */
2505
+ enteredAt: string | null;
2506
+ /**
2507
+ * The user whose action last moved the deal into this stage. `null` when `enteredAt` is `null` or the user is unknown.
2508
+ */
2509
+ enteredBy: NamedReference | null;
2510
+ /**
2511
+ * For a `completed` stage, when the deal first moved to a later stage after it last entered this one; `null` when no such move is recorded, and always `null` for `current` and `pending`.
2512
+ */
2513
+ completedAt: string | null;
2514
+ /**
2515
+ * The user whose action moved the deal past this stage, usually by completing a step of a later stage. `null` when `completedAt` is `null` or the user is unknown.
2516
+ */
2517
+ completedBy: NamedReference | null;
2518
+ steps: DealProcessStep[];
2519
+ };
2520
+ export type DealProcess = {
2521
+ process: NamedReference | null;
2522
+ /**
2523
+ * The main stage the deal is on. A deal that has reached no stage yet reports the first active stage of its process. null only when the deal has no process or its process has no active stage.
2524
+ */
2525
+ currentStage: NamedReference | null;
2526
+ stages: DealProcessStage[];
2527
+ };
2528
+ export type DealProcessEnvelope = {
2529
+ meta: EnvelopeMeta;
2530
+ data: DealProcess;
2531
+ extra: DealSubresourceExtra;
2532
+ };
2533
+ export type DictionaryProcessOutcome = {
2534
+ /**
2535
+ * Whether a user may remove the default todo template on this outcome.
2536
+ */
2537
+ canRemoveTaskTemplate: boolean;
2538
+ /**
2539
+ * Whether a user may change the default todo template on this outcome.
2540
+ */
2541
+ canChangeTaskTemplate: boolean;
2542
+ };
2543
+ /**
2544
+ * Present only when the process autocloses a deal; `null` otherwise.
2545
+ */
2546
+ export type DictionaryProcessAutoclose = {
2547
+ /**
2548
+ * What starts the autoclose delay.
2549
+ */
2550
+ trigger: "creation" | "closing" | "lastActivity";
2551
+ /**
2552
+ * Days after `trigger` before the deal autocloses.
2553
+ */
2554
+ delayDays: number;
2555
+ status: "lost" | "outdated" | null;
2556
+ reason: {
2557
+ id: PublicId;
2558
+ } | null;
2559
+ };
2560
+ export type DictionaryProcessSettings = {
2561
+ defaultLengthDays: number | null;
2562
+ /**
2563
+ * Whether a deal on this process must carry at least one product line.
2564
+ */
2565
+ productRequired: boolean;
2566
+ autoclose: DictionaryProcessAutoclose | null;
2567
+ afterWon: DictionaryProcessOutcome;
2568
+ afterLost: DictionaryProcessOutcome;
2569
+ };
2570
+ export type DictionaryProcessFieldBindingField = {
2571
+ id: PublicId;
2572
+ kind: "field";
2573
+ field: {
2574
+ /**
2575
+ * The field name in lower camel case, one of the names listed for its `objectType` in `SalesProcessCreateFieldBinding`.
2576
+ */
2577
+ name: string;
2578
+ };
2579
+ /**
2580
+ * Plain text.
2581
+ */
2582
+ displayName: string | null;
2583
+ required: boolean;
2584
+ /**
2585
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2586
+ */
2587
+ helperText: string | null;
2588
+ /**
2589
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2590
+ */
2591
+ description: string | null;
2592
+ sort: number;
2593
+ objectType: "deal" | "person" | "company";
2594
+ };
2595
+ export type DictionaryProcessFieldBindingQuestion = {
2596
+ id: PublicId;
2597
+ kind: "question";
2598
+ question: {
2599
+ id: PublicId;
2600
+ } | null;
2601
+ /**
2602
+ * Plain text.
2603
+ */
2604
+ displayName: string | null;
2605
+ required: boolean;
2606
+ /**
2607
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2608
+ */
2609
+ helperText: string | null;
2610
+ /**
2611
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2612
+ */
2613
+ description: string | null;
2614
+ sort: number;
2615
+ objectType: "deal" | "person" | "company";
2616
+ };
2617
+ export type DictionaryProcessFieldBindingRelation = {
2618
+ id: PublicId;
2619
+ kind: "relation";
2620
+ relationType: {
2621
+ id: PublicId;
2622
+ } | null;
2623
+ /**
2624
+ * Plain text.
2625
+ */
2626
+ displayName: string | null;
2627
+ required: boolean;
2628
+ /**
2629
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2630
+ */
2631
+ helperText: string | null;
2632
+ /**
2633
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2634
+ */
2635
+ description: string | null;
2636
+ sort: number;
2637
+ objectType: "deal" | "person" | "company";
2638
+ };
2639
+ /**
2640
+ * A field binding on a step. `kind` is `field` for a built-in field, `question` for an additional field, or `relation` for a link, and only that member is present.
2641
+ */
2642
+ export type DictionaryProcessFieldBinding = DictionaryProcessFieldBindingField | DictionaryProcessFieldBindingQuestion | DictionaryProcessFieldBindingRelation;
2643
+ export type DictionaryProcessStep = {
2644
+ id: PublicId;
2645
+ /**
2646
+ * Plain text.
2647
+ */
2648
+ name: string;
2649
+ /**
2650
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2651
+ */
2652
+ description: string | null;
2653
+ sort: number;
2654
+ /**
2655
+ * The step's weight in the stage's progress bar.
2656
+ */
2657
+ scales: number;
2658
+ mandatory: {
2659
+ /**
2660
+ * Whether the step must be completed to win the deal.
2661
+ */
2662
+ required: boolean;
2663
+ /**
2664
+ * What a user must attach to complete the step, if anything.
2665
+ */
2666
+ item: "none" | "note" | "file";
2667
+ };
2668
+ fieldBindings: DictionaryProcessFieldBinding[];
2669
+ };
2670
+ export type DictionaryProcessStage = {
2671
+ id: PublicId;
2672
+ /**
2673
+ * Plain text.
2674
+ */
2675
+ name: string;
2676
+ /**
2677
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2678
+ */
2679
+ description: string | null;
2680
+ sort: number;
2681
+ duration: {
2682
+ enabled: boolean;
2683
+ days: number;
2684
+ };
2685
+ steps: DictionaryProcessStep[];
2686
+ };
2687
+ export type DictionaryProcess = {
2688
+ id: PublicId;
2689
+ /**
2690
+ * Plain text.
2691
+ */
2692
+ name: string;
2693
+ /**
2694
+ * `true` when the process is active, so it can be sent as `process.id` on a create or a process change. A deal already in a switched-off process keeps it.
2695
+ */
2696
+ selectable: boolean;
2697
+ /**
2698
+ * Whether this is the account's default process.
2699
+ */
2700
+ isDefault: boolean;
2701
+ settings: DictionaryProcessSettings;
2702
+ stages: DictionaryProcessStage[];
2703
+ };
2704
+ /**
2705
+ * Every key is optional; a key left out keeps its value. `id`, `selectable`, `isDefault` and any other key cannot be sent.
2706
+ */
2707
+ export type SalesProcessUpdateRequest = {
2708
+ /**
2709
+ * Plain text.
2710
+ */
2711
+ name?: string;
2712
+ settings?: SalesProcessCreateSettings;
2713
+ /**
2714
+ * The whole structure: a stage left out is removed.
2715
+ */
2716
+ stages?: SalesProcessUpdateStage[];
2717
+ };
2718
+ /**
2719
+ * With `id`, an existing stage of this process, and a key left out keeps its value; without `id`, a new stage that needs a `name`. The order is the position in `stages`, so `sort` cannot be sent.
2720
+ */
2721
+ export type SalesProcessUpdateStage = {
2722
+ id?: PublicId;
2723
+ /**
2724
+ * Plain text.
2725
+ */
2726
+ name?: string;
2727
+ /**
2728
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2729
+ */
2730
+ description?: string | null;
2731
+ duration?: {
2732
+ enabled?: boolean;
2733
+ days?: number;
2734
+ };
2735
+ /**
2736
+ * The whole list of the stage's steps; left out, the list stays.
2737
+ */
2738
+ steps?: SalesProcessUpdateStep[];
2739
+ };
2740
+ /**
2741
+ * With `id`, an existing step of this process from any stage, and a key left out keeps its value; without `id`, a new step that needs `name` and `scales`. The order is the position in `steps`, so `sort` and `mandatory.item` cannot be sent.
2742
+ */
2743
+ export type SalesProcessUpdateStep = {
2744
+ id?: PublicId;
2745
+ /**
2746
+ * Plain text.
2747
+ */
2748
+ name?: string;
2749
+ /**
2750
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2751
+ */
2752
+ description?: string | null;
2753
+ scales?: number;
2754
+ mandatory?: {
2755
+ required?: boolean;
2756
+ };
2757
+ /**
2758
+ * The whole list of the step's bindings; left out, the list stays.
2759
+ */
2760
+ fieldBindings?: SalesProcessUpdateFieldBinding[];
2761
+ };
2762
+ /**
2763
+ * With `id`, an existing binding of this process, and a key left out keeps its value; without `id`, a new binding that needs `kind` and `objectType`. The target (`kind`, `objectType` and the one member of the `kind`) is sent whole or not at all, and the order is the position in `fieldBindings`.
2764
+ */
2765
+ export type SalesProcessUpdateFieldBinding = {
2766
+ id?: PublicId;
2767
+ kind?: "field" | "question" | "relation";
2768
+ objectType?: "deal" | "person" | "company";
2769
+ field?: {
2770
+ /**
2771
+ * A native field of the `objectType`, as in `SalesProcessCreateFieldBinding`. Any other name is `422`.
2772
+ */
2773
+ name: string;
2774
+ };
2775
+ question?: {
2776
+ /**
2777
+ * The public id of the referenced record.
2778
+ */
2779
+ id: string;
2780
+ };
2781
+ relationType?: {
2782
+ /**
2783
+ * The public id of the referenced record.
2784
+ */
2785
+ id: string;
2786
+ };
2787
+ required?: boolean;
2788
+ /**
2789
+ * Plain text.
2790
+ */
2791
+ displayName?: string | null;
2792
+ /**
2793
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2794
+ */
2795
+ helperText?: string | null;
2796
+ /**
2797
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2798
+ */
2799
+ description?: string | null;
2800
+ };
2801
+ /**
2802
+ * Any other key, `id`, `selectable` and `isDefault` included, is `400`.
2803
+ */
2804
+ export type SalesProcessCreateRequest = {
2805
+ /**
2806
+ * Plain text.
2807
+ */
2808
+ name: string;
2809
+ settings?: SalesProcessCreateSettings;
2810
+ stages: SalesProcessCreateStage[];
2811
+ };
2812
+ export type SalesProcessCreateSettings = {
2813
+ defaultLengthDays?: number;
2814
+ productRequired?: boolean;
2815
+ /**
2816
+ * Absent or `null` switches autoclose off.
2817
+ */
2818
+ autoclose?: null | SalesProcessCreateAutoclose;
2819
+ afterWon?: SalesProcessCreateOutcome;
2820
+ afterLost?: SalesProcessCreateOutcome;
2821
+ };
2822
+ export type SalesProcessCreateOutcome = {
2823
+ canRemoveTaskTemplate?: boolean;
2824
+ canChangeTaskTemplate?: boolean;
2825
+ };
2826
+ export type SalesProcessCreateAutoclose = {
2827
+ trigger: "creation" | "closing" | "lastActivity";
2828
+ delayDays: number;
2829
+ status?: "lost" | "outdated" | null;
2830
+ /**
2831
+ * A deal reason of the autoclose `status`. An id that names no active deal reason is `422` `Unknown reference.`.
2832
+ */
2833
+ reason?: null | {
2834
+ /**
2835
+ * The public id of the referenced record.
2836
+ */
2837
+ id: string;
2838
+ };
2839
+ };
2840
+ /**
2841
+ * Any other key, `id` and `sort` included, is `400`; `sort` is the position in `stages`.
2842
+ */
2843
+ export type SalesProcessCreateStage = {
2844
+ /**
2845
+ * Plain text.
2846
+ */
2847
+ name: string;
2848
+ /**
2849
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2850
+ */
2851
+ description?: string | null;
2852
+ duration?: {
2853
+ enabled?: boolean;
2854
+ days?: number;
2855
+ };
2856
+ steps?: SalesProcessCreateStep[];
2857
+ };
2858
+ /**
2859
+ * Any other key, `id`, `sort` and `mandatory.item` included, is `400`; `sort` is the position in `steps`.
2860
+ */
2861
+ export type SalesProcessCreateStep = {
2862
+ /**
2863
+ * Plain text.
2864
+ */
2865
+ name: string;
2866
+ /**
2867
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2868
+ */
2869
+ description?: string | null;
2870
+ scales: number;
2871
+ mandatory?: {
2872
+ required?: boolean;
2873
+ };
2874
+ fieldBindings?: SalesProcessCreateFieldBinding[];
2875
+ };
2876
+ /**
2877
+ * Only the member of the `kind` is present: `field`, `question` or `relationType`, in `fieldBindings` order. A step binds each target at most once.
2878
+ */
2879
+ export type SalesProcessCreateFieldBinding = {
2880
+ kind: "field" | "question" | "relation";
2881
+ objectType: "deal" | "person" | "company";
2882
+ field?: {
2883
+ /**
2884
+ * A native field of the `objectType`: for `deal` `person`, `company`, `owner`, `source`, `closingDate`; for `person` `firstName`, `lastName`, `position`, `source`, `group`, `owner`, `phone`, `email`, `website`, `addressStreet`, `addressPostcode`, `addressCity`, `addressRegion`, `addressCountry`; for `company` `name`, `nip`, `regon`, `source`, `group`, `owner`, `phone`, `email`, `website`, `addressStreet`, `addressPostcode`, `addressCity`, `addressRegion`, `addressCountry`. Any other name is refused.
2885
+ */
2886
+ name: string;
2887
+ };
2888
+ question?: {
2889
+ /**
2890
+ * The public id of the referenced record.
2891
+ */
2892
+ id: string;
2893
+ };
2894
+ relationType?: {
2895
+ /**
2896
+ * The public id of the referenced record.
2897
+ */
2898
+ id: string;
2899
+ };
2900
+ required?: boolean;
2901
+ /**
2902
+ * Plain text.
2903
+ */
2904
+ displayName?: string | null;
2905
+ /**
2906
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2907
+ */
2908
+ helperText?: string | null;
2909
+ /**
2910
+ * Text that may include a YouTube or Vimeo video. Other HTML is removed.
2911
+ */
2912
+ description?: string | null;
2913
+ };
2914
+ export type DictionaryProcessListEnvelope = {
2915
+ meta: EnvelopeMeta;
2916
+ data: DictionaryProcess[];
2917
+ extra: DictionaryListExtra;
2918
+ };
2919
+ export type DictionaryProcessEnvelope = {
2920
+ meta: EnvelopeMeta;
2921
+ data: DictionaryProcess;
2922
+ extra: EmptyExtra;
2923
+ };
2924
+ /**
2925
+ * A filter node: a group or a condition.
2926
+ */
2927
+ export type SearchFilter = SearchFilterGroup | SearchFilterCondition;
2928
+ /**
2929
+ * Exactly one of `and`, `or`.
2930
+ */
2931
+ export type SearchFilterGroup = {
2932
+ and?: SearchFilter[];
2933
+ or?: SearchFilter[];
2934
+ };
2935
+ export type SearchFilterCondition = {
2936
+ /**
2937
+ * A field listed in the operation's `x-filter-fields`.
2938
+ */
2939
+ field: string;
2940
+ operator: "eq" | "neq" | "contains" | "notContains" | "startsWith" | "gt" | "gte" | "lt" | "lte" | "between" | "in" | "nin" | "anyOf" | "allOf" | "noneOf" | "isEmpty" | "isNotEmpty";
2941
+ /**
2942
+ * Absent for `isEmpty` and `isNotEmpty`, a list of ids for `anyOf`, `allOf` and `noneOf`, `{from, to}` for `between`, and otherwise a non-empty string. A date takes an RFC 3339 instant or a relative token such as `today` (see [Searching](/searching/#dates-in-a-filter)).
2943
+ */
2944
+ value?: unknown;
2945
+ };
2946
+ export type SearchSort = {
2947
+ /**
2948
+ * A field marked `sortable` in `x-filter-fields`.
2949
+ */
2950
+ field: string;
2951
+ direction: "asc" | "desc";
2952
+ };
2953
+ export type SearchCompaniesRequest = {
2954
+ filter?: SearchFilter;
2955
+ sort?: SearchSort;
2956
+ page?: number;
2957
+ perPage?: number;
2958
+ };
2959
+ export type SearchPeopleRequest = {
2960
+ filter?: SearchFilter;
2961
+ sort?: SearchSort;
2962
+ page?: number;
2963
+ perPage?: number;
2964
+ };
2965
+ export type SearchDealsRequest = {
2966
+ filter?: SearchFilter;
2967
+ sort?: SearchSort;
2968
+ page?: number;
2969
+ /**
2970
+ * At most 50 under `application/vnd.ls-api.extended.v2+json`, where an absent perPage defaults to 50.
2971
+ */
2972
+ perPage?: number;
2973
+ };
2974
+ export type SearchTasksRequest = {
2975
+ filter?: SearchFilter;
2976
+ /**
2977
+ * Defaults to `updatedAt desc`. On `endsAt` and `completedAt` a task without a value comes last in both directions.
2978
+ */
2979
+ sort?: {
2980
+ field: "updatedAt" | "startsAt" | "createdAt" | "endsAt" | "completedAt" | "priority" | "title";
2981
+ direction: "asc" | "desc";
2982
+ };
2983
+ page?: number;
2984
+ perPage?: number;
2985
+ };
2986
+ /**
2987
+ * Paging echo and per-item permissions of a search. A JSON object, never `[]`.
2988
+ */
2989
+ export type SearchPagingExtra = {
2990
+ page: number;
2991
+ perPage: number;
2992
+ /**
2993
+ * Number of matching items across all pages, capped at 10 000.
2994
+ */
2995
+ totalCount: number;
2996
+ /**
2997
+ * `false` when the count reached the cap.
2998
+ */
2999
+ totalCountExact: boolean;
3000
+ /**
3001
+ * One entry per returned item, keyed by its public id.
3002
+ */
3003
+ permissions: Record<string, RecordPermissions>;
3004
+ };
3005
+ export type CompanyListEnvelope = {
3006
+ meta: EnvelopeMeta;
3007
+ data: Company[];
3008
+ extra: SearchPagingExtra;
3009
+ };
3010
+ export type CompanyMinimalListEnvelope = {
3011
+ meta: EnvelopeMeta;
3012
+ data: CompanyMinimal[];
3013
+ extra: SearchPagingExtra;
3014
+ };
3015
+ export type PersonListEnvelope = {
3016
+ meta: EnvelopeMeta;
3017
+ data: Person[];
3018
+ extra: SearchPagingExtra;
3019
+ };
3020
+ export type PersonMinimalListEnvelope = {
3021
+ meta: EnvelopeMeta;
3022
+ data: PersonMinimal[];
3023
+ extra: SearchPagingExtra;
3024
+ };
3025
+ export type DealListEnvelope = {
3026
+ meta: EnvelopeMeta;
3027
+ data: Deal[];
3028
+ extra: SearchPagingExtra;
3029
+ };
3030
+ export type DealMinimalListEnvelope = {
3031
+ meta: EnvelopeMeta;
3032
+ data: DealMinimal[];
3033
+ extra: SearchPagingExtra;
3034
+ };
3035
+ /**
3036
+ * The deal as `GET /deals/{id}` returns it, with every member present on every item (`null` or `[]` when empty). `additionalFields` lists every deal field the caller may read, with `value: null` when the deal has none.
3037
+ */
3038
+ export type DealExtended = Deal;
3039
+ export type DealExtendedListEnvelope = {
3040
+ meta: EnvelopeMeta;
3041
+ data: DealExtended[];
3042
+ extra: SearchPagingExtra;
3043
+ };
3044
+ /**
3045
+ * A committed write the caller can no longer read, for example a record it has just made hidden or handed to another owner. Only the record id is returned.
3046
+ */
3047
+ export type WrittenRecordIdEnvelope = {
3048
+ meta: EnvelopeMeta;
3049
+ data: {
3050
+ id: PublicId;
3051
+ };
3052
+ extra: Record<string, never>;
3053
+ };
3054
+ /**
3055
+ * A record the task is linked to. `name` is `null` when the caller may not view that record; the id stays.
3056
+ */
3057
+ export type TaskLink = {
3058
+ id: PublicId;
3059
+ name: string | null;
3060
+ };
3061
+ /**
3062
+ * People and e-mail addresses invited to the task.
3063
+ */
3064
+ export type TaskContacts = {
3065
+ people: TaskLink[];
3066
+ emails: string[];
3067
+ };
3068
+ /**
3069
+ * A closed body: any other key (`people`, `contacts`, `completed`, `recurrence`, `allDay`, …) is `400`.
3070
+ */
3071
+ export type CreateTaskRequest = {
3072
+ /**
3073
+ * Plain text, trimmed, from 1 to 256 characters.
3074
+ */
3075
+ title: string;
3076
+ /**
3077
+ * Plain text.
3078
+ */
3079
+ description?: string | null;
3080
+ priority?: "normal" | "high";
3081
+ type?: null | {
3082
+ id: PublicId;
3083
+ };
3084
+ status?: null | {
3085
+ id: PublicId;
3086
+ };
3087
+ /**
3088
+ * The responsible user. Required on create when the account makes the responsible role mandatory for tasks.
3089
+ */
3090
+ assignee?: null | {
3091
+ id: PublicId;
3092
+ };
3093
+ /**
3094
+ * Defaults to `scheduled` when `startsAt` is sent, else `unscheduled`. `startsAt` or `endsAt` with another value is `422`.
3095
+ */
3096
+ dueType?: "scheduled" | "someday" | "unscheduled";
3097
+ /**
3098
+ * A day `YYYY-MM-DD` (an all-day task in the caller's time zone; an end day is inclusive) or an RFC 3339 instant with an offset (a timed task). `startsAt` and `endsAt` are of one kind.
3099
+ */
3100
+ startsAt?: string;
3101
+ /**
3102
+ * A day `YYYY-MM-DD` (an all-day task in the caller's time zone; an end day is inclusive) or an RFC 3339 instant with an offset (a timed task). `startsAt` and `endsAt` are of one kind.
3103
+ */
3104
+ endsAt?: string;
3105
+ private?: boolean;
3106
+ /**
3107
+ * Users and teams holding the member role. `null` is `400`.
3108
+ */
3109
+ members?: {
3110
+ users?: {
3111
+ id: PublicId;
3112
+ }[];
3113
+ teams?: {
3114
+ id: PublicId;
3115
+ }[];
3116
+ };
3117
+ additionalFields?: AdditionalFieldWriteList;
3118
+ };
3119
+ /**
3120
+ * A closed body: any other key (`people`, `contacts`, `completed`, `recurrence`, `allDay`, …) is `400`. Omitted keys stay unchanged; `null` clears a nullable key.
3121
+ */
3122
+ export type UpdateTaskRequest = {
3123
+ /**
3124
+ * Plain text, trimmed, from 1 to 256 characters.
3125
+ */
3126
+ title?: string;
3127
+ /**
3128
+ * Plain text.
3129
+ */
3130
+ description?: string | null;
3131
+ priority?: "normal" | "high";
3132
+ type?: null | {
3133
+ id: PublicId;
3134
+ };
3135
+ status?: null | {
3136
+ id: PublicId;
3137
+ };
3138
+ /**
3139
+ * The responsible user. Required on create when the account makes the responsible role mandatory for tasks.
3140
+ */
3141
+ assignee?: null | {
3142
+ id: PublicId;
3143
+ };
3144
+ /**
3145
+ * Defaults to `scheduled` when `startsAt` is sent, else `unscheduled`. `startsAt` or `endsAt` with another value is `422`.
3146
+ */
3147
+ dueType?: "scheduled" | "someday" | "unscheduled";
3148
+ /**
3149
+ * A day `YYYY-MM-DD` (an all-day task in the caller's time zone; an end day is inclusive) or an RFC 3339 instant with an offset (a timed task). `startsAt` and `endsAt` are of one kind.
3150
+ */
3151
+ startsAt?: string;
3152
+ endsAt?: null | string;
3153
+ private?: boolean;
3154
+ /**
3155
+ * Users and teams holding the member role; the list replaces the members, and `{"users": [], "teams": []}` clears them. `null` is refused.
3156
+ */
3157
+ members?: {
3158
+ users?: {
3159
+ id: PublicId;
3160
+ }[];
3161
+ teams?: {
3162
+ id: PublicId;
3163
+ }[];
3164
+ };
3165
+ additionalFields?: AdditionalFieldWriteList;
3166
+ };
3167
+ /**
3168
+ * The repeat rule of a recurring task.
3169
+ */
3170
+ export type TaskRecurrence = {
3171
+ frequency: "daily" | "weekly" | "monthly" | "yearly";
3172
+ /**
3173
+ * Repeat every `interval` days, weeks, months or years.
3174
+ */
3175
+ interval: number;
3176
+ /**
3177
+ * The weekdays of a `weekly` rule; `null` for every other frequency.
3178
+ */
3179
+ daysOfWeek: ("monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday")[] | null;
3180
+ /**
3181
+ * The week of the month of a `monthly` rule anchored on a weekday; otherwise `null`.
3182
+ */
3183
+ weekOfMonth: number | null;
3184
+ /**
3185
+ * The weekday of a `monthly` rule anchored on a weekday; otherwise `null`.
3186
+ */
3187
+ dayOfWeek: "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday" | null;
3188
+ ends: {
3189
+ kind: "never" | "afterOccurrences" | "onDate";
3190
+ /**
3191
+ * The number of occurrences when `kind` is `afterOccurrences`.
3192
+ */
3193
+ count: number | null;
3194
+ /**
3195
+ * The last day, in the caller's time zone, when `kind` is `onDate`.
3196
+ */
3197
+ until: string | null;
3198
+ };
3199
+ };
3200
+ export type Task = {
3201
+ id: PublicId;
3202
+ /**
3203
+ * Plain text.
3204
+ */
3205
+ title: string;
3206
+ /**
3207
+ * `null` when empty. Plain text.
3208
+ */
3209
+ description: string | null;
3210
+ completed: boolean;
3211
+ /**
3212
+ * UTC instant with a trailing `Z`; `null` unless `completed`.
3213
+ */
3214
+ completedAt: string | null;
3215
+ priority: "normal" | "high";
3216
+ dueType: "scheduled" | "someday" | "unscheduled";
3217
+ /**
3218
+ * The start: a UTC instant for a timed task, a `YYYY-MM-DD` day in the caller's time zone for an all-day task. `null` unless `dueType` is `scheduled`.
3219
+ */
3220
+ startsAt: string | null;
3221
+ /**
3222
+ * The end: a UTC instant for a timed task, or the last day of an all-day task, inclusive, as `YYYY-MM-DD`. `null` unless `dueType` is `scheduled`.
3223
+ */
3224
+ endsAt: string | null;
3225
+ /**
3226
+ * `null` unless `dueType` is `scheduled`.
3227
+ */
3228
+ allDay: boolean | null;
3229
+ /**
3230
+ * The task type; a retired type still renders. `null` when the task has none.
3231
+ */
3232
+ type: NamedReference | null;
3233
+ /**
3234
+ * The task status; `null` when the task has none or task statuses are switched off for the account.
3235
+ */
3236
+ status: NamedReference | null;
3237
+ private: boolean;
3238
+ recurring: boolean;
3239
+ /**
3240
+ * `null` unless `recurring`.
3241
+ */
3242
+ recurrence: TaskRecurrence | null;
3243
+ /**
3244
+ * Users and teams responsible for the task.
3245
+ */
3246
+ assignees: RecordOwners;
3247
+ /**
3248
+ * Users and teams taking part in the task.
3249
+ */
3250
+ members: RecordOwners;
3251
+ createdBy: CreatedByUser | null;
3252
+ /**
3253
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
3254
+ */
3255
+ createdAt: string | null;
3256
+ updatedBy: CreatedByUser | null;
3257
+ /**
3258
+ * A UTC instant with a trailing `Z`, such as `2024-01-09T14:15:30Z`.
3259
+ */
3260
+ updatedAt: string | null;
3261
+ people: TaskLink[];
3262
+ companies: TaskLink[];
3263
+ deals: TaskLink[];
3264
+ spaces: TaskLink[];
3265
+ contacts: TaskContacts;
3266
+ additionalFields: PublicAdditionalField[];
3267
+ /**
3268
+ * The task page in the Livespace UI.
3269
+ */
3270
+ url: string;
3271
+ };
3272
+ export type TaskMinimal = {
3273
+ id: PublicId;
3274
+ /**
3275
+ * Plain text.
3276
+ */
3277
+ title: string;
3278
+ completed: boolean;
3279
+ dueType: "scheduled" | "someday" | "unscheduled";
3280
+ /**
3281
+ * The start: a UTC instant for a timed task, a `YYYY-MM-DD` day in the caller's time zone for an all-day task. `null` unless `dueType` is `scheduled`.
3282
+ */
3283
+ startsAt: string | null;
3284
+ allDay: boolean | null;
3285
+ private: boolean;
3286
+ url: string;
3287
+ };
3288
+ export type TaskEnvelope = {
3289
+ meta: EnvelopeMeta;
3290
+ data: Task;
3291
+ extra: RecordPermissionsExtra;
3292
+ };
3293
+ export type TaskMinimalEnvelope = {
3294
+ meta: EnvelopeMeta;
3295
+ data: TaskMinimal;
3296
+ extra: RecordPermissionsExtra;
3297
+ };
3298
+ export type TaskListEnvelope = {
3299
+ meta: EnvelopeMeta;
3300
+ data: Task[];
3301
+ extra: SearchPagingExtra;
3302
+ };
3303
+ export type TaskMinimalListEnvelope = {
3304
+ meta: EnvelopeMeta;
3305
+ data: TaskMinimal[];
3306
+ extra: SearchPagingExtra;
3307
+ };
3308
+ /**
3309
+ * A call to log on a person, company or deal. Any other key, including `tags`, `answered` and `related`, is `400`.
3310
+ */
3311
+ export type CreateCallRequest = {
3312
+ /**
3313
+ * The other party's phone number. Trimmed; 1 to 30 characters after the trim: digits, spaces and `+ ( ) - . / # *` only.
3314
+ */
3315
+ number: string;
3316
+ direction: "incoming" | "outgoing";
3317
+ /**
3318
+ * When the call took place, an ATOM date-time with an offset. Defaults to the moment of the request.
3319
+ */
3320
+ date?: string;
3321
+ /**
3322
+ * Duration in seconds. Defaults to `0`; a call with a duration above `0` is answered.
3323
+ */
3324
+ duration?: number;
3325
+ /**
3326
+ * The text of the call, at most 50 000 bytes. Without visible text it defaults to a short phrase in the language of the user the call is attributed to.
3327
+ */
3328
+ note?: string;
3329
+ /**
3330
+ * Defaults to `all`.
3331
+ */
3332
+ visibility?: "all" | "forMe" | "forMeAndManagers";
3333
+ /**
3334
+ * The caller's own id of the call, for example a PBX call id. It is printable ASCII, it is kept as sent, and a value already used by a call that is not deleted is `409`.
3335
+ */
3336
+ externalId?: string;
3337
+ /**
3338
+ * An absolute `https` or `http` URL of the recording, without whitespace, `"`, `'`, `<` or `>`, shown as a link on the record's timeline and never fetched. Leave the key out when there is no recording; `null` is refused.
3339
+ */
3340
+ recordingUrl?: string;
3341
+ /**
3342
+ * The user the call is attributed to, the caller by default. Only an integration key may name another user.
3343
+ */
3344
+ user?: {
3345
+ id: string;
3346
+ };
3347
+ };
3348
+ /**
3349
+ * The fields of a call to change; every key is optional and only `recordingUrl` takes `null`. `number`, `direction`, `date` and `duration` change only on a call logged through this API, and `externalId` and `user` cannot be sent.
3350
+ */
3351
+ export type UpdateCallRequest = {
3352
+ /**
3353
+ * The text of the call, at most 50 000 bytes. A note without visible text is refused.
3354
+ */
3355
+ note?: string;
3356
+ visibility?: "all" | "forMe" | "forMeAndManagers";
3357
+ /**
3358
+ * The other party's phone number. Trimmed; 1 to 30 characters after the trim: digits, spaces and `+ ( ) - . / # *` only.
3359
+ */
3360
+ number?: string;
3361
+ direction?: "incoming" | "outgoing";
3362
+ /**
3363
+ * When the call took place, an ATOM date-time with an offset.
3364
+ */
3365
+ date?: string;
3366
+ /**
3367
+ * Duration in seconds; a call with a duration above `0` is answered.
3368
+ */
3369
+ duration?: number;
3370
+ /**
3371
+ * An absolute `https` or `http` URL of the recording, without whitespace, `"`, `'`, `<` or `>`; `null` removes it, and any call can change it. Setting or removing the link also clears `recordingExpiresOn`.
3372
+ */
3373
+ recordingUrl?: string | null;
3374
+ };
3375
+ export type CallEnvelope = {
3376
+ meta: EnvelopeMeta;
3377
+ data: Call;
3378
+ /**
3379
+ * Always present. Empty on this operation — a JSON object `{}`, never `[]`.
3380
+ */
3381
+ extra: EmptyExtra;
3382
+ };
3383
+ export type Product = {
3384
+ id: PublicId;
3385
+ /**
3386
+ * Plain text. `""` when the entry has no name.
3387
+ */
3388
+ name: string;
3389
+ /**
3390
+ * The stock keeping unit, as plain text, or `null` when none is set.
3391
+ */
3392
+ sku: string | null;
3393
+ /**
3394
+ * The default unit price in the account's default currency, which `GET /metadata/products/capabilities` names. `null` when none is set.
3395
+ */
3396
+ defaultPrice: number | null;
3397
+ /**
3398
+ * `true` when a user may not change the price on a deal line.
3399
+ */
3400
+ priceLocked: boolean;
3401
+ /**
3402
+ * The product group, or `null` when the entry has none or its group is a cost group.
3403
+ */
3404
+ group: NamedReference | null;
3405
+ /**
3406
+ * When the entry was created, in UTC.
3407
+ */
3408
+ createdAt: string;
3409
+ /**
3410
+ * When the entry was last changed, in UTC.
3411
+ */
3412
+ updatedAt: string;
3413
+ };
3414
+ export type Cost = {
3415
+ id: PublicId;
3416
+ /**
3417
+ * Plain text. `""` when the entry has no name.
3418
+ */
3419
+ name: string;
3420
+ /**
3421
+ * The cost group, or `null` when the entry has none or its group is a product group.
3422
+ */
3423
+ group: NamedReference | null;
3424
+ /**
3425
+ * When the entry was created, in UTC.
3426
+ */
3427
+ createdAt: string;
3428
+ /**
3429
+ * When the entry was last changed, in UTC.
3430
+ */
3431
+ updatedAt: string;
3432
+ };
3433
+ export type CatalogGroup = {
3434
+ id: PublicId;
3435
+ /**
3436
+ * Plain text, or `""` when the group has no name. A rename changes the group name every deal line shows.
3437
+ */
3438
+ name: string;
3439
+ };
3440
+ export type SearchProductsRequest = {
3441
+ filter?: SearchFilter;
3442
+ /**
3443
+ * Defaults to `name asc`.
3444
+ */
3445
+ sort?: {
3446
+ field: "name" | "createdAt" | "updatedAt";
3447
+ direction: "asc" | "desc";
3448
+ };
3449
+ page?: number;
3450
+ perPage?: number;
3451
+ };
3452
+ export type SearchCostsRequest = {
3453
+ filter?: SearchFilter;
3454
+ /**
3455
+ * Defaults to `name asc`.
3456
+ */
3457
+ sort?: {
3458
+ field: "name" | "createdAt" | "updatedAt";
3459
+ direction: "asc" | "desc";
3460
+ };
3461
+ page?: number;
3462
+ perPage?: number;
3463
+ };
3464
+ /**
3465
+ * Paging echo for a catalog search. A JSON object, never `[]`.
3466
+ */
3467
+ export type CatalogSearchExtra = {
3468
+ page: number;
3469
+ perPage: number;
3470
+ /**
3471
+ * Matching entries, capped at 10 000.
3472
+ */
3473
+ totalCount: number;
3474
+ /**
3475
+ * `false` when more than 10 000 entries match and `totalCount` is the cap.
3476
+ */
3477
+ totalCountExact: boolean;
3478
+ };
3479
+ export type ProductEnvelope = {
3480
+ meta: EnvelopeMeta;
3481
+ data: Product;
3482
+ extra: EmptyExtra;
3483
+ };
3484
+ export type ProductSearchEnvelope = {
3485
+ meta: EnvelopeMeta;
3486
+ data: Product[];
3487
+ extra: CatalogSearchExtra;
3488
+ };
3489
+ export type ProductListEnvelope = {
3490
+ meta: EnvelopeMeta;
3491
+ data: Product[];
3492
+ extra: DictionaryListExtra;
3493
+ };
3494
+ export type CostEnvelope = {
3495
+ meta: EnvelopeMeta;
3496
+ data: Cost;
3497
+ extra: EmptyExtra;
3498
+ };
3499
+ export type CostSearchEnvelope = {
3500
+ meta: EnvelopeMeta;
3501
+ data: Cost[];
3502
+ extra: CatalogSearchExtra;
3503
+ };
3504
+ export type CostListEnvelope = {
3505
+ meta: EnvelopeMeta;
3506
+ data: Cost[];
3507
+ extra: DictionaryListExtra;
3508
+ };
3509
+ export type CatalogGroupEnvelope = {
3510
+ meta: EnvelopeMeta;
3511
+ data: CatalogGroup;
3512
+ extra: EmptyExtra;
3513
+ };
3514
+ export type CreateCatalogGroupRequest = {
3515
+ /**
3516
+ * The group name, trimmed plain text. `"0"` is a name, and names need not be unique.
3517
+ */
3518
+ name: string;
3519
+ };
3520
+ /**
3521
+ * Only the keys the body carries are written; `{}` writes nothing.
3522
+ */
3523
+ export type UpdateCatalogGroupRequest = {
3524
+ /**
3525
+ * The group name, trimmed plain text; `null` is refused. `"0"` is a name, and names need not be unique.
3526
+ */
3527
+ name?: string;
3528
+ };
3529
+ export type MoveCatalogGroupMembersRequest = {
3530
+ /**
3531
+ * The entries to move, 1 to 100 per request. A larger set moves in several requests, each atomic on its own.
3532
+ */
3533
+ members: {
3534
+ id: PublicId;
3535
+ }[];
3536
+ };
3537
+ export type CatalogGroupListEnvelope = {
3538
+ meta: EnvelopeMeta;
3539
+ data: CatalogGroup[];
3540
+ extra: DictionaryListExtra;
3541
+ };
3542
+ export type ProductCapabilities = {
3543
+ /**
3544
+ * Whether products are switched on for deals.
3545
+ */
3546
+ productsEnabled: boolean;
3547
+ /**
3548
+ * Whether costs are switched on for deals.
3549
+ */
3550
+ costsEnabled: boolean;
3551
+ /**
3552
+ * Whether product lines carry amounts. Applies only while `productsEnabled` is `true`.
3553
+ */
3554
+ amountsEnabled: boolean;
3555
+ /**
3556
+ * Whether product lines carry dates. Applies only while `productsEnabled` is `true`.
3557
+ */
3558
+ datesEnabled: boolean;
3559
+ /**
3560
+ * Whether product lines carry billing cycles. Applies only while `productsEnabled` is `true`.
3561
+ */
3562
+ cyclesEnabled: boolean;
3563
+ /**
3564
+ * ISO 4217 code of the account's default currency, in which `defaultPrice` is expressed.
3565
+ */
3566
+ defaultCurrency: string;
3567
+ };
3568
+ export type ProductCapabilitiesEnvelope = {
3569
+ meta: EnvelopeMeta;
3570
+ data: ProductCapabilities;
3571
+ extra: EmptyExtra;
3572
+ };
3573
+ /**
3574
+ * Any other key, `prices`, `id`, `createdAt`, `updatedAt` or `group.name` included, is `400`. `null` on `sku`, `defaultPrice` or `group` is the same as leaving the key out.
3575
+ */
3576
+ export type CreateProductRequest = {
3577
+ /**
3578
+ * Plain text, trimmed and not empty. A rename also renames every deal line that names the product.
3579
+ */
3580
+ name: string;
3581
+ /**
3582
+ * The stock keeping unit, trimmed plain text. `null` creates the product without a SKU.
3583
+ */
3584
+ sku?: string | null;
3585
+ /**
3586
+ * The default unit price in the account's default currency, at most two decimal places; `0` is a zero price. `null` creates the product without a default price.
3587
+ */
3588
+ defaultPrice?: number | null;
3589
+ /**
3590
+ * `true` forbids users to change the price on a deal line. Locking needs a default price: a lock without one is `422` on `/priceLocked`, and clearing the price of a locked product is `422` on `/defaultPrice`.
3591
+ */
3592
+ priceLocked?: boolean;
3593
+ /**
3594
+ * The product group by id, or `null` for none. A product group id only: any other id is `422` on `/group/id` with `Unknown reference.`
3595
+ */
3596
+ group?: null | {
3597
+ id: PublicId;
3598
+ };
3599
+ };
3600
+ /**
3601
+ * Every key is optional, and a key left out stays. `name` and `priceLocked` refuse `null`, and `null` on `sku`, `defaultPrice` or `group` clears it.
3602
+ */
3603
+ export type UpdateProductRequest = {
3604
+ /**
3605
+ * Plain text, trimmed and not empty. A rename also renames every deal line that names the product.
3606
+ */
3607
+ name?: string;
3608
+ /**
3609
+ * The stock keeping unit, trimmed plain text. `null` clears it.
3610
+ */
3611
+ sku?: string | null;
3612
+ /**
3613
+ * The default unit price in the account's default currency, at most two decimal places; `0` is a zero price and `null` clears it. Prices in other currencies stay.
3614
+ */
3615
+ defaultPrice?: number | null;
3616
+ /**
3617
+ * `true` forbids users to change the price on a deal line. Locking needs a default price: a lock without one is `422` on `/priceLocked`, and clearing the price of a locked product is `422` on `/defaultPrice`.
3618
+ */
3619
+ priceLocked?: boolean;
3620
+ /**
3621
+ * The product group by id, or `null` for none. A product group id only: any other id is `422` on `/group/id` with `Unknown reference.`
3622
+ */
3623
+ group?: null | {
3624
+ id: PublicId;
3625
+ };
3626
+ };
3627
+ /**
3628
+ * A cost has no sku, price or lock: `sku`, `defaultPrice`, `priceLocked` and any other key are `400`.
3629
+ */
3630
+ export type CreateCostRequest = {
3631
+ /**
3632
+ * Plain text, trimmed and not empty. A rename also renames every deal line that names the cost.
3633
+ */
3634
+ name: string;
3635
+ /**
3636
+ * The cost group by id, or `null` for none. A cost group id only: any other id is `422` on `/group/id` with `Unknown reference.`
3637
+ */
3638
+ group?: null | {
3639
+ id: PublicId;
3640
+ };
3641
+ };
3642
+ /**
3643
+ * Every key is optional, and a key left out stays; `name` refuses `null` and `null` on `group` clears it. `sku`, `defaultPrice` and `priceLocked` cannot be sent.
3644
+ */
3645
+ export type UpdateCostRequest = {
3646
+ /**
3647
+ * Plain text, trimmed and not empty. A rename also renames every deal line that names the cost.
3648
+ */
3649
+ name?: string;
3650
+ /**
3651
+ * The cost group by id, or `null` for none. A cost group id only: any other id is `422` on `/group/id` with `Unknown reference.`
3652
+ */
3653
+ group?: null | {
3654
+ id: PublicId;
3655
+ };
3656
+ };
3657
+ export type SourceCreateRequest = {
3658
+ name: string;
3659
+ };
3660
+ export type SourceUpdateRequest = {
3661
+ name: string;
3662
+ };
3663
+ export type ConsentStatusCreateRequest = {
3664
+ name: string;
3665
+ };
3666
+ export type ConsentStatusUpdateRequest = {
3667
+ name: string;
3668
+ };
3669
+ export type DealReasonCreateRequest = {
3670
+ /**
3671
+ * The reason name, trimmed plain text; names need not be unique.
3672
+ */
3673
+ name: string;
3674
+ /**
3675
+ * The deal outcome the reason explains.
3676
+ */
3677
+ kind: "won" | "lost" | "outdated";
3678
+ };
3679
+ /**
3680
+ * Send `name`, `kind` or both; a key that is left out keeps its value.
3681
+ */
3682
+ export type DealReasonUpdateRequest = {
3683
+ /**
3684
+ * The reason name, trimmed plain text; `null` is refused.
3685
+ */
3686
+ name?: string;
3687
+ /**
3688
+ * The new kind; a deal that holds the reason keeps it.
3689
+ */
3690
+ kind?: "won" | "lost" | "outdated";
3691
+ };
3692
+ export type PersonGroupCreateRequest = {
3693
+ /**
3694
+ * The group name, trimmed plain text; names need not be unique.
3695
+ */
3696
+ name: string;
3697
+ };
3698
+ export type PersonGroupUpdateRequest = {
3699
+ /**
3700
+ * The group name, trimmed plain text; names need not be unique.
3701
+ */
3702
+ name: string;
3703
+ };
3704
+ export type DealGroupCreateRequest = {
3705
+ /**
3706
+ * The group name, trimmed plain text, 1 to 255 characters. `"0"` is a name, and names need not be unique.
3707
+ */
3708
+ name: string;
3709
+ };
3710
+ export type DealGroupUpdateRequest = {
3711
+ /**
3712
+ * The group name, trimmed plain text, 1 to 255 characters; `null` is refused. Names need not be unique.
3713
+ */
3714
+ name: string;
3715
+ };
3716
+ /**
3717
+ * At most one record, named by its id. On an update, the list replaces the records of that kind; `[]` removes them and `null` is `400`.
3718
+ */
3719
+ export type TaskWriteLinks = {
3720
+ id: PublicId;
3721
+ }[];
3722
+ /**
3723
+ * A closed body: any other key (`contacts`, `spaces`, `completed`, `recurrence`, `allDay`, …) is `400`.
3724
+ */
3725
+ export type CreateTaskWithLinksRequest = {
3726
+ /**
3727
+ * Plain text, trimmed, from 1 to 256 characters.
3728
+ */
3729
+ title: string;
3730
+ /**
3731
+ * Plain text.
3732
+ */
3733
+ description?: string | null;
3734
+ priority?: "normal" | "high";
3735
+ type?: null | {
3736
+ id: PublicId;
3737
+ };
3738
+ status?: null | {
3739
+ id: PublicId;
3740
+ };
3741
+ /**
3742
+ * The responsible user. Required on create when the account makes the responsible role mandatory for tasks.
3743
+ */
3744
+ assignee?: null | {
3745
+ id: PublicId;
3746
+ };
3747
+ /**
3748
+ * Defaults to `scheduled` when `startsAt` is sent, else `unscheduled`. `startsAt` or `endsAt` with another value is `422`.
3749
+ */
3750
+ dueType?: "scheduled" | "someday" | "unscheduled";
3751
+ /**
3752
+ * A day `YYYY-MM-DD` (an all-day task in the caller's time zone; an end day is inclusive) or an RFC 3339 instant with an offset (a timed task). `startsAt` and `endsAt` are of one kind.
3753
+ */
3754
+ startsAt?: string;
3755
+ /**
3756
+ * A day `YYYY-MM-DD` (an all-day task in the caller's time zone; an end day is inclusive) or an RFC 3339 instant with an offset (a timed task). `startsAt` and `endsAt` are of one kind.
3757
+ */
3758
+ endsAt?: string;
3759
+ private?: boolean;
3760
+ /**
3761
+ * Users and teams holding the member role. `null` is `400`.
3762
+ */
3763
+ members?: {
3764
+ users?: {
3765
+ id: PublicId;
3766
+ }[];
3767
+ teams?: {
3768
+ id: PublicId;
3769
+ }[];
3770
+ };
3771
+ additionalFields?: AdditionalFieldWriteList;
3772
+ /**
3773
+ * The person the task is linked to.
3774
+ */
3775
+ people?: TaskWriteLinks;
3776
+ /**
3777
+ * The company the task is linked to.
3778
+ */
3779
+ companies?: TaskWriteLinks;
3780
+ /**
3781
+ * The deal the task is linked to.
3782
+ */
3783
+ deals?: TaskWriteLinks;
3784
+ };
3785
+ /**
3786
+ * A closed body: any other key (`contacts`, `spaces`, `completed`, `recurrence`, `allDay`, …) is `400`. Omitted keys stay unchanged; `null` clears a nullable key.
3787
+ */
3788
+ export type UpdateTaskWithLinksRequest = {
3789
+ /**
3790
+ * Plain text, trimmed, from 1 to 256 characters.
3791
+ */
3792
+ title?: string;
3793
+ /**
3794
+ * Plain text.
3795
+ */
3796
+ description?: string | null;
3797
+ priority?: "normal" | "high";
3798
+ type?: null | {
3799
+ id: PublicId;
3800
+ };
3801
+ status?: null | {
3802
+ id: PublicId;
3803
+ };
3804
+ /**
3805
+ * The responsible user. Required on create when the account makes the responsible role mandatory for tasks.
3806
+ */
3807
+ assignee?: null | {
3808
+ id: PublicId;
3809
+ };
3810
+ /**
3811
+ * Defaults to `scheduled` when `startsAt` is sent, else `unscheduled`. `startsAt` or `endsAt` with another value is `422`.
3812
+ */
3813
+ dueType?: "scheduled" | "someday" | "unscheduled";
3814
+ /**
3815
+ * A day `YYYY-MM-DD` (an all-day task in the caller's time zone; an end day is inclusive) or an RFC 3339 instant with an offset (a timed task). `startsAt` and `endsAt` are of one kind.
3816
+ */
3817
+ startsAt?: string;
3818
+ endsAt?: null | string;
3819
+ private?: boolean;
3820
+ /**
3821
+ * Users and teams holding the member role; the list replaces the members, and `{"users": [], "teams": []}` clears them. `null` is refused.
3822
+ */
3823
+ members?: {
3824
+ users?: {
3825
+ id: PublicId;
3826
+ }[];
3827
+ teams?: {
3828
+ id: PublicId;
3829
+ }[];
3830
+ };
3831
+ additionalFields?: AdditionalFieldWriteList;
3832
+ /**
3833
+ * The person the task is linked to.
3834
+ */
3835
+ people?: TaskWriteLinks;
3836
+ /**
3837
+ * The company the task is linked to.
3838
+ */
3839
+ companies?: TaskWriteLinks;
3840
+ /**
3841
+ * The deal the task is linked to.
3842
+ */
3843
+ deals?: TaskWriteLinks;
3844
+ };