@aglyn/plugins-crm 1.24.0 → 1.26.0

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.
@@ -14,7 +14,7 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
14
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
- */ import { booleanField, integerField, isoField, nullableField, objectKindField, openObjectField, postalAddressField, queryParam, RECORD_STAMPS, stringField, stringListField, UPDATED_AFTER_PARAM } from "@aglyn/tenant-data-admin/server/api-v1-description";
17
+ */ import { booleanField, integerField, isoField, nullableField, objectKindField, openObjectField, postalAddressField, queryParam, requiredQueryParam, RECORD_STAMPS, stringField, stringListField, UPDATED_AFTER_PARAM } from "@aglyn/tenant-data-admin/server/api-v1-description";
18
18
  /**
19
19
  * The CRM's resources as the customer API's OpenAPI document describes them
20
20
  * (AGL-2733), keyed by the resource each describes — what the console's
@@ -28,9 +28,16 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
28
28
  */ /** How a company picklist field reads in the description (AGL-3514). */ function companyPicklistNote(label, plural) {
29
29
  return `${label}: one of the organization's active ${plural} (CRM › Fields › Companies), matched ` + 'without regard to case. Any other value is refused with a 400 naming the values allowed; ' + 'the value a company already holds is kept even after it is deactivated.';
30
30
  }
31
+ /**
32
+ * The site a lead belongs to (AGL-4225). A lead is a site's record and its id
33
+ * is unique only within the site, so the handler refuses every lead request
34
+ * without one — and until this was declared, a client reading the document
35
+ * could not know to send it.
36
+ */ const LEAD_SITE_PARAM = requiredQueryParam('siteId', 'Required. The site the lead belongs to — the `id` of a site from `listSites`.');
31
37
  export const CRM_API_V1_DESCRIPTIONS = {
32
38
  contacts: {
33
39
  tag: 'Contacts',
40
+ docsPage: 'contacts',
34
41
  description: 'People, organization-wide. Part of the CRM, which is included from Starter.',
35
42
  schemaName: 'Contact',
36
43
  required: [
@@ -122,30 +129,33 @@ export const CRM_API_V1_DESCRIPTIONS = {
122
129
  list: true,
123
130
  returns: 'Contact',
124
131
  entitlement: 'crm',
125
- description: 'Combining `email` with `tag` narrows on `email` and checks `tag` on the page, so pages can come back short. `lifecycleStage` and `ownerUid` live on a per-site profile and are ALWAYS checked on the page.',
132
+ description: 'Lists the workspace’s contacts: one record per person, with email, name, phone, tags and per-site profile. Filter by exact `email` to find one person.',
126
133
  filters: [
127
- queryParam('email', 'Exact match, normalized the way the write path normalizes it. An unusable value is a 400.'),
128
- queryParam('tag', 'Checked on the page when combined with `email`.'),
129
- queryParam('lifecycleStage', 'Always checked on the page.'),
130
- queryParam('ownerUid', 'Always checked on the page.')
134
+ queryParam('email', 'The contact with this email address. Letter case is ignored; an address that cannot be read is refused.'),
135
+ queryParam('tag', 'Contacts with this tag.'),
136
+ queryParam('lifecycleStage', 'Contacts at this lifecycle stage.'),
137
+ queryParam('ownerUid', 'Contacts owned by this workspace member.')
131
138
  ]
132
139
  },
140
+ // openWorld: after saving, the address’s mail domain is looked up (DNS) to flag addresses that would bounce.
133
141
  {
134
142
  path: '/v1/contacts',
135
143
  method: 'post',
136
144
  operationId: 'createContact',
137
- summary: 'Create a contact',
145
+ summary: 'Add a contact',
138
146
  accepts: 'ContactWrite',
139
147
  returns: 'Contact',
140
148
  entitlement: 'crm',
141
149
  creates: true,
142
- description: 'A duplicate email is `409 conflict` (`code: "contact_exists"`), and the message names the existing id.'
150
+ description: 'Adds a person to the workspace’s contacts. An email address is a contact’s identity: one that already belongs to a contact is refused, naming the existing contact’s id. Returns the new contact.',
151
+ openWorld: true
143
152
  },
144
153
  {
145
154
  path: '/v1/contacts/{contactId}',
146
155
  method: 'get',
147
156
  operationId: 'getContact',
148
- summary: 'Retrieve a contact',
157
+ summary: 'Get a contact',
158
+ description: 'Returns one contact. Needs `contactId` from List contacts.',
149
159
  returns: 'Contact',
150
160
  entitlement: 'crm',
151
161
  pathParams: [
@@ -160,6 +170,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
160
170
  method: 'patch',
161
171
  operationId: 'updateContact',
162
172
  summary: 'Update a contact',
173
+ description: 'Changes a contact’s details; fields not sent stay as they are. The email address cannot be changed. Needs `contactId` from List contacts. Returns the updated contact.',
163
174
  accepts: 'ContactWrite',
164
175
  returns: 'Contact',
165
176
  entitlement: 'crm',
@@ -175,6 +186,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
175
186
  method: 'delete',
176
187
  operationId: 'deleteContact',
177
188
  summary: 'Delete a contact',
189
+ description: 'Removes a person from the workspace’s contacts, with the tags, notes, timeline and consent the workspace’s sites hold for them. Permanent. Needs `contactId` from List contacts.',
178
190
  returns: 'Deleted',
179
191
  entitlement: 'crm',
180
192
  pathParams: [
@@ -189,6 +201,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
189
201
  method: 'post',
190
202
  operationId: 'mergeContact',
191
203
  summary: 'Merge two contacts',
204
+ description: 'Folds one contact into another: the contact in `contactId` survives and keeps its email, and the contact named in `sourceContactId` is merged into it and deleted. Permanent. Returns the surviving contact.',
192
205
  accepts: 'ContactMerge',
193
206
  returns: 'Contact',
194
207
  entitlement: 'crm',
@@ -198,7 +211,8 @@ export const CRM_API_V1_DESCRIPTIONS = {
198
211
  name: 'contactId',
199
212
  description: 'The contact that survives.'
200
213
  }
201
- ]
214
+ ],
215
+ idempotent: true
202
216
  }
203
217
  ],
204
218
  components: {
@@ -220,6 +234,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
220
234
  },
221
235
  companies: {
222
236
  tag: 'Companies',
237
+ docsPage: 'companies',
223
238
  description: 'Organizations in the CRM.',
224
239
  schemaName: 'Company',
225
240
  required: [
@@ -300,6 +315,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
300
315
  method: 'get',
301
316
  operationId: 'listCompanies',
302
317
  summary: 'List companies',
318
+ description: 'Lists the companies in the workspace’s CRM. Filter by exact `domain` to find one.',
303
319
  list: true,
304
320
  returns: 'Company',
305
321
  entitlement: 'crm',
@@ -313,18 +329,22 @@ export const CRM_API_V1_DESCRIPTIONS = {
313
329
  path: '/v1/companies',
314
330
  method: 'post',
315
331
  operationId: 'createCompany',
316
- summary: 'Create a company',
332
+ summary: 'Add a company',
317
333
  accepts: 'CompanyWrite',
318
334
  returns: 'Company',
319
335
  entitlement: 'crm',
320
336
  creates: true,
321
- description: 'A duplicate domain is `409 conflict` (`code: "company_exists"`), naming the existing id.'
337
+ description: 'Adds a company to the CRM. Needs a `name`. A company whose domain is already in the CRM is refused, naming the existing id. Returns the new company.',
338
+ bodyRequires: [
339
+ 'name'
340
+ ]
322
341
  },
323
342
  {
324
343
  path: '/v1/companies/{companyId}',
325
344
  method: 'get',
326
345
  operationId: 'getCompany',
327
- summary: 'Retrieve a company',
346
+ summary: 'Get a company',
347
+ description: 'Returns one company. Needs `companyId` from List companies.',
328
348
  returns: 'Company',
329
349
  entitlement: 'crm',
330
350
  pathParams: [
@@ -339,6 +359,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
339
359
  method: 'patch',
340
360
  operationId: 'updateCompany',
341
361
  summary: 'Update a company',
362
+ description: 'Changes a company’s details; fields not sent stay as they are. Needs `companyId` from List companies. Returns the updated company.',
342
363
  accepts: 'CompanyWrite',
343
364
  returns: 'Company',
344
365
  entitlement: 'crm',
@@ -354,6 +375,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
354
375
  method: 'delete',
355
376
  operationId: 'deleteCompany',
356
377
  summary: 'Delete a company',
378
+ description: 'Deletes a company permanently. Needs `companyId` from List companies.',
357
379
  returns: 'Deleted',
358
380
  entitlement: 'crm',
359
381
  pathParams: [
@@ -367,6 +389,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
367
389
  },
368
390
  pipelines: {
369
391
  tag: 'Pipelines',
392
+ docsPage: 'pipelines',
370
393
  description: 'Deal pipelines and their stages. Read-only over the API.',
371
394
  schemaName: 'Pipeline',
372
395
  required: [
@@ -431,7 +454,8 @@ export const CRM_API_V1_DESCRIPTIONS = {
431
454
  path: '/v1/pipelines',
432
455
  method: 'get',
433
456
  operationId: 'listPipelines',
434
- summary: 'List pipelines',
457
+ summary: 'List deal pipelines',
458
+ description: 'Lists the workspace’s sales pipelines and their stages. A stage’s id is the `stageId` a deal takes.',
435
459
  list: true,
436
460
  returns: 'Pipeline',
437
461
  entitlement: 'crm',
@@ -443,7 +467,8 @@ export const CRM_API_V1_DESCRIPTIONS = {
443
467
  path: '/v1/pipelines/{pipelineId}',
444
468
  method: 'get',
445
469
  operationId: 'getPipeline',
446
- summary: 'Retrieve a pipeline',
470
+ summary: 'Get a deal pipeline',
471
+ description: 'Returns one pipeline and its stages. Needs `pipelineId` from List deal pipelines.',
447
472
  returns: 'Pipeline',
448
473
  entitlement: 'crm',
449
474
  pathParams: [
@@ -457,6 +482,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
457
482
  },
458
483
  deals: {
459
484
  tag: 'Deals',
485
+ docsPage: 'deals',
460
486
  description: 'Opportunities moving through a pipeline.',
461
487
  schemaName: 'Deal',
462
488
  required: [
@@ -553,6 +579,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
553
579
  method: 'get',
554
580
  operationId: 'listDeals',
555
581
  summary: 'List deals',
582
+ description: 'Lists the workspace’s deals with their pipeline, stage, amount and status. Filter by pipeline, stage, status or owner.',
556
583
  list: true,
557
584
  returns: 'Deal',
558
585
  entitlement: 'crm',
@@ -572,17 +599,22 @@ export const CRM_API_V1_DESCRIPTIONS = {
572
599
  path: '/v1/deals',
573
600
  method: 'post',
574
601
  operationId: 'createDeal',
575
- summary: 'Create a deal',
602
+ summary: 'Add a deal',
603
+ description: 'Opens a deal. Needs a `title`; `pipelineId` and `stageId` come from List deal pipelines. Returns the new deal.',
576
604
  accepts: 'DealWrite',
577
605
  returns: 'Deal',
578
606
  entitlement: 'crm',
579
- creates: true
607
+ creates: true,
608
+ bodyRequires: [
609
+ 'title'
610
+ ]
580
611
  },
581
612
  {
582
613
  path: '/v1/deals/{dealId}',
583
614
  method: 'get',
584
615
  operationId: 'getDeal',
585
- summary: 'Retrieve a deal',
616
+ summary: 'Get a deal',
617
+ description: 'Returns one deal. Needs `dealId` from List deals.',
586
618
  returns: 'Deal',
587
619
  entitlement: 'crm',
588
620
  pathParams: [
@@ -597,6 +629,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
597
629
  method: 'patch',
598
630
  operationId: 'updateDeal',
599
631
  summary: 'Update a deal',
632
+ description: 'Changes a deal, including moving it to another stage or marking it won or lost; fields not sent stay as they are. Needs `dealId` from List deals. Returns the updated deal.',
600
633
  accepts: 'DealWrite',
601
634
  returns: 'Deal',
602
635
  entitlement: 'crm',
@@ -612,6 +645,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
612
645
  method: 'delete',
613
646
  operationId: 'deleteDeal',
614
647
  summary: 'Delete a deal',
648
+ description: 'Deletes a deal permanently. Needs `dealId` from List deals.',
615
649
  returns: 'Deleted',
616
650
  entitlement: 'crm',
617
651
  pathParams: [
@@ -625,6 +659,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
625
659
  },
626
660
  tasks: {
627
661
  tag: 'Tasks',
662
+ docsPage: 'tasks',
628
663
  description: 'Follow-ups attached to CRM records.',
629
664
  schemaName: 'Task',
630
665
  required: [
@@ -677,6 +712,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
677
712
  method: 'get',
678
713
  operationId: 'listTasks',
679
714
  summary: 'List tasks',
715
+ description: 'Lists the workspace’s CRM tasks. Filter by status, assignee, contact or deal.',
680
716
  list: true,
681
717
  returns: 'Task',
682
718
  entitlement: 'crm',
@@ -692,17 +728,22 @@ export const CRM_API_V1_DESCRIPTIONS = {
692
728
  path: '/v1/tasks',
693
729
  method: 'post',
694
730
  operationId: 'createTask',
695
- summary: 'Create a task',
731
+ summary: 'Add a task',
732
+ description: 'Creates a task, such as a follow-up, with a `title` and optionally a due date, a reminder and the contact, company or deal it is about. Returns the new task.',
696
733
  accepts: 'TaskWrite',
697
734
  returns: 'Task',
698
735
  entitlement: 'crm',
699
- creates: true
736
+ creates: true,
737
+ bodyRequires: [
738
+ 'title'
739
+ ]
700
740
  },
701
741
  {
702
742
  path: '/v1/tasks/{taskId}',
703
743
  method: 'get',
704
744
  operationId: 'getTask',
705
- summary: 'Retrieve a task',
745
+ summary: 'Get a task',
746
+ description: 'Returns one task. Needs `taskId` from List tasks.',
706
747
  returns: 'Task',
707
748
  entitlement: 'crm',
708
749
  pathParams: [
@@ -717,6 +758,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
717
758
  method: 'patch',
718
759
  operationId: 'updateTask',
719
760
  summary: 'Update a task',
761
+ description: 'Changes a task, including marking it done; fields not sent stay as they are. Needs `taskId` from List tasks. Returns the updated task.',
720
762
  accepts: 'TaskWrite',
721
763
  returns: 'Task',
722
764
  entitlement: 'crm',
@@ -732,6 +774,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
732
774
  method: 'delete',
733
775
  operationId: 'deleteTask',
734
776
  summary: 'Delete a task',
777
+ description: 'Deletes a task permanently. Needs `taskId` from List tasks.',
735
778
  returns: 'Deleted',
736
779
  entitlement: 'crm',
737
780
  pathParams: [
@@ -745,6 +788,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
745
788
  },
746
789
  activities: {
747
790
  tag: 'Activities',
791
+ docsPage: 'activities',
748
792
  description: 'Logged interactions. Append-only: no PATCH.',
749
793
  schemaName: 'Activity',
750
794
  required: [
@@ -794,6 +838,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
794
838
  method: 'get',
795
839
  operationId: 'listActivities',
796
840
  summary: 'List activities',
841
+ description: 'Lists the calls, emails, meetings and notes logged in the CRM. Filter by kind, contact or deal.',
797
842
  list: true,
798
843
  returns: 'Activity',
799
844
  entitlement: 'crm',
@@ -809,6 +854,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
809
854
  method: 'post',
810
855
  operationId: 'createActivity',
811
856
  summary: 'Log an activity',
857
+ description: 'Records a call, email, meeting or note against a contact, company or deal. Needs the activity’s text in `body`. Returns the logged activity. Logging an email records it; it does not send one.',
812
858
  accepts: 'ActivityWrite',
813
859
  returns: 'Activity',
814
860
  entitlement: 'crm',
@@ -818,7 +864,8 @@ export const CRM_API_V1_DESCRIPTIONS = {
818
864
  path: '/v1/activities/{activityId}',
819
865
  method: 'get',
820
866
  operationId: 'getActivity',
821
- summary: 'Retrieve an activity',
867
+ summary: 'Get an activity',
868
+ description: 'Returns one logged activity. Needs `activityId` from List activities.',
822
869
  returns: 'Activity',
823
870
  entitlement: 'crm',
824
871
  pathParams: [
@@ -833,6 +880,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
833
880
  method: 'delete',
834
881
  operationId: 'deleteActivity',
835
882
  summary: 'Delete an activity',
883
+ description: 'Deletes a logged activity permanently. Needs `activityId` from List activities.',
836
884
  returns: 'Deleted',
837
885
  entitlement: 'crm',
838
886
  pathParams: [
@@ -846,6 +894,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
846
894
  },
847
895
  leads: {
848
896
  tag: 'Leads',
897
+ docsPage: 'leads',
849
898
  description: 'Unqualified interest, before it becomes a contact. A lead is a record of its own: the person and their company as text, until converting makes the contact and the company.',
850
899
  schemaName: 'Lead',
851
900
  required: [
@@ -937,33 +986,42 @@ export const CRM_API_V1_DESCRIPTIONS = {
937
986
  path: '/v1/leads',
938
987
  method: 'get',
939
988
  operationId: 'listLeads',
940
- summary: 'List leads',
989
+ summary: 'List a site’s leads',
990
+ description: 'Lists the leads one site has captured, not yet converted into contacts. Needs `siteId` from List sites. Filter by status or owner.',
941
991
  list: true,
942
992
  returns: 'Lead',
943
993
  entitlement: 'crm',
944
994
  filters: [
945
995
  UPDATED_AFTER_PARAM,
946
- queryParam('siteId', 'Site the lead arrived on.'),
996
+ LEAD_SITE_PARAM,
947
997
  queryParam('status', 'Lead status.'),
948
998
  queryParam('ownerUid', 'Owning user.')
949
999
  ]
950
1000
  },
1001
+ // openWorld: after saving, the address’s mail domain is looked up (DNS) to flag addresses that would bounce.
951
1002
  {
952
1003
  path: '/v1/leads',
953
1004
  method: 'post',
954
1005
  operationId: 'createLead',
955
- summary: 'Create a lead',
1006
+ summary: 'Add a lead to a site',
956
1007
  accepts: 'LeadWrite',
957
1008
  returns: 'Lead',
958
1009
  entitlement: 'crm',
959
1010
  creates: true,
960
- description: 'A lead sourced outside the site, entered before anyone has qualified it. One address is one lead per site: creating one the site already holds updates it and answers 200. No contact and no company are created — converting the lead does that — and no marketing consent is recorded.'
1011
+ description: 'Adds a lead to one site. Needs `siteId` from List sites and the lead’s `email`. One email is one lead per site: adding an address the site already holds updates that lead. No contact is created until the lead is converted. Returns the lead.',
1012
+ idempotent: true,
1013
+ openWorld: true,
1014
+ bodyRequires: [
1015
+ 'siteId',
1016
+ 'email'
1017
+ ]
961
1018
  },
962
1019
  {
963
1020
  path: '/v1/leads/{leadId}',
964
1021
  method: 'get',
965
1022
  operationId: 'getLead',
966
- summary: 'Retrieve a lead',
1023
+ summary: 'Get a lead',
1024
+ description: 'Returns one lead. Needs `siteId` from List sites and `leadId` from List a site’s leads.',
967
1025
  returns: 'Lead',
968
1026
  entitlement: 'crm',
969
1027
  pathParams: [
@@ -971,6 +1029,9 @@ export const CRM_API_V1_DESCRIPTIONS = {
971
1029
  name: 'leadId',
972
1030
  description: 'Lead id.'
973
1031
  }
1032
+ ],
1033
+ filters: [
1034
+ LEAD_SITE_PARAM
974
1035
  ]
975
1036
  },
976
1037
  {
@@ -978,6 +1039,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
978
1039
  method: 'patch',
979
1040
  operationId: 'updateLead',
980
1041
  summary: 'Update a lead',
1042
+ description: 'Changes a lead, including its status; fields not sent stay as they are. Needs `siteId` from List sites and `leadId` from List a site’s leads. Returns the updated lead.',
981
1043
  accepts: 'LeadWrite',
982
1044
  returns: 'Lead',
983
1045
  entitlement: 'crm',
@@ -986,28 +1048,68 @@ export const CRM_API_V1_DESCRIPTIONS = {
986
1048
  name: 'leadId',
987
1049
  description: 'Lead id.'
988
1050
  }
1051
+ ],
1052
+ filters: [
1053
+ LEAD_SITE_PARAM
989
1054
  ]
990
1055
  },
1056
+ // openWorld: the contact it creates has its mail domain looked up (DNS) to flag addresses that would bounce.
991
1057
  {
992
1058
  path: '/v1/leads/{leadId}/convert',
993
1059
  method: 'post',
994
1060
  operationId: 'convertLead',
995
- summary: 'Convert a lead',
1061
+ summary: 'Convert a lead into a contact',
1062
+ accepts: 'LeadConvertRequest',
1063
+ bodyOptional: true,
996
1064
  returns: 'LeadConversion',
997
1065
  entitlement: 'crm',
998
- description: 'Creates a contact, and optionally a company and a deal. Idempotent on the lead: converting an already-converted lead returns the existing ids.',
1066
+ description: 'Turns a lead into a contact, joining an existing contact with the same email, and can also link or create a company and open a deal. Needs `siteId` from List sites and `leadId` from List a site’s leads. Converting a lead again returns the same ids.',
999
1067
  pathParams: [
1000
1068
  {
1001
1069
  name: 'leadId',
1002
1070
  description: 'Lead id.'
1003
1071
  }
1072
+ ],
1073
+ idempotent: true,
1074
+ openWorld: true,
1075
+ filters: [
1076
+ LEAD_SITE_PARAM
1004
1077
  ]
1005
1078
  }
1006
1079
  ],
1007
1080
  components: {
1081
+ LeadConvertRequest: {
1082
+ type: 'object',
1083
+ description: 'Optional. What else the conversion does besides creating the contact. ' + 'Leave it out to convert the lead into a contact alone.',
1084
+ properties: {
1085
+ company: {
1086
+ type: [
1087
+ 'object',
1088
+ 'null'
1089
+ ],
1090
+ description: 'A company for the contact: `{ "link": "<companyId>" }` to link one from List companies, ' + '`{ "create": { "name": "…", "domain": "…" } }` to add one (an existing company with that ' + 'name or domain is reused), or null for none.'
1091
+ },
1092
+ deal: {
1093
+ type: [
1094
+ 'object',
1095
+ 'null'
1096
+ ],
1097
+ description: 'A deal to open in the default pipeline: `{ "title": "…", "amountCents": 12500, "currency": ' + '"usd", "stageId": "…", "type": "…" }`. `title` is required; the rest is optional. Null for none.'
1098
+ },
1099
+ ownerUid: {
1100
+ type: 'string',
1101
+ description: 'Workspace member who owns the contact and the deal. Defaults to the lead’s owner.'
1102
+ },
1103
+ ownerEmail: {
1104
+ type: 'string',
1105
+ description: 'The owner by email address, instead of `ownerUid`.'
1106
+ }
1107
+ },
1108
+ additionalProperties: false
1109
+ },
1008
1110
  LeadConversion: {
1009
1111
  type: 'object',
1010
- description: 'What the conversion produced. Idempotent on the lead: converting an ' + 'already-converted lead returns the existing ids rather than creating ' + 'a second set.',
1112
+ description: 'What the conversion produced: the contact, and the company and deal ' + 'when it made or linked them. Converting the same lead again returns ' + 'the same ids.',
1011
1113
  properties: {
1012
1114
  object: {
1013
1115
  type: 'string',
@@ -1035,6 +1137,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
1035
1137
  },
1036
1138
  'email-templates': {
1037
1139
  tag: 'Email templates',
1140
+ docsPage: 'email-templates',
1038
1141
  description: 'Reusable email bodies.',
1039
1142
  schemaName: 'EmailTemplate',
1040
1143
  required: [
@@ -1072,6 +1175,7 @@ export const CRM_API_V1_DESCRIPTIONS = {
1072
1175
  method: 'get',
1073
1176
  operationId: 'listEmailTemplates',
1074
1177
  summary: 'List email templates',
1178
+ description: 'Lists the workspace’s saved email templates with their name, subject and kind.',
1075
1179
  list: true,
1076
1180
  returns: 'EmailTemplate',
1077
1181
  entitlement: 'crm',
@@ -1085,17 +1189,23 @@ export const CRM_API_V1_DESCRIPTIONS = {
1085
1189
  path: '/v1/email-templates',
1086
1190
  method: 'post',
1087
1191
  operationId: 'createEmailTemplate',
1088
- summary: 'Create a template',
1192
+ summary: 'Add an email template',
1193
+ description: 'Saves a reusable email with a `name`, a subject and the message in `body`. Saving a template sends nothing. Returns the new template.',
1089
1194
  accepts: 'EmailTemplateWrite',
1090
1195
  returns: 'EmailTemplate',
1091
1196
  entitlement: 'crm',
1092
- creates: true
1197
+ creates: true,
1198
+ bodyRequires: [
1199
+ 'name',
1200
+ 'body'
1201
+ ]
1093
1202
  },
1094
1203
  {
1095
1204
  path: '/v1/email-templates/{templateId}',
1096
1205
  method: 'get',
1097
1206
  operationId: 'getEmailTemplate',
1098
- summary: 'Retrieve a template',
1207
+ summary: 'Get an email template',
1208
+ description: 'Returns one email template. Needs `templateId` from List email templates.',
1099
1209
  returns: 'EmailTemplate',
1100
1210
  entitlement: 'crm',
1101
1211
  pathParams: [
@@ -1109,7 +1219,8 @@ export const CRM_API_V1_DESCRIPTIONS = {
1109
1219
  path: '/v1/email-templates/{templateId}',
1110
1220
  method: 'patch',
1111
1221
  operationId: 'updateEmailTemplate',
1112
- summary: 'Update a template',
1222
+ summary: 'Update an email template',
1223
+ description: 'Changes a template; fields not sent stay as they are. Needs `templateId` from List email templates. Returns the updated template.',
1113
1224
  accepts: 'EmailTemplateWrite',
1114
1225
  returns: 'EmailTemplate',
1115
1226
  entitlement: 'crm',
@@ -1124,7 +1235,8 @@ export const CRM_API_V1_DESCRIPTIONS = {
1124
1235
  path: '/v1/email-templates/{templateId}',
1125
1236
  method: 'delete',
1126
1237
  operationId: 'deleteEmailTemplate',
1127
- summary: 'Delete a template',
1238
+ summary: 'Delete an email template',
1239
+ description: 'Deletes a template permanently. Needs `templateId` from List email templates.',
1128
1240
  returns: 'Deleted',
1129
1241
  entitlement: 'crm',
1130
1242
  pathParams: [