-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.go
More file actions
640 lines (536 loc) · 32.5 KB
/
cli.go
File metadata and controls
640 lines (536 loc) · 32.5 KB
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
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
// Code generated by goa v3.24.1, DO NOT EDIT.
//
// survey-api HTTP client CLI support package
//
// Command:
// $ goa gen
// github.com/linuxfoundation/lfx-v2-survey-service/api/survey/v1/design
package cli
import (
"flag"
"fmt"
"net/http"
"os"
surveyc "github.com/linuxfoundation/lfx-v2-survey-service/gen/http/survey/client"
goahttp "goa.design/goa/v3/http"
goa "goa.design/goa/v3/pkg"
)
// UsageCommands returns the set of commands and sub-commands using the format
//
// command (subcommand1|subcommand2|...)
func UsageCommands() []string {
return []string{
"survey (schedule-survey|get-survey|update-survey|delete-survey|bulk-resend-survey|preview-send-survey|send-missing-recipients|delete-survey-response|resend-survey-response|delete-recipient-group|create-exclusion|delete-exclusion|get-exclusion|delete-exclusion-by-id|validate-email)",
}
}
// UsageExamples produces an example of a valid invocation of the CLI tool.
func UsageExamples() string {
return os.Args[0] + " " + "survey schedule-survey --body '{\n \"committee_uid\": \"qa1e8536-a985-4cf5-b981-a170927a1d11\",\n \"committee_voting_enabled\": true,\n \"creator_id\": \"Quam esse saepe eum non omnis amet.\",\n \"creator_name\": \"Consequatur quod numquam et provident dolorem voluptatem.\",\n \"creator_username\": \"Numquam eum suscipit labore odio rerum.\",\n \"email_body\": \"Repellendus sunt omnis voluptate minima possimus.\",\n \"email_body_text\": \"Occaecati sunt odit quia quia fugiat est.\",\n \"email_subject\": \"Quis vero voluptatem et temporibus.\",\n \"is_project_survey\": true,\n \"send_immediately\": true,\n \"stage_filter\": \"Dolorem quia et in.\",\n \"survey_cutoff_date\": \"Omnis sint reprehenderit.\",\n \"survey_monkey_id\": \"Omnis est at omnis.\",\n \"survey_reminder_rate_days\": 3291766316701683331,\n \"survey_send_date\": \"Et nulla quia.\",\n \"survey_title\": \"Dolorum cumque.\"\n }' --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"" + "\n" +
""
}
// ParseEndpoint returns the endpoint and payload as specified on the command
// line.
func ParseEndpoint(
scheme, host string,
doer goahttp.Doer,
enc func(*http.Request) goahttp.Encoder,
dec func(*http.Response) goahttp.Decoder,
restore bool,
) (goa.Endpoint, any, error) {
var (
surveyFlags = flag.NewFlagSet("survey", flag.ContinueOnError)
surveyScheduleSurveyFlags = flag.NewFlagSet("schedule-survey", flag.ExitOnError)
surveyScheduleSurveyBodyFlag = surveyScheduleSurveyFlags.String("body", "REQUIRED", "")
surveyScheduleSurveyTokenFlag = surveyScheduleSurveyFlags.String("token", "", "")
surveyGetSurveyFlags = flag.NewFlagSet("get-survey", flag.ExitOnError)
surveyGetSurveySurveyUIDFlag = surveyGetSurveyFlags.String("survey-uid", "REQUIRED", "Survey identifier")
surveyGetSurveyProjectUIDFlag = surveyGetSurveyFlags.String("project-uid", "", "")
surveyGetSurveyProjectUidsFlag = surveyGetSurveyFlags.String("project-uids", "", "")
surveyGetSurveyTokenFlag = surveyGetSurveyFlags.String("token", "", "")
surveyUpdateSurveyFlags = flag.NewFlagSet("update-survey", flag.ExitOnError)
surveyUpdateSurveyBodyFlag = surveyUpdateSurveyFlags.String("body", "REQUIRED", "")
surveyUpdateSurveySurveyUIDFlag = surveyUpdateSurveyFlags.String("survey-uid", "REQUIRED", "Survey identifier")
surveyUpdateSurveyTokenFlag = surveyUpdateSurveyFlags.String("token", "", "")
surveyDeleteSurveyFlags = flag.NewFlagSet("delete-survey", flag.ExitOnError)
surveyDeleteSurveySurveyUIDFlag = surveyDeleteSurveyFlags.String("survey-uid", "REQUIRED", "Survey identifier")
surveyDeleteSurveyTokenFlag = surveyDeleteSurveyFlags.String("token", "", "")
surveyBulkResendSurveyFlags = flag.NewFlagSet("bulk-resend-survey", flag.ExitOnError)
surveyBulkResendSurveyBodyFlag = surveyBulkResendSurveyFlags.String("body", "REQUIRED", "")
surveyBulkResendSurveySurveyUIDFlag = surveyBulkResendSurveyFlags.String("survey-uid", "REQUIRED", "Survey identifier")
surveyBulkResendSurveyTokenFlag = surveyBulkResendSurveyFlags.String("token", "", "")
surveyPreviewSendSurveyFlags = flag.NewFlagSet("preview-send-survey", flag.ExitOnError)
surveyPreviewSendSurveySurveyUIDFlag = surveyPreviewSendSurveyFlags.String("survey-uid", "REQUIRED", "Survey identifier")
surveyPreviewSendSurveyCommitteeUIDFlag = surveyPreviewSendSurveyFlags.String("committee-uid", "", "")
surveyPreviewSendSurveyTokenFlag = surveyPreviewSendSurveyFlags.String("token", "", "")
surveySendMissingRecipientsFlags = flag.NewFlagSet("send-missing-recipients", flag.ExitOnError)
surveySendMissingRecipientsSurveyUIDFlag = surveySendMissingRecipientsFlags.String("survey-uid", "REQUIRED", "Survey identifier")
surveySendMissingRecipientsCommitteeUIDFlag = surveySendMissingRecipientsFlags.String("committee-uid", "", "")
surveySendMissingRecipientsTokenFlag = surveySendMissingRecipientsFlags.String("token", "", "")
surveyDeleteSurveyResponseFlags = flag.NewFlagSet("delete-survey-response", flag.ExitOnError)
surveyDeleteSurveyResponseSurveyUIDFlag = surveyDeleteSurveyResponseFlags.String("survey-uid", "REQUIRED", "Survey identifier")
surveyDeleteSurveyResponseResponseIDFlag = surveyDeleteSurveyResponseFlags.String("response-id", "REQUIRED", "Response identifier")
surveyDeleteSurveyResponseTokenFlag = surveyDeleteSurveyResponseFlags.String("token", "", "")
surveyResendSurveyResponseFlags = flag.NewFlagSet("resend-survey-response", flag.ExitOnError)
surveyResendSurveyResponseSurveyUIDFlag = surveyResendSurveyResponseFlags.String("survey-uid", "REQUIRED", "Survey identifier")
surveyResendSurveyResponseResponseIDFlag = surveyResendSurveyResponseFlags.String("response-id", "REQUIRED", "Response identifier")
surveyResendSurveyResponseTokenFlag = surveyResendSurveyResponseFlags.String("token", "", "")
surveyDeleteRecipientGroupFlags = flag.NewFlagSet("delete-recipient-group", flag.ExitOnError)
surveyDeleteRecipientGroupSurveyUIDFlag = surveyDeleteRecipientGroupFlags.String("survey-uid", "REQUIRED", "Survey identifier")
surveyDeleteRecipientGroupCommitteeUIDFlag = surveyDeleteRecipientGroupFlags.String("committee-uid", "", "")
surveyDeleteRecipientGroupProjectUIDFlag = surveyDeleteRecipientGroupFlags.String("project-uid", "", "")
surveyDeleteRecipientGroupFoundationIDFlag = surveyDeleteRecipientGroupFlags.String("foundation-id", "", "")
surveyDeleteRecipientGroupTokenFlag = surveyDeleteRecipientGroupFlags.String("token", "", "")
surveyCreateExclusionFlags = flag.NewFlagSet("create-exclusion", flag.ExitOnError)
surveyCreateExclusionBodyFlag = surveyCreateExclusionFlags.String("body", "REQUIRED", "")
surveyCreateExclusionTokenFlag = surveyCreateExclusionFlags.String("token", "", "")
surveyDeleteExclusionFlags = flag.NewFlagSet("delete-exclusion", flag.ExitOnError)
surveyDeleteExclusionBodyFlag = surveyDeleteExclusionFlags.String("body", "REQUIRED", "")
surveyDeleteExclusionTokenFlag = surveyDeleteExclusionFlags.String("token", "", "")
surveyGetExclusionFlags = flag.NewFlagSet("get-exclusion", flag.ExitOnError)
surveyGetExclusionExclusionIDFlag = surveyGetExclusionFlags.String("exclusion-id", "REQUIRED", "Exclusion identifier")
surveyGetExclusionTokenFlag = surveyGetExclusionFlags.String("token", "", "")
surveyDeleteExclusionByIDFlags = flag.NewFlagSet("delete-exclusion-by-id", flag.ExitOnError)
surveyDeleteExclusionByIDExclusionIDFlag = surveyDeleteExclusionByIDFlags.String("exclusion-id", "REQUIRED", "Exclusion identifier")
surveyDeleteExclusionByIDTokenFlag = surveyDeleteExclusionByIDFlags.String("token", "", "")
surveyValidateEmailFlags = flag.NewFlagSet("validate-email", flag.ExitOnError)
surveyValidateEmailBodyFlag = surveyValidateEmailFlags.String("body", "REQUIRED", "")
surveyValidateEmailTokenFlag = surveyValidateEmailFlags.String("token", "", "")
)
surveyFlags.Usage = surveyUsage
surveyScheduleSurveyFlags.Usage = surveyScheduleSurveyUsage
surveyGetSurveyFlags.Usage = surveyGetSurveyUsage
surveyUpdateSurveyFlags.Usage = surveyUpdateSurveyUsage
surveyDeleteSurveyFlags.Usage = surveyDeleteSurveyUsage
surveyBulkResendSurveyFlags.Usage = surveyBulkResendSurveyUsage
surveyPreviewSendSurveyFlags.Usage = surveyPreviewSendSurveyUsage
surveySendMissingRecipientsFlags.Usage = surveySendMissingRecipientsUsage
surveyDeleteSurveyResponseFlags.Usage = surveyDeleteSurveyResponseUsage
surveyResendSurveyResponseFlags.Usage = surveyResendSurveyResponseUsage
surveyDeleteRecipientGroupFlags.Usage = surveyDeleteRecipientGroupUsage
surveyCreateExclusionFlags.Usage = surveyCreateExclusionUsage
surveyDeleteExclusionFlags.Usage = surveyDeleteExclusionUsage
surveyGetExclusionFlags.Usage = surveyGetExclusionUsage
surveyDeleteExclusionByIDFlags.Usage = surveyDeleteExclusionByIDUsage
surveyValidateEmailFlags.Usage = surveyValidateEmailUsage
if err := flag.CommandLine.Parse(os.Args[1:]); err != nil {
return nil, nil, err
}
if flag.NArg() < 2 { // two non flag args are required: SERVICE and ENDPOINT (aka COMMAND)
return nil, nil, fmt.Errorf("not enough arguments")
}
var (
svcn string
svcf *flag.FlagSet
)
{
svcn = flag.Arg(0)
switch svcn {
case "survey":
svcf = surveyFlags
default:
return nil, nil, fmt.Errorf("unknown service %q", svcn)
}
}
if err := svcf.Parse(flag.Args()[1:]); err != nil {
return nil, nil, err
}
var (
epn string
epf *flag.FlagSet
)
{
epn = svcf.Arg(0)
switch svcn {
case "survey":
switch epn {
case "schedule-survey":
epf = surveyScheduleSurveyFlags
case "get-survey":
epf = surveyGetSurveyFlags
case "update-survey":
epf = surveyUpdateSurveyFlags
case "delete-survey":
epf = surveyDeleteSurveyFlags
case "bulk-resend-survey":
epf = surveyBulkResendSurveyFlags
case "preview-send-survey":
epf = surveyPreviewSendSurveyFlags
case "send-missing-recipients":
epf = surveySendMissingRecipientsFlags
case "delete-survey-response":
epf = surveyDeleteSurveyResponseFlags
case "resend-survey-response":
epf = surveyResendSurveyResponseFlags
case "delete-recipient-group":
epf = surveyDeleteRecipientGroupFlags
case "create-exclusion":
epf = surveyCreateExclusionFlags
case "delete-exclusion":
epf = surveyDeleteExclusionFlags
case "get-exclusion":
epf = surveyGetExclusionFlags
case "delete-exclusion-by-id":
epf = surveyDeleteExclusionByIDFlags
case "validate-email":
epf = surveyValidateEmailFlags
}
}
}
if epf == nil {
return nil, nil, fmt.Errorf("unknown %q endpoint %q", svcn, epn)
}
// Parse endpoint flags if any
if svcf.NArg() > 1 {
if err := epf.Parse(svcf.Args()[1:]); err != nil {
return nil, nil, err
}
}
var (
data any
endpoint goa.Endpoint
err error
)
{
switch svcn {
case "survey":
c := surveyc.NewClient(scheme, host, doer, enc, dec, restore)
switch epn {
case "schedule-survey":
endpoint = c.ScheduleSurvey()
data, err = surveyc.BuildScheduleSurveyPayload(*surveyScheduleSurveyBodyFlag, *surveyScheduleSurveyTokenFlag)
case "get-survey":
endpoint = c.GetSurvey()
data, err = surveyc.BuildGetSurveyPayload(*surveyGetSurveySurveyUIDFlag, *surveyGetSurveyProjectUIDFlag, *surveyGetSurveyProjectUidsFlag, *surveyGetSurveyTokenFlag)
case "update-survey":
endpoint = c.UpdateSurvey()
data, err = surveyc.BuildUpdateSurveyPayload(*surveyUpdateSurveyBodyFlag, *surveyUpdateSurveySurveyUIDFlag, *surveyUpdateSurveyTokenFlag)
case "delete-survey":
endpoint = c.DeleteSurvey()
data, err = surveyc.BuildDeleteSurveyPayload(*surveyDeleteSurveySurveyUIDFlag, *surveyDeleteSurveyTokenFlag)
case "bulk-resend-survey":
endpoint = c.BulkResendSurvey()
data, err = surveyc.BuildBulkResendSurveyPayload(*surveyBulkResendSurveyBodyFlag, *surveyBulkResendSurveySurveyUIDFlag, *surveyBulkResendSurveyTokenFlag)
case "preview-send-survey":
endpoint = c.PreviewSendSurvey()
data, err = surveyc.BuildPreviewSendSurveyPayload(*surveyPreviewSendSurveySurveyUIDFlag, *surveyPreviewSendSurveyCommitteeUIDFlag, *surveyPreviewSendSurveyTokenFlag)
case "send-missing-recipients":
endpoint = c.SendMissingRecipients()
data, err = surveyc.BuildSendMissingRecipientsPayload(*surveySendMissingRecipientsSurveyUIDFlag, *surveySendMissingRecipientsCommitteeUIDFlag, *surveySendMissingRecipientsTokenFlag)
case "delete-survey-response":
endpoint = c.DeleteSurveyResponse()
data, err = surveyc.BuildDeleteSurveyResponsePayload(*surveyDeleteSurveyResponseSurveyUIDFlag, *surveyDeleteSurveyResponseResponseIDFlag, *surveyDeleteSurveyResponseTokenFlag)
case "resend-survey-response":
endpoint = c.ResendSurveyResponse()
data, err = surveyc.BuildResendSurveyResponsePayload(*surveyResendSurveyResponseSurveyUIDFlag, *surveyResendSurveyResponseResponseIDFlag, *surveyResendSurveyResponseTokenFlag)
case "delete-recipient-group":
endpoint = c.DeleteRecipientGroup()
data, err = surveyc.BuildDeleteRecipientGroupPayload(*surveyDeleteRecipientGroupSurveyUIDFlag, *surveyDeleteRecipientGroupCommitteeUIDFlag, *surveyDeleteRecipientGroupProjectUIDFlag, *surveyDeleteRecipientGroupFoundationIDFlag, *surveyDeleteRecipientGroupTokenFlag)
case "create-exclusion":
endpoint = c.CreateExclusion()
data, err = surveyc.BuildCreateExclusionPayload(*surveyCreateExclusionBodyFlag, *surveyCreateExclusionTokenFlag)
case "delete-exclusion":
endpoint = c.DeleteExclusion()
data, err = surveyc.BuildDeleteExclusionPayload(*surveyDeleteExclusionBodyFlag, *surveyDeleteExclusionTokenFlag)
case "get-exclusion":
endpoint = c.GetExclusion()
data, err = surveyc.BuildGetExclusionPayload(*surveyGetExclusionExclusionIDFlag, *surveyGetExclusionTokenFlag)
case "delete-exclusion-by-id":
endpoint = c.DeleteExclusionByID()
data, err = surveyc.BuildDeleteExclusionByIDPayload(*surveyDeleteExclusionByIDExclusionIDFlag, *surveyDeleteExclusionByIDTokenFlag)
case "validate-email":
endpoint = c.ValidateEmail()
data, err = surveyc.BuildValidateEmailPayload(*surveyValidateEmailBodyFlag, *surveyValidateEmailTokenFlag)
}
}
}
if err != nil {
return nil, nil, err
}
return endpoint, data, nil
}
// surveyUsage displays the usage of the survey command and its subcommands.
func surveyUsage() {
fmt.Fprintln(os.Stderr, `Survey service that proxies to ITX survey API`)
fmt.Fprintf(os.Stderr, "Usage:\n %s [globalflags] survey COMMAND [flags]\n\n", os.Args[0])
fmt.Fprintln(os.Stderr, "COMMAND:")
fmt.Fprintln(os.Stderr, ` schedule-survey: Create a scheduled survey for ITX project committee (proxies to ITX POST /surveys/schedule)`)
fmt.Fprintln(os.Stderr, ` get-survey: Get survey details (proxies to ITX GET /v2/surveys/{survey_uid})`)
fmt.Fprintln(os.Stderr, ` update-survey: Update survey (proxies to ITX PUT /v2/surveys/{survey_uid}). Only allowed when status is 'disabled'`)
fmt.Fprintln(os.Stderr, ` delete-survey: Delete survey (proxies to ITX DELETE /v2/surveys/{survey_uid}). Only allowed when status is 'disabled'`)
fmt.Fprintln(os.Stderr, ` bulk-resend-survey: Bulk resend survey emails to select recipients (proxies to ITX POST /v2/surveys/{survey_uid}/bulk_resend)`)
fmt.Fprintln(os.Stderr, ` preview-send-survey: Preview which recipients, committees, and projects would be affected by a resend (proxies to ITX GET /v2/surveys/{survey_uid}/preview_send)`)
fmt.Fprintln(os.Stderr, ` send-missing-recipients: Send survey emails to committee members who haven't received it (proxies to ITX POST /v2/surveys/{survey_uid}/send_missing_recipients)`)
fmt.Fprintln(os.Stderr, ` delete-survey-response: Delete survey response - removes recipient from survey and recalculates statistics (proxies to ITX DELETE /v2/surveys/{survey_uid}/responses/{response_id})`)
fmt.Fprintln(os.Stderr, ` resend-survey-response: Resend survey email to a specific user (proxies to ITX POST /v2/surveys/{survey_uid}/responses/{response_id}/resend)`)
fmt.Fprintln(os.Stderr, ` delete-recipient-group: Remove a recipient group (committee, project, or foundation) from survey and recalculate statistics (proxies to ITX DELETE /v2/surveys/{survey_uid}/recipient_group)`)
fmt.Fprintln(os.Stderr, ` create-exclusion: Create a survey or global exclusion (proxies to ITX POST /v2/surveys/exclusion)`)
fmt.Fprintln(os.Stderr, ` delete-exclusion: Delete a survey or global exclusion (proxies to ITX DELETE /v2/surveys/exclusion)`)
fmt.Fprintln(os.Stderr, ` get-exclusion: Get exclusion by ID (proxies to ITX GET /v2/surveys/exclusion/{exclusion_id})`)
fmt.Fprintln(os.Stderr, ` delete-exclusion-by-id: Delete exclusion by ID (proxies to ITX DELETE /v2/surveys/exclusion/{exclusion_id})`)
fmt.Fprintln(os.Stderr, ` validate-email: Validate email template body and subject (proxies to ITX POST /v2/surveys/validate_email)`)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Additional help:")
fmt.Fprintf(os.Stderr, " %s survey COMMAND --help\n", os.Args[0])
}
func surveyScheduleSurveyUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey schedule-survey", os.Args[0])
fmt.Fprint(os.Stderr, " -body JSON")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Create a scheduled survey for ITX project committee (proxies to ITX POST /surveys/schedule)`)
// Flags list
fmt.Fprintln(os.Stderr, ` -body JSON: `)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey schedule-survey --body '{\n \"committee_uid\": \"qa1e8536-a985-4cf5-b981-a170927a1d11\",\n \"committee_voting_enabled\": true,\n \"creator_id\": \"Quam esse saepe eum non omnis amet.\",\n \"creator_name\": \"Consequatur quod numquam et provident dolorem voluptatem.\",\n \"creator_username\": \"Numquam eum suscipit labore odio rerum.\",\n \"email_body\": \"Repellendus sunt omnis voluptate minima possimus.\",\n \"email_body_text\": \"Occaecati sunt odit quia quia fugiat est.\",\n \"email_subject\": \"Quis vero voluptatem et temporibus.\",\n \"is_project_survey\": true,\n \"send_immediately\": true,\n \"stage_filter\": \"Dolorem quia et in.\",\n \"survey_cutoff_date\": \"Omnis sint reprehenderit.\",\n \"survey_monkey_id\": \"Omnis est at omnis.\",\n \"survey_reminder_rate_days\": 3291766316701683331,\n \"survey_send_date\": \"Et nulla quia.\",\n \"survey_title\": \"Dolorum cumque.\"\n }' --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyGetSurveyUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey get-survey", os.Args[0])
fmt.Fprint(os.Stderr, " -survey-uid STRING")
fmt.Fprint(os.Stderr, " -project-uid STRING")
fmt.Fprint(os.Stderr, " -project-uids STRING")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Get survey details (proxies to ITX GET /v2/surveys/{survey_uid})`)
// Flags list
fmt.Fprintln(os.Stderr, ` -survey-uid STRING: Survey identifier`)
fmt.Fprintln(os.Stderr, ` -project-uid STRING: `)
fmt.Fprintln(os.Stderr, ` -project-uids STRING: `)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey get-survey --survey-uid \"b03cdbaf-53b1-4d47-bc04-dd7e459dd309\" --project-uid \"qa1e8536-a985-4cf5-b981-a170927a1d11\" --project-uids \"qa1e8536-a985-4cf5-b981-a170927a1d11,qa1e8536-a985-4cf5-b981-a170927a1d12\" --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyUpdateSurveyUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey update-survey", os.Args[0])
fmt.Fprint(os.Stderr, " -body JSON")
fmt.Fprint(os.Stderr, " -survey-uid STRING")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Update survey (proxies to ITX PUT /v2/surveys/{survey_uid}). Only allowed when status is 'disabled'`)
// Flags list
fmt.Fprintln(os.Stderr, ` -body JSON: `)
fmt.Fprintln(os.Stderr, ` -survey-uid STRING: Survey identifier`)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey update-survey --body '{\n \"committee_uid\": \"qa1e8536-a985-4cf5-b981-a170927a1d11\",\n \"committee_voting_enabled\": true,\n \"creator_id\": \"Qui distinctio dolorum quia non quaerat nostrum.\",\n \"email_body\": \"Veniam consequuntur sed praesentium.\",\n \"email_body_text\": \"Similique et sapiente sunt sit.\",\n \"email_subject\": \"Quo omnis maiores impedit.\",\n \"survey_cutoff_date\": \"Consequatur rem et voluptatem et.\",\n \"survey_reminder_rate_days\": 464515454408226755,\n \"survey_send_date\": \"Sed in perspiciatis odit nesciunt.\",\n \"survey_title\": \"Ut dicta eum ut vero animi.\"\n }' --survey-uid \"b03cdbaf-53b1-4d47-bc04-dd7e459dd309\" --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyDeleteSurveyUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey delete-survey", os.Args[0])
fmt.Fprint(os.Stderr, " -survey-uid STRING")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Delete survey (proxies to ITX DELETE /v2/surveys/{survey_uid}). Only allowed when status is 'disabled'`)
// Flags list
fmt.Fprintln(os.Stderr, ` -survey-uid STRING: Survey identifier`)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey delete-survey --survey-uid \"b03cdbaf-53b1-4d47-bc04-dd7e459dd309\" --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyBulkResendSurveyUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey bulk-resend-survey", os.Args[0])
fmt.Fprint(os.Stderr, " -body JSON")
fmt.Fprint(os.Stderr, " -survey-uid STRING")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Bulk resend survey emails to select recipients (proxies to ITX POST /v2/surveys/{survey_uid}/bulk_resend)`)
// Flags list
fmt.Fprintln(os.Stderr, ` -body JSON: `)
fmt.Fprintln(os.Stderr, ` -survey-uid STRING: Survey identifier`)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey bulk-resend-survey --body '{\n \"recipient_ids\": [\n \"cba14f40-1636-11ec-9621-0242ac130002\",\n \"cba14f40-1636-11ec-9621-0242ac130003\"\n ]\n }' --survey-uid \"b03cdbaf-53b1-4d47-bc04-dd7e459dd309\" --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyPreviewSendSurveyUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey preview-send-survey", os.Args[0])
fmt.Fprint(os.Stderr, " -survey-uid STRING")
fmt.Fprint(os.Stderr, " -committee-uid STRING")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Preview which recipients, committees, and projects would be affected by a resend (proxies to ITX GET /v2/surveys/{survey_uid}/preview_send)`)
// Flags list
fmt.Fprintln(os.Stderr, ` -survey-uid STRING: Survey identifier`)
fmt.Fprintln(os.Stderr, ` -committee-uid STRING: `)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey preview-send-survey --survey-uid \"b03cdbaf-53b1-4d47-bc04-dd7e459dd309\" --committee-uid \"qa1e8536-a985-4cf5-b981-a170927a1d11\" --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveySendMissingRecipientsUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey send-missing-recipients", os.Args[0])
fmt.Fprint(os.Stderr, " -survey-uid STRING")
fmt.Fprint(os.Stderr, " -committee-uid STRING")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Send survey emails to committee members who haven't received it (proxies to ITX POST /v2/surveys/{survey_uid}/send_missing_recipients)`)
// Flags list
fmt.Fprintln(os.Stderr, ` -survey-uid STRING: Survey identifier`)
fmt.Fprintln(os.Stderr, ` -committee-uid STRING: `)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey send-missing-recipients --survey-uid \"b03cdbaf-53b1-4d47-bc04-dd7e459dd309\" --committee-uid \"qa1e8536-a985-4cf5-b981-a170927a1d11\" --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyDeleteSurveyResponseUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey delete-survey-response", os.Args[0])
fmt.Fprint(os.Stderr, " -survey-uid STRING")
fmt.Fprint(os.Stderr, " -response-id STRING")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Delete survey response - removes recipient from survey and recalculates statistics (proxies to ITX DELETE /v2/surveys/{survey_uid}/responses/{response_id})`)
// Flags list
fmt.Fprintln(os.Stderr, ` -survey-uid STRING: Survey identifier`)
fmt.Fprintln(os.Stderr, ` -response-id STRING: Response identifier`)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey delete-survey-response --survey-uid \"b03cdbaf-53b1-4d47-bc04-dd7e459dd309\" --response-id \"cba14f40-1636-11ec-9621-0242ac130002\" --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyResendSurveyResponseUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey resend-survey-response", os.Args[0])
fmt.Fprint(os.Stderr, " -survey-uid STRING")
fmt.Fprint(os.Stderr, " -response-id STRING")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Resend survey email to a specific user (proxies to ITX POST /v2/surveys/{survey_uid}/responses/{response_id}/resend)`)
// Flags list
fmt.Fprintln(os.Stderr, ` -survey-uid STRING: Survey identifier`)
fmt.Fprintln(os.Stderr, ` -response-id STRING: Response identifier`)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey resend-survey-response --survey-uid \"b03cdbaf-53b1-4d47-bc04-dd7e459dd309\" --response-id \"cba14f40-1636-11ec-9621-0242ac130002\" --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyDeleteRecipientGroupUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey delete-recipient-group", os.Args[0])
fmt.Fprint(os.Stderr, " -survey-uid STRING")
fmt.Fprint(os.Stderr, " -committee-uid STRING")
fmt.Fprint(os.Stderr, " -project-uid STRING")
fmt.Fprint(os.Stderr, " -foundation-id STRING")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Remove a recipient group (committee, project, or foundation) from survey and recalculate statistics (proxies to ITX DELETE /v2/surveys/{survey_uid}/recipient_group)`)
// Flags list
fmt.Fprintln(os.Stderr, ` -survey-uid STRING: Survey identifier`)
fmt.Fprintln(os.Stderr, ` -committee-uid STRING: `)
fmt.Fprintln(os.Stderr, ` -project-uid STRING: `)
fmt.Fprintln(os.Stderr, ` -foundation-id STRING: `)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey delete-recipient-group --survey-uid \"b03cdbaf-53b1-4d47-bc04-dd7e459dd309\" --committee-uid \"qa1e8536-a985-4cf5-b981-a170927a1d11\" --project-uid \"003170000123XHTAA2\" --foundation-id \"003170000123XHTAA2\" --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyCreateExclusionUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey create-exclusion", os.Args[0])
fmt.Fprint(os.Stderr, " -body JSON")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Create a survey or global exclusion (proxies to ITX POST /v2/surveys/exclusion)`)
// Flags list
fmt.Fprintln(os.Stderr, ` -body JSON: `)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey create-exclusion --body '{\n \"committee_uid\": \"Tenetur omnis.\",\n \"email\": \"Vel ipsam laborum quos provident ad.\",\n \"global_exclusion\": \"Amet deleniti aut.\",\n \"survey_uid\": \"Nihil eos molestiae numquam.\",\n \"user_id\": \"Id minima id.\"\n }' --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyDeleteExclusionUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey delete-exclusion", os.Args[0])
fmt.Fprint(os.Stderr, " -body JSON")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Delete a survey or global exclusion (proxies to ITX DELETE /v2/surveys/exclusion)`)
// Flags list
fmt.Fprintln(os.Stderr, ` -body JSON: `)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey delete-exclusion --body '{\n \"committee_uid\": \"Asperiores at dicta iusto adipisci est est.\",\n \"email\": \"Repellendus modi illo voluptatem ab possimus.\",\n \"global_exclusion\": \"Soluta facilis rerum exercitationem.\",\n \"survey_uid\": \"Incidunt libero quo voluptates accusamus omnis saepe.\",\n \"user_id\": \"Dolorem voluptatum ab accusantium magni nesciunt deleniti.\"\n }' --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyGetExclusionUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey get-exclusion", os.Args[0])
fmt.Fprint(os.Stderr, " -exclusion-id STRING")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Get exclusion by ID (proxies to ITX GET /v2/surveys/exclusion/{exclusion_id})`)
// Flags list
fmt.Fprintln(os.Stderr, ` -exclusion-id STRING: Exclusion identifier`)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey get-exclusion --exclusion-id \"12345\" --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyDeleteExclusionByIDUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey delete-exclusion-by-id", os.Args[0])
fmt.Fprint(os.Stderr, " -exclusion-id STRING")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Delete exclusion by ID (proxies to ITX DELETE /v2/surveys/exclusion/{exclusion_id})`)
// Flags list
fmt.Fprintln(os.Stderr, ` -exclusion-id STRING: Exclusion identifier`)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey delete-exclusion-by-id --exclusion-id \"12345\" --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}
func surveyValidateEmailUsage() {
// Header with flags
fmt.Fprintf(os.Stderr, "%s [flags] survey validate-email", os.Args[0])
fmt.Fprint(os.Stderr, " -body JSON")
fmt.Fprint(os.Stderr, " -token STRING")
fmt.Fprintln(os.Stderr)
// Description
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, `Validate email template body and subject (proxies to ITX POST /v2/surveys/validate_email)`)
// Flags list
fmt.Fprintln(os.Stderr, ` -body JSON: `)
fmt.Fprintln(os.Stderr, ` -token STRING: `)
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, " %s %s\n", os.Args[0], "survey validate-email --body '{\n \"body\": \"Vero in.\",\n \"subject\": \"Ratione ut consequatur ullam.\"\n }' --token \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"")
}