@argos-ci/api-client 0.17.0 → 0.17.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +349 -43
- package/dist/index.mjs +11 -5
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -41,6 +41,42 @@ interface paths {
|
|
|
41
41
|
patch?: never;
|
|
42
42
|
trace?: never;
|
|
43
43
|
};
|
|
44
|
+
"/auth/cli/token": {
|
|
45
|
+
parameters: {
|
|
46
|
+
query?: never;
|
|
47
|
+
header?: never;
|
|
48
|
+
path?: never;
|
|
49
|
+
cookie?: never;
|
|
50
|
+
};
|
|
51
|
+
get?: never;
|
|
52
|
+
put?: never;
|
|
53
|
+
/**
|
|
54
|
+
* Exchange CLI authorization code for a token
|
|
55
|
+
* @description Called by the CLI to exchange a PKCE authorization code for an API token.
|
|
56
|
+
*/
|
|
57
|
+
post: operations["exchangeCliToken"];
|
|
58
|
+
delete?: never;
|
|
59
|
+
options?: never;
|
|
60
|
+
head?: never;
|
|
61
|
+
patch?: never;
|
|
62
|
+
trace?: never;
|
|
63
|
+
};
|
|
64
|
+
"/project": {
|
|
65
|
+
parameters: {
|
|
66
|
+
query?: never;
|
|
67
|
+
header?: never;
|
|
68
|
+
path?: never;
|
|
69
|
+
cookie?: never;
|
|
70
|
+
};
|
|
71
|
+
get: operations["getAuthProject"];
|
|
72
|
+
put?: never;
|
|
73
|
+
post?: never;
|
|
74
|
+
delete?: never;
|
|
75
|
+
options?: never;
|
|
76
|
+
head?: never;
|
|
77
|
+
patch?: never;
|
|
78
|
+
trace?: never;
|
|
79
|
+
};
|
|
44
80
|
"/builds/{buildId}": {
|
|
45
81
|
parameters: {
|
|
46
82
|
query?: never;
|
|
@@ -48,7 +84,7 @@ interface paths {
|
|
|
48
84
|
path?: never;
|
|
49
85
|
cookie?: never;
|
|
50
86
|
};
|
|
51
|
-
get
|
|
87
|
+
get?: never;
|
|
52
88
|
put: operations["updateBuild"];
|
|
53
89
|
post?: never;
|
|
54
90
|
delete?: never;
|
|
@@ -57,14 +93,14 @@ interface paths {
|
|
|
57
93
|
patch?: never;
|
|
58
94
|
trace?: never;
|
|
59
95
|
};
|
|
60
|
-
"/
|
|
96
|
+
"/projects/{owner}/{project}": {
|
|
61
97
|
parameters: {
|
|
62
98
|
query?: never;
|
|
63
99
|
header?: never;
|
|
64
100
|
path?: never;
|
|
65
101
|
cookie?: never;
|
|
66
102
|
};
|
|
67
|
-
get: operations["
|
|
103
|
+
get: operations["getProject"];
|
|
68
104
|
put?: never;
|
|
69
105
|
post?: never;
|
|
70
106
|
delete?: never;
|
|
@@ -73,14 +109,14 @@ interface paths {
|
|
|
73
109
|
patch?: never;
|
|
74
110
|
trace?: never;
|
|
75
111
|
};
|
|
76
|
-
"/project": {
|
|
112
|
+
"/projects/{owner}/{project}/builds": {
|
|
77
113
|
parameters: {
|
|
78
114
|
query?: never;
|
|
79
115
|
header?: never;
|
|
80
116
|
path?: never;
|
|
81
117
|
cookie?: never;
|
|
82
118
|
};
|
|
83
|
-
get: operations["
|
|
119
|
+
get: operations["getProjectBuilds"];
|
|
84
120
|
put?: never;
|
|
85
121
|
post?: never;
|
|
86
122
|
delete?: never;
|
|
@@ -89,14 +125,14 @@ interface paths {
|
|
|
89
125
|
patch?: never;
|
|
90
126
|
trace?: never;
|
|
91
127
|
};
|
|
92
|
-
"/project/builds": {
|
|
128
|
+
"/projects/{owner}/{project}/builds/{buildNumber}": {
|
|
93
129
|
parameters: {
|
|
94
130
|
query?: never;
|
|
95
131
|
header?: never;
|
|
96
132
|
path?: never;
|
|
97
133
|
cookie?: never;
|
|
98
134
|
};
|
|
99
|
-
get: operations["
|
|
135
|
+
get: operations["getBuild"];
|
|
100
136
|
put?: never;
|
|
101
137
|
post?: never;
|
|
102
138
|
delete?: never;
|
|
@@ -105,6 +141,38 @@ interface paths {
|
|
|
105
141
|
patch?: never;
|
|
106
142
|
trace?: never;
|
|
107
143
|
};
|
|
144
|
+
"/projects/{owner}/{project}/builds/{buildNumber}/diffs": {
|
|
145
|
+
parameters: {
|
|
146
|
+
query?: never;
|
|
147
|
+
header?: never;
|
|
148
|
+
path?: never;
|
|
149
|
+
cookie?: never;
|
|
150
|
+
};
|
|
151
|
+
get: operations["getBuildDiffs"];
|
|
152
|
+
put?: never;
|
|
153
|
+
post?: never;
|
|
154
|
+
delete?: never;
|
|
155
|
+
options?: never;
|
|
156
|
+
head?: never;
|
|
157
|
+
patch?: never;
|
|
158
|
+
trace?: never;
|
|
159
|
+
};
|
|
160
|
+
"/projects/{owner}/{project}/builds/{buildNumber}/reviews": {
|
|
161
|
+
parameters: {
|
|
162
|
+
query?: never;
|
|
163
|
+
header?: never;
|
|
164
|
+
path?: never;
|
|
165
|
+
cookie?: never;
|
|
166
|
+
};
|
|
167
|
+
get?: never;
|
|
168
|
+
put?: never; /** Create a review on a specified build */
|
|
169
|
+
post: operations["createReview"];
|
|
170
|
+
delete?: never;
|
|
171
|
+
options?: never;
|
|
172
|
+
head?: never;
|
|
173
|
+
patch?: never;
|
|
174
|
+
trace?: never;
|
|
175
|
+
};
|
|
108
176
|
}
|
|
109
177
|
type webhooks = Record<string, never>;
|
|
110
178
|
interface components {
|
|
@@ -194,10 +262,15 @@ interface components {
|
|
|
194
262
|
duration?: number;
|
|
195
263
|
};
|
|
196
264
|
};
|
|
197
|
-
};
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* @description The build number
|
|
268
|
+
* @example 42
|
|
269
|
+
*/
|
|
270
|
+
BuildNumber: string; /** @description Build */
|
|
198
271
|
Build: {
|
|
199
|
-
id: components["schemas"]["BuildId"];
|
|
200
|
-
number:
|
|
272
|
+
id: components["schemas"]["BuildId"];
|
|
273
|
+
number: components["schemas"]["BuildNumberOutput"]; /** @description The head reference of the build */
|
|
201
274
|
head: components["schemas"]["BuildGitReference"]; /** @description The base reference of the build */
|
|
202
275
|
base: components["schemas"]["BuildGitReference"] | null; /** @description The status of the build */
|
|
203
276
|
status: ("accepted" | "rejected") | ("no-changes" | "changes-detected") | ("expired" | "pending" | "progress" | "error" | "aborted"); /** @description The conclusion of the build */
|
|
@@ -250,6 +323,17 @@ interface components {
|
|
|
250
323
|
details?: {
|
|
251
324
|
message: string;
|
|
252
325
|
}[];
|
|
326
|
+
}; /** @description Project */
|
|
327
|
+
Project: {
|
|
328
|
+
id: string;
|
|
329
|
+
account: components["schemas"]["Account"];
|
|
330
|
+
name: string;
|
|
331
|
+
defaultBaseBranch: string;
|
|
332
|
+
hasRemoteContentAccess: boolean;
|
|
333
|
+
}; /** @description Account */
|
|
334
|
+
Account: {
|
|
335
|
+
id: string;
|
|
336
|
+
slug: string;
|
|
253
337
|
}; /** @description Page information */
|
|
254
338
|
PageInfo: {
|
|
255
339
|
/** @description Total number of items */total: number; /** @description Current page number */
|
|
@@ -406,12 +490,12 @@ interface components {
|
|
|
406
490
|
url: string; /** @description Content type of the snapshot file */
|
|
407
491
|
contentType: string;
|
|
408
492
|
} | null;
|
|
409
|
-
}; /** @description Project */
|
|
410
|
-
Project: {
|
|
411
|
-
id: string;
|
|
412
|
-
defaultBaseBranch: string;
|
|
413
|
-
hasRemoteContentAccess: boolean;
|
|
414
493
|
};
|
|
494
|
+
/**
|
|
495
|
+
* @description The build number
|
|
496
|
+
* @example 42
|
|
497
|
+
*/
|
|
498
|
+
BuildNumberOutput: unknown;
|
|
415
499
|
};
|
|
416
500
|
responses: never;
|
|
417
501
|
parameters: never;
|
|
@@ -587,23 +671,30 @@ interface operations {
|
|
|
587
671
|
};
|
|
588
672
|
};
|
|
589
673
|
};
|
|
590
|
-
|
|
674
|
+
exchangeCliToken: {
|
|
591
675
|
parameters: {
|
|
592
676
|
query?: never;
|
|
593
677
|
header?: never;
|
|
594
|
-
path
|
|
595
|
-
/** @description A unique identifier for the build */buildId: components["schemas"]["BuildId"];
|
|
596
|
-
};
|
|
678
|
+
path?: never;
|
|
597
679
|
cookie?: never;
|
|
598
680
|
};
|
|
599
|
-
requestBody?:
|
|
681
|
+
requestBody?: {
|
|
682
|
+
content: {
|
|
683
|
+
"application/json": {
|
|
684
|
+
/** @description PKCE authorization code from the login flow */code: string; /** @description PKCE code verifier matching the code challenge */
|
|
685
|
+
code_verifier: string;
|
|
686
|
+
};
|
|
687
|
+
};
|
|
688
|
+
};
|
|
600
689
|
responses: {
|
|
601
|
-
/** @description
|
|
690
|
+
/** @description Token exchange successful */200: {
|
|
602
691
|
headers: {
|
|
603
692
|
[name: string]: unknown;
|
|
604
693
|
};
|
|
605
694
|
content: {
|
|
606
|
-
"application/json":
|
|
695
|
+
"application/json": {
|
|
696
|
+
/** @description Argos API token for CLI use */token: string;
|
|
697
|
+
};
|
|
607
698
|
};
|
|
608
699
|
}; /** @description Invalid parameters */
|
|
609
700
|
400: {
|
|
@@ -621,8 +712,35 @@ interface operations {
|
|
|
621
712
|
content: {
|
|
622
713
|
"application/json": components["schemas"]["Error"];
|
|
623
714
|
};
|
|
624
|
-
}; /** @description
|
|
625
|
-
|
|
715
|
+
}; /** @description Server error */
|
|
716
|
+
500: {
|
|
717
|
+
headers: {
|
|
718
|
+
[name: string]: unknown;
|
|
719
|
+
};
|
|
720
|
+
content: {
|
|
721
|
+
"application/json": components["schemas"]["Error"];
|
|
722
|
+
};
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
getAuthProject: {
|
|
727
|
+
parameters: {
|
|
728
|
+
query?: never;
|
|
729
|
+
header?: never;
|
|
730
|
+
path?: never;
|
|
731
|
+
cookie?: never;
|
|
732
|
+
};
|
|
733
|
+
requestBody?: never;
|
|
734
|
+
responses: {
|
|
735
|
+
/** @description Project */200: {
|
|
736
|
+
headers: {
|
|
737
|
+
[name: string]: unknown;
|
|
738
|
+
};
|
|
739
|
+
content: {
|
|
740
|
+
"application/json": components["schemas"]["Project"];
|
|
741
|
+
};
|
|
742
|
+
}; /** @description Unauthorized */
|
|
743
|
+
401: {
|
|
626
744
|
headers: {
|
|
627
745
|
[name: string]: unknown;
|
|
628
746
|
};
|
|
@@ -721,28 +839,86 @@ interface operations {
|
|
|
721
839
|
};
|
|
722
840
|
};
|
|
723
841
|
};
|
|
724
|
-
|
|
842
|
+
getProject: {
|
|
843
|
+
parameters: {
|
|
844
|
+
query?: never;
|
|
845
|
+
header?: never;
|
|
846
|
+
path: {
|
|
847
|
+
owner: string;
|
|
848
|
+
project: string;
|
|
849
|
+
};
|
|
850
|
+
cookie?: never;
|
|
851
|
+
};
|
|
852
|
+
requestBody?: never;
|
|
853
|
+
responses: {
|
|
854
|
+
/** @description Project */200: {
|
|
855
|
+
headers: {
|
|
856
|
+
[name: string]: unknown;
|
|
857
|
+
};
|
|
858
|
+
content: {
|
|
859
|
+
"application/json": components["schemas"]["Project"];
|
|
860
|
+
};
|
|
861
|
+
}; /** @description Unauthorized */
|
|
862
|
+
401: {
|
|
863
|
+
headers: {
|
|
864
|
+
[name: string]: unknown;
|
|
865
|
+
};
|
|
866
|
+
content: {
|
|
867
|
+
"application/json": components["schemas"]["Error"];
|
|
868
|
+
};
|
|
869
|
+
}; /** @description Forbidden */
|
|
870
|
+
403: {
|
|
871
|
+
headers: {
|
|
872
|
+
[name: string]: unknown;
|
|
873
|
+
};
|
|
874
|
+
content: {
|
|
875
|
+
"application/json": components["schemas"]["Error"];
|
|
876
|
+
};
|
|
877
|
+
}; /** @description Not found */
|
|
878
|
+
404: {
|
|
879
|
+
headers: {
|
|
880
|
+
[name: string]: unknown;
|
|
881
|
+
};
|
|
882
|
+
content: {
|
|
883
|
+
"application/json": components["schemas"]["Error"];
|
|
884
|
+
};
|
|
885
|
+
}; /** @description Server error */
|
|
886
|
+
500: {
|
|
887
|
+
headers: {
|
|
888
|
+
[name: string]: unknown;
|
|
889
|
+
};
|
|
890
|
+
content: {
|
|
891
|
+
"application/json": components["schemas"]["Error"];
|
|
892
|
+
};
|
|
893
|
+
};
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
getProjectBuilds: {
|
|
725
897
|
parameters: {
|
|
726
898
|
query?: {
|
|
727
899
|
/** @description Number of items per page (max 100) */perPage?: string; /** @description Page number */
|
|
728
900
|
page?: string;
|
|
901
|
+
head?: string;
|
|
902
|
+
headSha?: components["schemas"]["Sha1Hash"]; /** @description Only return the latest builds created, unique by name and commit. */
|
|
903
|
+
distinctName?: string;
|
|
729
904
|
};
|
|
730
905
|
header?: never;
|
|
731
906
|
path: {
|
|
732
|
-
|
|
907
|
+
owner: string;
|
|
908
|
+
project: string;
|
|
733
909
|
};
|
|
734
910
|
cookie?: never;
|
|
735
911
|
};
|
|
736
912
|
requestBody?: never;
|
|
737
913
|
responses: {
|
|
738
|
-
/** @description List of
|
|
914
|
+
/** @description List of builds */200: {
|
|
739
915
|
headers: {
|
|
740
916
|
[name: string]: unknown;
|
|
741
917
|
};
|
|
742
918
|
content: {
|
|
743
919
|
"application/json": {
|
|
744
920
|
pageInfo: components["schemas"]["PageInfo"];
|
|
745
|
-
results: components["schemas"]["
|
|
921
|
+
results: components["schemas"]["Build"][];
|
|
746
922
|
};
|
|
747
923
|
};
|
|
748
924
|
}; /** @description Invalid parameters */
|
|
@@ -761,6 +937,14 @@ interface operations {
|
|
|
761
937
|
content: {
|
|
762
938
|
"application/json": components["schemas"]["Error"];
|
|
763
939
|
};
|
|
940
|
+
}; /** @description Forbidden */
|
|
941
|
+
403: {
|
|
942
|
+
headers: {
|
|
943
|
+
[name: string]: unknown;
|
|
944
|
+
};
|
|
945
|
+
content: {
|
|
946
|
+
"application/json": components["schemas"]["Error"];
|
|
947
|
+
};
|
|
764
948
|
}; /** @description Not found */
|
|
765
949
|
404: {
|
|
766
950
|
headers: {
|
|
@@ -780,21 +964,33 @@ interface operations {
|
|
|
780
964
|
};
|
|
781
965
|
};
|
|
782
966
|
};
|
|
783
|
-
|
|
967
|
+
getBuild: {
|
|
784
968
|
parameters: {
|
|
785
969
|
query?: never;
|
|
786
970
|
header?: never;
|
|
787
|
-
path
|
|
971
|
+
path: {
|
|
972
|
+
owner: string;
|
|
973
|
+
project: string; /** @description The build number */
|
|
974
|
+
buildNumber: components["schemas"]["BuildNumber"];
|
|
975
|
+
};
|
|
788
976
|
cookie?: never;
|
|
789
977
|
};
|
|
790
978
|
requestBody?: never;
|
|
791
979
|
responses: {
|
|
792
|
-
/** @description
|
|
980
|
+
/** @description Build */200: {
|
|
793
981
|
headers: {
|
|
794
982
|
[name: string]: unknown;
|
|
795
983
|
};
|
|
796
984
|
content: {
|
|
797
|
-
"application/json": components["schemas"]["
|
|
985
|
+
"application/json": components["schemas"]["Build"];
|
|
986
|
+
};
|
|
987
|
+
}; /** @description Invalid parameters */
|
|
988
|
+
400: {
|
|
989
|
+
headers: {
|
|
990
|
+
[name: string]: unknown;
|
|
991
|
+
};
|
|
992
|
+
content: {
|
|
993
|
+
"application/json": components["schemas"]["Error"];
|
|
798
994
|
};
|
|
799
995
|
}; /** @description Unauthorized */
|
|
800
996
|
401: {
|
|
@@ -804,6 +1000,22 @@ interface operations {
|
|
|
804
1000
|
content: {
|
|
805
1001
|
"application/json": components["schemas"]["Error"];
|
|
806
1002
|
};
|
|
1003
|
+
}; /** @description Forbidden */
|
|
1004
|
+
403: {
|
|
1005
|
+
headers: {
|
|
1006
|
+
[name: string]: unknown;
|
|
1007
|
+
};
|
|
1008
|
+
content: {
|
|
1009
|
+
"application/json": components["schemas"]["Error"];
|
|
1010
|
+
};
|
|
1011
|
+
}; /** @description Not found */
|
|
1012
|
+
404: {
|
|
1013
|
+
headers: {
|
|
1014
|
+
[name: string]: unknown;
|
|
1015
|
+
};
|
|
1016
|
+
content: {
|
|
1017
|
+
"application/json": components["schemas"]["Error"];
|
|
1018
|
+
};
|
|
807
1019
|
}; /** @description Server error */
|
|
808
1020
|
500: {
|
|
809
1021
|
headers: {
|
|
@@ -815,29 +1027,31 @@ interface operations {
|
|
|
815
1027
|
};
|
|
816
1028
|
};
|
|
817
1029
|
};
|
|
818
|
-
|
|
1030
|
+
getBuildDiffs: {
|
|
819
1031
|
parameters: {
|
|
820
1032
|
query?: {
|
|
821
1033
|
/** @description Number of items per page (max 100) */perPage?: string; /** @description Page number */
|
|
822
|
-
page?: string;
|
|
823
|
-
|
|
824
|
-
headSha?: components["schemas"]["Sha1Hash"]; /** @description Only return the latest builds created, unique by name and commit. */
|
|
825
|
-
distinctName?: string;
|
|
1034
|
+
page?: string; /** @description Only return diffs that require review. Matches `changed`, `added`, and `removed`, except `removed` is excluded for subset builds. */
|
|
1035
|
+
needsReview?: string;
|
|
826
1036
|
};
|
|
827
1037
|
header?: never;
|
|
828
|
-
path
|
|
1038
|
+
path: {
|
|
1039
|
+
owner: string;
|
|
1040
|
+
project: string; /** @description The build number */
|
|
1041
|
+
buildNumber: components["schemas"]["BuildNumber"];
|
|
1042
|
+
};
|
|
829
1043
|
cookie?: never;
|
|
830
1044
|
};
|
|
831
1045
|
requestBody?: never;
|
|
832
1046
|
responses: {
|
|
833
|
-
/** @description List of
|
|
1047
|
+
/** @description List of screenshot diffs */200: {
|
|
834
1048
|
headers: {
|
|
835
1049
|
[name: string]: unknown;
|
|
836
1050
|
};
|
|
837
1051
|
content: {
|
|
838
1052
|
"application/json": {
|
|
839
1053
|
pageInfo: components["schemas"]["PageInfo"];
|
|
840
|
-
results: components["schemas"]["
|
|
1054
|
+
results: components["schemas"]["SnapshotDiff"][];
|
|
841
1055
|
};
|
|
842
1056
|
};
|
|
843
1057
|
}; /** @description Invalid parameters */
|
|
@@ -856,6 +1070,94 @@ interface operations {
|
|
|
856
1070
|
content: {
|
|
857
1071
|
"application/json": components["schemas"]["Error"];
|
|
858
1072
|
};
|
|
1073
|
+
}; /** @description Not found */
|
|
1074
|
+
404: {
|
|
1075
|
+
headers: {
|
|
1076
|
+
[name: string]: unknown;
|
|
1077
|
+
};
|
|
1078
|
+
content: {
|
|
1079
|
+
"application/json": components["schemas"]["Error"];
|
|
1080
|
+
};
|
|
1081
|
+
}; /** @description Server error */
|
|
1082
|
+
500: {
|
|
1083
|
+
headers: {
|
|
1084
|
+
[name: string]: unknown;
|
|
1085
|
+
};
|
|
1086
|
+
content: {
|
|
1087
|
+
"application/json": components["schemas"]["Error"];
|
|
1088
|
+
};
|
|
1089
|
+
};
|
|
1090
|
+
};
|
|
1091
|
+
};
|
|
1092
|
+
createReview: {
|
|
1093
|
+
parameters: {
|
|
1094
|
+
query?: never;
|
|
1095
|
+
header?: never;
|
|
1096
|
+
path: {
|
|
1097
|
+
owner: string;
|
|
1098
|
+
project: string; /** @description The build number */
|
|
1099
|
+
buildNumber: components["schemas"]["BuildNumber"];
|
|
1100
|
+
};
|
|
1101
|
+
cookie?: never;
|
|
1102
|
+
};
|
|
1103
|
+
requestBody: {
|
|
1104
|
+
content: {
|
|
1105
|
+
"application/json": {
|
|
1106
|
+
/**
|
|
1107
|
+
* @description Overall review conclusion for the build: "APPROVE" or "REQUEST_CHANGES"
|
|
1108
|
+
* @enum {string}
|
|
1109
|
+
*/
|
|
1110
|
+
conclusion: "APPROVE" | "REQUEST_CHANGES";
|
|
1111
|
+
/**
|
|
1112
|
+
* @description Optional per-snapshot review decisions. When omitted, only the build-level review is recorded.
|
|
1113
|
+
* @default []
|
|
1114
|
+
*/
|
|
1115
|
+
snapshots?: {
|
|
1116
|
+
/** @description The ID of the snapshot to review */id: string;
|
|
1117
|
+
/**
|
|
1118
|
+
* @description Review conclusion for this individual snapshot: "APPROVE" or "REQUEST_CHANGES"
|
|
1119
|
+
* @enum {string}
|
|
1120
|
+
*/
|
|
1121
|
+
conclusion: "APPROVE" | "REQUEST_CHANGES";
|
|
1122
|
+
}[];
|
|
1123
|
+
};
|
|
1124
|
+
};
|
|
1125
|
+
};
|
|
1126
|
+
responses: {
|
|
1127
|
+
/** @description Review submitted successfully — returns the review */200: {
|
|
1128
|
+
headers: {
|
|
1129
|
+
[name: string]: unknown;
|
|
1130
|
+
};
|
|
1131
|
+
content: {
|
|
1132
|
+
"application/json": {
|
|
1133
|
+
id: string; /** @enum {string} */
|
|
1134
|
+
state: "approved" | "rejected";
|
|
1135
|
+
};
|
|
1136
|
+
};
|
|
1137
|
+
}; /** @description Unauthorized */
|
|
1138
|
+
401: {
|
|
1139
|
+
headers: {
|
|
1140
|
+
[name: string]: unknown;
|
|
1141
|
+
};
|
|
1142
|
+
content: {
|
|
1143
|
+
"application/json": components["schemas"]["Error"];
|
|
1144
|
+
};
|
|
1145
|
+
}; /** @description Forbidden */
|
|
1146
|
+
403: {
|
|
1147
|
+
headers: {
|
|
1148
|
+
[name: string]: unknown;
|
|
1149
|
+
};
|
|
1150
|
+
content: {
|
|
1151
|
+
"application/json": components["schemas"]["Error"];
|
|
1152
|
+
};
|
|
1153
|
+
}; /** @description Not found */
|
|
1154
|
+
404: {
|
|
1155
|
+
headers: {
|
|
1156
|
+
[name: string]: unknown;
|
|
1157
|
+
};
|
|
1158
|
+
content: {
|
|
1159
|
+
"application/json": components["schemas"]["Error"];
|
|
1160
|
+
};
|
|
859
1161
|
}; /** @description Server error */
|
|
860
1162
|
500: {
|
|
861
1163
|
headers: {
|
|
@@ -874,16 +1176,20 @@ type ArgosAPIClient = ReturnType<typeof createClient>;
|
|
|
874
1176
|
/**
|
|
875
1177
|
* Create Argos API client.
|
|
876
1178
|
*/
|
|
877
|
-
declare function createClient(options
|
|
1179
|
+
declare function createClient(options?: {
|
|
878
1180
|
baseUrl?: string;
|
|
879
|
-
authToken
|
|
1181
|
+
authToken?: string;
|
|
880
1182
|
}): _$openapi_fetch0.Client<paths, `${string}/${string}`>;
|
|
881
1183
|
declare class APIError extends Error {
|
|
882
1184
|
constructor(message: string);
|
|
883
1185
|
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Handle API errors.
|
|
1188
|
+
*/
|
|
1189
|
+
declare function formatAPIError(error: components["schemas"]["Error"]): string;
|
|
884
1190
|
/**
|
|
885
1191
|
* Handle API errors.
|
|
886
1192
|
*/
|
|
887
1193
|
declare function throwAPIError(error: components["schemas"]["Error"]): never;
|
|
888
1194
|
//#endregion
|
|
889
|
-
export { APIError, ArgosAPIClient, schema_d_exports as ArgosAPISchema, createClient, throwAPIError };
|
|
1195
|
+
export { APIError, ArgosAPIClient, schema_d_exports as ArgosAPISchema, createClient, formatAPIError, throwAPIError };
|
package/dist/index.mjs
CHANGED
|
@@ -197,10 +197,10 @@ var schema_exports = /* @__PURE__ */ __exportAll({});
|
|
|
197
197
|
* Create Argos API client.
|
|
198
198
|
*/
|
|
199
199
|
function createClient(options) {
|
|
200
|
-
const { baseUrl } = options || {};
|
|
200
|
+
const { baseUrl, authToken } = options || {};
|
|
201
201
|
return createFetchClient({
|
|
202
202
|
baseUrl: baseUrl || "https://api.argos-ci.com/v2/",
|
|
203
|
-
headers: { Authorization: `Bearer ${
|
|
203
|
+
headers: { Authorization: authToken ? `Bearer ${authToken}` : void 0 },
|
|
204
204
|
fetch: (input) => {
|
|
205
205
|
return pRetry(async () => {
|
|
206
206
|
const response = await fetch(input.clone());
|
|
@@ -224,10 +224,16 @@ var APIError = class extends Error {
|
|
|
224
224
|
/**
|
|
225
225
|
* Handle API errors.
|
|
226
226
|
*/
|
|
227
|
-
function
|
|
227
|
+
function formatAPIError(error) {
|
|
228
228
|
debug("API error", error);
|
|
229
229
|
const detailMessage = error.details?.map((detail) => detail.message).join(", ");
|
|
230
|
-
|
|
230
|
+
return detailMessage ? `${error.error}: ${detailMessage}` : error.error;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Handle API errors.
|
|
234
|
+
*/
|
|
235
|
+
function throwAPIError(error) {
|
|
236
|
+
throw new APIError(formatAPIError(error));
|
|
231
237
|
}
|
|
232
238
|
//#endregion
|
|
233
|
-
export { APIError, schema_exports as ArgosAPISchema, createClient, throwAPIError };
|
|
239
|
+
export { APIError, schema_exports as ArgosAPISchema, createClient, formatAPIError, throwAPIError };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/api-client",
|
|
3
3
|
"description": "Argos API Client library.",
|
|
4
|
-
"version": "0.17.
|
|
4
|
+
"version": "0.17.1-alpha.6+74828da",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"debug": "^4.4.3",
|
|
53
53
|
"openapi-fetch": "^0.17.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "74828dafbe25ef00f58c7e87721ea0ec7211fee4"
|
|
56
56
|
}
|