@argos-ci/api-client 0.17.1-alpha.2 → 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 +327 -50
- 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;
|
|
@@ -57,14 +93,14 @@ interface paths {
|
|
|
57
93
|
patch?: never;
|
|
58
94
|
trace?: never;
|
|
59
95
|
};
|
|
60
|
-
"/project": {
|
|
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;
|
|
@@ -96,7 +132,7 @@ interface paths {
|
|
|
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;
|
|
@@ -121,6 +157,22 @@ interface paths {
|
|
|
121
157
|
patch?: never;
|
|
122
158
|
trace?: never;
|
|
123
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
|
+
};
|
|
124
176
|
}
|
|
125
177
|
type webhooks = Record<string, never>;
|
|
126
178
|
interface components {
|
|
@@ -210,10 +262,15 @@ interface components {
|
|
|
210
262
|
duration?: number;
|
|
211
263
|
};
|
|
212
264
|
};
|
|
213
|
-
};
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* @description The build number
|
|
268
|
+
* @example 42
|
|
269
|
+
*/
|
|
270
|
+
BuildNumber: string; /** @description Build */
|
|
214
271
|
Build: {
|
|
215
|
-
id: components["schemas"]["BuildId"];
|
|
216
|
-
number:
|
|
272
|
+
id: components["schemas"]["BuildId"];
|
|
273
|
+
number: components["schemas"]["BuildNumberOutput"]; /** @description The head reference of the build */
|
|
217
274
|
head: components["schemas"]["BuildGitReference"]; /** @description The base reference of the build */
|
|
218
275
|
base: components["schemas"]["BuildGitReference"] | null; /** @description The status of the build */
|
|
219
276
|
status: ("accepted" | "rejected") | ("no-changes" | "changes-detected") | ("expired" | "pending" | "progress" | "error" | "aborted"); /** @description The conclusion of the build */
|
|
@@ -266,6 +323,17 @@ interface components {
|
|
|
266
323
|
details?: {
|
|
267
324
|
message: string;
|
|
268
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;
|
|
269
337
|
}; /** @description Page information */
|
|
270
338
|
PageInfo: {
|
|
271
339
|
/** @description Total number of items */total: number; /** @description Current page number */
|
|
@@ -422,17 +490,12 @@ interface components {
|
|
|
422
490
|
url: string; /** @description Content type of the snapshot file */
|
|
423
491
|
contentType: string;
|
|
424
492
|
} | null;
|
|
425
|
-
}; /** @description Project */
|
|
426
|
-
Project: {
|
|
427
|
-
id: string; /** @description Account that owns the project */
|
|
428
|
-
account: {
|
|
429
|
-
id: string;
|
|
430
|
-
slug: string;
|
|
431
|
-
};
|
|
432
|
-
name: string;
|
|
433
|
-
defaultBaseBranch: string;
|
|
434
|
-
hasRemoteContentAccess: boolean;
|
|
435
493
|
};
|
|
494
|
+
/**
|
|
495
|
+
* @description The build number
|
|
496
|
+
* @example 42
|
|
497
|
+
*/
|
|
498
|
+
BuildNumberOutput: unknown;
|
|
436
499
|
};
|
|
437
500
|
responses: never;
|
|
438
501
|
parameters: never;
|
|
@@ -608,6 +671,93 @@ interface operations {
|
|
|
608
671
|
};
|
|
609
672
|
};
|
|
610
673
|
};
|
|
674
|
+
exchangeCliToken: {
|
|
675
|
+
parameters: {
|
|
676
|
+
query?: never;
|
|
677
|
+
header?: never;
|
|
678
|
+
path?: never;
|
|
679
|
+
cookie?: never;
|
|
680
|
+
};
|
|
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
|
+
};
|
|
689
|
+
responses: {
|
|
690
|
+
/** @description Token exchange successful */200: {
|
|
691
|
+
headers: {
|
|
692
|
+
[name: string]: unknown;
|
|
693
|
+
};
|
|
694
|
+
content: {
|
|
695
|
+
"application/json": {
|
|
696
|
+
/** @description Argos API token for CLI use */token: string;
|
|
697
|
+
};
|
|
698
|
+
};
|
|
699
|
+
}; /** @description Invalid parameters */
|
|
700
|
+
400: {
|
|
701
|
+
headers: {
|
|
702
|
+
[name: string]: unknown;
|
|
703
|
+
};
|
|
704
|
+
content: {
|
|
705
|
+
"application/json": components["schemas"]["Error"];
|
|
706
|
+
};
|
|
707
|
+
}; /** @description Unauthorized */
|
|
708
|
+
401: {
|
|
709
|
+
headers: {
|
|
710
|
+
[name: string]: unknown;
|
|
711
|
+
};
|
|
712
|
+
content: {
|
|
713
|
+
"application/json": components["schemas"]["Error"];
|
|
714
|
+
};
|
|
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: {
|
|
744
|
+
headers: {
|
|
745
|
+
[name: string]: unknown;
|
|
746
|
+
};
|
|
747
|
+
content: {
|
|
748
|
+
"application/json": components["schemas"]["Error"];
|
|
749
|
+
};
|
|
750
|
+
}; /** @description Server error */
|
|
751
|
+
500: {
|
|
752
|
+
headers: {
|
|
753
|
+
[name: string]: unknown;
|
|
754
|
+
};
|
|
755
|
+
content: {
|
|
756
|
+
"application/json": components["schemas"]["Error"];
|
|
757
|
+
};
|
|
758
|
+
};
|
|
759
|
+
};
|
|
760
|
+
};
|
|
611
761
|
updateBuild: {
|
|
612
762
|
parameters: {
|
|
613
763
|
query?: never;
|
|
@@ -689,31 +839,86 @@ interface operations {
|
|
|
689
839
|
};
|
|
690
840
|
};
|
|
691
841
|
};
|
|
692
|
-
|
|
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: {
|
|
693
897
|
parameters: {
|
|
694
898
|
query?: {
|
|
695
899
|
/** @description Number of items per page (max 100) */perPage?: string; /** @description Page number */
|
|
696
|
-
page?: string;
|
|
697
|
-
|
|
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;
|
|
698
904
|
};
|
|
699
905
|
header?: never;
|
|
700
906
|
path: {
|
|
701
|
-
|
|
702
|
-
project: string;
|
|
703
|
-
buildNumber: number;
|
|
907
|
+
owner: string;
|
|
908
|
+
project: string;
|
|
704
909
|
};
|
|
705
910
|
cookie?: never;
|
|
706
911
|
};
|
|
707
912
|
requestBody?: never;
|
|
708
913
|
responses: {
|
|
709
|
-
/** @description List of
|
|
914
|
+
/** @description List of builds */200: {
|
|
710
915
|
headers: {
|
|
711
916
|
[name: string]: unknown;
|
|
712
917
|
};
|
|
713
918
|
content: {
|
|
714
919
|
"application/json": {
|
|
715
920
|
pageInfo: components["schemas"]["PageInfo"];
|
|
716
|
-
results: components["schemas"]["
|
|
921
|
+
results: components["schemas"]["Build"][];
|
|
717
922
|
};
|
|
718
923
|
};
|
|
719
924
|
}; /** @description Invalid parameters */
|
|
@@ -732,6 +937,14 @@ interface operations {
|
|
|
732
937
|
content: {
|
|
733
938
|
"application/json": components["schemas"]["Error"];
|
|
734
939
|
};
|
|
940
|
+
}; /** @description Forbidden */
|
|
941
|
+
403: {
|
|
942
|
+
headers: {
|
|
943
|
+
[name: string]: unknown;
|
|
944
|
+
};
|
|
945
|
+
content: {
|
|
946
|
+
"application/json": components["schemas"]["Error"];
|
|
947
|
+
};
|
|
735
948
|
}; /** @description Not found */
|
|
736
949
|
404: {
|
|
737
950
|
headers: {
|
|
@@ -751,21 +964,33 @@ interface operations {
|
|
|
751
964
|
};
|
|
752
965
|
};
|
|
753
966
|
};
|
|
754
|
-
|
|
967
|
+
getBuild: {
|
|
755
968
|
parameters: {
|
|
756
969
|
query?: never;
|
|
757
970
|
header?: never;
|
|
758
|
-
path
|
|
971
|
+
path: {
|
|
972
|
+
owner: string;
|
|
973
|
+
project: string; /** @description The build number */
|
|
974
|
+
buildNumber: components["schemas"]["BuildNumber"];
|
|
975
|
+
};
|
|
759
976
|
cookie?: never;
|
|
760
977
|
};
|
|
761
978
|
requestBody?: never;
|
|
762
979
|
responses: {
|
|
763
|
-
/** @description
|
|
980
|
+
/** @description Build */200: {
|
|
764
981
|
headers: {
|
|
765
982
|
[name: string]: unknown;
|
|
766
983
|
};
|
|
767
984
|
content: {
|
|
768
|
-
"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"];
|
|
769
994
|
};
|
|
770
995
|
}; /** @description Unauthorized */
|
|
771
996
|
401: {
|
|
@@ -775,6 +1000,22 @@ interface operations {
|
|
|
775
1000
|
content: {
|
|
776
1001
|
"application/json": components["schemas"]["Error"];
|
|
777
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
|
+
};
|
|
778
1019
|
}; /** @description Server error */
|
|
779
1020
|
500: {
|
|
780
1021
|
headers: {
|
|
@@ -786,32 +1027,31 @@ interface operations {
|
|
|
786
1027
|
};
|
|
787
1028
|
};
|
|
788
1029
|
};
|
|
789
|
-
|
|
1030
|
+
getBuildDiffs: {
|
|
790
1031
|
parameters: {
|
|
791
1032
|
query?: {
|
|
792
1033
|
/** @description Number of items per page (max 100) */perPage?: string; /** @description Page number */
|
|
793
|
-
page?: string;
|
|
794
|
-
|
|
795
|
-
headSha?: components["schemas"]["Sha1Hash"]; /** @description Only return the latest builds created, unique by name and commit. */
|
|
796
|
-
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;
|
|
797
1036
|
};
|
|
798
1037
|
header?: never;
|
|
799
1038
|
path: {
|
|
800
|
-
|
|
801
|
-
project: string;
|
|
1039
|
+
owner: string;
|
|
1040
|
+
project: string; /** @description The build number */
|
|
1041
|
+
buildNumber: components["schemas"]["BuildNumber"];
|
|
802
1042
|
};
|
|
803
1043
|
cookie?: never;
|
|
804
1044
|
};
|
|
805
1045
|
requestBody?: never;
|
|
806
1046
|
responses: {
|
|
807
|
-
/** @description List of
|
|
1047
|
+
/** @description List of screenshot diffs */200: {
|
|
808
1048
|
headers: {
|
|
809
1049
|
[name: string]: unknown;
|
|
810
1050
|
};
|
|
811
1051
|
content: {
|
|
812
1052
|
"application/json": {
|
|
813
1053
|
pageInfo: components["schemas"]["PageInfo"];
|
|
814
|
-
results: components["schemas"]["
|
|
1054
|
+
results: components["schemas"]["SnapshotDiff"][];
|
|
815
1055
|
};
|
|
816
1056
|
};
|
|
817
1057
|
}; /** @description Invalid parameters */
|
|
@@ -830,6 +1070,14 @@ interface operations {
|
|
|
830
1070
|
content: {
|
|
831
1071
|
"application/json": components["schemas"]["Error"];
|
|
832
1072
|
};
|
|
1073
|
+
}; /** @description Not found */
|
|
1074
|
+
404: {
|
|
1075
|
+
headers: {
|
|
1076
|
+
[name: string]: unknown;
|
|
1077
|
+
};
|
|
1078
|
+
content: {
|
|
1079
|
+
"application/json": components["schemas"]["Error"];
|
|
1080
|
+
};
|
|
833
1081
|
}; /** @description Server error */
|
|
834
1082
|
500: {
|
|
835
1083
|
headers: {
|
|
@@ -841,36 +1089,61 @@ interface operations {
|
|
|
841
1089
|
};
|
|
842
1090
|
};
|
|
843
1091
|
};
|
|
844
|
-
|
|
1092
|
+
createReview: {
|
|
845
1093
|
parameters: {
|
|
846
1094
|
query?: never;
|
|
847
1095
|
header?: never;
|
|
848
1096
|
path: {
|
|
849
|
-
|
|
1097
|
+
owner: string;
|
|
850
1098
|
project: string; /** @description The build number */
|
|
851
|
-
buildNumber:
|
|
1099
|
+
buildNumber: components["schemas"]["BuildNumber"];
|
|
852
1100
|
};
|
|
853
1101
|
cookie?: never;
|
|
854
1102
|
};
|
|
855
|
-
requestBody
|
|
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
|
+
};
|
|
856
1126
|
responses: {
|
|
857
|
-
/** @description
|
|
1127
|
+
/** @description Review submitted successfully — returns the review */200: {
|
|
858
1128
|
headers: {
|
|
859
1129
|
[name: string]: unknown;
|
|
860
1130
|
};
|
|
861
1131
|
content: {
|
|
862
|
-
"application/json":
|
|
1132
|
+
"application/json": {
|
|
1133
|
+
id: string; /** @enum {string} */
|
|
1134
|
+
state: "approved" | "rejected";
|
|
1135
|
+
};
|
|
863
1136
|
};
|
|
864
|
-
}; /** @description
|
|
865
|
-
|
|
1137
|
+
}; /** @description Unauthorized */
|
|
1138
|
+
401: {
|
|
866
1139
|
headers: {
|
|
867
1140
|
[name: string]: unknown;
|
|
868
1141
|
};
|
|
869
1142
|
content: {
|
|
870
1143
|
"application/json": components["schemas"]["Error"];
|
|
871
1144
|
};
|
|
872
|
-
}; /** @description
|
|
873
|
-
|
|
1145
|
+
}; /** @description Forbidden */
|
|
1146
|
+
403: {
|
|
874
1147
|
headers: {
|
|
875
1148
|
[name: string]: unknown;
|
|
876
1149
|
};
|
|
@@ -903,16 +1176,20 @@ type ArgosAPIClient = ReturnType<typeof createClient>;
|
|
|
903
1176
|
/**
|
|
904
1177
|
* Create Argos API client.
|
|
905
1178
|
*/
|
|
906
|
-
declare function createClient(options
|
|
1179
|
+
declare function createClient(options?: {
|
|
907
1180
|
baseUrl?: string;
|
|
908
|
-
authToken
|
|
1181
|
+
authToken?: string;
|
|
909
1182
|
}): _$openapi_fetch0.Client<paths, `${string}/${string}`>;
|
|
910
1183
|
declare class APIError extends Error {
|
|
911
1184
|
constructor(message: string);
|
|
912
1185
|
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Handle API errors.
|
|
1188
|
+
*/
|
|
1189
|
+
declare function formatAPIError(error: components["schemas"]["Error"]): string;
|
|
913
1190
|
/**
|
|
914
1191
|
* Handle API errors.
|
|
915
1192
|
*/
|
|
916
1193
|
declare function throwAPIError(error: components["schemas"]["Error"]): never;
|
|
917
1194
|
//#endregion
|
|
918
|
-
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.1-alpha.
|
|
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
|
}
|