@huaweicloud/huaweicloud-sdk-codeartsbuild 3.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,732 @@
1
+ import { HcClient } from "@huaweicloud/huaweicloud-sdk-core/HcClient";
2
+ import { ClientBuilder } from "@huaweicloud/huaweicloud-sdk-core/ClientBuilder";
3
+ import { SdkResponse } from "@huaweicloud/huaweicloud-sdk-core/SdkResponse";
4
+
5
+ import { BuildStep } from './model/BuildStep';
6
+ import { DownloadKeystoreRequest } from './model/DownloadKeystoreRequest';
7
+ import { DownloadKeystoreResponse } from './model/DownloadKeystoreResponse';
8
+ import { HistoryRecord } from './model/HistoryRecord';
9
+ import { HistoryRecord1 } from './model/HistoryRecord1';
10
+ import { Job } from './model/Job';
11
+ import { ParameterItem } from './model/ParameterItem';
12
+ import { RunJobRequest } from './model/RunJobRequest';
13
+ import { RunJobRequestBody } from './model/RunJobRequestBody';
14
+ import { RunJobResponse } from './model/RunJobResponse';
15
+ import { Scm } from './model/Scm';
16
+ import { ShowHistoryDetailsRequest } from './model/ShowHistoryDetailsRequest';
17
+ import { ShowHistoryDetailsResponse } from './model/ShowHistoryDetailsResponse';
18
+ import { ShowJobListByProjectIdRequest } from './model/ShowJobListByProjectIdRequest';
19
+ import { ShowJobListByProjectIdResponse } from './model/ShowJobListByProjectIdResponse';
20
+ import { ShowJobStatusRequest } from './model/ShowJobStatusRequest';
21
+ import { ShowJobStatusResponse } from './model/ShowJobStatusResponse';
22
+ import { ShowJobSuccessRatioRequest } from './model/ShowJobSuccessRatioRequest';
23
+ import { ShowJobSuccessRatioResponse } from './model/ShowJobSuccessRatioResponse';
24
+ import { ShowLastHistoryRequest } from './model/ShowLastHistoryRequest';
25
+ import { ShowLastHistoryResponse } from './model/ShowLastHistoryResponse';
26
+ import { ShowListHistoryRequest } from './model/ShowListHistoryRequest';
27
+ import { ShowListHistoryResponse } from './model/ShowListHistoryResponse';
28
+ import { ShowListPeriodHistoryRequest } from './model/ShowListPeriodHistoryRequest';
29
+ import { ShowListPeriodHistoryResponse } from './model/ShowListPeriodHistoryResponse';
30
+
31
+ export class CodeArtsBuildClient {
32
+ public static newBuilder(): ClientBuilder<CodeArtsBuildClient> {
33
+ return new ClientBuilder<CodeArtsBuildClient>(newClient);
34
+ }
35
+
36
+ private hcClient: HcClient;
37
+ public constructor(client: HcClient) {
38
+ this.hcClient = client;
39
+ }
40
+
41
+ public getPath() {
42
+ return __dirname;
43
+ }
44
+
45
+
46
+ /**
47
+ * 下载指定租户下的KeyStore文件
48
+ *
49
+ * Please refer to HUAWEI cloud API Explorer for details.
50
+ *
51
+ * @summary KeyStore文件下载
52
+ * @param {string} fileName 下载的文件名称
53
+ * @param {string} domainId 租户ID。32位数字、小写字母组合
54
+ * @param {*} [options] Override http request option.
55
+ * @throws {RequiredError}
56
+ */
57
+ public downloadKeystore(downloadKeystoreRequest?: DownloadKeystoreRequest): Promise<DownloadKeystoreResponse> {
58
+ const options = ParamCreater().downloadKeystore(downloadKeystoreRequest);
59
+
60
+ // @ts-ignore
61
+ options['responseHeaders'] = [''];
62
+
63
+ return this.hcClient.sendRequest(options);
64
+ }
65
+
66
+ /**
67
+ * 执行构建任务,可传自定义参数。
68
+ *
69
+ * Please refer to HUAWEI cloud API Explorer for details.
70
+ *
71
+ * @summary 执行构建任务
72
+ * @param {RunJobRequestBody} runJobRequestBody body
73
+ * @param {*} [options] Override http request option.
74
+ * @throws {RequiredError}
75
+ */
76
+ public runJob(runJobRequest?: RunJobRequest): Promise<RunJobResponse> {
77
+ const options = ParamCreater().runJob(runJobRequest);
78
+
79
+ // @ts-ignore
80
+ options['responseHeaders'] = [''];
81
+
82
+ return this.hcClient.sendRequest(options);
83
+ }
84
+
85
+ /**
86
+ * 获取构建历史详情信息接口
87
+ *
88
+ * Please refer to HUAWEI cloud API Explorer for details.
89
+ *
90
+ * @summary 获取构建历史详情信息接口
91
+ * @param {string} jobId 构建的任务ID [获取项目下构建任务列表](https://support.huaweicloud.com/api-codeci/ShowJobListByProjectId.html); 编辑构建任务时,浏览器URL末尾的32位数字、字母组合的字符串。
92
+ * @param {number} buildNumber 构建任务的构建编号,从1开始,每次构建递增1
93
+ * @param {*} [options] Override http request option.
94
+ * @throws {RequiredError}
95
+ */
96
+ public showHistoryDetails(showHistoryDetailsRequest?: ShowHistoryDetailsRequest): Promise<ShowHistoryDetailsResponse> {
97
+ const options = ParamCreater().showHistoryDetails(showHistoryDetailsRequest);
98
+
99
+ // @ts-ignore
100
+ options['responseHeaders'] = [''];
101
+
102
+ return this.hcClient.sendRequest(options);
103
+ }
104
+
105
+ /**
106
+ * 查看项目下用户的构建任务列表
107
+ *
108
+ * Please refer to HUAWEI cloud API Explorer for details.
109
+ *
110
+ * @summary 查看项目下用户的构建任务列表
111
+ * @param {string} projectId CodeArts项目ID,32位数字、小写字母组合。[查询项目列表](https://support.huaweicloud.com/api-projectman/ListProjectsV4.html)
112
+ * @param {number} pageIndex 分页页码, 表示从此页开始查询, page_index大于等于0
113
+ * @param {number} pageSize 每页显示的条目数量,page_size小于等于100
114
+ * @param {*} [options] Override http request option.
115
+ * @throws {RequiredError}
116
+ */
117
+ public showJobListByProjectId(showJobListByProjectIdRequest?: ShowJobListByProjectIdRequest): Promise<ShowJobListByProjectIdResponse> {
118
+ const options = ParamCreater().showJobListByProjectId(showJobListByProjectIdRequest);
119
+
120
+ // @ts-ignore
121
+ options['responseHeaders'] = [''];
122
+
123
+ return this.hcClient.sendRequest(options);
124
+ }
125
+
126
+ /**
127
+ * 查看任务运行状态
128
+ *
129
+ * Please refer to HUAWEI cloud API Explorer for details.
130
+ *
131
+ * @summary 查看任务运行状态
132
+ * @param {string} jobId 构建的任务ID [获取项目下构建任务列表](https://support.huaweicloud.com/api-codeci/ShowJobListByProjectId.html); 编辑构建任务时,浏览器URL末尾的32位数字、字母组合的字符串。
133
+ * @param {*} [options] Override http request option.
134
+ * @throws {RequiredError}
135
+ */
136
+ public showJobStatus(showJobStatusRequest?: ShowJobStatusRequest): Promise<ShowJobStatusResponse> {
137
+ const options = ParamCreater().showJobStatus(showJobStatusRequest);
138
+
139
+ // @ts-ignore
140
+ options['responseHeaders'] = [''];
141
+
142
+ return this.hcClient.sendRequest(options);
143
+ }
144
+
145
+ /**
146
+ * 根据开始时间和结束时间查看构建任务的构建成功率
147
+ *
148
+ * Please refer to HUAWEI cloud API Explorer for details.
149
+ *
150
+ * @summary 根据开始时间和结束时间查看构建任务的构建成功率
151
+ * @param {string} jobId 构建的任务ID [获取项目下构建任务列表](https://support.huaweicloud.com/api-codeci/ShowJobListByProjectId.html); 编辑构建任务时,浏览器URL末尾的32位数字、字母组合的字符串。
152
+ * @param {string} startTime 区间开始时间,格式yyyy-MM-dd。
153
+ * @param {string} endTime 区间结束时间,格式yyyy-MM-dd。
154
+ * @param {*} [options] Override http request option.
155
+ * @throws {RequiredError}
156
+ */
157
+ public showJobSuccessRatio(showJobSuccessRatioRequest?: ShowJobSuccessRatioRequest): Promise<ShowJobSuccessRatioResponse> {
158
+ const options = ParamCreater().showJobSuccessRatio(showJobSuccessRatioRequest);
159
+
160
+ // @ts-ignore
161
+ options['responseHeaders'] = [''];
162
+
163
+ return this.hcClient.sendRequest(options);
164
+ }
165
+
166
+ /**
167
+ * 查询指定代码仓库最近一次成功的构建历史
168
+ *
169
+ * Please refer to HUAWEI cloud API Explorer for details.
170
+ *
171
+ * @summary 查询指定代码仓库最近一次成功的构建历史
172
+ * @param {string} projectId CodeArts项目ID,32位数字、小写字母组合。[查询项目列表](https://support.huaweicloud.com/api-projectman/ListProjectsV4.html)
173
+ * @param {string} repositoryName 代码仓库名,不支持中文
174
+ * @param {*} [options] Override http request option.
175
+ * @throws {RequiredError}
176
+ */
177
+ public showLastHistory(showLastHistoryRequest?: ShowLastHistoryRequest): Promise<ShowLastHistoryResponse> {
178
+ const options = ParamCreater().showLastHistory(showLastHistoryRequest);
179
+
180
+ // @ts-ignore
181
+ options['responseHeaders'] = [''];
182
+
183
+ return this.hcClient.sendRequest(options);
184
+ }
185
+
186
+ /**
187
+ * 查看构建任务的构建历史列表
188
+ *
189
+ * Please refer to HUAWEI cloud API Explorer for details.
190
+ *
191
+ * @summary 查看构建任务的构建历史列表
192
+ * @param {string} jobId 构建的任务ID [获取项目下构建任务列表](https://support.huaweicloud.com/api-codeci/ShowJobListByProjectId.html); 编辑构建任务时,浏览器URL末尾的32位数字、字母组合的字符串。
193
+ * @param {number} offset 分页页码, 表示从此页开始查询, offset大于等于0
194
+ * @param {number} limit 每页显示的条目数量,limit小于等于100
195
+ * @param {number} interval 距今天的时间区间(单位:天),interval小于等于30
196
+ * @param {*} [options] Override http request option.
197
+ * @throws {RequiredError}
198
+ */
199
+ public showListHistory(showListHistoryRequest?: ShowListHistoryRequest): Promise<ShowListHistoryResponse> {
200
+ const options = ParamCreater().showListHistory(showListHistoryRequest);
201
+
202
+ // @ts-ignore
203
+ options['responseHeaders'] = [''];
204
+
205
+ return this.hcClient.sendRequest(options);
206
+ }
207
+
208
+ /**
209
+ * 根据开始时间和结束时间查看构建任务的构建历史列表
210
+ *
211
+ * Please refer to HUAWEI cloud API Explorer for details.
212
+ *
213
+ * @summary 根据开始时间和结束时间查看构建任务的构建历史列表
214
+ * @param {string} jobId 构建的任务ID [获取项目下构建任务列表](https://support.huaweicloud.com/api-codeci/ShowJobListByProjectId.html); 编辑构建任务时,浏览器URL末尾的32位数字、字母组合的字符串。
215
+ * @param {number} offset 分页页码, 表示从此页开始查询, offset大于等于0
216
+ * @param {number} limit 每页显示的条目数量,limit小于等于100
217
+ * @param {string} startTime 区间开始时间,格式yyyy-MM-dd。 开始时间和结束时间间隔不能超过30天
218
+ * @param {string} endTime 区间结束时间,格式yyyy-MM-dd。 开始时间和结束时间间隔不能超过30天
219
+ * @param {*} [options] Override http request option.
220
+ * @throws {RequiredError}
221
+ */
222
+ public showListPeriodHistory(showListPeriodHistoryRequest?: ShowListPeriodHistoryRequest): Promise<ShowListPeriodHistoryResponse> {
223
+ const options = ParamCreater().showListPeriodHistory(showListPeriodHistoryRequest);
224
+
225
+ // @ts-ignore
226
+ options['responseHeaders'] = [''];
227
+
228
+ return this.hcClient.sendRequest(options);
229
+ }
230
+ }
231
+
232
+ export const ParamCreater = function () {
233
+ return {
234
+
235
+ /**
236
+ * 下载指定租户下的KeyStore文件
237
+ *
238
+ * Please refer to HUAWEI cloud API Explorer for details.
239
+ */
240
+ downloadKeystore(downloadKeystoreRequest?: DownloadKeystoreRequest) {
241
+ const options = {
242
+ method: "GET",
243
+ url: "/v3/keystore",
244
+ contentType: "application/json",
245
+ queryParams: {},
246
+ pathParams: {},
247
+ headers: {}
248
+ };
249
+ const localVarHeaderParameter = {} as any;
250
+ const localVarQueryParameter = {} as any;
251
+
252
+ let fileName;
253
+
254
+ let domainId;
255
+
256
+ if (downloadKeystoreRequest !== null && downloadKeystoreRequest !== undefined) {
257
+ if (downloadKeystoreRequest instanceof DownloadKeystoreRequest) {
258
+ fileName = downloadKeystoreRequest.fileName;
259
+ domainId = downloadKeystoreRequest.domainId;
260
+ } else {
261
+ fileName = downloadKeystoreRequest['file_name'];
262
+ domainId = downloadKeystoreRequest['domain_id'];
263
+ }
264
+ }
265
+
266
+
267
+ if (fileName === null || fileName === undefined) {
268
+ throw new RequiredError('fileName','Required parameter fileName was null or undefined when calling downloadKeystore.');
269
+ }
270
+ if (fileName !== null && fileName !== undefined) {
271
+ localVarQueryParameter['file_name'] = fileName;
272
+ }
273
+ if (domainId === null || domainId === undefined) {
274
+ throw new RequiredError('domainId','Required parameter domainId was null or undefined when calling downloadKeystore.');
275
+ }
276
+ if (domainId !== null && domainId !== undefined) {
277
+ localVarQueryParameter['domain_id'] = domainId;
278
+ }
279
+
280
+ options.queryParams = localVarQueryParameter;
281
+ options.headers = localVarHeaderParameter;
282
+ return options;
283
+ },
284
+
285
+ /**
286
+ * 执行构建任务,可传自定义参数。
287
+ *
288
+ * Please refer to HUAWEI cloud API Explorer for details.
289
+ */
290
+ runJob(runJobRequest?: RunJobRequest) {
291
+ const options = {
292
+ method: "POST",
293
+ url: "/v3/jobs/build",
294
+ contentType: "application/json",
295
+ queryParams: {},
296
+ pathParams: {},
297
+ headers: {},
298
+ data: {}
299
+ };
300
+ const localVarHeaderParameter = {} as any;
301
+
302
+ let body: any;
303
+
304
+ if (runJobRequest !== null && runJobRequest !== undefined) {
305
+ if (runJobRequest instanceof RunJobRequest) {
306
+ body = runJobRequest.body
307
+ } else {
308
+ body = runJobRequest['body'];
309
+ }
310
+ }
311
+
312
+
313
+ if (body === null || body === undefined) {
314
+ throw new RequiredError('body','Required parameter body was null or undefined when calling body.');
315
+ }
316
+ localVarHeaderParameter['Content-Type'] = 'application/json';
317
+
318
+ options.data = body !== undefined ? body : {};
319
+ options.headers = localVarHeaderParameter;
320
+ return options;
321
+ },
322
+
323
+ /**
324
+ * 获取构建历史详情信息接口
325
+ *
326
+ * Please refer to HUAWEI cloud API Explorer for details.
327
+ */
328
+ showHistoryDetails(showHistoryDetailsRequest?: ShowHistoryDetailsRequest) {
329
+ const options = {
330
+ method: "GET",
331
+ url: "/v3/jobs/{job_id}/{build_number}/history-details",
332
+ contentType: "application/json",
333
+ queryParams: {},
334
+ pathParams: {},
335
+ headers: {}
336
+ };
337
+ const localVarHeaderParameter = {} as any;
338
+
339
+
340
+ let jobId;
341
+
342
+ let buildNumber;
343
+
344
+ if (showHistoryDetailsRequest !== null && showHistoryDetailsRequest !== undefined) {
345
+ if (showHistoryDetailsRequest instanceof ShowHistoryDetailsRequest) {
346
+ jobId = showHistoryDetailsRequest.jobId;
347
+ buildNumber = showHistoryDetailsRequest.buildNumber;
348
+ } else {
349
+ jobId = showHistoryDetailsRequest['job_id'];
350
+ buildNumber = showHistoryDetailsRequest['build_number'];
351
+ }
352
+ }
353
+
354
+
355
+ if (jobId === null || jobId === undefined) {
356
+ throw new RequiredError('jobId','Required parameter jobId was null or undefined when calling showHistoryDetails.');
357
+ }
358
+ if (buildNumber === null || buildNumber === undefined) {
359
+ throw new RequiredError('buildNumber','Required parameter buildNumber was null or undefined when calling showHistoryDetails.');
360
+ }
361
+
362
+ options.pathParams = { 'job_id': jobId,'build_number': buildNumber, };
363
+ options.headers = localVarHeaderParameter;
364
+ return options;
365
+ },
366
+
367
+ /**
368
+ * 查看项目下用户的构建任务列表
369
+ *
370
+ * Please refer to HUAWEI cloud API Explorer for details.
371
+ */
372
+ showJobListByProjectId(showJobListByProjectIdRequest?: ShowJobListByProjectIdRequest) {
373
+ const options = {
374
+ method: "GET",
375
+ url: "/v3/{project_id}/jobs",
376
+ contentType: "application/json",
377
+ queryParams: {},
378
+ pathParams: {},
379
+ headers: {}
380
+ };
381
+ const localVarHeaderParameter = {} as any;
382
+ const localVarQueryParameter = {} as any;
383
+
384
+ let projectId;
385
+
386
+ let pageIndex;
387
+
388
+ let pageSize;
389
+
390
+ if (showJobListByProjectIdRequest !== null && showJobListByProjectIdRequest !== undefined) {
391
+ if (showJobListByProjectIdRequest instanceof ShowJobListByProjectIdRequest) {
392
+ projectId = showJobListByProjectIdRequest.projectId;
393
+ pageIndex = showJobListByProjectIdRequest.pageIndex;
394
+ pageSize = showJobListByProjectIdRequest.pageSize;
395
+ } else {
396
+ projectId = showJobListByProjectIdRequest['project_id'];
397
+ pageIndex = showJobListByProjectIdRequest['page_index'];
398
+ pageSize = showJobListByProjectIdRequest['page_size'];
399
+ }
400
+ }
401
+
402
+
403
+ if (projectId === null || projectId === undefined) {
404
+ throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling showJobListByProjectId.');
405
+ }
406
+ if (pageIndex === null || pageIndex === undefined) {
407
+ throw new RequiredError('pageIndex','Required parameter pageIndex was null or undefined when calling showJobListByProjectId.');
408
+ }
409
+ if (pageIndex !== null && pageIndex !== undefined) {
410
+ localVarQueryParameter['page_index'] = pageIndex;
411
+ }
412
+ if (pageSize === null || pageSize === undefined) {
413
+ throw new RequiredError('pageSize','Required parameter pageSize was null or undefined when calling showJobListByProjectId.');
414
+ }
415
+ if (pageSize !== null && pageSize !== undefined) {
416
+ localVarQueryParameter['page_size'] = pageSize;
417
+ }
418
+
419
+ options.queryParams = localVarQueryParameter;
420
+ options.pathParams = { 'project_id': projectId, };
421
+ options.headers = localVarHeaderParameter;
422
+ return options;
423
+ },
424
+
425
+ /**
426
+ * 查看任务运行状态
427
+ *
428
+ * Please refer to HUAWEI cloud API Explorer for details.
429
+ */
430
+ showJobStatus(showJobStatusRequest?: ShowJobStatusRequest) {
431
+ const options = {
432
+ method: "GET",
433
+ url: "/v3/jobs/{job_id}/status",
434
+ contentType: "application/json",
435
+ queryParams: {},
436
+ pathParams: {},
437
+ headers: {}
438
+ };
439
+ const localVarHeaderParameter = {} as any;
440
+
441
+
442
+ let jobId;
443
+
444
+ if (showJobStatusRequest !== null && showJobStatusRequest !== undefined) {
445
+ if (showJobStatusRequest instanceof ShowJobStatusRequest) {
446
+ jobId = showJobStatusRequest.jobId;
447
+ } else {
448
+ jobId = showJobStatusRequest['job_id'];
449
+ }
450
+ }
451
+
452
+
453
+ if (jobId === null || jobId === undefined) {
454
+ throw new RequiredError('jobId','Required parameter jobId was null or undefined when calling showJobStatus.');
455
+ }
456
+
457
+ options.pathParams = { 'job_id': jobId, };
458
+ options.headers = localVarHeaderParameter;
459
+ return options;
460
+ },
461
+
462
+ /**
463
+ * 根据开始时间和结束时间查看构建任务的构建成功率
464
+ *
465
+ * Please refer to HUAWEI cloud API Explorer for details.
466
+ */
467
+ showJobSuccessRatio(showJobSuccessRatioRequest?: ShowJobSuccessRatioRequest) {
468
+ const options = {
469
+ method: "GET",
470
+ url: "/v3/jobs/{job_id}/success-ratio",
471
+ contentType: "application/json",
472
+ queryParams: {},
473
+ pathParams: {},
474
+ headers: {}
475
+ };
476
+ const localVarHeaderParameter = {} as any;
477
+ const localVarQueryParameter = {} as any;
478
+
479
+ let jobId;
480
+
481
+ let startTime;
482
+
483
+ let endTime;
484
+
485
+ if (showJobSuccessRatioRequest !== null && showJobSuccessRatioRequest !== undefined) {
486
+ if (showJobSuccessRatioRequest instanceof ShowJobSuccessRatioRequest) {
487
+ jobId = showJobSuccessRatioRequest.jobId;
488
+ startTime = showJobSuccessRatioRequest.startTime;
489
+ endTime = showJobSuccessRatioRequest.endTime;
490
+ } else {
491
+ jobId = showJobSuccessRatioRequest['job_id'];
492
+ startTime = showJobSuccessRatioRequest['start_time'];
493
+ endTime = showJobSuccessRatioRequest['end_time'];
494
+ }
495
+ }
496
+
497
+
498
+ if (jobId === null || jobId === undefined) {
499
+ throw new RequiredError('jobId','Required parameter jobId was null or undefined when calling showJobSuccessRatio.');
500
+ }
501
+ if (startTime === null || startTime === undefined) {
502
+ throw new RequiredError('startTime','Required parameter startTime was null or undefined when calling showJobSuccessRatio.');
503
+ }
504
+ if (startTime !== null && startTime !== undefined) {
505
+ localVarQueryParameter['start_time'] = startTime;
506
+ }
507
+ if (endTime === null || endTime === undefined) {
508
+ throw new RequiredError('endTime','Required parameter endTime was null or undefined when calling showJobSuccessRatio.');
509
+ }
510
+ if (endTime !== null && endTime !== undefined) {
511
+ localVarQueryParameter['end_time'] = endTime;
512
+ }
513
+
514
+ options.queryParams = localVarQueryParameter;
515
+ options.pathParams = { 'job_id': jobId, };
516
+ options.headers = localVarHeaderParameter;
517
+ return options;
518
+ },
519
+
520
+ /**
521
+ * 查询指定代码仓库最近一次成功的构建历史
522
+ *
523
+ * Please refer to HUAWEI cloud API Explorer for details.
524
+ */
525
+ showLastHistory(showLastHistoryRequest?: ShowLastHistoryRequest) {
526
+ const options = {
527
+ method: "GET",
528
+ url: "/v3/jobs/{project_id}/last-history",
529
+ contentType: "application/json",
530
+ queryParams: {},
531
+ pathParams: {},
532
+ headers: {}
533
+ };
534
+ const localVarHeaderParameter = {} as any;
535
+ const localVarQueryParameter = {} as any;
536
+
537
+ let projectId;
538
+
539
+ let repositoryName;
540
+
541
+ if (showLastHistoryRequest !== null && showLastHistoryRequest !== undefined) {
542
+ if (showLastHistoryRequest instanceof ShowLastHistoryRequest) {
543
+ projectId = showLastHistoryRequest.projectId;
544
+ repositoryName = showLastHistoryRequest.repositoryName;
545
+ } else {
546
+ projectId = showLastHistoryRequest['project_id'];
547
+ repositoryName = showLastHistoryRequest['repository_name'];
548
+ }
549
+ }
550
+
551
+
552
+ if (projectId === null || projectId === undefined) {
553
+ throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling showLastHistory.');
554
+ }
555
+ if (repositoryName === null || repositoryName === undefined) {
556
+ throw new RequiredError('repositoryName','Required parameter repositoryName was null or undefined when calling showLastHistory.');
557
+ }
558
+ if (repositoryName !== null && repositoryName !== undefined) {
559
+ localVarQueryParameter['repository_name'] = repositoryName;
560
+ }
561
+
562
+ options.queryParams = localVarQueryParameter;
563
+ options.pathParams = { 'project_id': projectId, };
564
+ options.headers = localVarHeaderParameter;
565
+ return options;
566
+ },
567
+
568
+ /**
569
+ * 查看构建任务的构建历史列表
570
+ *
571
+ * Please refer to HUAWEI cloud API Explorer for details.
572
+ */
573
+ showListHistory(showListHistoryRequest?: ShowListHistoryRequest) {
574
+ const options = {
575
+ method: "GET",
576
+ url: "/v3/jobs/{job_id}/history",
577
+ contentType: "application/json",
578
+ queryParams: {},
579
+ pathParams: {},
580
+ headers: {}
581
+ };
582
+ const localVarHeaderParameter = {} as any;
583
+ const localVarQueryParameter = {} as any;
584
+
585
+ let jobId;
586
+
587
+ let offset;
588
+
589
+ let limit;
590
+
591
+ let interval;
592
+
593
+ if (showListHistoryRequest !== null && showListHistoryRequest !== undefined) {
594
+ if (showListHistoryRequest instanceof ShowListHistoryRequest) {
595
+ jobId = showListHistoryRequest.jobId;
596
+ offset = showListHistoryRequest.offset;
597
+ limit = showListHistoryRequest.limit;
598
+ interval = showListHistoryRequest.interval;
599
+ } else {
600
+ jobId = showListHistoryRequest['job_id'];
601
+ offset = showListHistoryRequest['offset'];
602
+ limit = showListHistoryRequest['limit'];
603
+ interval = showListHistoryRequest['interval'];
604
+ }
605
+ }
606
+
607
+
608
+ if (jobId === null || jobId === undefined) {
609
+ throw new RequiredError('jobId','Required parameter jobId was null or undefined when calling showListHistory.');
610
+ }
611
+ if (offset === null || offset === undefined) {
612
+ throw new RequiredError('offset','Required parameter offset was null or undefined when calling showListHistory.');
613
+ }
614
+ if (offset !== null && offset !== undefined) {
615
+ localVarQueryParameter['offset'] = offset;
616
+ }
617
+ if (limit === null || limit === undefined) {
618
+ throw new RequiredError('limit','Required parameter limit was null or undefined when calling showListHistory.');
619
+ }
620
+ if (limit !== null && limit !== undefined) {
621
+ localVarQueryParameter['limit'] = limit;
622
+ }
623
+ if (interval === null || interval === undefined) {
624
+ throw new RequiredError('interval','Required parameter interval was null or undefined when calling showListHistory.');
625
+ }
626
+ if (interval !== null && interval !== undefined) {
627
+ localVarQueryParameter['interval'] = interval;
628
+ }
629
+
630
+ options.queryParams = localVarQueryParameter;
631
+ options.pathParams = { 'job_id': jobId, };
632
+ options.headers = localVarHeaderParameter;
633
+ return options;
634
+ },
635
+
636
+ /**
637
+ * 根据开始时间和结束时间查看构建任务的构建历史列表
638
+ *
639
+ * Please refer to HUAWEI cloud API Explorer for details.
640
+ */
641
+ showListPeriodHistory(showListPeriodHistoryRequest?: ShowListPeriodHistoryRequest) {
642
+ const options = {
643
+ method: "GET",
644
+ url: "/v3/jobs/{job_id}/period-history",
645
+ contentType: "application/json",
646
+ queryParams: {},
647
+ pathParams: {},
648
+ headers: {}
649
+ };
650
+ const localVarHeaderParameter = {} as any;
651
+ const localVarQueryParameter = {} as any;
652
+
653
+ let jobId;
654
+
655
+ let offset;
656
+
657
+ let limit;
658
+
659
+ let startTime;
660
+
661
+ let endTime;
662
+
663
+ if (showListPeriodHistoryRequest !== null && showListPeriodHistoryRequest !== undefined) {
664
+ if (showListPeriodHistoryRequest instanceof ShowListPeriodHistoryRequest) {
665
+ jobId = showListPeriodHistoryRequest.jobId;
666
+ offset = showListPeriodHistoryRequest.offset;
667
+ limit = showListPeriodHistoryRequest.limit;
668
+ startTime = showListPeriodHistoryRequest.startTime;
669
+ endTime = showListPeriodHistoryRequest.endTime;
670
+ } else {
671
+ jobId = showListPeriodHistoryRequest['job_id'];
672
+ offset = showListPeriodHistoryRequest['offset'];
673
+ limit = showListPeriodHistoryRequest['limit'];
674
+ startTime = showListPeriodHistoryRequest['start_time'];
675
+ endTime = showListPeriodHistoryRequest['end_time'];
676
+ }
677
+ }
678
+
679
+
680
+ if (jobId === null || jobId === undefined) {
681
+ throw new RequiredError('jobId','Required parameter jobId was null or undefined when calling showListPeriodHistory.');
682
+ }
683
+ if (offset === null || offset === undefined) {
684
+ throw new RequiredError('offset','Required parameter offset was null or undefined when calling showListPeriodHistory.');
685
+ }
686
+ if (offset !== null && offset !== undefined) {
687
+ localVarQueryParameter['offset'] = offset;
688
+ }
689
+ if (limit === null || limit === undefined) {
690
+ throw new RequiredError('limit','Required parameter limit was null or undefined when calling showListPeriodHistory.');
691
+ }
692
+ if (limit !== null && limit !== undefined) {
693
+ localVarQueryParameter['limit'] = limit;
694
+ }
695
+ if (startTime === null || startTime === undefined) {
696
+ throw new RequiredError('startTime','Required parameter startTime was null or undefined when calling showListPeriodHistory.');
697
+ }
698
+ if (startTime !== null && startTime !== undefined) {
699
+ localVarQueryParameter['start_time'] = startTime;
700
+ }
701
+ if (endTime === null || endTime === undefined) {
702
+ throw new RequiredError('endTime','Required parameter endTime was null or undefined when calling showListPeriodHistory.');
703
+ }
704
+ if (endTime !== null && endTime !== undefined) {
705
+ localVarQueryParameter['end_time'] = endTime;
706
+ }
707
+
708
+ options.queryParams = localVarQueryParameter;
709
+ options.pathParams = { 'job_id': jobId, };
710
+ options.headers = localVarHeaderParameter;
711
+ return options;
712
+ },
713
+
714
+ }
715
+ };
716
+
717
+ function newClient(client: HcClient): CodeArtsBuildClient {
718
+ return new CodeArtsBuildClient(client);
719
+ }
720
+
721
+ /**
722
+ *
723
+ * @export
724
+ * @class RequiredError
725
+ * @extends {Error}
726
+ */
727
+ export class RequiredError extends Error {
728
+ name: "RequiredError" = "RequiredError";
729
+ constructor(public field: string, msg?: string) {
730
+ super(msg);
731
+ }
732
+ }