@dakkitor/api-contracts 1.1.130 → 1.1.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/call-history/call-history.contract.d.ts +765 -717
- package/dist/call-history/call-history.contract.d.ts.map +1 -1
- package/dist/call-history/call-history.contract.js +84 -60
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/leads/leads.contract.d.ts +160 -102
- package/dist/leads/leads.contract.d.ts.map +1 -1
- package/dist/leads/leads.contract.js +126 -116
- package/dist/own-research/own-research.contract.d.ts +1736 -0
- package/dist/own-research/own-research.contract.d.ts.map +1 -0
- package/dist/own-research/own-research.contract.js +189 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leads.contract.d.ts","sourceRoot":"","sources":["../../contracts/leads/leads.contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB;;GAEG;AACH,eAAO,MAAM,gBAAgB,qDAEM,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"leads.contract.d.ts","sourceRoot":"","sources":["../../contracts/leads/leads.contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB;;GAEG;AACH,eAAO,MAAM,gBAAgB,qDAEM,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,wBAAwB,kJAaM,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,iBAAiB,kDAEM,CAAC;AAErC,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,K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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuG/B,CAAC"}
|
|
@@ -14,97 +14,104 @@ const pagination_schema_1 = require("../common/pagination.schema");
|
|
|
14
14
|
* Lead Status Enum
|
|
15
15
|
*/
|
|
16
16
|
exports.LeadStatusSchema = zod_1.z
|
|
17
|
-
.enum([
|
|
18
|
-
.openapi({ title:
|
|
17
|
+
.enum(["AVAILABLE", "ASSIGNED", "BLACKLISTED"])
|
|
18
|
+
.openapi({ title: "LeadStatus" });
|
|
19
19
|
/**
|
|
20
20
|
* Lead Sortable Fields Enum
|
|
21
21
|
*/
|
|
22
22
|
exports.LeadSortableFieldsSchema = zod_1.z
|
|
23
23
|
.enum([
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
"name",
|
|
25
|
+
"phoneNumber",
|
|
26
|
+
"status",
|
|
27
|
+
"source",
|
|
28
|
+
"lastCalledAt",
|
|
29
|
+
"qualityScore",
|
|
30
|
+
"conversionRate",
|
|
31
|
+
"totalCalls",
|
|
32
|
+
"createdAt",
|
|
33
|
+
"updatedAt",
|
|
33
34
|
])
|
|
34
|
-
.openapi({ title:
|
|
35
|
+
.openapi({ title: "LeadSortableFields" });
|
|
35
36
|
/**
|
|
36
37
|
* Quality Tier Enum
|
|
37
38
|
*/
|
|
38
39
|
exports.QualityTierSchema = zod_1.z
|
|
39
|
-
.enum([
|
|
40
|
-
.openapi({ title:
|
|
40
|
+
.enum(["high", "medium", "low", "untested"])
|
|
41
|
+
.openapi({ title: "QualityTier" });
|
|
41
42
|
/**
|
|
42
43
|
* Main Lead Schema
|
|
43
44
|
*/
|
|
44
45
|
exports.LeadSchema = zod_1.z
|
|
45
46
|
.object({
|
|
46
|
-
id: zod_1.z.string().uuid().describe(
|
|
47
|
-
name: zod_1.z.string().describe(
|
|
48
|
-
phoneNumber: zod_1.z.string().describe(
|
|
49
|
-
status: exports.LeadStatusSchema.describe(
|
|
47
|
+
id: zod_1.z.string().uuid().describe("Lead ID"),
|
|
48
|
+
name: zod_1.z.string().describe("Company Name"),
|
|
49
|
+
phoneNumber: zod_1.z.string().describe("Phone Number"),
|
|
50
|
+
status: exports.LeadStatusSchema.describe("Lead Status"),
|
|
50
51
|
blacklistReason: zod_1.z
|
|
51
52
|
.string()
|
|
52
53
|
.optional()
|
|
53
54
|
.nullable()
|
|
54
|
-
.describe(
|
|
55
|
-
source: zod_1.z.string().describe(
|
|
55
|
+
.describe("Reason for Blacklisting"),
|
|
56
|
+
source: zod_1.z.string().describe("Lead Source"),
|
|
57
|
+
lastCalledAt: zod_1.z
|
|
58
|
+
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
59
|
+
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
60
|
+
.describe("Last Called Date")
|
|
61
|
+
.optional()
|
|
62
|
+
.nullable(),
|
|
56
63
|
qualityScore: zod_1.z
|
|
57
64
|
.number()
|
|
58
65
|
.min(0)
|
|
59
66
|
.max(1)
|
|
60
67
|
.optional()
|
|
61
68
|
.nullable()
|
|
62
|
-
.describe(
|
|
69
|
+
.describe("Overall Quality Score"),
|
|
63
70
|
qualityTier: exports.QualityTierSchema.optional()
|
|
64
71
|
.nullable()
|
|
65
|
-
.describe(
|
|
72
|
+
.describe("Quality Tier Classification"),
|
|
66
73
|
conversionRate: zod_1.z
|
|
67
74
|
.number()
|
|
68
75
|
.min(0)
|
|
69
76
|
.max(1)
|
|
70
77
|
.optional()
|
|
71
78
|
.nullable()
|
|
72
|
-
.describe(
|
|
73
|
-
totalCalls: zod_1.z.number().int().optional().nullable().describe(
|
|
79
|
+
.describe("Conversion Rate"),
|
|
80
|
+
totalCalls: zod_1.z.number().int().optional().nullable().describe("Total Calls"),
|
|
74
81
|
createdAt: zod_1.z
|
|
75
82
|
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
76
83
|
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
77
|
-
.describe(
|
|
84
|
+
.describe("Creation Date"),
|
|
78
85
|
updatedAt: zod_1.z
|
|
79
86
|
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
80
87
|
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
81
|
-
.describe(
|
|
88
|
+
.describe("Last Update Date"),
|
|
82
89
|
})
|
|
83
|
-
.openapi({ title:
|
|
90
|
+
.openapi({ title: "Lead" });
|
|
84
91
|
/**
|
|
85
92
|
* Create Lead Schema
|
|
86
93
|
*/
|
|
87
94
|
exports.CreateLeadSchema = zod_1.z
|
|
88
95
|
.object({
|
|
89
|
-
name: zod_1.z.string().max(255).describe(
|
|
90
|
-
phoneNumber: zod_1.z.string().max(20).describe(
|
|
91
|
-
status: exports.LeadStatusSchema.optional().describe(
|
|
92
|
-
isBlacklisted: zod_1.z.boolean().default(false).describe(
|
|
96
|
+
name: zod_1.z.string().max(255).describe("Company Name"),
|
|
97
|
+
phoneNumber: zod_1.z.string().max(20).describe("Phone Number"),
|
|
98
|
+
status: exports.LeadStatusSchema.optional().describe("Lead Status"),
|
|
99
|
+
isBlacklisted: zod_1.z.boolean().default(false).describe("Is Blacklisted"),
|
|
93
100
|
blacklistReason: zod_1.z
|
|
94
101
|
.string()
|
|
95
102
|
.max(500)
|
|
96
103
|
.optional()
|
|
97
104
|
.nullable()
|
|
98
|
-
.describe(
|
|
99
|
-
source: zod_1.z.string().max(100).describe(
|
|
105
|
+
.describe("Reason for Blacklisting"),
|
|
106
|
+
source: zod_1.z.string().max(100).describe("Lead Source"),
|
|
100
107
|
})
|
|
101
|
-
.openapi({ title:
|
|
108
|
+
.openapi({ title: "CreateLead" })
|
|
102
109
|
.superRefine((data, ctx) => {
|
|
103
|
-
if (data.status ===
|
|
110
|
+
if (data.status === "BLACKLISTED" && !data.blacklistReason) {
|
|
104
111
|
ctx.addIssue({
|
|
105
112
|
code: zod_1.z.ZodIssueCode.custom,
|
|
106
|
-
message:
|
|
107
|
-
path: [
|
|
113
|
+
message: "blacklistReason is required when status is BLACKLISTED",
|
|
114
|
+
path: ["blacklistReason"],
|
|
108
115
|
});
|
|
109
116
|
}
|
|
110
117
|
});
|
|
@@ -113,23 +120,23 @@ exports.CreateLeadSchema = zod_1.z
|
|
|
113
120
|
*/
|
|
114
121
|
exports.UpdateLeadSchema = zod_1.z
|
|
115
122
|
.object({
|
|
116
|
-
name: zod_1.z.string().max(255).optional().describe(
|
|
117
|
-
phoneNumber: zod_1.z.string().max(20).optional().describe(
|
|
118
|
-
status: exports.LeadStatusSchema.optional().describe(
|
|
123
|
+
name: zod_1.z.string().max(255).optional().describe("Company Name"),
|
|
124
|
+
phoneNumber: zod_1.z.string().max(20).optional().describe("Phone Number"),
|
|
125
|
+
status: exports.LeadStatusSchema.optional().describe("Lead Status"),
|
|
119
126
|
blacklistReason: zod_1.z
|
|
120
127
|
.string()
|
|
121
128
|
.optional()
|
|
122
129
|
.nullable()
|
|
123
|
-
.describe(
|
|
124
|
-
source: zod_1.z.string().max(100).optional().describe(
|
|
130
|
+
.describe("Reason for Blacklisting"),
|
|
131
|
+
source: zod_1.z.string().max(100).optional().describe("Lead Source"),
|
|
125
132
|
})
|
|
126
|
-
.openapi({ title:
|
|
133
|
+
.openapi({ title: "UpdateLead" })
|
|
127
134
|
.superRefine((data, ctx) => {
|
|
128
|
-
if (data.status ===
|
|
135
|
+
if (data.status === "BLACKLISTED" && !data.blacklistReason) {
|
|
129
136
|
ctx.addIssue({
|
|
130
137
|
code: zod_1.z.ZodIssueCode.custom,
|
|
131
|
-
message:
|
|
132
|
-
path: [
|
|
138
|
+
message: "blacklistReason is required when status is BLACKLISTED",
|
|
139
|
+
path: ["blacklistReason"],
|
|
133
140
|
});
|
|
134
141
|
}
|
|
135
142
|
});
|
|
@@ -141,204 +148,207 @@ exports.FilterLeadSchema = pagination_query_schema_1.PaginationQuerySchema.exten
|
|
|
141
148
|
.string()
|
|
142
149
|
.optional()
|
|
143
150
|
.nullable()
|
|
144
|
-
.describe(
|
|
151
|
+
.describe("Filter by company name (case-insensitive, partial match)"),
|
|
145
152
|
phoneNumber: zod_1.z
|
|
146
153
|
.string()
|
|
147
154
|
.optional()
|
|
148
155
|
.nullable()
|
|
149
|
-
.describe(
|
|
156
|
+
.describe("Filter by phone number (partial match)"),
|
|
150
157
|
status: exports.LeadStatusSchema.optional()
|
|
151
158
|
.nullable()
|
|
152
|
-
.describe(
|
|
159
|
+
.describe("Filter by lead status"),
|
|
153
160
|
source: zod_1.z
|
|
154
161
|
.string()
|
|
155
162
|
.optional()
|
|
156
163
|
.nullable()
|
|
157
|
-
.describe(
|
|
164
|
+
.describe("Filter by source (case-insensitive, partial match)"),
|
|
158
165
|
minQualityScore: zod_1.z
|
|
159
166
|
.number()
|
|
160
167
|
.min(0)
|
|
161
168
|
.max(1)
|
|
162
169
|
.optional()
|
|
163
170
|
.nullable()
|
|
164
|
-
.describe(
|
|
171
|
+
.describe("Filter by minimum quality score (0-1)"),
|
|
165
172
|
maxQualityScore: zod_1.z
|
|
166
173
|
.number()
|
|
167
174
|
.min(0)
|
|
168
175
|
.max(1)
|
|
169
176
|
.optional()
|
|
170
177
|
.nullable()
|
|
171
|
-
.describe(
|
|
178
|
+
.describe("Filter by maximum quality score (0-1)"),
|
|
172
179
|
qualityTier: exports.QualityTierSchema.optional()
|
|
173
180
|
.nullable()
|
|
174
|
-
.describe(
|
|
181
|
+
.describe("Filter by quality tier"),
|
|
175
182
|
minConversionRate: zod_1.z
|
|
176
183
|
.number()
|
|
177
184
|
.min(0)
|
|
178
185
|
.max(1)
|
|
179
186
|
.optional()
|
|
180
187
|
.nullable()
|
|
181
|
-
.describe(
|
|
188
|
+
.describe("Filter by minimum conversion rate (0-1)"),
|
|
182
189
|
minTotalCalls: zod_1.z
|
|
183
190
|
.number()
|
|
184
191
|
.int()
|
|
185
192
|
.min(0)
|
|
186
193
|
.optional()
|
|
187
194
|
.nullable()
|
|
188
|
-
.describe(
|
|
195
|
+
.describe("Filter by minimum total calls"),
|
|
196
|
+
lastCalledAt: common_schemas_1.DateRangeSchema.optional()
|
|
197
|
+
.nullable()
|
|
198
|
+
.describe("Filter by last called date range"),
|
|
189
199
|
sortBy: exports.LeadSortableFieldsSchema.optional()
|
|
190
200
|
.nullable()
|
|
191
|
-
.describe(
|
|
201
|
+
.describe("The field to sort the results by"),
|
|
192
202
|
sortOrder: common_schemas_1.SortOrderSchema.optional()
|
|
193
203
|
.nullable()
|
|
194
|
-
.describe(
|
|
204
|
+
.describe("The order to sort the results by"),
|
|
195
205
|
});
|
|
196
206
|
/**
|
|
197
207
|
* Call History Response Schema for leads
|
|
198
208
|
*/
|
|
199
209
|
exports.LeadCallHistoryResponseSchema = zod_1.z
|
|
200
210
|
.object({
|
|
201
|
-
id: zod_1.z.string().uuid().describe(
|
|
202
|
-
assignmentId: zod_1.z.string().uuid().describe(
|
|
203
|
-
leadId: zod_1.z.string().uuid().describe(
|
|
204
|
-
agentId: zod_1.z.string().uuid().describe(
|
|
211
|
+
id: zod_1.z.string().uuid().describe("Call History ID"),
|
|
212
|
+
assignmentId: zod_1.z.string().uuid().describe("Assignment ID"),
|
|
213
|
+
leadId: zod_1.z.string().uuid().describe("Lead ID"),
|
|
214
|
+
agentId: zod_1.z.string().uuid().describe("Agent ID"),
|
|
205
215
|
callDate: zod_1.z
|
|
206
216
|
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
207
217
|
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
208
|
-
.describe(
|
|
209
|
-
callType: call_history_contract_1.CallTypeSchema.describe(
|
|
210
|
-
rating: call_history_contract_1.CallRatingSchema.describe(
|
|
211
|
-
ratingWeight: zod_1.z.number().describe(
|
|
212
|
-
notes: zod_1.z.string().nullable().optional().describe(
|
|
218
|
+
.describe("Call Date"),
|
|
219
|
+
callType: call_history_contract_1.CallTypeSchema.describe("Call Type"),
|
|
220
|
+
rating: call_history_contract_1.CallRatingSchema.describe("Call Rating"),
|
|
221
|
+
ratingWeight: zod_1.z.number().describe("Rating Weight"),
|
|
222
|
+
notes: zod_1.z.string().nullable().optional().describe("Call Notes"),
|
|
213
223
|
createdAt: zod_1.z
|
|
214
224
|
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
215
225
|
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
216
|
-
.describe(
|
|
226
|
+
.describe("Creation Date"),
|
|
217
227
|
updatedAt: zod_1.z
|
|
218
228
|
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
219
229
|
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
220
|
-
.describe(
|
|
230
|
+
.describe("Last Update Date"),
|
|
221
231
|
})
|
|
222
|
-
.openapi({ title:
|
|
232
|
+
.openapi({ title: "LeadCallHistoryResponse" });
|
|
223
233
|
/**
|
|
224
234
|
* Lead Statistics Schema for quality dashboard
|
|
225
235
|
*/
|
|
226
236
|
exports.TierDistributionSchema = zod_1.z
|
|
227
237
|
.object({
|
|
228
|
-
high: zod_1.z.number().int().describe(
|
|
229
|
-
medium: zod_1.z.number().int().describe(
|
|
230
|
-
low: zod_1.z.number().int().describe(
|
|
231
|
-
untested: zod_1.z.number().int().describe(
|
|
238
|
+
high: zod_1.z.number().int().describe("High Quality Leads"),
|
|
239
|
+
medium: zod_1.z.number().int().describe("Medium Quality Leads"),
|
|
240
|
+
low: zod_1.z.number().int().describe("Low Quality Leads"),
|
|
241
|
+
untested: zod_1.z.number().int().describe("Untested Leads"),
|
|
232
242
|
})
|
|
233
|
-
.openapi({ title:
|
|
243
|
+
.openapi({ title: "TierDistribution" });
|
|
234
244
|
exports.LeadStatisticsSchema = zod_1.z
|
|
235
245
|
.object({
|
|
236
|
-
totalLeads: zod_1.z.number().int().describe(
|
|
237
|
-
avgQualityScore: zod_1.z.number().min(0).max(1).describe(
|
|
246
|
+
totalLeads: zod_1.z.number().int().describe("Total Leads"),
|
|
247
|
+
avgQualityScore: zod_1.z.number().min(0).max(1).describe("Average Quality Score"),
|
|
238
248
|
avgConversionRate: zod_1.z
|
|
239
249
|
.number()
|
|
240
250
|
.min(0)
|
|
241
251
|
.max(1)
|
|
242
|
-
.describe(
|
|
243
|
-
avgCallsPerLead: zod_1.z.number().describe(
|
|
244
|
-
tierDistribution: exports.TierDistributionSchema.describe(
|
|
252
|
+
.describe("Average Conversion Rate"),
|
|
253
|
+
avgCallsPerLead: zod_1.z.number().describe("Average Calls Per Lead"),
|
|
254
|
+
tierDistribution: exports.TierDistributionSchema.describe("Tier Distribution"),
|
|
245
255
|
})
|
|
246
|
-
.openapi({ title:
|
|
256
|
+
.openapi({ title: "LeadStatistics" });
|
|
247
257
|
exports.PaginatedLeadResponseSchema = (0, pagination_schema_1.createPaginatedResponseSchema)(exports.LeadSchema)
|
|
248
|
-
.describe(
|
|
249
|
-
.openapi({ title:
|
|
258
|
+
.describe("Leads retrieved successfully")
|
|
259
|
+
.openapi({ title: "LeadsPaginatedResponse" });
|
|
250
260
|
const c = (0, core_1.initContract)();
|
|
251
261
|
exports.leadsContractRouter = c.router({
|
|
252
262
|
create: {
|
|
253
|
-
method:
|
|
254
|
-
path:
|
|
263
|
+
method: "POST",
|
|
264
|
+
path: "/v2/leads",
|
|
255
265
|
responses: {
|
|
256
266
|
201: exports.LeadSchema,
|
|
257
267
|
409: error_schemas_1.ErrorResponseSchema,
|
|
258
268
|
},
|
|
259
269
|
body: exports.CreateLeadSchema,
|
|
260
|
-
summary:
|
|
261
|
-
metadata: { tags: [
|
|
270
|
+
summary: "Create a new lead",
|
|
271
|
+
metadata: { tags: ["Leads"], openApi: { operationId: "createLead" } },
|
|
262
272
|
},
|
|
263
273
|
findAll: {
|
|
264
|
-
method:
|
|
265
|
-
path:
|
|
274
|
+
method: "GET",
|
|
275
|
+
path: "/v2/leads",
|
|
266
276
|
responses: {
|
|
267
277
|
200: exports.PaginatedLeadResponseSchema,
|
|
268
278
|
},
|
|
269
279
|
query: exports.FilterLeadSchema,
|
|
270
|
-
summary:
|
|
271
|
-
metadata: { tags: [
|
|
280
|
+
summary: "Get all leads",
|
|
281
|
+
metadata: { tags: ["Leads"], openApi: { operationId: "findAllLeads" } },
|
|
272
282
|
},
|
|
273
283
|
findOne: {
|
|
274
|
-
method:
|
|
275
|
-
path:
|
|
284
|
+
method: "GET",
|
|
285
|
+
path: "/v2/leads/:id",
|
|
276
286
|
responses: {
|
|
277
287
|
200: exports.LeadSchema,
|
|
278
288
|
404: error_schemas_1.ErrorResponseSchema,
|
|
279
289
|
},
|
|
280
290
|
pathParams: zod_1.z.object({
|
|
281
|
-
id: zod_1.z.string().uuid().describe(
|
|
291
|
+
id: zod_1.z.string().uuid().describe("Lead ID"),
|
|
282
292
|
}),
|
|
283
|
-
summary:
|
|
284
|
-
metadata: { tags: [
|
|
293
|
+
summary: "Get a lead by ID",
|
|
294
|
+
metadata: { tags: ["Leads"], openApi: { operationId: "findLeadById" } },
|
|
285
295
|
},
|
|
286
296
|
update: {
|
|
287
|
-
method:
|
|
288
|
-
path:
|
|
297
|
+
method: "PATCH",
|
|
298
|
+
path: "/v2/leads/:id",
|
|
289
299
|
responses: {
|
|
290
300
|
200: exports.LeadSchema,
|
|
291
301
|
404: error_schemas_1.ErrorResponseSchema,
|
|
292
302
|
409: error_schemas_1.ErrorResponseSchema,
|
|
293
303
|
},
|
|
294
304
|
pathParams: zod_1.z.object({
|
|
295
|
-
id: zod_1.z.string().uuid().describe(
|
|
305
|
+
id: zod_1.z.string().uuid().describe("Lead ID"),
|
|
296
306
|
}),
|
|
297
307
|
body: exports.UpdateLeadSchema,
|
|
298
|
-
summary:
|
|
299
|
-
metadata: { tags: [
|
|
308
|
+
summary: "Update a lead",
|
|
309
|
+
metadata: { tags: ["Leads"], openApi: { operationId: "updateLead" } },
|
|
300
310
|
},
|
|
301
311
|
remove: {
|
|
302
|
-
method:
|
|
303
|
-
path:
|
|
312
|
+
method: "DELETE",
|
|
313
|
+
path: "/v2/leads/:id",
|
|
304
314
|
responses: {
|
|
305
315
|
204: zod_1.z.undefined(),
|
|
306
316
|
404: error_schemas_1.ErrorResponseSchema,
|
|
307
317
|
},
|
|
308
318
|
pathParams: zod_1.z.object({
|
|
309
|
-
id: zod_1.z.string().uuid().describe(
|
|
319
|
+
id: zod_1.z.string().uuid().describe("Lead ID"),
|
|
310
320
|
}),
|
|
311
321
|
body: c.noBody(),
|
|
312
|
-
summary:
|
|
313
|
-
metadata: { tags: [
|
|
322
|
+
summary: "Delete a lead",
|
|
323
|
+
metadata: { tags: ["Leads"], openApi: { operationId: "deleteLead" } },
|
|
314
324
|
},
|
|
315
325
|
recordCall: {
|
|
316
|
-
method:
|
|
317
|
-
path:
|
|
326
|
+
method: "POST",
|
|
327
|
+
path: "/v2/leads/:id/call",
|
|
318
328
|
responses: {
|
|
319
329
|
201: exports.LeadCallHistoryResponseSchema,
|
|
320
330
|
},
|
|
321
331
|
pathParams: zod_1.z.object({
|
|
322
|
-
id: zod_1.z.string().uuid().describe(
|
|
332
|
+
id: zod_1.z.string().uuid().describe("Lead ID"),
|
|
323
333
|
}),
|
|
324
334
|
body: call_history_contract_1.CreateCallHistorySchema,
|
|
325
|
-
summary:
|
|
335
|
+
summary: "Record a call to a lead",
|
|
326
336
|
metadata: {
|
|
327
|
-
tags: [
|
|
328
|
-
openApi: { operationId:
|
|
337
|
+
tags: ["Leads"],
|
|
338
|
+
openApi: { operationId: "recordCallToLead" },
|
|
329
339
|
},
|
|
330
340
|
},
|
|
331
341
|
getQualityDashboard: {
|
|
332
|
-
method:
|
|
333
|
-
path:
|
|
342
|
+
method: "GET",
|
|
343
|
+
path: "/v2/leads/analytics/quality-dashboard",
|
|
334
344
|
responses: {
|
|
335
345
|
200: exports.LeadStatisticsSchema,
|
|
336
346
|
},
|
|
337
347
|
query: zod_1.z.object({}),
|
|
338
|
-
summary:
|
|
348
|
+
summary: "Get lead quality analytics dashboard",
|
|
339
349
|
metadata: {
|
|
340
|
-
tags: [
|
|
341
|
-
openApi: { operationId:
|
|
350
|
+
tags: ["Leads"],
|
|
351
|
+
openApi: { operationId: "getQualityDashboard" },
|
|
342
352
|
},
|
|
343
353
|
},
|
|
344
354
|
}, {
|