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
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
#![allow(unused_imports)]
#![cfg_attr(rustfmt, rustfmt_skip)]
/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT */
use crate::{Client, ClientBuilder, Credentials, Retry};
use anyhow::Error;
use serde_json::Value;
use std::time::Duration;
use crate::util::urlencode;

/// Queue Service
///
/// The queue service is responsible for accepting tasks and tracking their state
/// as they are executed by workers, in order to ensure they are eventually
/// resolved.
///
/// ## Artifact Storage Types
///
/// * **Object artifacts** contain arbitrary data, stored via the object service.
/// * **Redirect artifacts**, will redirect the caller to URL when fetched
/// with a a 303 (See Other) response.  Clients will not apply any kind of
/// authentication to that URL.
/// * **Link artifacts**, will be treated as if the caller requested the linked
/// artifact on the same task.  Links may be chained, but cycles are forbidden.
/// The caller must have scopes for the linked artifact, or a 403 response will
/// be returned.
/// * **Error artifacts**, only consists of meta-data which the queue will
/// store for you. These artifacts are only meant to indicate that you the
/// worker or the task failed to generate a specific artifact, that you
/// would otherwise have uploaded. For example docker-worker will upload an
/// error artifact, if the file it was supposed to upload doesn't exists or
/// turns out to be a directory. Clients requesting an error artifact will
/// get a `424` (Failed Dependency) response. This is mainly designed to
/// ensure that dependent tasks can distinguish between artifacts that were
/// suppose to be generated and artifacts for which the name is misspelled.
/// * **S3 artifacts** are used for static files which will be
/// stored on S3. When creating an S3 artifact the queue will return a
/// pre-signed URL to which you can do a `PUT` request to upload your
/// artifact. Note that `PUT` request **must** specify the `content-length`
/// header and **must** give the `content-type` header the same value as in
/// the request to `createArtifact`. S3 artifacts will be deprecated soon,
/// and users should prefer object artifacts instead.
///
/// ## Artifact immutability
///
/// Generally speaking you cannot overwrite an artifact when created.
/// But if you repeat the request with the same properties the request will
/// succeed as the operation is idempotent.
/// This is useful if you need to refresh a signed URL while uploading.
/// Do not abuse this to overwrite artifacts created by another entity!
/// Such as worker-host overwriting artifact created by worker-code.
///
/// The queue defines the following *immutability special cases*:
///
/// * A `reference` artifact can replace an existing `reference` artifact.
/// * A `link` artifact can replace an existing `reference` artifact.
/// * Any artifact's `expires` can be extended (made later, but not earlier).
pub struct Queue {
    /// The underlying client used to make API calls for this service.
    pub client: Client
}

#[allow(non_snake_case)]
impl Queue {
    /// Create a new Queue instance, based on the given client builder
    pub fn new<CB: Into<ClientBuilder>>(client_builder: CB) -> Result<Self, Error> {
        Ok(Self{
            client: client_builder
                .into()
                .path_prefix("api/queue/v1/")
                .build()?,
        })
    }

    /// Ping Server
    ///
    /// Respond without doing anything.
    /// This endpoint is used to check that the service is up.
    pub async fn ping(&self) -> Result<(), Error> {
        let method = "GET";
        let (path, query) = Self::ping_details();
        let body = None;
        let resp = self.client.request(method, path, query, body).await?;
        resp.bytes().await?;
        Ok(())
    }

    /// Generate an unsigned URL for the ping endpoint
    pub fn ping_url(&self) -> Result<String, Error> {
        let (path, query) = Self::ping_details();
        self.client.make_url(path, query)
    }

    /// Generate a signed URL for the ping endpoint
    pub fn ping_signed_url(&self, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::ping_details();
        self.client.make_signed_url(path, query, ttl)
    }

    /// Determine the HTTP request details for ping
    fn ping_details<'a>() -> (&'static str, Option<Vec<(&'static str, &'a str)>>) {
        let path = "ping";
        let query = None;

        (path, query)
    }

    /// Load Balancer Heartbeat
    ///
    /// Respond without doing anything.
    /// This endpoint is used to check that the service is up.
    pub async fn lbheartbeat(&self) -> Result<(), Error> {
        let method = "GET";
        let (path, query) = Self::lbheartbeat_details();
        let body = None;
        let resp = self.client.request(method, path, query, body).await?;
        resp.bytes().await?;
        Ok(())
    }

    /// Generate an unsigned URL for the lbheartbeat endpoint
    pub fn lbheartbeat_url(&self) -> Result<String, Error> {
        let (path, query) = Self::lbheartbeat_details();
        self.client.make_url(path, query)
    }

    /// Generate a signed URL for the lbheartbeat endpoint
    pub fn lbheartbeat_signed_url(&self, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::lbheartbeat_details();
        self.client.make_signed_url(path, query, ttl)
    }

    /// Determine the HTTP request details for lbheartbeat
    fn lbheartbeat_details<'a>() -> (&'static str, Option<Vec<(&'static str, &'a str)>>) {
        let path = "__lbheartbeat__";
        let query = None;

        (path, query)
    }

    /// Taskcluster Version
    ///
    /// Respond with the JSON version object.
    /// https://github.com/mozilla-services/Dockerflow/blob/main/docs/version_object.md
    pub async fn version(&self) -> Result<(), Error> {
        let method = "GET";
        let (path, query) = Self::version_details();
        let body = None;
        let resp = self.client.request(method, path, query, body).await?;
        resp.bytes().await?;
        Ok(())
    }

    /// Generate an unsigned URL for the version endpoint
    pub fn version_url(&self) -> Result<String, Error> {
        let (path, query) = Self::version_details();
        self.client.make_url(path, query)
    }

    /// Generate a signed URL for the version endpoint
    pub fn version_signed_url(&self, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::version_details();
        self.client.make_signed_url(path, query, ttl)
    }

    /// Determine the HTTP request details for version
    fn version_details<'a>() -> (&'static str, Option<Vec<(&'static str, &'a str)>>) {
        let path = "__version__";
        let query = None;

        (path, query)
    }

    /// Get Task Definition
    ///
    /// This end-point will return the task-definition. Notice that the task
    /// definition may have been modified by queue, if an optional property is
    /// not specified the queue may provide a default value.
    pub async fn task(&self, taskId: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::task_details(taskId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the task endpoint
    pub fn task_url(&self, taskId: &str) -> Result<String, Error> {
        let (path, query) = Self::task_details(taskId);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the task endpoint
    pub fn task_signed_url(&self, taskId: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::task_details(taskId);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for task
    fn task_details<'a>(taskId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}", urlencode(taskId));
        let query = None;

        (path, query)
    }

    /// Get task status
    ///
    /// Get task status structure from `taskId`
    pub async fn status(&self, taskId: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::status_details(taskId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the status endpoint
    pub fn status_url(&self, taskId: &str) -> Result<String, Error> {
        let (path, query) = Self::status_details(taskId);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the status endpoint
    pub fn status_signed_url(&self, taskId: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::status_details(taskId);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for status
    fn status_details<'a>(taskId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/status", urlencode(taskId));
        let query = None;

        (path, query)
    }

    /// List Task Group
    ///
    /// List tasks sharing the same `taskGroupId`.
    ///
    /// As a task-group may contain an unbounded number of tasks, this end-point
    /// may return a `continuationToken`. To continue listing tasks you must call
    /// the `listTaskGroup` again with the `continuationToken` as the
    /// query-string option `continuationToken`.
    ///
    /// By default this end-point will try to return up to 1000 members in one
    /// request. But it **may return less**, even if more tasks are available.
    /// It may also return a `continuationToken` even though there are no more
    /// results. However, you can only be sure to have seen all results if you
    /// keep calling `listTaskGroup` with the last `continuationToken` until you
    /// get a result without a `continuationToken`.
    ///
    /// If you are not interested in listing all the members at once, you may
    /// use the query-string option `limit` to return fewer.
    ///
    /// If you only want to to fetch task group metadata without the tasks,
    /// you can call the `getTaskGroup` method.
    pub async fn listTaskGroup(&self, taskGroupId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::listTaskGroup_details(taskGroupId, continuationToken, limit);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the listTaskGroup endpoint
    pub fn listTaskGroup_url(&self, taskGroupId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<String, Error> {
        let (path, query) = Self::listTaskGroup_details(taskGroupId, continuationToken, limit);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the listTaskGroup endpoint
    pub fn listTaskGroup_signed_url(&self, taskGroupId: &str, continuationToken: Option<&str>, limit: Option<&str>, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::listTaskGroup_details(taskGroupId, continuationToken, limit);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for listTaskGroup
    fn listTaskGroup_details<'a>(taskGroupId: &'a str, continuationToken: Option<&'a str>, limit: Option<&'a str>) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task-group/{}/list", urlencode(taskGroupId));
        let mut query = None;
        if let Some(q) = continuationToken {
            query.get_or_insert_with(Vec::new).push(("continuationToken", q));
        }
        if let Some(q) = limit {
            query.get_or_insert_with(Vec::new).push(("limit", q));
        }

        (path, query)
    }

    /// Cancel Task Group
    ///
    /// This method will cancel all unresolved tasks (`unscheduled`, `pending` or `running` states)
    /// with the given `taskGroupId`. Behaviour is similar to the `cancelTask` method.
    ///
    /// It is only possible to cancel a task group if it has been sealed using `sealTaskGroup`.
    /// If the task group is not sealed, this method will return a 409 response.
    ///
    /// It is possible to rerun a canceled task which will result in a new run.
    /// Calling `cancelTaskGroup` again in this case will only cancel the new run.
    /// Other tasks that were already canceled would not be canceled again.
    pub async fn cancelTaskGroup(&self, taskGroupId: &str) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::cancelTaskGroup_details(taskGroupId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for cancelTaskGroup
    fn cancelTaskGroup_details<'a>(taskGroupId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task-group/{}/cancel", urlencode(taskGroupId));
        let query = None;

        (path, query)
    }

    /// Get Task Group
    ///
    /// Get task group information by `taskGroupId`.
    ///
    /// This will return meta-information associated with the task group.
    /// It contains information about task group expiry date or if it is sealed.
    ///
    /// If you also want to see which tasks belong to this task group, you can call
    /// `listTaskGroup` method.
    pub async fn getTaskGroup(&self, taskGroupId: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::getTaskGroup_details(taskGroupId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the getTaskGroup endpoint
    pub fn getTaskGroup_url(&self, taskGroupId: &str) -> Result<String, Error> {
        let (path, query) = Self::getTaskGroup_details(taskGroupId);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the getTaskGroup endpoint
    pub fn getTaskGroup_signed_url(&self, taskGroupId: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::getTaskGroup_details(taskGroupId);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for getTaskGroup
    fn getTaskGroup_details<'a>(taskGroupId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task-group/{}", urlencode(taskGroupId));
        let query = None;

        (path, query)
    }

    /// Seal Task Group
    ///
    /// Seal task group to prevent creation of new tasks.
    ///
    /// Task group can be sealed once and is irreversible. Calling it multiple times
    /// will return same result and will not update it again.
    pub async fn sealTaskGroup(&self, taskGroupId: &str) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::sealTaskGroup_details(taskGroupId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for sealTaskGroup
    fn sealTaskGroup_details<'a>(taskGroupId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task-group/{}/seal", urlencode(taskGroupId));
        let query = None;

        (path, query)
    }

    /// List Dependent Tasks
    ///
    /// List tasks that depend on the given `taskId`.
    ///
    /// As many tasks from different task-groups may dependent on a single tasks,
    /// this end-point may return a `continuationToken`. To continue listing
    /// tasks you must call `listDependentTasks` again with the
    /// `continuationToken` as the query-string option `continuationToken`.
    ///
    /// By default this end-point will try to return up to 1000 tasks in one
    /// request. But it **may return less**, even if more tasks are available.
    /// It may also return a `continuationToken` even though there are no more
    /// results. However, you can only be sure to have seen all results if you
    /// keep calling `listDependentTasks` with the last `continuationToken` until
    /// you get a result without a `continuationToken`.
    ///
    /// If you are not interested in listing all the tasks at once, you may
    /// use the query-string option `limit` to return fewer.
    pub async fn listDependentTasks(&self, taskId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::listDependentTasks_details(taskId, continuationToken, limit);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the listDependentTasks endpoint
    pub fn listDependentTasks_url(&self, taskId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<String, Error> {
        let (path, query) = Self::listDependentTasks_details(taskId, continuationToken, limit);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the listDependentTasks endpoint
    pub fn listDependentTasks_signed_url(&self, taskId: &str, continuationToken: Option<&str>, limit: Option<&str>, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::listDependentTasks_details(taskId, continuationToken, limit);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for listDependentTasks
    fn listDependentTasks_details<'a>(taskId: &'a str, continuationToken: Option<&'a str>, limit: Option<&'a str>) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/dependents", urlencode(taskId));
        let mut query = None;
        if let Some(q) = continuationToken {
            query.get_or_insert_with(Vec::new).push(("continuationToken", q));
        }
        if let Some(q) = limit {
            query.get_or_insert_with(Vec::new).push(("limit", q));
        }

        (path, query)
    }

    /// Create New Task
    ///
    /// Create a new task, this is an **idempotent** operation, so repeat it if
    /// you get an internal server error or network connection is dropped.
    ///
    /// **Task `deadline`**: the deadline property can be no more than 5 days
    /// into the future. This is to limit the amount of pending tasks not being
    /// taken care of. Ideally, you should use a much shorter deadline.
    ///
    /// **Task expiration**: the `expires` property must be greater than the
    /// task `deadline`. If not provided it will default to `deadline` + one
    /// year. Notice that artifacts created by a task must expire before the
    /// task's expiration.
    ///
    /// **Task specific routing-keys**: using the `task.routes` property you may
    /// define task specific routing-keys. If a task has a task specific
    /// routing-key: `<route>`, then when the AMQP message about the task is
    /// published, the message will be CC'ed with the routing-key:
    /// `route.<route>`. This is useful if you want another component to listen
    /// for completed tasks you have posted.  The caller must have scope
    /// `queue:route:<route>` for each route.
    ///
    /// **Dependencies**: any tasks referenced in `task.dependencies` must have
    /// already been created at the time of this call.
    ///
    /// **Scopes**: Note that the scopes required to complete this API call depend
    /// on the content of the `scopes`, `routes`, `schedulerId`, `priority`,
    /// `provisionerId`, and `workerType` properties of the task definition.
    ///
    /// If the task group was sealed, this end-point will return `409` reporting
    /// `RequestConflict` to indicate that it is no longer possible to add new tasks
    /// for this `taskGroupId`.
    pub async fn createTask(&self, taskId: &str, payload: &Value) -> Result<Value, Error> {
        let method = "PUT";
        let (path, query) = Self::createTask_details(taskId);
        let body = Some(payload);
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for createTask
    fn createTask_details<'a>(taskId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}", urlencode(taskId));
        let query = None;

        (path, query)
    }

    /// Schedule Defined Task
    ///
    /// scheduleTask will schedule a task to be executed, even if it has
    /// unresolved dependencies. A task would otherwise only be scheduled if
    /// its dependencies were resolved.
    ///
    /// This is useful if you have defined a task that depends on itself or on
    /// some other task that has not been resolved, but you wish the task to be
    /// scheduled immediately.
    ///
    /// This will announce the task as pending and workers will be allowed to
    /// claim it and resolve the task.
    ///
    /// **Note** this operation is **idempotent** and will not fail or complain
    /// if called with a `taskId` that is already scheduled, or even resolved.
    /// To reschedule a task previously resolved, use `rerunTask`.
    pub async fn scheduleTask(&self, taskId: &str) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::scheduleTask_details(taskId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for scheduleTask
    fn scheduleTask_details<'a>(taskId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/schedule", urlencode(taskId));
        let query = None;

        (path, query)
    }

    /// Rerun a Resolved Task
    ///
    /// This method _reruns_ a previously resolved task, even if it was
    /// _completed_. This is useful if your task completes unsuccessfully, and
    /// you just want to run it from scratch again. This will also reset the
    /// number of `retries` allowed. It will schedule a task that is _unscheduled_
    /// regardless of the state of its dependencies.
    ///
    /// Remember that `retries` in the task status counts the number of runs that
    /// the queue have started because the worker stopped responding, for example
    /// because a spot node died.
    ///
    /// **Remark** this operation is idempotent: if it is invoked for a task that
    /// is `pending` or `running`, it will just return the current task status.
    pub async fn rerunTask(&self, taskId: &str) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::rerunTask_details(taskId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for rerunTask
    fn rerunTask_details<'a>(taskId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/rerun", urlencode(taskId));
        let query = None;

        (path, query)
    }

    /// Cancel Task
    ///
    /// This method will cancel a task that is either `unscheduled`, `pending` or
    /// `running`. It will resolve the current run as `exception` with
    /// `reasonResolved` set to `canceled`. If the task isn't scheduled yet, ie.
    /// it doesn't have any runs, an initial run will be added and resolved as
    /// described above. Hence, after canceling a task, it cannot be scheduled
    /// with `queue.scheduleTask`, but a new run can be created with
    /// `queue.rerun`. These semantics is equivalent to calling
    /// `queue.scheduleTask` immediately followed by `queue.cancelTask`.
    ///
    /// **Remark** this operation is idempotent, if you try to cancel a task that
    /// isn't `unscheduled`, `pending` or `running`, this operation will just
    /// return the current task status.
    pub async fn cancelTask(&self, taskId: &str) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::cancelTask_details(taskId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for cancelTask
    fn cancelTask_details<'a>(taskId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/cancel", urlencode(taskId));
        let query = None;

        (path, query)
    }

    /// Claim Work
    ///
    /// Claim pending task(s) for the given task queue.
    ///
    /// If any work is available (even if fewer than the requested number of
    /// tasks, this will return immediately. Otherwise, it will block for tens of
    /// seconds waiting for work.  If no work appears, it will return an emtpy
    /// list of tasks.  Callers should sleep a short while (to avoid denial of
    /// service in an error condition) and call the endpoint again.  This is a
    /// simple implementation of "long polling".
    pub async fn claimWork(&self, taskQueueId: &str, payload: &Value) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::claimWork_details(taskQueueId);
        let body = Some(payload);
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for claimWork
    fn claimWork_details<'a>(taskQueueId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("claim-work/{}", urlencode(taskQueueId));
        let query = None;

        (path, query)
    }

    /// Claim Task
    ///
    /// claim a task - never documented
    pub async fn claimTask(&self, taskId: &str, runId: &str, payload: &Value) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::claimTask_details(taskId, runId);
        let body = Some(payload);
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for claimTask
    fn claimTask_details<'a>(taskId: &'a str, runId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/runs/{}/claim", urlencode(taskId), urlencode(runId));
        let query = None;

        (path, query)
    }

    /// Reclaim task
    ///
    /// Refresh the claim for a specific `runId` for given `taskId`. This updates
    /// the `takenUntil` property and returns a new set of temporary credentials
    /// for performing requests on behalf of the task. These credentials should
    /// be used in-place of the credentials returned by `claimWork`.
    ///
    /// The `reclaimTask` requests serves to:
    ///  * Postpone `takenUntil` preventing the queue from resolving
    ///    `claim-expired`,
    ///  * Refresh temporary credentials used for processing the task, and
    ///  * Abort execution if the task/run have been resolved.
    ///
    /// If the `takenUntil` timestamp is exceeded the queue will resolve the run
    /// as _exception_ with reason `claim-expired`, and proceeded to retry to the
    /// task. This ensures that tasks are retried, even if workers disappear
    /// without warning.
    ///
    /// If the task is resolved, this end-point will return `409` reporting
    /// `RequestConflict`. This typically happens if the task have been canceled
    /// or the `task.deadline` have been exceeded. If reclaiming fails, workers
    /// should abort the task and forget about the given `runId`. There is no
    /// need to resolve the run or upload artifacts.
    pub async fn reclaimTask(&self, taskId: &str, runId: &str) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::reclaimTask_details(taskId, runId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for reclaimTask
    fn reclaimTask_details<'a>(taskId: &'a str, runId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/runs/{}/reclaim", urlencode(taskId), urlencode(runId));
        let query = None;

        (path, query)
    }

    /// Report Run Completed
    ///
    /// Report a task completed, resolving the run as `completed`.
    pub async fn reportCompleted(&self, taskId: &str, runId: &str) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::reportCompleted_details(taskId, runId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for reportCompleted
    fn reportCompleted_details<'a>(taskId: &'a str, runId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/runs/{}/completed", urlencode(taskId), urlencode(runId));
        let query = None;

        (path, query)
    }

    /// Report Run Failed
    ///
    /// Report a run failed, resolving the run as `failed`. Use this to resolve
    /// a run that failed because the task specific code behaved unexpectedly.
    /// For example the task exited non-zero, or didn't produce expected output.
    ///
    /// Do not use this if the task couldn't be run because if malformed
    /// payload, or other unexpected condition. In these cases we have a task
    /// exception, which should be reported with `reportException`.
    pub async fn reportFailed(&self, taskId: &str, runId: &str) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::reportFailed_details(taskId, runId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for reportFailed
    fn reportFailed_details<'a>(taskId: &'a str, runId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/runs/{}/failed", urlencode(taskId), urlencode(runId));
        let query = None;

        (path, query)
    }

    /// Report Task Exception
    ///
    /// Resolve a run as _exception_. Generally, you will want to report tasks as
    /// failed instead of exception. You should `reportException` if,
    ///
    ///   * The `task.payload` is invalid,
    ///   * Non-existent resources are referenced,
    ///   * Declared actions cannot be executed due to unavailable resources,
    ///   * The worker had to shutdown prematurely,
    ///   * The worker experienced an unknown error, or,
    ///   * The task explicitly requested a retry.
    ///
    /// Do not use this to signal that some user-specified code crashed for any
    /// reason specific to this code. If user-specific code hits a resource that
    /// is temporarily unavailable worker should report task _failed_.
    pub async fn reportException(&self, taskId: &str, runId: &str, payload: &Value) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::reportException_details(taskId, runId);
        let body = Some(payload);
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for reportException
    fn reportException_details<'a>(taskId: &'a str, runId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/runs/{}/exception", urlencode(taskId), urlencode(runId));
        let query = None;

        (path, query)
    }

    /// Create Artifact
    ///
    /// This API end-point creates an artifact for a specific run of a task. This
    /// should **only** be used by a worker currently operating on this task, or
    /// from a process running within the task (ie. on the worker).
    ///
    /// All artifacts must specify when they expire. The queue will
    /// automatically take care of deleting artifacts past their
    /// expiration point. This feature makes it feasible to upload large
    /// intermediate artifacts from data processing applications, as the
    /// artifacts can be set to expire a few days later.
    pub async fn createArtifact(&self, taskId: &str, runId: &str, name: &str, payload: &Value) -> Result<Value, Error> {
        let method = "POST";
        let (path, query) = Self::createArtifact_details(taskId, runId, name);
        let body = Some(payload);
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for createArtifact
    fn createArtifact_details<'a>(taskId: &'a str, runId: &'a str, name: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/runs/{}/artifacts/{}", urlencode(taskId), urlencode(runId), urlencode(name));
        let query = None;

        (path, query)
    }

    /// Finish Artifact
    ///
    /// This endpoint marks an artifact as present for the given task, and
    /// should be called when the artifact data is fully uploaded.
    ///
    /// The storage types `reference`, `link`, and `error` do not need to
    /// be finished, as they are finished immediately by `createArtifact`.
    /// The storage type `s3` does not support this functionality and cannot
    /// be finished.  In all such cases, calling this method is an input error
    /// (400).
    pub async fn finishArtifact(&self, taskId: &str, runId: &str, name: &str, payload: &Value) -> Result<(), Error> {
        let method = "PUT";
        let (path, query) = Self::finishArtifact_details(taskId, runId, name);
        let body = Some(payload);
        let resp = self.client.request(method, &path, query, body).await?;
        resp.bytes().await?;
        Ok(())
    }

    /// Determine the HTTP request details for finishArtifact
    fn finishArtifact_details<'a>(taskId: &'a str, runId: &'a str, name: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/runs/{}/artifacts/{}", urlencode(taskId), urlencode(runId), urlencode(name));
        let query = None;

        (path, query)
    }

    /// Get Artifact Data from Run
    ///
    /// Get artifact by `<name>` from a specific run.
    ///
    /// **Artifact Access**, in order to get an artifact you need the scope
    /// `queue:get-artifact:<name>`, where `<name>` is the name of the artifact.
    /// To allow access to fetch artifacts with a client like `curl` or a web
    /// browser, without using Taskcluster credentials, include a scope in the
    /// `anonymous` role.  The convention is to include
    /// `queue:get-artifact:public/*`.
    ///
    /// **Response**: the HTTP response to this method is a 303 redirect to the
    /// URL from which the artifact can be downloaded.  The body of that response
    /// contains the data described in the output schema, contianing the same URL.
    /// Callers are encouraged to use whichever method of gathering the URL is
    /// most convenient.  Standard HTTP clients will follow the redirect, while
    /// API client libraries will return the JSON body.
    ///
    /// In order to download an artifact the following must be done:
    ///
    /// 1. Obtain queue url.  Building a signed url with a taskcluster client is
    /// recommended
    /// 1. Make a GET request which does not follow redirects
    /// 1. In all cases, if specified, the
    /// x-taskcluster-location-{content,transfer}-{sha256,length} values must be
    /// validated to be equal to the Content-Length and Sha256 checksum of the
    /// final artifact downloaded. as well as any intermediate redirects
    /// 1. If this response is a 500-series error, retry using an exponential
    /// backoff.  No more than 5 retries should be attempted
    /// 1. If this response is a 400-series error, treat it appropriately for
    /// your context.  This might be an error in responding to this request or
    /// an Error storage type body.  This request should not be retried.
    /// 1. If this response is a 200-series response, the response body is the artifact.
    /// If the x-taskcluster-location-{content,transfer}-{sha256,length} and
    /// x-taskcluster-location-content-encoding are specified, they should match
    /// this response body
    /// 1. If the response type is a 300-series redirect, the artifact will be at the
    /// location specified by the `Location` header.  There are multiple artifact storage
    /// types which use a 300-series redirect.
    /// 1. For all redirects followed, the user must verify that the content-sha256, content-length,
    /// transfer-sha256, transfer-length and content-encoding match every further request.  The final
    /// artifact must also be validated against the values specified in the original queue response
    /// 1. Caching of requests with an x-taskcluster-artifact-storage-type value of `reference`
    /// must not occur
    ///
    /// **Headers**
    /// The following important headers are set on the response to this method:
    ///
    /// * location: the url of the artifact if a redirect is to be performed
    /// * x-taskcluster-artifact-storage-type: the storage type.  Example: s3
    pub async fn getArtifact(&self, taskId: &str, runId: &str, name: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::getArtifact_details(taskId, runId, name);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the getArtifact endpoint
    pub fn getArtifact_url(&self, taskId: &str, runId: &str, name: &str) -> Result<String, Error> {
        let (path, query) = Self::getArtifact_details(taskId, runId, name);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the getArtifact endpoint
    pub fn getArtifact_signed_url(&self, taskId: &str, runId: &str, name: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::getArtifact_details(taskId, runId, name);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for getArtifact
    fn getArtifact_details<'a>(taskId: &'a str, runId: &'a str, name: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/runs/{}/artifacts/{}", urlencode(taskId), urlencode(runId), urlencode(name));
        let query = None;

        (path, query)
    }

    /// Get Artifact Data from Latest Run
    ///
    /// Get artifact by `<name>` from the last run of a task.
    ///
    /// **Artifact Access**, in order to get an artifact you need the scope
    /// `queue:get-artifact:<name>`, where `<name>` is the name of the artifact.
    /// To allow access to fetch artifacts with a client like `curl` or a web
    /// browser, without using Taskcluster credentials, include a scope in the
    /// `anonymous` role.  The convention is to include
    /// `queue:get-artifact:public/*`.
    ///
    /// **API Clients**, this method will redirect you to the artifact, if it is
    /// stored externally. Either way, the response may not be JSON. So API
    /// client users might want to generate a signed URL for this end-point and
    /// use that URL with a normal HTTP client.
    ///
    /// **Remark**, this end-point is slightly slower than
    /// `queue.getArtifact`, so consider that if you already know the `runId` of
    /// the latest run. Otherwise, just us the most convenient API end-point.
    pub async fn getLatestArtifact(&self, taskId: &str, name: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::getLatestArtifact_details(taskId, name);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the getLatestArtifact endpoint
    pub fn getLatestArtifact_url(&self, taskId: &str, name: &str) -> Result<String, Error> {
        let (path, query) = Self::getLatestArtifact_details(taskId, name);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the getLatestArtifact endpoint
    pub fn getLatestArtifact_signed_url(&self, taskId: &str, name: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::getLatestArtifact_details(taskId, name);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for getLatestArtifact
    fn getLatestArtifact_details<'a>(taskId: &'a str, name: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/artifacts/{}", urlencode(taskId), urlencode(name));
        let query = None;

        (path, query)
    }

    /// Get Artifacts from Run
    ///
    /// Returns a list of artifacts and associated meta-data for a given run.
    ///
    /// As a task may have many artifacts paging may be necessary. If this
    /// end-point returns a `continuationToken`, you should call the end-point
    /// again with the `continuationToken` as the query-string option:
    /// `continuationToken`.
    ///
    /// By default this end-point will list up-to 1000 artifacts in a single page
    /// you may limit this with the query-string parameter `limit`.
    pub async fn listArtifacts(&self, taskId: &str, runId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::listArtifacts_details(taskId, runId, continuationToken, limit);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the listArtifacts endpoint
    pub fn listArtifacts_url(&self, taskId: &str, runId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<String, Error> {
        let (path, query) = Self::listArtifacts_details(taskId, runId, continuationToken, limit);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the listArtifacts endpoint
    pub fn listArtifacts_signed_url(&self, taskId: &str, runId: &str, continuationToken: Option<&str>, limit: Option<&str>, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::listArtifacts_details(taskId, runId, continuationToken, limit);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for listArtifacts
    fn listArtifacts_details<'a>(taskId: &'a str, runId: &'a str, continuationToken: Option<&'a str>, limit: Option<&'a str>) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/runs/{}/artifacts", urlencode(taskId), urlencode(runId));
        let mut query = None;
        if let Some(q) = continuationToken {
            query.get_or_insert_with(Vec::new).push(("continuationToken", q));
        }
        if let Some(q) = limit {
            query.get_or_insert_with(Vec::new).push(("limit", q));
        }

        (path, query)
    }

    /// Get Artifacts from Latest Run
    ///
    /// Returns a list of artifacts and associated meta-data for the latest run
    /// from the given task.
    ///
    /// As a task may have many artifacts paging may be necessary. If this
    /// end-point returns a `continuationToken`, you should call the end-point
    /// again with the `continuationToken` as the query-string option:
    /// `continuationToken`.
    ///
    /// By default this end-point will list up-to 1000 artifacts in a single page
    /// you may limit this with the query-string parameter `limit`.
    pub async fn listLatestArtifacts(&self, taskId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::listLatestArtifacts_details(taskId, continuationToken, limit);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the listLatestArtifacts endpoint
    pub fn listLatestArtifacts_url(&self, taskId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<String, Error> {
        let (path, query) = Self::listLatestArtifacts_details(taskId, continuationToken, limit);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the listLatestArtifacts endpoint
    pub fn listLatestArtifacts_signed_url(&self, taskId: &str, continuationToken: Option<&str>, limit: Option<&str>, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::listLatestArtifacts_details(taskId, continuationToken, limit);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for listLatestArtifacts
    fn listLatestArtifacts_details<'a>(taskId: &'a str, continuationToken: Option<&'a str>, limit: Option<&'a str>) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/artifacts", urlencode(taskId));
        let mut query = None;
        if let Some(q) = continuationToken {
            query.get_or_insert_with(Vec::new).push(("continuationToken", q));
        }
        if let Some(q) = limit {
            query.get_or_insert_with(Vec::new).push(("limit", q));
        }

        (path, query)
    }

    /// Get Artifact Information From Run
    ///
    /// Returns associated metadata for a given artifact, in the given task run.
    /// The metadata is the same as that returned from `listArtifacts`, and does
    /// not grant access to the artifact data.
    ///
    /// Note that this method does *not* automatically follow link artifacts.
    pub async fn artifactInfo(&self, taskId: &str, runId: &str, name: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::artifactInfo_details(taskId, runId, name);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the artifactInfo endpoint
    pub fn artifactInfo_url(&self, taskId: &str, runId: &str, name: &str) -> Result<String, Error> {
        let (path, query) = Self::artifactInfo_details(taskId, runId, name);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the artifactInfo endpoint
    pub fn artifactInfo_signed_url(&self, taskId: &str, runId: &str, name: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::artifactInfo_details(taskId, runId, name);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for artifactInfo
    fn artifactInfo_details<'a>(taskId: &'a str, runId: &'a str, name: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/runs/{}/artifact-info/{}", urlencode(taskId), urlencode(runId), urlencode(name));
        let query = None;

        (path, query)
    }

    /// Get Artifact Information From Latest Run
    ///
    /// Returns associated metadata for a given artifact, in the latest run of the
    /// task.  The metadata is the same as that returned from `listArtifacts`,
    /// and does not grant access to the artifact data.
    ///
    /// Note that this method does *not* automatically follow link artifacts.
    pub async fn latestArtifactInfo(&self, taskId: &str, name: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::latestArtifactInfo_details(taskId, name);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the latestArtifactInfo endpoint
    pub fn latestArtifactInfo_url(&self, taskId: &str, name: &str) -> Result<String, Error> {
        let (path, query) = Self::latestArtifactInfo_details(taskId, name);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the latestArtifactInfo endpoint
    pub fn latestArtifactInfo_signed_url(&self, taskId: &str, name: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::latestArtifactInfo_details(taskId, name);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for latestArtifactInfo
    fn latestArtifactInfo_details<'a>(taskId: &'a str, name: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/artifact-info/{}", urlencode(taskId), urlencode(name));
        let query = None;

        (path, query)
    }

    /// Get Artifact Content From Run
    ///
    /// Returns information about the content of the artifact, in the given task run.
    ///
    /// Depending on the storage type, the endpoint returns the content of the artifact
    /// or enough information to access that content.
    ///
    /// This method follows link artifacts, so it will not return content
    /// for a link artifact.
    pub async fn artifact(&self, taskId: &str, runId: &str, name: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::artifact_details(taskId, runId, name);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the artifact endpoint
    pub fn artifact_url(&self, taskId: &str, runId: &str, name: &str) -> Result<String, Error> {
        let (path, query) = Self::artifact_details(taskId, runId, name);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the artifact endpoint
    pub fn artifact_signed_url(&self, taskId: &str, runId: &str, name: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::artifact_details(taskId, runId, name);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for artifact
    fn artifact_details<'a>(taskId: &'a str, runId: &'a str, name: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/runs/{}/artifact-content/{}", urlencode(taskId), urlencode(runId), urlencode(name));
        let query = None;

        (path, query)
    }

    /// Get Artifact Content From Latest Run
    ///
    /// Returns information about the content of the artifact, in the latest task run.
    ///
    /// Depending on the storage type, the endpoint returns the content of the artifact
    /// or enough information to access that content.
    ///
    /// This method follows link artifacts, so it will not return content
    /// for a link artifact.
    pub async fn latestArtifact(&self, taskId: &str, name: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::latestArtifact_details(taskId, name);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the latestArtifact endpoint
    pub fn latestArtifact_url(&self, taskId: &str, name: &str) -> Result<String, Error> {
        let (path, query) = Self::latestArtifact_details(taskId, name);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the latestArtifact endpoint
    pub fn latestArtifact_signed_url(&self, taskId: &str, name: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::latestArtifact_details(taskId, name);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for latestArtifact
    fn latestArtifact_details<'a>(taskId: &'a str, name: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task/{}/artifact-content/{}", urlencode(taskId), urlencode(name));
        let query = None;

        (path, query)
    }

    /// Get a list of all active provisioners
    ///
    /// Get all active provisioners.
    ///
    /// The term "provisioner" is taken broadly to mean anything with a provisionerId.
    /// This does not necessarily mean there is an associated service performing any
    /// provisioning activity.
    ///
    /// The response is paged. If this end-point returns a `continuationToken`, you
    /// should call the end-point again with the `continuationToken` as a query-string
    /// option. By default this end-point will list up to 1000 provisioners in a single
    /// page. You may limit this with the query-string parameter `limit`.
    pub async fn listProvisioners(&self, continuationToken: Option<&str>, limit: Option<&str>) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::listProvisioners_details(continuationToken, limit);
        let body = None;
        let resp = self.client.request(method, path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the listProvisioners endpoint
    pub fn listProvisioners_url(&self, continuationToken: Option<&str>, limit: Option<&str>) -> Result<String, Error> {
        let (path, query) = Self::listProvisioners_details(continuationToken, limit);
        self.client.make_url(path, query)
    }

    /// Generate a signed URL for the listProvisioners endpoint
    pub fn listProvisioners_signed_url(&self, continuationToken: Option<&str>, limit: Option<&str>, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::listProvisioners_details(continuationToken, limit);
        self.client.make_signed_url(path, query, ttl)
    }

    /// Determine the HTTP request details for listProvisioners
    fn listProvisioners_details<'a>(continuationToken: Option<&'a str>, limit: Option<&'a str>) -> (&'static str, Option<Vec<(&'static str, &'a str)>>) {
        let path = "provisioners";
        let mut query = None;
        if let Some(q) = continuationToken {
            query.get_or_insert_with(Vec::new).push(("continuationToken", q));
        }
        if let Some(q) = limit {
            query.get_or_insert_with(Vec::new).push(("limit", q));
        }

        (path, query)
    }

    /// Get an active provisioner
    ///
    /// Get an active provisioner.
    ///
    /// The term "provisioner" is taken broadly to mean anything with a provisionerId.
    /// This does not necessarily mean there is an associated service performing any
    /// provisioning activity.
    pub async fn getProvisioner(&self, provisionerId: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::getProvisioner_details(provisionerId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the getProvisioner endpoint
    pub fn getProvisioner_url(&self, provisionerId: &str) -> Result<String, Error> {
        let (path, query) = Self::getProvisioner_details(provisionerId);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the getProvisioner endpoint
    pub fn getProvisioner_signed_url(&self, provisionerId: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::getProvisioner_details(provisionerId);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for getProvisioner
    fn getProvisioner_details<'a>(provisionerId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("provisioners/{}", urlencode(provisionerId));
        let query = None;

        (path, query)
    }

    /// Update a provisioner
    ///
    /// Declare a provisioner, supplying some details about it.
    ///
    /// `declareProvisioner` allows updating one or more properties of a provisioner as long as the required scopes are
    /// possessed. For example, a request to update the `my-provisioner`
    /// provisioner with a body `{description: 'This provisioner is great'}` would require you to have the scope
    /// `queue:declare-provisioner:my-provisioner#description`.
    ///
    /// The term "provisioner" is taken broadly to mean anything with a provisionerId.
    /// This does not necessarily mean there is an associated service performing any
    /// provisioning activity.
    pub async fn declareProvisioner(&self, provisionerId: &str, payload: &Value) -> Result<Value, Error> {
        let method = "PUT";
        let (path, query) = Self::declareProvisioner_details(provisionerId);
        let body = Some(payload);
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for declareProvisioner
    fn declareProvisioner_details<'a>(provisionerId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("provisioners/{}", urlencode(provisionerId));
        let query = None;

        (path, query)
    }

    /// Get Number of Pending Tasks
    ///
    /// Get an approximate number of pending tasks for the given `taskQueueId`.
    ///
    /// As task states may change rapidly, this number may not represent the exact
    /// number of pending tasks, but a very good approximation.
    pub async fn pendingTasks(&self, taskQueueId: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::pendingTasks_details(taskQueueId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the pendingTasks endpoint
    pub fn pendingTasks_url(&self, taskQueueId: &str) -> Result<String, Error> {
        let (path, query) = Self::pendingTasks_details(taskQueueId);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the pendingTasks endpoint
    pub fn pendingTasks_signed_url(&self, taskQueueId: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::pendingTasks_details(taskQueueId);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for pendingTasks
    fn pendingTasks_details<'a>(taskQueueId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("pending/{}", urlencode(taskQueueId));
        let query = None;

        (path, query)
    }

    /// List Pending Tasks
    ///
    /// List pending tasks for the given `taskQueueId`.
    ///
    /// As task states may change rapidly, this information might not represent the exact
    /// state of such tasks, but a very good approximation.
    pub async fn listPendingTasks(&self, taskQueueId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::listPendingTasks_details(taskQueueId, continuationToken, limit);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the listPendingTasks endpoint
    pub fn listPendingTasks_url(&self, taskQueueId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<String, Error> {
        let (path, query) = Self::listPendingTasks_details(taskQueueId, continuationToken, limit);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the listPendingTasks endpoint
    pub fn listPendingTasks_signed_url(&self, taskQueueId: &str, continuationToken: Option<&str>, limit: Option<&str>, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::listPendingTasks_details(taskQueueId, continuationToken, limit);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for listPendingTasks
    fn listPendingTasks_details<'a>(taskQueueId: &'a str, continuationToken: Option<&'a str>, limit: Option<&'a str>) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task-queues/{}/pending", urlencode(taskQueueId));
        let mut query = None;
        if let Some(q) = continuationToken {
            query.get_or_insert_with(Vec::new).push(("continuationToken", q));
        }
        if let Some(q) = limit {
            query.get_or_insert_with(Vec::new).push(("limit", q));
        }

        (path, query)
    }

    /// List claimed Tasks
    ///
    /// List claimed tasks for the given `taskQueueId`.
    ///
    /// As task states may change rapidly, this information might not represent the exact
    /// state of such tasks, but a very good approximation.
    pub async fn listClaimedTasks(&self, taskQueueId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::listClaimedTasks_details(taskQueueId, continuationToken, limit);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the listClaimedTasks endpoint
    pub fn listClaimedTasks_url(&self, taskQueueId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<String, Error> {
        let (path, query) = Self::listClaimedTasks_details(taskQueueId, continuationToken, limit);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the listClaimedTasks endpoint
    pub fn listClaimedTasks_signed_url(&self, taskQueueId: &str, continuationToken: Option<&str>, limit: Option<&str>, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::listClaimedTasks_details(taskQueueId, continuationToken, limit);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for listClaimedTasks
    fn listClaimedTasks_details<'a>(taskQueueId: &'a str, continuationToken: Option<&'a str>, limit: Option<&'a str>) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task-queues/{}/claimed", urlencode(taskQueueId));
        let mut query = None;
        if let Some(q) = continuationToken {
            query.get_or_insert_with(Vec::new).push(("continuationToken", q));
        }
        if let Some(q) = limit {
            query.get_or_insert_with(Vec::new).push(("limit", q));
        }

        (path, query)
    }

    /// Get a list of all active worker-types
    ///
    /// Get all active worker-types for the given provisioner.
    ///
    /// The response is paged. If this end-point returns a `continuationToken`, you
    /// should call the end-point again with the `continuationToken` as a query-string
    /// option. By default this end-point will list up to 1000 worker-types in a single
    /// page. You may limit this with the query-string parameter `limit`.
    pub async fn listWorkerTypes(&self, provisionerId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::listWorkerTypes_details(provisionerId, continuationToken, limit);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the listWorkerTypes endpoint
    pub fn listWorkerTypes_url(&self, provisionerId: &str, continuationToken: Option<&str>, limit: Option<&str>) -> Result<String, Error> {
        let (path, query) = Self::listWorkerTypes_details(provisionerId, continuationToken, limit);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the listWorkerTypes endpoint
    pub fn listWorkerTypes_signed_url(&self, provisionerId: &str, continuationToken: Option<&str>, limit: Option<&str>, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::listWorkerTypes_details(provisionerId, continuationToken, limit);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for listWorkerTypes
    fn listWorkerTypes_details<'a>(provisionerId: &'a str, continuationToken: Option<&'a str>, limit: Option<&'a str>) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("provisioners/{}/worker-types", urlencode(provisionerId));
        let mut query = None;
        if let Some(q) = continuationToken {
            query.get_or_insert_with(Vec::new).push(("continuationToken", q));
        }
        if let Some(q) = limit {
            query.get_or_insert_with(Vec::new).push(("limit", q));
        }

        (path, query)
    }

    /// Get a worker-type
    ///
    /// Get a worker-type from a provisioner.
    pub async fn getWorkerType(&self, provisionerId: &str, workerType: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::getWorkerType_details(provisionerId, workerType);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the getWorkerType endpoint
    pub fn getWorkerType_url(&self, provisionerId: &str, workerType: &str) -> Result<String, Error> {
        let (path, query) = Self::getWorkerType_details(provisionerId, workerType);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the getWorkerType endpoint
    pub fn getWorkerType_signed_url(&self, provisionerId: &str, workerType: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::getWorkerType_details(provisionerId, workerType);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for getWorkerType
    fn getWorkerType_details<'a>(provisionerId: &'a str, workerType: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("provisioners/{}/worker-types/{}", urlencode(provisionerId), urlencode(workerType));
        let query = None;

        (path, query)
    }

    /// Update a worker-type
    ///
    /// Declare a workerType, supplying some details about it.
    ///
    /// `declareWorkerType` allows updating one or more properties of a worker-type as long as the required scopes are
    /// possessed. For example, a request to update the `highmem` worker-type within the `my-provisioner`
    /// provisioner with a body `{description: 'This worker type is great'}` would require you to have the scope
    /// `queue:declare-worker-type:my-provisioner/highmem#description`.
    pub async fn declareWorkerType(&self, provisionerId: &str, workerType: &str, payload: &Value) -> Result<Value, Error> {
        let method = "PUT";
        let (path, query) = Self::declareWorkerType_details(provisionerId, workerType);
        let body = Some(payload);
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for declareWorkerType
    fn declareWorkerType_details<'a>(provisionerId: &'a str, workerType: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("provisioners/{}/worker-types/{}", urlencode(provisionerId), urlencode(workerType));
        let query = None;

        (path, query)
    }

    /// Get a list of all active task queues
    ///
    /// Get all active task queues.
    ///
    /// The response is paged. If this end-point returns a `continuationToken`, you
    /// should call the end-point again with the `continuationToken` as a query-string
    /// option. By default this end-point will list up to 1000 task queues in a single
    /// page. You may limit this with the query-string parameter `limit`.
    pub async fn listTaskQueues(&self, continuationToken: Option<&str>, limit: Option<&str>) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::listTaskQueues_details(continuationToken, limit);
        let body = None;
        let resp = self.client.request(method, path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the listTaskQueues endpoint
    pub fn listTaskQueues_url(&self, continuationToken: Option<&str>, limit: Option<&str>) -> Result<String, Error> {
        let (path, query) = Self::listTaskQueues_details(continuationToken, limit);
        self.client.make_url(path, query)
    }

    /// Generate a signed URL for the listTaskQueues endpoint
    pub fn listTaskQueues_signed_url(&self, continuationToken: Option<&str>, limit: Option<&str>, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::listTaskQueues_details(continuationToken, limit);
        self.client.make_signed_url(path, query, ttl)
    }

    /// Determine the HTTP request details for listTaskQueues
    fn listTaskQueues_details<'a>(continuationToken: Option<&'a str>, limit: Option<&'a str>) -> (&'static str, Option<Vec<(&'static str, &'a str)>>) {
        let path = "task-queues";
        let mut query = None;
        if let Some(q) = continuationToken {
            query.get_or_insert_with(Vec::new).push(("continuationToken", q));
        }
        if let Some(q) = limit {
            query.get_or_insert_with(Vec::new).push(("limit", q));
        }

        (path, query)
    }

    /// Get a task queue
    ///
    /// Get a task queue.
    pub async fn getTaskQueue(&self, taskQueueId: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::getTaskQueue_details(taskQueueId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the getTaskQueue endpoint
    pub fn getTaskQueue_url(&self, taskQueueId: &str) -> Result<String, Error> {
        let (path, query) = Self::getTaskQueue_details(taskQueueId);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the getTaskQueue endpoint
    pub fn getTaskQueue_signed_url(&self, taskQueueId: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::getTaskQueue_details(taskQueueId);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for getTaskQueue
    fn getTaskQueue_details<'a>(taskQueueId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("task-queues/{}", urlencode(taskQueueId));
        let query = None;

        (path, query)
    }

    /// Get a list of all active workers of a workerType
    ///
    /// Get a list of all active workers of a workerType.
    ///
    /// `listWorkers` allows a response to be filtered by quarantined and non quarantined workers.
    /// To filter the query, you should call the end-point with `quarantined` as a query-string option with a
    /// true or false value.
    ///
    /// The response is paged. If this end-point returns a `continuationToken`, you
    /// should call the end-point again with the `continuationToken` as a query-string
    /// option. By default this end-point will list up to 1000 workers in a single
    /// page. You may limit this with the query-string parameter `limit`.
    pub async fn listWorkers(&self, provisionerId: &str, workerType: &str, continuationToken: Option<&str>, limit: Option<&str>, quarantined: Option<&str>) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::listWorkers_details(provisionerId, workerType, continuationToken, limit, quarantined);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the listWorkers endpoint
    pub fn listWorkers_url(&self, provisionerId: &str, workerType: &str, continuationToken: Option<&str>, limit: Option<&str>, quarantined: Option<&str>) -> Result<String, Error> {
        let (path, query) = Self::listWorkers_details(provisionerId, workerType, continuationToken, limit, quarantined);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the listWorkers endpoint
    pub fn listWorkers_signed_url(&self, provisionerId: &str, workerType: &str, continuationToken: Option<&str>, limit: Option<&str>, quarantined: Option<&str>, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::listWorkers_details(provisionerId, workerType, continuationToken, limit, quarantined);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for listWorkers
    fn listWorkers_details<'a>(provisionerId: &'a str, workerType: &'a str, continuationToken: Option<&'a str>, limit: Option<&'a str>, quarantined: Option<&'a str>) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("provisioners/{}/worker-types/{}/workers", urlencode(provisionerId), urlencode(workerType));
        let mut query = None;
        if let Some(q) = continuationToken {
            query.get_or_insert_with(Vec::new).push(("continuationToken", q));
        }
        if let Some(q) = limit {
            query.get_or_insert_with(Vec::new).push(("limit", q));
        }
        if let Some(q) = quarantined {
            query.get_or_insert_with(Vec::new).push(("quarantined", q));
        }

        (path, query)
    }

    /// Get a worker from worker-type
    ///
    /// Get a worker from a worker-type.
    pub async fn getWorker(&self, provisionerId: &str, workerType: &str, workerGroup: &str, workerId: &str) -> Result<Value, Error> {
        let method = "GET";
        let (path, query) = Self::getWorker_details(provisionerId, workerType, workerGroup, workerId);
        let body = None;
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Generate an unsigned URL for the getWorker endpoint
    pub fn getWorker_url(&self, provisionerId: &str, workerType: &str, workerGroup: &str, workerId: &str) -> Result<String, Error> {
        let (path, query) = Self::getWorker_details(provisionerId, workerType, workerGroup, workerId);
        self.client.make_url(&path, query)
    }

    /// Generate a signed URL for the getWorker endpoint
    pub fn getWorker_signed_url(&self, provisionerId: &str, workerType: &str, workerGroup: &str, workerId: &str, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::getWorker_details(provisionerId, workerType, workerGroup, workerId);
        self.client.make_signed_url(&path, query, ttl)
    }

    /// Determine the HTTP request details for getWorker
    fn getWorker_details<'a>(provisionerId: &'a str, workerType: &'a str, workerGroup: &'a str, workerId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("provisioners/{}/worker-types/{}/workers/{}/{}", urlencode(provisionerId), urlencode(workerType), urlencode(workerGroup), urlencode(workerId));
        let query = None;

        (path, query)
    }

    /// Quarantine a worker
    ///
    /// Quarantine a worker
    pub async fn quarantineWorker(&self, provisionerId: &str, workerType: &str, workerGroup: &str, workerId: &str, payload: &Value) -> Result<Value, Error> {
        let method = "PUT";
        let (path, query) = Self::quarantineWorker_details(provisionerId, workerType, workerGroup, workerId);
        let body = Some(payload);
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for quarantineWorker
    fn quarantineWorker_details<'a>(provisionerId: &'a str, workerType: &'a str, workerGroup: &'a str, workerId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("provisioners/{}/worker-types/{}/workers/{}/{}", urlencode(provisionerId), urlencode(workerType), urlencode(workerGroup), urlencode(workerId));
        let query = None;

        (path, query)
    }

    /// Declare a worker
    ///
    /// Declare a worker, supplying some details about it.
    ///
    /// `declareWorker` allows updating one or more properties of a worker as long as the required scopes are
    /// possessed.
    pub async fn declareWorker(&self, provisionerId: &str, workerType: &str, workerGroup: &str, workerId: &str, payload: &Value) -> Result<Value, Error> {
        let method = "PUT";
        let (path, query) = Self::declareWorker_details(provisionerId, workerType, workerGroup, workerId);
        let body = Some(payload);
        let resp = self.client.request(method, &path, query, body).await?;
        Ok(resp.json().await?)
    }

    /// Determine the HTTP request details for declareWorker
    fn declareWorker_details<'a>(provisionerId: &'a str, workerType: &'a str, workerGroup: &'a str, workerId: &'a str) -> (String, Option<Vec<(&'static str, &'a str)>>) {
        let path = format!("provisioners/{}/worker-types/{}/{}/{}", urlencode(provisionerId), urlencode(workerType), urlencode(workerGroup), urlencode(workerId));
        let query = None;

        (path, query)
    }

    /// Heartbeat
    ///
    /// Respond with a service heartbeat.
    ///
    /// This endpoint is used to check on backing services this service
    /// depends on.
    pub async fn heartbeat(&self) -> Result<(), Error> {
        let method = "GET";
        let (path, query) = Self::heartbeat_details();
        let body = None;
        let resp = self.client.request(method, path, query, body).await?;
        resp.bytes().await?;
        Ok(())
    }

    /// Generate an unsigned URL for the heartbeat endpoint
    pub fn heartbeat_url(&self) -> Result<String, Error> {
        let (path, query) = Self::heartbeat_details();
        self.client.make_url(path, query)
    }

    /// Generate a signed URL for the heartbeat endpoint
    pub fn heartbeat_signed_url(&self, ttl: Duration) -> Result<String, Error> {
        let (path, query) = Self::heartbeat_details();
        self.client.make_signed_url(path, query, ttl)
    }

    /// Determine the HTTP request details for heartbeat
    fn heartbeat_details<'a>() -> (&'static str, Option<Vec<(&'static str, &'a str)>>) {
        let path = "__heartbeat__";
        let query = None;

        (path, query)
    }
}