-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest_suites.go
497 lines (442 loc) · 14.8 KB
/
test_suites.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
// This file was auto-generated by Fern from our API Definition.
package api
import (
json "encoding/json"
fmt "fmt"
internal "github.com/VapiAI/server-sdk-go/internal"
time "time"
)
type CreateTestSuiteDto struct {
// This is the name of the test suite.
Name *string `json:"name,omitempty" url:"-"`
// This is the phone number ID associated with this test suite.
PhoneNumberId *string `json:"phoneNumberId,omitempty" url:"-"`
// Override the default tester plan by providing custom assistant configuration for the test agent.
//
// We recommend only using this if you are confident, as we have already set sensible defaults on the tester plan.
TesterPlan *TesterPlan `json:"testerPlan,omitempty" url:"-"`
// These are the configuration for the assistant / phone number that is being tested.
TargetPlan *TargetPlan `json:"targetPlan,omitempty" url:"-"`
}
type TestSuiteControllerFindAllPaginatedRequest struct {
// This is the page number to return. Defaults to 1.
Page *float64 `json:"-" url:"page,omitempty"`
// This is the sort order for pagination. Defaults to 'DESC'.
SortOrder *TestSuiteControllerFindAllPaginatedRequestSortOrder `json:"-" url:"sortOrder,omitempty"`
// This is the maximum number of items to return. Defaults to 100.
Limit *float64 `json:"-" url:"limit,omitempty"`
// This will return items where the createdAt is greater than the specified value.
CreatedAtGt *time.Time `json:"-" url:"createdAtGt,omitempty"`
// This will return items where the createdAt is less than the specified value.
CreatedAtLt *time.Time `json:"-" url:"createdAtLt,omitempty"`
// This will return items where the createdAt is greater than or equal to the specified value.
CreatedAtGe *time.Time `json:"-" url:"createdAtGe,omitempty"`
// This will return items where the createdAt is less than or equal to the specified value.
CreatedAtLe *time.Time `json:"-" url:"createdAtLe,omitempty"`
// This will return items where the updatedAt is greater than the specified value.
UpdatedAtGt *time.Time `json:"-" url:"updatedAtGt,omitempty"`
// This will return items where the updatedAt is less than the specified value.
UpdatedAtLt *time.Time `json:"-" url:"updatedAtLt,omitempty"`
// This will return items where the updatedAt is greater than or equal to the specified value.
UpdatedAtGe *time.Time `json:"-" url:"updatedAtGe,omitempty"`
// This will return items where the updatedAt is less than or equal to the specified value.
UpdatedAtLe *time.Time `json:"-" url:"updatedAtLe,omitempty"`
}
type UpdateTestSuiteDto struct {
// This is the name of the test suite.
Name *string `json:"name,omitempty" url:"-"`
// This is the phone number ID associated with this test suite.
PhoneNumberId *string `json:"phoneNumberId,omitempty" url:"-"`
// Override the default tester plan by providing custom assistant configuration for the test agent.
//
// We recommend only using this if you are confident, as we have already set sensible defaults on the tester plan.
TesterPlan *TesterPlan `json:"testerPlan,omitempty" url:"-"`
// These are the configuration for the assistant / phone number that is being tested.
TargetPlan *TargetPlan `json:"targetPlan,omitempty" url:"-"`
}
type TargetPlan struct {
// This is the phone number that is being tested.
// During the actual test, it'll be called and the assistant attached to it will pick up and be tested.
// To test an assistant directly, send assistantId instead.
PhoneNumberId *string `json:"phoneNumberId,omitempty" url:"phoneNumberId,omitempty"`
// This can be any phone number (even not on Vapi).
// During the actual test, it'll be called.
// To test a Vapi number, send phoneNumberId. To test an assistant directly, send assistantId instead.
PhoneNumber *TestSuitePhoneNumber `json:"phoneNumber,omitempty" url:"phoneNumber,omitempty"`
// This is the assistant being tested.
// During the actual test, it'll invoked directly.
// To test the assistant over phone number, send phoneNumberId instead.
AssistantId *string `json:"assistantId,omitempty" url:"assistantId,omitempty"`
// This is the assistant overrides applied to assistantId before it is tested.
AssistantOverrides *AssistantOverrides `json:"assistantOverrides,omitempty" url:"assistantOverrides,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (t *TargetPlan) GetPhoneNumberId() *string {
if t == nil {
return nil
}
return t.PhoneNumberId
}
func (t *TargetPlan) GetPhoneNumber() *TestSuitePhoneNumber {
if t == nil {
return nil
}
return t.PhoneNumber
}
func (t *TargetPlan) GetAssistantId() *string {
if t == nil {
return nil
}
return t.AssistantId
}
func (t *TargetPlan) GetAssistantOverrides() *AssistantOverrides {
if t == nil {
return nil
}
return t.AssistantOverrides
}
func (t *TargetPlan) GetExtraProperties() map[string]interface{} {
return t.extraProperties
}
func (t *TargetPlan) UnmarshalJSON(data []byte) error {
type unmarshaler TargetPlan
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*t = TargetPlan(value)
extraProperties, err := internal.ExtractExtraProperties(data, *t)
if err != nil {
return err
}
t.extraProperties = extraProperties
t.rawJSON = json.RawMessage(data)
return nil
}
func (t *TargetPlan) String() string {
if len(t.rawJSON) > 0 {
if value, err := internal.StringifyJSON(t.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(t); err == nil {
return value
}
return fmt.Sprintf("%#v", t)
}
type TestSuite struct {
// This is the unique identifier for the test suite.
Id string `json:"id" url:"id"`
// This is the unique identifier for the org that this test suite belongs to.
OrgId string `json:"orgId" url:"orgId"`
// This is the ISO 8601 date-time string of when the test suite was created.
CreatedAt time.Time `json:"createdAt" url:"createdAt"`
// This is the ISO 8601 date-time string of when the test suite was last updated.
UpdatedAt time.Time `json:"updatedAt" url:"updatedAt"`
// This is the name of the test suite.
Name *string `json:"name,omitempty" url:"name,omitempty"`
// This is the phone number ID associated with this test suite.
PhoneNumberId *string `json:"phoneNumberId,omitempty" url:"phoneNumberId,omitempty"`
// Override the default tester plan by providing custom assistant configuration for the test agent.
//
// We recommend only using this if you are confident, as we have already set sensible defaults on the tester plan.
TesterPlan *TesterPlan `json:"testerPlan,omitempty" url:"testerPlan,omitempty"`
// These are the configuration for the assistant / phone number that is being tested.
TargetPlan *TargetPlan `json:"targetPlan,omitempty" url:"targetPlan,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (t *TestSuite) GetId() string {
if t == nil {
return ""
}
return t.Id
}
func (t *TestSuite) GetOrgId() string {
if t == nil {
return ""
}
return t.OrgId
}
func (t *TestSuite) GetCreatedAt() time.Time {
if t == nil {
return time.Time{}
}
return t.CreatedAt
}
func (t *TestSuite) GetUpdatedAt() time.Time {
if t == nil {
return time.Time{}
}
return t.UpdatedAt
}
func (t *TestSuite) GetName() *string {
if t == nil {
return nil
}
return t.Name
}
func (t *TestSuite) GetPhoneNumberId() *string {
if t == nil {
return nil
}
return t.PhoneNumberId
}
func (t *TestSuite) GetTesterPlan() *TesterPlan {
if t == nil {
return nil
}
return t.TesterPlan
}
func (t *TestSuite) GetTargetPlan() *TargetPlan {
if t == nil {
return nil
}
return t.TargetPlan
}
func (t *TestSuite) GetExtraProperties() map[string]interface{} {
return t.extraProperties
}
func (t *TestSuite) UnmarshalJSON(data []byte) error {
type embed TestSuite
var unmarshaler = struct {
embed
CreatedAt *internal.DateTime `json:"createdAt"`
UpdatedAt *internal.DateTime `json:"updatedAt"`
}{
embed: embed(*t),
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
*t = TestSuite(unmarshaler.embed)
t.CreatedAt = unmarshaler.CreatedAt.Time()
t.UpdatedAt = unmarshaler.UpdatedAt.Time()
extraProperties, err := internal.ExtractExtraProperties(data, *t)
if err != nil {
return err
}
t.extraProperties = extraProperties
t.rawJSON = json.RawMessage(data)
return nil
}
func (t *TestSuite) MarshalJSON() ([]byte, error) {
type embed TestSuite
var marshaler = struct {
embed
CreatedAt *internal.DateTime `json:"createdAt"`
UpdatedAt *internal.DateTime `json:"updatedAt"`
}{
embed: embed(*t),
CreatedAt: internal.NewDateTime(t.CreatedAt),
UpdatedAt: internal.NewDateTime(t.UpdatedAt),
}
return json.Marshal(marshaler)
}
func (t *TestSuite) String() string {
if len(t.rawJSON) > 0 {
if value, err := internal.StringifyJSON(t.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(t); err == nil {
return value
}
return fmt.Sprintf("%#v", t)
}
type TestSuitePhoneNumber struct {
// This is the provider of the phone number.
// This is the phone number that is being tested.
Number string `json:"number" url:"number"`
provider string
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (t *TestSuitePhoneNumber) GetNumber() string {
if t == nil {
return ""
}
return t.Number
}
func (t *TestSuitePhoneNumber) Provider() string {
return t.provider
}
func (t *TestSuitePhoneNumber) GetExtraProperties() map[string]interface{} {
return t.extraProperties
}
func (t *TestSuitePhoneNumber) UnmarshalJSON(data []byte) error {
type embed TestSuitePhoneNumber
var unmarshaler = struct {
embed
Provider string `json:"provider"`
}{
embed: embed(*t),
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
*t = TestSuitePhoneNumber(unmarshaler.embed)
if unmarshaler.Provider != "test-suite" {
return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", t, "test-suite", unmarshaler.Provider)
}
t.provider = unmarshaler.Provider
extraProperties, err := internal.ExtractExtraProperties(data, *t, "provider")
if err != nil {
return err
}
t.extraProperties = extraProperties
t.rawJSON = json.RawMessage(data)
return nil
}
func (t *TestSuitePhoneNumber) MarshalJSON() ([]byte, error) {
type embed TestSuitePhoneNumber
var marshaler = struct {
embed
Provider string `json:"provider"`
}{
embed: embed(*t),
Provider: "test-suite",
}
return json.Marshal(marshaler)
}
func (t *TestSuitePhoneNumber) String() string {
if len(t.rawJSON) > 0 {
if value, err := internal.StringifyJSON(t.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(t); err == nil {
return value
}
return fmt.Sprintf("%#v", t)
}
type TestSuitesPaginatedResponse struct {
Results []*TestSuite `json:"results,omitempty" url:"results,omitempty"`
Metadata *PaginationMeta `json:"metadata,omitempty" url:"metadata,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (t *TestSuitesPaginatedResponse) GetResults() []*TestSuite {
if t == nil {
return nil
}
return t.Results
}
func (t *TestSuitesPaginatedResponse) GetMetadata() *PaginationMeta {
if t == nil {
return nil
}
return t.Metadata
}
func (t *TestSuitesPaginatedResponse) GetExtraProperties() map[string]interface{} {
return t.extraProperties
}
func (t *TestSuitesPaginatedResponse) UnmarshalJSON(data []byte) error {
type unmarshaler TestSuitesPaginatedResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*t = TestSuitesPaginatedResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *t)
if err != nil {
return err
}
t.extraProperties = extraProperties
t.rawJSON = json.RawMessage(data)
return nil
}
func (t *TestSuitesPaginatedResponse) String() string {
if len(t.rawJSON) > 0 {
if value, err := internal.StringifyJSON(t.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(t); err == nil {
return value
}
return fmt.Sprintf("%#v", t)
}
type TesterPlan struct {
// Pass a transient assistant to use for the test assistant.
//
// Make sure to write a detailed system prompt for a test assistant, and use the {{test.script}} variable to access the test script.
Assistant *CreateAssistantDto `json:"assistant,omitempty" url:"assistant,omitempty"`
// Pass an assistant id that can be access
//
// Make sure to write a detailed system prompt for the test assistant, and use the {{test.script}} variable to access the test script.
AssistantId *string `json:"assistantId,omitempty" url:"assistantId,omitempty"`
// Add any assistant overrides to the test assistant.
//
// One use case is if you want to pass custom variables into the test using variableValues, that you can then access in the script
// and rubric using {{varName}}.
AssistantOverrides *AssistantOverrides `json:"assistantOverrides,omitempty" url:"assistantOverrides,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (t *TesterPlan) GetAssistant() *CreateAssistantDto {
if t == nil {
return nil
}
return t.Assistant
}
func (t *TesterPlan) GetAssistantId() *string {
if t == nil {
return nil
}
return t.AssistantId
}
func (t *TesterPlan) GetAssistantOverrides() *AssistantOverrides {
if t == nil {
return nil
}
return t.AssistantOverrides
}
func (t *TesterPlan) GetExtraProperties() map[string]interface{} {
return t.extraProperties
}
func (t *TesterPlan) UnmarshalJSON(data []byte) error {
type unmarshaler TesterPlan
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*t = TesterPlan(value)
extraProperties, err := internal.ExtractExtraProperties(data, *t)
if err != nil {
return err
}
t.extraProperties = extraProperties
t.rawJSON = json.RawMessage(data)
return nil
}
func (t *TesterPlan) String() string {
if len(t.rawJSON) > 0 {
if value, err := internal.StringifyJSON(t.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(t); err == nil {
return value
}
return fmt.Sprintf("%#v", t)
}
type TestSuiteControllerFindAllPaginatedRequestSortOrder string
const (
TestSuiteControllerFindAllPaginatedRequestSortOrderAsc TestSuiteControllerFindAllPaginatedRequestSortOrder = "ASC"
TestSuiteControllerFindAllPaginatedRequestSortOrderDesc TestSuiteControllerFindAllPaginatedRequestSortOrder = "DESC"
)
func NewTestSuiteControllerFindAllPaginatedRequestSortOrderFromString(s string) (TestSuiteControllerFindAllPaginatedRequestSortOrder, error) {
switch s {
case "ASC":
return TestSuiteControllerFindAllPaginatedRequestSortOrderAsc, nil
case "DESC":
return TestSuiteControllerFindAllPaginatedRequestSortOrderDesc, nil
}
var t TestSuiteControllerFindAllPaginatedRequestSortOrder
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (t TestSuiteControllerFindAllPaginatedRequestSortOrder) Ptr() *TestSuiteControllerFindAllPaginatedRequestSortOrder {
return &t
}