@brunyee-studio/onus-cli 2.28.0
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/README.md +436 -0
- package/dist/bin.js +2354 -0
- package/dist/chunk-HE2HTZ3Y.js +77 -0
- package/dist/chunk-HJQGUY5T.js +3631 -0
- package/dist/client-QNEDGCP7.js +8 -0
- package/dist/config-FWANRWOT.js +15 -0
- package/dist/index.d.ts +9560 -0
- package/dist/index.js +8296 -0
- package/package.json +57 -0
- package/skills/onus-cli/SKILL.md +145 -0
|
@@ -0,0 +1,3631 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
loadConfig,
|
|
4
|
+
saveConfig
|
|
5
|
+
} from "./chunk-HE2HTZ3Y.js";
|
|
6
|
+
|
|
7
|
+
// src/generated/runtime.ts
|
|
8
|
+
var BASE_PATH = "/v1".replace(/\/+$/, "");
|
|
9
|
+
var Configuration = class {
|
|
10
|
+
constructor(configuration = {}) {
|
|
11
|
+
this.configuration = configuration;
|
|
12
|
+
}
|
|
13
|
+
configuration;
|
|
14
|
+
set config(configuration) {
|
|
15
|
+
this.configuration = configuration;
|
|
16
|
+
}
|
|
17
|
+
get basePath() {
|
|
18
|
+
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
|
|
19
|
+
}
|
|
20
|
+
get fetchApi() {
|
|
21
|
+
return this.configuration.fetchApi;
|
|
22
|
+
}
|
|
23
|
+
get middleware() {
|
|
24
|
+
return this.configuration.middleware || [];
|
|
25
|
+
}
|
|
26
|
+
get queryParamsStringify() {
|
|
27
|
+
return this.configuration.queryParamsStringify || querystring;
|
|
28
|
+
}
|
|
29
|
+
get username() {
|
|
30
|
+
return this.configuration.username;
|
|
31
|
+
}
|
|
32
|
+
get password() {
|
|
33
|
+
return this.configuration.password;
|
|
34
|
+
}
|
|
35
|
+
get apiKey() {
|
|
36
|
+
const apiKey = this.configuration.apiKey;
|
|
37
|
+
if (apiKey) {
|
|
38
|
+
return typeof apiKey === "function" ? apiKey : () => apiKey;
|
|
39
|
+
}
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
42
|
+
get accessToken() {
|
|
43
|
+
const accessToken = this.configuration.accessToken;
|
|
44
|
+
if (accessToken) {
|
|
45
|
+
return typeof accessToken === "function" ? accessToken : async () => accessToken;
|
|
46
|
+
}
|
|
47
|
+
return void 0;
|
|
48
|
+
}
|
|
49
|
+
get headers() {
|
|
50
|
+
return this.configuration.headers;
|
|
51
|
+
}
|
|
52
|
+
get credentials() {
|
|
53
|
+
return this.configuration.credentials;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var DefaultConfig = new Configuration();
|
|
57
|
+
var BaseAPI = class _BaseAPI {
|
|
58
|
+
constructor(configuration = DefaultConfig) {
|
|
59
|
+
this.configuration = configuration;
|
|
60
|
+
this.middleware = configuration.middleware;
|
|
61
|
+
}
|
|
62
|
+
configuration;
|
|
63
|
+
static jsonRegex = new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$", "i");
|
|
64
|
+
middleware;
|
|
65
|
+
withMiddleware(...middlewares) {
|
|
66
|
+
const next = this.clone();
|
|
67
|
+
next.middleware = next.middleware.concat(...middlewares);
|
|
68
|
+
return next;
|
|
69
|
+
}
|
|
70
|
+
withPreMiddleware(...preMiddlewares) {
|
|
71
|
+
const middlewares = preMiddlewares.map((pre) => ({ pre }));
|
|
72
|
+
return this.withMiddleware(...middlewares);
|
|
73
|
+
}
|
|
74
|
+
withPostMiddleware(...postMiddlewares) {
|
|
75
|
+
const middlewares = postMiddlewares.map((post) => ({ post }));
|
|
76
|
+
return this.withMiddleware(...middlewares);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Check if the given MIME is a JSON MIME.
|
|
80
|
+
* JSON MIME examples:
|
|
81
|
+
* application/json
|
|
82
|
+
* application/json; charset=UTF8
|
|
83
|
+
* APPLICATION/JSON
|
|
84
|
+
* application/vnd.company+json
|
|
85
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
86
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
87
|
+
*/
|
|
88
|
+
isJsonMime(mime) {
|
|
89
|
+
if (!mime) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
return _BaseAPI.jsonRegex.test(mime);
|
|
93
|
+
}
|
|
94
|
+
async request(context, initOverrides) {
|
|
95
|
+
const { url, init } = await this.createFetchParams(context, initOverrides);
|
|
96
|
+
const response = await this.fetchApi(url, init);
|
|
97
|
+
if (response && (response.status >= 200 && response.status < 300)) {
|
|
98
|
+
return response;
|
|
99
|
+
}
|
|
100
|
+
throw new ResponseError(response, "Response returned an error code");
|
|
101
|
+
}
|
|
102
|
+
async createFetchParams(context, initOverrides) {
|
|
103
|
+
let url = this.configuration.basePath + context.path;
|
|
104
|
+
if (context.query !== void 0 && Object.keys(context.query).length !== 0) {
|
|
105
|
+
url += "?" + this.configuration.queryParamsStringify(context.query);
|
|
106
|
+
}
|
|
107
|
+
const headers = Object.assign({}, this.configuration.headers, context.headers);
|
|
108
|
+
Object.keys(headers).forEach((key) => headers[key] === void 0 ? delete headers[key] : {});
|
|
109
|
+
const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
|
|
110
|
+
const initParams = {
|
|
111
|
+
method: context.method,
|
|
112
|
+
headers,
|
|
113
|
+
body: context.body,
|
|
114
|
+
credentials: this.configuration.credentials
|
|
115
|
+
};
|
|
116
|
+
const overriddenInit = {
|
|
117
|
+
...initParams,
|
|
118
|
+
...await initOverrideFn({
|
|
119
|
+
init: initParams,
|
|
120
|
+
context
|
|
121
|
+
})
|
|
122
|
+
};
|
|
123
|
+
let body;
|
|
124
|
+
if (isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body)) {
|
|
125
|
+
body = overriddenInit.body;
|
|
126
|
+
} else if (this.isJsonMime(headers["Content-Type"])) {
|
|
127
|
+
body = JSON.stringify(overriddenInit.body);
|
|
128
|
+
} else {
|
|
129
|
+
body = overriddenInit.body;
|
|
130
|
+
}
|
|
131
|
+
const init = {
|
|
132
|
+
...overriddenInit,
|
|
133
|
+
body
|
|
134
|
+
};
|
|
135
|
+
return { url, init };
|
|
136
|
+
}
|
|
137
|
+
fetchApi = async (url, init) => {
|
|
138
|
+
let fetchParams = { url, init };
|
|
139
|
+
for (const middleware of this.middleware) {
|
|
140
|
+
if (middleware.pre) {
|
|
141
|
+
fetchParams = await middleware.pre({
|
|
142
|
+
fetch: this.fetchApi,
|
|
143
|
+
...fetchParams
|
|
144
|
+
}) || fetchParams;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
let response = void 0;
|
|
148
|
+
try {
|
|
149
|
+
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
|
150
|
+
} catch (e) {
|
|
151
|
+
for (const middleware of this.middleware) {
|
|
152
|
+
if (middleware.onError) {
|
|
153
|
+
response = await middleware.onError({
|
|
154
|
+
fetch: this.fetchApi,
|
|
155
|
+
url: fetchParams.url,
|
|
156
|
+
init: fetchParams.init,
|
|
157
|
+
error: e,
|
|
158
|
+
response: response ? response.clone() : void 0
|
|
159
|
+
}) || response;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (response === void 0) {
|
|
163
|
+
if (e instanceof Error) {
|
|
164
|
+
throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
|
|
165
|
+
} else {
|
|
166
|
+
throw e;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
for (const middleware of this.middleware) {
|
|
171
|
+
if (middleware.post) {
|
|
172
|
+
response = await middleware.post({
|
|
173
|
+
fetch: this.fetchApi,
|
|
174
|
+
url: fetchParams.url,
|
|
175
|
+
init: fetchParams.init,
|
|
176
|
+
response: response.clone()
|
|
177
|
+
}) || response;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return response;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Create a shallow clone of `this` by constructing a new instance
|
|
184
|
+
* and then shallow cloning data members.
|
|
185
|
+
*/
|
|
186
|
+
clone() {
|
|
187
|
+
const constructor = this.constructor;
|
|
188
|
+
const next = new constructor(this.configuration);
|
|
189
|
+
next.middleware = this.middleware.slice();
|
|
190
|
+
return next;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
function isBlob(value) {
|
|
194
|
+
return typeof Blob !== "undefined" && value instanceof Blob;
|
|
195
|
+
}
|
|
196
|
+
function isFormData(value) {
|
|
197
|
+
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
198
|
+
}
|
|
199
|
+
var ResponseError = class extends Error {
|
|
200
|
+
constructor(response, msg) {
|
|
201
|
+
super(msg);
|
|
202
|
+
this.response = response;
|
|
203
|
+
}
|
|
204
|
+
response;
|
|
205
|
+
name = "ResponseError";
|
|
206
|
+
};
|
|
207
|
+
var FetchError = class extends Error {
|
|
208
|
+
constructor(cause, msg) {
|
|
209
|
+
super(msg);
|
|
210
|
+
this.cause = cause;
|
|
211
|
+
}
|
|
212
|
+
cause;
|
|
213
|
+
name = "FetchError";
|
|
214
|
+
};
|
|
215
|
+
var RequiredError = class extends Error {
|
|
216
|
+
constructor(field, msg) {
|
|
217
|
+
super(msg);
|
|
218
|
+
this.field = field;
|
|
219
|
+
}
|
|
220
|
+
field;
|
|
221
|
+
name = "RequiredError";
|
|
222
|
+
};
|
|
223
|
+
function querystring(params, prefix = "") {
|
|
224
|
+
return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
|
|
225
|
+
}
|
|
226
|
+
function querystringSingleKey(key, value, keyPrefix = "") {
|
|
227
|
+
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
|
|
228
|
+
if (value instanceof Array) {
|
|
229
|
+
const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
|
|
230
|
+
return `${encodeURIComponent(fullKey)}=${multiValue}`;
|
|
231
|
+
}
|
|
232
|
+
if (value instanceof Set) {
|
|
233
|
+
const valueAsArray = Array.from(value);
|
|
234
|
+
return querystringSingleKey(key, valueAsArray, keyPrefix);
|
|
235
|
+
}
|
|
236
|
+
if (value instanceof Date) {
|
|
237
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
|
|
238
|
+
}
|
|
239
|
+
if (value instanceof Object) {
|
|
240
|
+
return querystring(value, fullKey);
|
|
241
|
+
}
|
|
242
|
+
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
|
243
|
+
}
|
|
244
|
+
var JSONApiResponse = class {
|
|
245
|
+
constructor(raw, transformer = (jsonValue) => jsonValue) {
|
|
246
|
+
this.raw = raw;
|
|
247
|
+
this.transformer = transformer;
|
|
248
|
+
}
|
|
249
|
+
raw;
|
|
250
|
+
transformer;
|
|
251
|
+
async value() {
|
|
252
|
+
return this.transformer(await this.raw.json());
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
var VoidApiResponse = class {
|
|
256
|
+
constructor(raw) {
|
|
257
|
+
this.raw = raw;
|
|
258
|
+
}
|
|
259
|
+
raw;
|
|
260
|
+
async value() {
|
|
261
|
+
return void 0;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// src/generated/models/CommentsCommentIdPatch200ResponseAuthor.ts
|
|
266
|
+
function CommentsCommentIdPatch200ResponseAuthorFromJSON(json) {
|
|
267
|
+
return CommentsCommentIdPatch200ResponseAuthorFromJSONTyped(json, false);
|
|
268
|
+
}
|
|
269
|
+
function CommentsCommentIdPatch200ResponseAuthorFromJSONTyped(json, ignoreDiscriminator) {
|
|
270
|
+
if (json == null) {
|
|
271
|
+
return json;
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
"id": json["id"],
|
|
275
|
+
"full_name": json["full_name"],
|
|
276
|
+
"avatar_url": json["avatar_url"]
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// src/generated/models/AnalyticsEventsGet200ResponseInner.ts
|
|
281
|
+
function AnalyticsEventsGet200ResponseInnerFromJSON(json) {
|
|
282
|
+
return AnalyticsEventsGet200ResponseInnerFromJSONTyped(json, false);
|
|
283
|
+
}
|
|
284
|
+
function AnalyticsEventsGet200ResponseInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
285
|
+
if (json == null) {
|
|
286
|
+
return json;
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
"event": json["event"],
|
|
290
|
+
"count": json["count"],
|
|
291
|
+
"last_seen": json["last_seen"] == null ? null : new Date(json["last_seen"])
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// src/generated/models/AnalyticsQueryPost200ResponseAnyOf1BreakdownRowsInnerStepsInner.ts
|
|
296
|
+
function AnalyticsQueryPost200ResponseAnyOf1BreakdownRowsInnerStepsInnerFromJSON(json) {
|
|
297
|
+
return AnalyticsQueryPost200ResponseAnyOf1BreakdownRowsInnerStepsInnerFromJSONTyped(json, false);
|
|
298
|
+
}
|
|
299
|
+
function AnalyticsQueryPost200ResponseAnyOf1BreakdownRowsInnerStepsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
300
|
+
if (json == null) {
|
|
301
|
+
return json;
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
"step": json["step"],
|
|
305
|
+
"count": json["count"]
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// src/generated/models/AnalyticsQueryPost200ResponseAnyOf1BreakdownRowsInner.ts
|
|
310
|
+
function AnalyticsQueryPost200ResponseAnyOf1BreakdownRowsInnerFromJSON(json) {
|
|
311
|
+
return AnalyticsQueryPost200ResponseAnyOf1BreakdownRowsInnerFromJSONTyped(json, false);
|
|
312
|
+
}
|
|
313
|
+
function AnalyticsQueryPost200ResponseAnyOf1BreakdownRowsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
314
|
+
if (json == null) {
|
|
315
|
+
return json;
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
"value": json["value"],
|
|
319
|
+
"entered": json["entered"],
|
|
320
|
+
"steps": json["steps"].map(AnalyticsQueryPost200ResponseAnyOf1BreakdownRowsInnerStepsInnerFromJSON)
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// src/generated/models/AnalyticsQueryPost200ResponseAnyOf1StepsInner.ts
|
|
325
|
+
function AnalyticsQueryPost200ResponseAnyOf1StepsInnerFromJSON(json) {
|
|
326
|
+
return AnalyticsQueryPost200ResponseAnyOf1StepsInnerFromJSONTyped(json, false);
|
|
327
|
+
}
|
|
328
|
+
function AnalyticsQueryPost200ResponseAnyOf1StepsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
329
|
+
if (json == null) {
|
|
330
|
+
return json;
|
|
331
|
+
}
|
|
332
|
+
return {
|
|
333
|
+
"event": json["event"],
|
|
334
|
+
"count": json["count"],
|
|
335
|
+
"overall": json["overall"],
|
|
336
|
+
"relative": json["relative"]
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// src/generated/models/AnalyticsOverviewGet200ResponseCurrent.ts
|
|
341
|
+
function AnalyticsOverviewGet200ResponseCurrentFromJSON(json) {
|
|
342
|
+
return AnalyticsOverviewGet200ResponseCurrentFromJSONTyped(json, false);
|
|
343
|
+
}
|
|
344
|
+
function AnalyticsOverviewGet200ResponseCurrentFromJSONTyped(json, ignoreDiscriminator) {
|
|
345
|
+
if (json == null) {
|
|
346
|
+
return json;
|
|
347
|
+
}
|
|
348
|
+
return {
|
|
349
|
+
"visitors": json["visitors"],
|
|
350
|
+
"pageviews": json["pageviews"],
|
|
351
|
+
"sessions": json["sessions"],
|
|
352
|
+
"bounce_rate": json["bounce_rate"],
|
|
353
|
+
"median_session_duration_seconds": json["median_session_duration_seconds"]
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// src/generated/models/AnalyticsOverviewGet200Response.ts
|
|
358
|
+
function AnalyticsOverviewGet200ResponseFromJSON(json) {
|
|
359
|
+
return AnalyticsOverviewGet200ResponseFromJSONTyped(json, false);
|
|
360
|
+
}
|
|
361
|
+
function AnalyticsOverviewGet200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
362
|
+
if (json == null) {
|
|
363
|
+
return json;
|
|
364
|
+
}
|
|
365
|
+
return {
|
|
366
|
+
"current": AnalyticsOverviewGet200ResponseCurrentFromJSON(json["current"]),
|
|
367
|
+
"previous": AnalyticsOverviewGet200ResponseCurrentFromJSON(json["previous"]),
|
|
368
|
+
"from": new Date(json["from"]),
|
|
369
|
+
"to": new Date(json["to"])
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// src/generated/models/AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsPointsInner.ts
|
|
374
|
+
function AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsPointsInnerFromJSON(json) {
|
|
375
|
+
return AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsPointsInnerFromJSONTyped(json, false);
|
|
376
|
+
}
|
|
377
|
+
function AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsPointsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
378
|
+
if (json == null) {
|
|
379
|
+
return json;
|
|
380
|
+
}
|
|
381
|
+
return {
|
|
382
|
+
"bucket": json["bucket"],
|
|
383
|
+
"value": json["value"]
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// src/generated/models/AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsBreakdownInner.ts
|
|
388
|
+
function AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsBreakdownInnerFromJSON(json) {
|
|
389
|
+
return AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsBreakdownInnerFromJSONTyped(json, false);
|
|
390
|
+
}
|
|
391
|
+
function AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsBreakdownInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
392
|
+
if (json == null) {
|
|
393
|
+
return json;
|
|
394
|
+
}
|
|
395
|
+
return {
|
|
396
|
+
"value": json["value"],
|
|
397
|
+
"total": json["total"],
|
|
398
|
+
"points": json["points"].map(AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsPointsInnerFromJSON)
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// src/generated/models/AnalyticsQueryPost200ResponseAnyOfSeriesInnerRows.ts
|
|
403
|
+
function AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsFromJSON(json) {
|
|
404
|
+
return AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsFromJSONTyped(json, false);
|
|
405
|
+
}
|
|
406
|
+
function AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsFromJSONTyped(json, ignoreDiscriminator) {
|
|
407
|
+
if (json == null) {
|
|
408
|
+
return json;
|
|
409
|
+
}
|
|
410
|
+
return {
|
|
411
|
+
"total": json["total"],
|
|
412
|
+
"points": json["points"] == null ? void 0 : json["points"].map(AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsPointsInnerFromJSON),
|
|
413
|
+
"breakdown": json["breakdown"] == null ? void 0 : json["breakdown"].map(AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsBreakdownInnerFromJSON)
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// src/generated/models/AnalyticsQueryPost200ResponseAnyOfSeriesInner.ts
|
|
418
|
+
function AnalyticsQueryPost200ResponseAnyOfSeriesInnerFromJSON(json) {
|
|
419
|
+
return AnalyticsQueryPost200ResponseAnyOfSeriesInnerFromJSONTyped(json, false);
|
|
420
|
+
}
|
|
421
|
+
function AnalyticsQueryPost200ResponseAnyOfSeriesInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
422
|
+
if (json == null) {
|
|
423
|
+
return json;
|
|
424
|
+
}
|
|
425
|
+
return {
|
|
426
|
+
"label": json["label"],
|
|
427
|
+
"event": json["event"],
|
|
428
|
+
"math": json["math"],
|
|
429
|
+
"rows": AnalyticsQueryPost200ResponseAnyOfSeriesInnerRowsFromJSON(json["rows"])
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// src/generated/models/AnalyticsQueryPost200Response.ts
|
|
434
|
+
function AnalyticsQueryPost200ResponseFromJSON(json) {
|
|
435
|
+
return AnalyticsQueryPost200ResponseFromJSONTyped(json, false);
|
|
436
|
+
}
|
|
437
|
+
function AnalyticsQueryPost200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
438
|
+
if (json == null) {
|
|
439
|
+
return json;
|
|
440
|
+
}
|
|
441
|
+
return {
|
|
442
|
+
"interval": json["interval"],
|
|
443
|
+
"from": new Date(json["from"]),
|
|
444
|
+
"to": new Date(json["to"]),
|
|
445
|
+
"series": json["series"].map(AnalyticsQueryPost200ResponseAnyOfSeriesInnerFromJSON),
|
|
446
|
+
"entered": json["entered"],
|
|
447
|
+
"steps": json["steps"].map(AnalyticsQueryPost200ResponseAnyOf1StepsInnerFromJSON),
|
|
448
|
+
"breakdown": json["breakdown"],
|
|
449
|
+
"breakdown_rows": json["breakdown_rows"] == null ? void 0 : json["breakdown_rows"].map(AnalyticsQueryPost200ResponseAnyOf1BreakdownRowsInnerFromJSON),
|
|
450
|
+
"median_seconds_to_convert": json["median_seconds_to_convert"]
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// src/generated/models/AnalyticsQueryPostRequestQueryAnyOfSeriesInnerFiltersInner.ts
|
|
455
|
+
function AnalyticsQueryPostRequestQueryAnyOfSeriesInnerFiltersInnerToJSON(json) {
|
|
456
|
+
return AnalyticsQueryPostRequestQueryAnyOfSeriesInnerFiltersInnerToJSONTyped(json, false);
|
|
457
|
+
}
|
|
458
|
+
function AnalyticsQueryPostRequestQueryAnyOfSeriesInnerFiltersInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
459
|
+
if (value == null) {
|
|
460
|
+
return value;
|
|
461
|
+
}
|
|
462
|
+
return {
|
|
463
|
+
"key": value["key"],
|
|
464
|
+
"op": value["op"],
|
|
465
|
+
"value": value["value"]
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// src/generated/models/AnalyticsQueryPostRequestQueryAnyOfSeriesInnerMath.ts
|
|
470
|
+
function AnalyticsQueryPostRequestQueryAnyOfSeriesInnerMathToJSON(json) {
|
|
471
|
+
return AnalyticsQueryPostRequestQueryAnyOfSeriesInnerMathToJSONTyped(json, false);
|
|
472
|
+
}
|
|
473
|
+
function AnalyticsQueryPostRequestQueryAnyOfSeriesInnerMathToJSONTyped(value, ignoreDiscriminator = false) {
|
|
474
|
+
if (value == null) {
|
|
475
|
+
return value;
|
|
476
|
+
}
|
|
477
|
+
return {
|
|
478
|
+
"agg": value["agg"],
|
|
479
|
+
"property": value["property"]
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// src/generated/models/AnalyticsQueryPostRequestQueryAnyOfSeriesInner.ts
|
|
484
|
+
function AnalyticsQueryPostRequestQueryAnyOfSeriesInnerToJSON(json) {
|
|
485
|
+
return AnalyticsQueryPostRequestQueryAnyOfSeriesInnerToJSONTyped(json, false);
|
|
486
|
+
}
|
|
487
|
+
function AnalyticsQueryPostRequestQueryAnyOfSeriesInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
488
|
+
if (value == null) {
|
|
489
|
+
return value;
|
|
490
|
+
}
|
|
491
|
+
return {
|
|
492
|
+
"event": value["event"],
|
|
493
|
+
"label": value["label"],
|
|
494
|
+
"math": AnalyticsQueryPostRequestQueryAnyOfSeriesInnerMathToJSON(value["math"]),
|
|
495
|
+
"filters": value["filters"] == null ? void 0 : value["filters"].map(AnalyticsQueryPostRequestQueryAnyOfSeriesInnerFiltersInnerToJSON)
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// src/generated/models/AnalyticsQueryPostRequestQueryAnyOf1StepsInner.ts
|
|
500
|
+
function AnalyticsQueryPostRequestQueryAnyOf1StepsInnerToJSON(json) {
|
|
501
|
+
return AnalyticsQueryPostRequestQueryAnyOf1StepsInnerToJSONTyped(json, false);
|
|
502
|
+
}
|
|
503
|
+
function AnalyticsQueryPostRequestQueryAnyOf1StepsInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
504
|
+
if (value == null) {
|
|
505
|
+
return value;
|
|
506
|
+
}
|
|
507
|
+
return {
|
|
508
|
+
"event": value["event"],
|
|
509
|
+
"filters": value["filters"] == null ? void 0 : value["filters"].map(AnalyticsQueryPostRequestQueryAnyOfSeriesInnerFiltersInnerToJSON)
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// src/generated/models/AnalyticsQueryPostRequestQueryAnyOf1DateRange.ts
|
|
514
|
+
function AnalyticsQueryPostRequestQueryAnyOf1DateRangeToJSON(json) {
|
|
515
|
+
return AnalyticsQueryPostRequestQueryAnyOf1DateRangeToJSONTyped(json, false);
|
|
516
|
+
}
|
|
517
|
+
function AnalyticsQueryPostRequestQueryAnyOf1DateRangeToJSONTyped(value, ignoreDiscriminator = false) {
|
|
518
|
+
if (value == null) {
|
|
519
|
+
return value;
|
|
520
|
+
}
|
|
521
|
+
return {
|
|
522
|
+
"from": value["from"].toISOString(),
|
|
523
|
+
"to": value["to"].toISOString()
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// src/generated/models/AnalyticsQueryPostRequestQuery.ts
|
|
528
|
+
function AnalyticsQueryPostRequestQueryToJSON(json) {
|
|
529
|
+
return AnalyticsQueryPostRequestQueryToJSONTyped(json, false);
|
|
530
|
+
}
|
|
531
|
+
function AnalyticsQueryPostRequestQueryToJSONTyped(value, ignoreDiscriminator = false) {
|
|
532
|
+
if (value == null) {
|
|
533
|
+
return value;
|
|
534
|
+
}
|
|
535
|
+
return {
|
|
536
|
+
"type": value["type"],
|
|
537
|
+
"series": value["series"].map(AnalyticsQueryPostRequestQueryAnyOfSeriesInnerToJSON),
|
|
538
|
+
"filters": value["filters"] == null ? void 0 : value["filters"].map(AnalyticsQueryPostRequestQueryAnyOfSeriesInnerFiltersInnerToJSON),
|
|
539
|
+
"segments": value["segments"],
|
|
540
|
+
"breakdown": value["breakdown"],
|
|
541
|
+
"interval": value["interval"],
|
|
542
|
+
"display": value["display"],
|
|
543
|
+
"dateRange": AnalyticsQueryPostRequestQueryAnyOf1DateRangeToJSON(value["dateRange"]),
|
|
544
|
+
"steps": value["steps"].map(AnalyticsQueryPostRequestQueryAnyOf1StepsInnerToJSON),
|
|
545
|
+
"window_days": value["window_days"],
|
|
546
|
+
"funnelTrend": value["funnelTrend"]
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
// src/generated/models/AnalyticsQueryPostRequest.ts
|
|
551
|
+
function AnalyticsQueryPostRequestToJSON(json) {
|
|
552
|
+
return AnalyticsQueryPostRequestToJSONTyped(json, false);
|
|
553
|
+
}
|
|
554
|
+
function AnalyticsQueryPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
555
|
+
if (value == null) {
|
|
556
|
+
return value;
|
|
557
|
+
}
|
|
558
|
+
return {
|
|
559
|
+
"team_id": value["team_id"],
|
|
560
|
+
"query": AnalyticsQueryPostRequestQueryToJSON(value["query"]),
|
|
561
|
+
"from": value["from"] == null ? void 0 : value["from"].toISOString(),
|
|
562
|
+
"to": value["to"] == null ? void 0 : value["to"].toISOString()
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// src/generated/models/AttachmentsIdDownloadUrlGet200Response.ts
|
|
567
|
+
function AttachmentsIdDownloadUrlGet200ResponseFromJSON(json) {
|
|
568
|
+
return AttachmentsIdDownloadUrlGet200ResponseFromJSONTyped(json, false);
|
|
569
|
+
}
|
|
570
|
+
function AttachmentsIdDownloadUrlGet200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
571
|
+
if (json == null) {
|
|
572
|
+
return json;
|
|
573
|
+
}
|
|
574
|
+
return {
|
|
575
|
+
"download_url": json["download_url"]
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// src/generated/models/IssuesBulkPostRequestOneOfItemsInnerSet.ts
|
|
580
|
+
function IssuesBulkPostRequestOneOfItemsInnerSetToJSON(json) {
|
|
581
|
+
return IssuesBulkPostRequestOneOfItemsInnerSetToJSONTyped(json, false);
|
|
582
|
+
}
|
|
583
|
+
function IssuesBulkPostRequestOneOfItemsInnerSetToJSONTyped(value, ignoreDiscriminator = false) {
|
|
584
|
+
if (value == null) {
|
|
585
|
+
return value;
|
|
586
|
+
}
|
|
587
|
+
return {
|
|
588
|
+
"status": value["status"],
|
|
589
|
+
"priority": value["priority"],
|
|
590
|
+
"assignee_id": value["assignee_id"],
|
|
591
|
+
"project_id": value["project_id"],
|
|
592
|
+
"labels": value["labels"]
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// src/generated/models/IssuesBulkPostRequestOneOfItemsInner.ts
|
|
597
|
+
function IssuesBulkPostRequestOneOfItemsInnerToJSON(json) {
|
|
598
|
+
return IssuesBulkPostRequestOneOfItemsInnerToJSONTyped(json, false);
|
|
599
|
+
}
|
|
600
|
+
function IssuesBulkPostRequestOneOfItemsInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
601
|
+
if (value == null) {
|
|
602
|
+
return value;
|
|
603
|
+
}
|
|
604
|
+
return {
|
|
605
|
+
"ref": value["ref"],
|
|
606
|
+
"set": IssuesBulkPostRequestOneOfItemsInnerSetToJSON(value["set"])
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// src/generated/models/IssuesBulkPostRequestOneOf.ts
|
|
611
|
+
function instanceOfIssuesBulkPostRequestOneOf(value) {
|
|
612
|
+
if (!("operation" in value) || value["operation"] === void 0) return false;
|
|
613
|
+
if (!("items" in value) || value["items"] === void 0) return false;
|
|
614
|
+
return true;
|
|
615
|
+
}
|
|
616
|
+
function IssuesBulkPostRequestOneOfToJSON(json) {
|
|
617
|
+
return IssuesBulkPostRequestOneOfToJSONTyped(json, false);
|
|
618
|
+
}
|
|
619
|
+
function IssuesBulkPostRequestOneOfToJSONTyped(value, ignoreDiscriminator = false) {
|
|
620
|
+
if (value == null) {
|
|
621
|
+
return value;
|
|
622
|
+
}
|
|
623
|
+
return {
|
|
624
|
+
"operation": value["operation"],
|
|
625
|
+
"items": value["items"].map(IssuesBulkPostRequestOneOfItemsInnerToJSON)
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// src/generated/models/IssuesBulkPostRequestOneOf1ItemsInner.ts
|
|
630
|
+
function IssuesBulkPostRequestOneOf1ItemsInnerToJSON(json) {
|
|
631
|
+
return IssuesBulkPostRequestOneOf1ItemsInnerToJSONTyped(json, false);
|
|
632
|
+
}
|
|
633
|
+
function IssuesBulkPostRequestOneOf1ItemsInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
634
|
+
if (value == null) {
|
|
635
|
+
return value;
|
|
636
|
+
}
|
|
637
|
+
return {
|
|
638
|
+
"ref": value["ref"],
|
|
639
|
+
"body": value["body"],
|
|
640
|
+
"client_token": value["client_token"]
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// src/generated/models/IssuesBulkPostRequestOneOf1.ts
|
|
645
|
+
function instanceOfIssuesBulkPostRequestOneOf1(value) {
|
|
646
|
+
if (!("operation" in value) || value["operation"] === void 0) return false;
|
|
647
|
+
if (!("items" in value) || value["items"] === void 0) return false;
|
|
648
|
+
return true;
|
|
649
|
+
}
|
|
650
|
+
function IssuesBulkPostRequestOneOf1ToJSON(json) {
|
|
651
|
+
return IssuesBulkPostRequestOneOf1ToJSONTyped(json, false);
|
|
652
|
+
}
|
|
653
|
+
function IssuesBulkPostRequestOneOf1ToJSONTyped(value, ignoreDiscriminator = false) {
|
|
654
|
+
if (value == null) {
|
|
655
|
+
return value;
|
|
656
|
+
}
|
|
657
|
+
return {
|
|
658
|
+
"operation": value["operation"],
|
|
659
|
+
"items": value["items"].map(IssuesBulkPostRequestOneOf1ItemsInnerToJSON)
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// src/generated/models/IssuesPost200ResponseParent.ts
|
|
664
|
+
function IssuesPost200ResponseParentFromJSON(json) {
|
|
665
|
+
return IssuesPost200ResponseParentFromJSONTyped(json, false);
|
|
666
|
+
}
|
|
667
|
+
function IssuesPost200ResponseParentFromJSONTyped(json, ignoreDiscriminator) {
|
|
668
|
+
if (json == null) {
|
|
669
|
+
return json;
|
|
670
|
+
}
|
|
671
|
+
return {
|
|
672
|
+
"id": json["id"],
|
|
673
|
+
"team_id": json["team_id"],
|
|
674
|
+
"identifier": json["identifier"],
|
|
675
|
+
"title": json["title"],
|
|
676
|
+
"status": json["status"]
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
// src/generated/models/IssuesBulkPost200ResponseResultsInnerAnyOf1Error.ts
|
|
681
|
+
function IssuesBulkPost200ResponseResultsInnerAnyOf1ErrorFromJSON(json) {
|
|
682
|
+
return IssuesBulkPost200ResponseResultsInnerAnyOf1ErrorFromJSONTyped(json, false);
|
|
683
|
+
}
|
|
684
|
+
function IssuesBulkPost200ResponseResultsInnerAnyOf1ErrorFromJSONTyped(json, ignoreDiscriminator) {
|
|
685
|
+
if (json == null) {
|
|
686
|
+
return json;
|
|
687
|
+
}
|
|
688
|
+
return {
|
|
689
|
+
"code": json["code"],
|
|
690
|
+
"message": json["message"]
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// src/generated/models/IssuesBulkPost200ResponseResultsInner.ts
|
|
695
|
+
function IssuesBulkPost200ResponseResultsInnerFromJSON(json) {
|
|
696
|
+
return IssuesBulkPost200ResponseResultsInnerFromJSONTyped(json, false);
|
|
697
|
+
}
|
|
698
|
+
function IssuesBulkPost200ResponseResultsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
699
|
+
if (json == null) {
|
|
700
|
+
return json;
|
|
701
|
+
}
|
|
702
|
+
return {
|
|
703
|
+
"index": json["index"],
|
|
704
|
+
"ok": json["ok"],
|
|
705
|
+
"issue": IssuesPost200ResponseParentFromJSON(json["issue"]),
|
|
706
|
+
"error": IssuesBulkPost200ResponseResultsInnerAnyOf1ErrorFromJSON(json["error"])
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
// src/generated/models/CommentsCommentIdPatch200Response.ts
|
|
711
|
+
function CommentsCommentIdPatch200ResponseFromJSON(json) {
|
|
712
|
+
return CommentsCommentIdPatch200ResponseFromJSONTyped(json, false);
|
|
713
|
+
}
|
|
714
|
+
function CommentsCommentIdPatch200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
715
|
+
if (json == null) {
|
|
716
|
+
return json;
|
|
717
|
+
}
|
|
718
|
+
return {
|
|
719
|
+
"id": json["id"],
|
|
720
|
+
"issue_id": json["issue_id"],
|
|
721
|
+
"author_id": json["author_id"],
|
|
722
|
+
"body": json["body"],
|
|
723
|
+
"created_at": json["created_at"],
|
|
724
|
+
"updated_at": json["updated_at"],
|
|
725
|
+
"author": json["author"] == null ? void 0 : CommentsCommentIdPatch200ResponseAuthorFromJSON(json["author"])
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
// src/generated/models/CommentsCommentIdPatchRequest.ts
|
|
730
|
+
function CommentsCommentIdPatchRequestToJSON(json) {
|
|
731
|
+
return CommentsCommentIdPatchRequestToJSONTyped(json, false);
|
|
732
|
+
}
|
|
733
|
+
function CommentsCommentIdPatchRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
734
|
+
if (value == null) {
|
|
735
|
+
return value;
|
|
736
|
+
}
|
|
737
|
+
return {
|
|
738
|
+
"body": value["body"]
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// src/generated/models/EventsStreamGet200Response.ts
|
|
743
|
+
function EventsStreamGet200ResponseFromJSON(json) {
|
|
744
|
+
return EventsStreamGet200ResponseFromJSONTyped(json, false);
|
|
745
|
+
}
|
|
746
|
+
function EventsStreamGet200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
747
|
+
if (json == null) {
|
|
748
|
+
return json;
|
|
749
|
+
}
|
|
750
|
+
return {
|
|
751
|
+
"seq": json["seq"],
|
|
752
|
+
"type": json["type"],
|
|
753
|
+
"team_id": json["team_id"],
|
|
754
|
+
"created_at": json["created_at"],
|
|
755
|
+
"payload": json["payload"],
|
|
756
|
+
"replay": json["replay"] == null ? void 0 : json["replay"]
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
// src/generated/models/IngestKeysIdDelete200Response.ts
|
|
761
|
+
function IngestKeysIdDelete200ResponseFromJSON(json) {
|
|
762
|
+
return IngestKeysIdDelete200ResponseFromJSONTyped(json, false);
|
|
763
|
+
}
|
|
764
|
+
function IngestKeysIdDelete200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
765
|
+
if (json == null) {
|
|
766
|
+
return json;
|
|
767
|
+
}
|
|
768
|
+
return {
|
|
769
|
+
"ok": json["ok"]
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// src/generated/models/IngestKeysIdPatchRequest.ts
|
|
774
|
+
function IngestKeysIdPatchRequestToJSON(json) {
|
|
775
|
+
return IngestKeysIdPatchRequestToJSONTyped(json, false);
|
|
776
|
+
}
|
|
777
|
+
function IngestKeysIdPatchRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
778
|
+
if (value == null) {
|
|
779
|
+
return value;
|
|
780
|
+
}
|
|
781
|
+
return {
|
|
782
|
+
"status": value["status"]
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// src/generated/models/IngestKeysIdRotatePost200Response.ts
|
|
787
|
+
function IngestKeysIdRotatePost200ResponseFromJSON(json) {
|
|
788
|
+
return IngestKeysIdRotatePost200ResponseFromJSONTyped(json, false);
|
|
789
|
+
}
|
|
790
|
+
function IngestKeysIdRotatePost200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
791
|
+
if (json == null) {
|
|
792
|
+
return json;
|
|
793
|
+
}
|
|
794
|
+
return {
|
|
795
|
+
"id": json["id"],
|
|
796
|
+
"label": json["label"],
|
|
797
|
+
"secret": json["secret"],
|
|
798
|
+
"dsn": json["dsn"],
|
|
799
|
+
"status": json["status"],
|
|
800
|
+
"grace_until": json["grace_until"] == null ? null : new Date(json["grace_until"])
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// src/generated/models/IngestKeysIdRotatePostRequest.ts
|
|
805
|
+
function IngestKeysIdRotatePostRequestToJSON(json) {
|
|
806
|
+
return IngestKeysIdRotatePostRequestToJSONTyped(json, false);
|
|
807
|
+
}
|
|
808
|
+
function IngestKeysIdRotatePostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
809
|
+
if (value == null) {
|
|
810
|
+
return value;
|
|
811
|
+
}
|
|
812
|
+
return {
|
|
813
|
+
"grace_seconds": value["grace_seconds"]
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// src/generated/models/IssuesPost200ResponseAttachmentsInner.ts
|
|
818
|
+
function IssuesPost200ResponseAttachmentsInnerFromJSON(json) {
|
|
819
|
+
return IssuesPost200ResponseAttachmentsInnerFromJSONTyped(json, false);
|
|
820
|
+
}
|
|
821
|
+
function IssuesPost200ResponseAttachmentsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
822
|
+
if (json == null) {
|
|
823
|
+
return json;
|
|
824
|
+
}
|
|
825
|
+
return {
|
|
826
|
+
"id": json["id"],
|
|
827
|
+
"filename": json["filename"],
|
|
828
|
+
"content_type": json["content_type"],
|
|
829
|
+
"size_bytes": json["size_bytes"],
|
|
830
|
+
"storage_path": json["storage_path"],
|
|
831
|
+
"created_at": json["created_at"],
|
|
832
|
+
"uploader": CommentsCommentIdPatch200ResponseAuthorFromJSON(json["uploader"])
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// src/generated/models/IssuesGet200ResponseDataInnerProject.ts
|
|
837
|
+
function IssuesGet200ResponseDataInnerProjectFromJSON(json) {
|
|
838
|
+
return IssuesGet200ResponseDataInnerProjectFromJSONTyped(json, false);
|
|
839
|
+
}
|
|
840
|
+
function IssuesGet200ResponseDataInnerProjectFromJSONTyped(json, ignoreDiscriminator) {
|
|
841
|
+
if (json == null) {
|
|
842
|
+
return json;
|
|
843
|
+
}
|
|
844
|
+
return {
|
|
845
|
+
"id": json["id"],
|
|
846
|
+
"name": json["name"],
|
|
847
|
+
"icon": json["icon"],
|
|
848
|
+
"color": json["color"]
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// src/generated/models/IssuesPost200ResponseRelationsInner.ts
|
|
853
|
+
function IssuesPost200ResponseRelationsInnerFromJSON(json) {
|
|
854
|
+
return IssuesPost200ResponseRelationsInnerFromJSONTyped(json, false);
|
|
855
|
+
}
|
|
856
|
+
function IssuesPost200ResponseRelationsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
857
|
+
if (json == null) {
|
|
858
|
+
return json;
|
|
859
|
+
}
|
|
860
|
+
return {
|
|
861
|
+
"id": json["id"],
|
|
862
|
+
"issue_id": json["issue_id"],
|
|
863
|
+
"related_issue_id": json["related_issue_id"],
|
|
864
|
+
"type": json["type"],
|
|
865
|
+
"created_at": json["created_at"],
|
|
866
|
+
"related_issue": json["related_issue"] == null ? void 0 : IssuesPost200ResponseParentFromJSON(json["related_issue"])
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
// src/generated/models/IssuesGet200ResponseDataInnerLabelsInner.ts
|
|
871
|
+
function IssuesGet200ResponseDataInnerLabelsInnerFromJSON(json) {
|
|
872
|
+
return IssuesGet200ResponseDataInnerLabelsInnerFromJSONTyped(json, false);
|
|
873
|
+
}
|
|
874
|
+
function IssuesGet200ResponseDataInnerLabelsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
875
|
+
if (json == null) {
|
|
876
|
+
return json;
|
|
877
|
+
}
|
|
878
|
+
return {
|
|
879
|
+
"id": json["id"],
|
|
880
|
+
"team_id": json["team_id"],
|
|
881
|
+
"name": json["name"],
|
|
882
|
+
"color": json["color"]
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// src/generated/models/IssuesGet200ResponseDataInnerTeam.ts
|
|
887
|
+
function IssuesGet200ResponseDataInnerTeamFromJSON(json) {
|
|
888
|
+
return IssuesGet200ResponseDataInnerTeamFromJSONTyped(json, false);
|
|
889
|
+
}
|
|
890
|
+
function IssuesGet200ResponseDataInnerTeamFromJSONTyped(json, ignoreDiscriminator) {
|
|
891
|
+
if (json == null) {
|
|
892
|
+
return json;
|
|
893
|
+
}
|
|
894
|
+
return {
|
|
895
|
+
"id": json["id"],
|
|
896
|
+
"key": json["key"],
|
|
897
|
+
"name": json["name"]
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// src/generated/models/IssuesPost200ResponseActivityInner.ts
|
|
902
|
+
function IssuesPost200ResponseActivityInnerFromJSON(json) {
|
|
903
|
+
return IssuesPost200ResponseActivityInnerFromJSONTyped(json, false);
|
|
904
|
+
}
|
|
905
|
+
function IssuesPost200ResponseActivityInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
906
|
+
if (json == null) {
|
|
907
|
+
return json;
|
|
908
|
+
}
|
|
909
|
+
return {
|
|
910
|
+
"id": json["id"],
|
|
911
|
+
"issue_id": json["issue_id"],
|
|
912
|
+
"kind": json["kind"],
|
|
913
|
+
"from_value": json["from_value"],
|
|
914
|
+
"to_value": json["to_value"],
|
|
915
|
+
"created_at": json["created_at"],
|
|
916
|
+
"actor": CommentsCommentIdPatch200ResponseAuthorFromJSON(json["actor"])
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
// src/generated/models/IssuesPost200ResponsePullRequestsInner.ts
|
|
921
|
+
function IssuesPost200ResponsePullRequestsInnerFromJSON(json) {
|
|
922
|
+
return IssuesPost200ResponsePullRequestsInnerFromJSONTyped(json, false);
|
|
923
|
+
}
|
|
924
|
+
function IssuesPost200ResponsePullRequestsInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
925
|
+
if (json == null) {
|
|
926
|
+
return json;
|
|
927
|
+
}
|
|
928
|
+
return {
|
|
929
|
+
"number": json["number"],
|
|
930
|
+
"title": json["title"],
|
|
931
|
+
"html_url": json["html_url"],
|
|
932
|
+
"state": json["state"],
|
|
933
|
+
"draft": json["draft"],
|
|
934
|
+
"merged_at": json["merged_at"],
|
|
935
|
+
"head_branch": json["head_branch"],
|
|
936
|
+
"owner": json["owner"],
|
|
937
|
+
"repo": json["repo"],
|
|
938
|
+
"closes_on_merge": json["closes_on_merge"],
|
|
939
|
+
"source": json["source"]
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// src/generated/models/IssuesBulkPost200Response.ts
|
|
944
|
+
function IssuesBulkPost200ResponseFromJSON(json) {
|
|
945
|
+
return IssuesBulkPost200ResponseFromJSONTyped(json, false);
|
|
946
|
+
}
|
|
947
|
+
function IssuesBulkPost200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
948
|
+
if (json == null) {
|
|
949
|
+
return json;
|
|
950
|
+
}
|
|
951
|
+
return {
|
|
952
|
+
"results": json["results"].map(IssuesBulkPost200ResponseResultsInnerFromJSON),
|
|
953
|
+
"succeeded": json["succeeded"],
|
|
954
|
+
"failed": json["failed"]
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// src/generated/models/IssuesBulkPostRequest.ts
|
|
959
|
+
function IssuesBulkPostRequestToJSON(json) {
|
|
960
|
+
return IssuesBulkPostRequestToJSONTyped(json, false);
|
|
961
|
+
}
|
|
962
|
+
function IssuesBulkPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
963
|
+
if (value == null) {
|
|
964
|
+
return value;
|
|
965
|
+
}
|
|
966
|
+
if (instanceOfIssuesBulkPostRequestOneOf(value)) {
|
|
967
|
+
return IssuesBulkPostRequestOneOfToJSON(value);
|
|
968
|
+
}
|
|
969
|
+
if (instanceOfIssuesBulkPostRequestOneOf1(value)) {
|
|
970
|
+
return IssuesBulkPostRequestOneOf1ToJSON(value);
|
|
971
|
+
}
|
|
972
|
+
return {};
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// src/generated/models/IssuesGet200ResponseDataInner.ts
|
|
976
|
+
function IssuesGet200ResponseDataInnerFromJSON(json) {
|
|
977
|
+
return IssuesGet200ResponseDataInnerFromJSONTyped(json, false);
|
|
978
|
+
}
|
|
979
|
+
function IssuesGet200ResponseDataInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
980
|
+
if (json == null) {
|
|
981
|
+
return json;
|
|
982
|
+
}
|
|
983
|
+
return {
|
|
984
|
+
"id": json["id"],
|
|
985
|
+
"team_id": json["team_id"],
|
|
986
|
+
"project_id": json["project_id"],
|
|
987
|
+
"parent_id": json["parent_id"],
|
|
988
|
+
"identifier": json["identifier"],
|
|
989
|
+
"title": json["title"],
|
|
990
|
+
"status": json["status"],
|
|
991
|
+
"priority": json["priority"],
|
|
992
|
+
"assignee_id": json["assignee_id"],
|
|
993
|
+
"created_at": json["created_at"],
|
|
994
|
+
"updated_at": json["updated_at"],
|
|
995
|
+
"team": IssuesGet200ResponseDataInnerTeamFromJSON(json["team"]),
|
|
996
|
+
"assignee": CommentsCommentIdPatch200ResponseAuthorFromJSON(json["assignee"]),
|
|
997
|
+
"project": IssuesGet200ResponseDataInnerProjectFromJSON(json["project"]),
|
|
998
|
+
"labels": json["labels"].map(IssuesGet200ResponseDataInnerLabelsInnerFromJSON)
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
// src/generated/models/IssuesGet200Response.ts
|
|
1003
|
+
function IssuesGet200ResponseFromJSON(json) {
|
|
1004
|
+
return IssuesGet200ResponseFromJSONTyped(json, false);
|
|
1005
|
+
}
|
|
1006
|
+
function IssuesGet200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
1007
|
+
if (json == null) {
|
|
1008
|
+
return json;
|
|
1009
|
+
}
|
|
1010
|
+
return {
|
|
1011
|
+
"data": json["data"].map(IssuesGet200ResponseDataInnerFromJSON),
|
|
1012
|
+
"next_cursor": json["next_cursor"]
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// src/generated/models/IssuesIdAttachmentsPost200Response.ts
|
|
1017
|
+
function IssuesIdAttachmentsPost200ResponseFromJSON(json) {
|
|
1018
|
+
return IssuesIdAttachmentsPost200ResponseFromJSONTyped(json, false);
|
|
1019
|
+
}
|
|
1020
|
+
function IssuesIdAttachmentsPost200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
1021
|
+
if (json == null) {
|
|
1022
|
+
return json;
|
|
1023
|
+
}
|
|
1024
|
+
return {
|
|
1025
|
+
"id": json["id"],
|
|
1026
|
+
"filename": json["filename"],
|
|
1027
|
+
"content_type": json["content_type"],
|
|
1028
|
+
"size_bytes": json["size_bytes"],
|
|
1029
|
+
"storage_path": json["storage_path"],
|
|
1030
|
+
"created_at": json["created_at"],
|
|
1031
|
+
"uploader": CommentsCommentIdPatch200ResponseAuthorFromJSON(json["uploader"]),
|
|
1032
|
+
"upload_url": json["upload_url"],
|
|
1033
|
+
"expires_at": json["expires_at"]
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// src/generated/models/IssuesIdAttachmentsPostRequest.ts
|
|
1038
|
+
function IssuesIdAttachmentsPostRequestToJSON(json) {
|
|
1039
|
+
return IssuesIdAttachmentsPostRequestToJSONTyped(json, false);
|
|
1040
|
+
}
|
|
1041
|
+
function IssuesIdAttachmentsPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1042
|
+
if (value == null) {
|
|
1043
|
+
return value;
|
|
1044
|
+
}
|
|
1045
|
+
return {
|
|
1046
|
+
"filename": value["filename"],
|
|
1047
|
+
"content_type": value["content_type"],
|
|
1048
|
+
"size_bytes": value["size_bytes"]
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
// src/generated/models/IssuesIdLabelsPostRequest.ts
|
|
1053
|
+
function IssuesIdLabelsPostRequestToJSON(json) {
|
|
1054
|
+
return IssuesIdLabelsPostRequestToJSONTyped(json, false);
|
|
1055
|
+
}
|
|
1056
|
+
function IssuesIdLabelsPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1057
|
+
if (value == null) {
|
|
1058
|
+
return value;
|
|
1059
|
+
}
|
|
1060
|
+
return {
|
|
1061
|
+
"label_id": value["label_id"]
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
// src/generated/models/IssuesIdPatchRequest.ts
|
|
1066
|
+
function IssuesIdPatchRequestToJSON(json) {
|
|
1067
|
+
return IssuesIdPatchRequestToJSONTyped(json, false);
|
|
1068
|
+
}
|
|
1069
|
+
function IssuesIdPatchRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1070
|
+
if (value == null) {
|
|
1071
|
+
return value;
|
|
1072
|
+
}
|
|
1073
|
+
return {
|
|
1074
|
+
"title": value["title"],
|
|
1075
|
+
"description": value["description"],
|
|
1076
|
+
"template_id": value["template_id"],
|
|
1077
|
+
"status": value["status"],
|
|
1078
|
+
"priority": value["priority"],
|
|
1079
|
+
"assignee_id": value["assignee_id"],
|
|
1080
|
+
"project_id": value["project_id"],
|
|
1081
|
+
"parent_id": value["parent_id"]
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// src/generated/models/IssuesIdPullRequestsPost200Response.ts
|
|
1086
|
+
function IssuesIdPullRequestsPost200ResponseFromJSON(json) {
|
|
1087
|
+
return IssuesIdPullRequestsPost200ResponseFromJSONTyped(json, false);
|
|
1088
|
+
}
|
|
1089
|
+
function IssuesIdPullRequestsPost200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
1090
|
+
if (json == null) {
|
|
1091
|
+
return json;
|
|
1092
|
+
}
|
|
1093
|
+
return {
|
|
1094
|
+
"id": json["id"]
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
// src/generated/models/IssuesIdPullRequestsPostRequest.ts
|
|
1099
|
+
function IssuesIdPullRequestsPostRequestToJSON(json) {
|
|
1100
|
+
return IssuesIdPullRequestsPostRequestToJSONTyped(json, false);
|
|
1101
|
+
}
|
|
1102
|
+
function IssuesIdPullRequestsPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1103
|
+
if (value == null) {
|
|
1104
|
+
return value;
|
|
1105
|
+
}
|
|
1106
|
+
return {
|
|
1107
|
+
"repo": value["repo"],
|
|
1108
|
+
"number": value["number"]
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
// src/generated/models/IssuesIdRelationsPostRequest.ts
|
|
1113
|
+
function IssuesIdRelationsPostRequestToJSON(json) {
|
|
1114
|
+
return IssuesIdRelationsPostRequestToJSONTyped(json, false);
|
|
1115
|
+
}
|
|
1116
|
+
function IssuesIdRelationsPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1117
|
+
if (value == null) {
|
|
1118
|
+
return value;
|
|
1119
|
+
}
|
|
1120
|
+
return {
|
|
1121
|
+
"related_issue_id": value["related_issue_id"],
|
|
1122
|
+
"related_issue_ref": value["related_issue_ref"],
|
|
1123
|
+
"type": value["type"]
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
// src/generated/models/IssuesIdSubscriptionGet200Response.ts
|
|
1128
|
+
function IssuesIdSubscriptionGet200ResponseFromJSON(json) {
|
|
1129
|
+
return IssuesIdSubscriptionGet200ResponseFromJSONTyped(json, false);
|
|
1130
|
+
}
|
|
1131
|
+
function IssuesIdSubscriptionGet200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
1132
|
+
if (json == null) {
|
|
1133
|
+
return json;
|
|
1134
|
+
}
|
|
1135
|
+
return {
|
|
1136
|
+
"isSubscribed": json["isSubscribed"]
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
// src/generated/models/IssuesIdSubscriptionPostRequest.ts
|
|
1141
|
+
function IssuesIdSubscriptionPostRequestToJSON(json) {
|
|
1142
|
+
return IssuesIdSubscriptionPostRequestToJSONTyped(json, false);
|
|
1143
|
+
}
|
|
1144
|
+
function IssuesIdSubscriptionPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1145
|
+
if (value == null) {
|
|
1146
|
+
return value;
|
|
1147
|
+
}
|
|
1148
|
+
return {
|
|
1149
|
+
"isSubscribed": value["isSubscribed"]
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
// src/generated/models/IssuesPost200Response.ts
|
|
1154
|
+
function IssuesPost200ResponseFromJSON(json) {
|
|
1155
|
+
return IssuesPost200ResponseFromJSONTyped(json, false);
|
|
1156
|
+
}
|
|
1157
|
+
function IssuesPost200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
1158
|
+
if (json == null) {
|
|
1159
|
+
return json;
|
|
1160
|
+
}
|
|
1161
|
+
return {
|
|
1162
|
+
"id": json["id"],
|
|
1163
|
+
"team_id": json["team_id"],
|
|
1164
|
+
"project_id": json["project_id"],
|
|
1165
|
+
"parent_id": json["parent_id"],
|
|
1166
|
+
"identifier": json["identifier"],
|
|
1167
|
+
"title": json["title"],
|
|
1168
|
+
"status": json["status"],
|
|
1169
|
+
"priority": json["priority"],
|
|
1170
|
+
"assignee_id": json["assignee_id"],
|
|
1171
|
+
"created_at": json["created_at"],
|
|
1172
|
+
"updated_at": json["updated_at"],
|
|
1173
|
+
"team": IssuesGet200ResponseDataInnerTeamFromJSON(json["team"]),
|
|
1174
|
+
"assignee": CommentsCommentIdPatch200ResponseAuthorFromJSON(json["assignee"]),
|
|
1175
|
+
"project": IssuesGet200ResponseDataInnerProjectFromJSON(json["project"]),
|
|
1176
|
+
"labels": json["labels"].map(IssuesGet200ResponseDataInnerLabelsInnerFromJSON),
|
|
1177
|
+
"description": json["description"],
|
|
1178
|
+
"parent": IssuesPost200ResponseParentFromJSON(json["parent"]),
|
|
1179
|
+
"subIssues": json["subIssues"].map(IssuesPost200ResponseParentFromJSON),
|
|
1180
|
+
"comments": json["comments"].map(CommentsCommentIdPatch200ResponseFromJSON),
|
|
1181
|
+
"activity": json["activity"].map(IssuesPost200ResponseActivityInnerFromJSON),
|
|
1182
|
+
"relations": json["relations"].map(IssuesPost200ResponseRelationsInnerFromJSON),
|
|
1183
|
+
"pullRequests": json["pullRequests"].map(IssuesPost200ResponsePullRequestsInnerFromJSON),
|
|
1184
|
+
"attachments": json["attachments"].map(IssuesPost200ResponseAttachmentsInnerFromJSON)
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// src/generated/models/IssuesPostRequest.ts
|
|
1189
|
+
function IssuesPostRequestToJSON(json) {
|
|
1190
|
+
return IssuesPostRequestToJSONTyped(json, false);
|
|
1191
|
+
}
|
|
1192
|
+
function IssuesPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1193
|
+
if (value == null) {
|
|
1194
|
+
return value;
|
|
1195
|
+
}
|
|
1196
|
+
return {
|
|
1197
|
+
"team_id": value["team_id"],
|
|
1198
|
+
"title": value["title"],
|
|
1199
|
+
"description": value["description"],
|
|
1200
|
+
"template_id": value["template_id"],
|
|
1201
|
+
"status": value["status"],
|
|
1202
|
+
"priority": value["priority"],
|
|
1203
|
+
"assignee_id": value["assignee_id"],
|
|
1204
|
+
"project_id": value["project_id"],
|
|
1205
|
+
"parent_id": value["parent_id"],
|
|
1206
|
+
"labels": value["labels"]
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
// src/generated/models/LabelsPostRequest.ts
|
|
1211
|
+
function LabelsPostRequestToJSON(json) {
|
|
1212
|
+
return LabelsPostRequestToJSONTyped(json, false);
|
|
1213
|
+
}
|
|
1214
|
+
function LabelsPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1215
|
+
if (value == null) {
|
|
1216
|
+
return value;
|
|
1217
|
+
}
|
|
1218
|
+
return {
|
|
1219
|
+
"team_id": value["team_id"],
|
|
1220
|
+
"name": value["name"],
|
|
1221
|
+
"color": value["color"]
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// src/generated/models/MeGet200Response.ts
|
|
1226
|
+
function MeGet200ResponseFromJSON(json) {
|
|
1227
|
+
return MeGet200ResponseFromJSONTyped(json, false);
|
|
1228
|
+
}
|
|
1229
|
+
function MeGet200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
1230
|
+
if (json == null) {
|
|
1231
|
+
return json;
|
|
1232
|
+
}
|
|
1233
|
+
return {
|
|
1234
|
+
"id": json["id"],
|
|
1235
|
+
"full_name": json["full_name"],
|
|
1236
|
+
"avatar_url": json["avatar_url"],
|
|
1237
|
+
"role": json["role"]
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
// src/generated/models/ProjectsGet200ResponseInner.ts
|
|
1242
|
+
function ProjectsGet200ResponseInnerFromJSON(json) {
|
|
1243
|
+
return ProjectsGet200ResponseInnerFromJSONTyped(json, false);
|
|
1244
|
+
}
|
|
1245
|
+
function ProjectsGet200ResponseInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
1246
|
+
if (json == null) {
|
|
1247
|
+
return json;
|
|
1248
|
+
}
|
|
1249
|
+
return {
|
|
1250
|
+
"id": json["id"],
|
|
1251
|
+
"team_id": json["team_id"],
|
|
1252
|
+
"name": json["name"],
|
|
1253
|
+
"icon": json["icon"],
|
|
1254
|
+
"color": json["color"],
|
|
1255
|
+
"status": json["status"],
|
|
1256
|
+
"priority": json["priority"],
|
|
1257
|
+
"lead_id": json["lead_id"],
|
|
1258
|
+
"lead": json["lead"] == null ? void 0 : CommentsCommentIdPatch200ResponseAuthorFromJSON(json["lead"]),
|
|
1259
|
+
"target_date": json["target_date"],
|
|
1260
|
+
"description": json["description"],
|
|
1261
|
+
"agent_context": json["agent_context"],
|
|
1262
|
+
"ai_report_enabled": json["ai_report_enabled"] == null ? void 0 : json["ai_report_enabled"],
|
|
1263
|
+
"created_at": json["created_at"] == null ? void 0 : json["created_at"],
|
|
1264
|
+
"updated_at": json["updated_at"] == null ? void 0 : json["updated_at"]
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// src/generated/models/ProjectsIdPatchRequest.ts
|
|
1269
|
+
function ProjectsIdPatchRequestToJSON(json) {
|
|
1270
|
+
return ProjectsIdPatchRequestToJSONTyped(json, false);
|
|
1271
|
+
}
|
|
1272
|
+
function ProjectsIdPatchRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1273
|
+
if (value == null) {
|
|
1274
|
+
return value;
|
|
1275
|
+
}
|
|
1276
|
+
return {
|
|
1277
|
+
"name": value["name"],
|
|
1278
|
+
"icon": value["icon"],
|
|
1279
|
+
"color": value["color"],
|
|
1280
|
+
"status": value["status"],
|
|
1281
|
+
"priority": value["priority"],
|
|
1282
|
+
"lead_id": value["lead_id"],
|
|
1283
|
+
"target_date": value["target_date"],
|
|
1284
|
+
"description": value["description"],
|
|
1285
|
+
"agent_context": value["agent_context"]
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
// src/generated/models/ProjectsPostRequest.ts
|
|
1290
|
+
function ProjectsPostRequestToJSON(json) {
|
|
1291
|
+
return ProjectsPostRequestToJSONTyped(json, false);
|
|
1292
|
+
}
|
|
1293
|
+
function ProjectsPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1294
|
+
if (value == null) {
|
|
1295
|
+
return value;
|
|
1296
|
+
}
|
|
1297
|
+
return {
|
|
1298
|
+
"team_id": value["team_id"],
|
|
1299
|
+
"name": value["name"],
|
|
1300
|
+
"icon": value["icon"],
|
|
1301
|
+
"color": value["color"],
|
|
1302
|
+
"status": value["status"],
|
|
1303
|
+
"priority": value["priority"],
|
|
1304
|
+
"lead_id": value["lead_id"],
|
|
1305
|
+
"target_date": value["target_date"],
|
|
1306
|
+
"description": value["description"],
|
|
1307
|
+
"agent_context": value["agent_context"]
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// src/generated/models/TeamsGet200ResponseInner.ts
|
|
1312
|
+
function TeamsGet200ResponseInnerFromJSON(json) {
|
|
1313
|
+
return TeamsGet200ResponseInnerFromJSONTyped(json, false);
|
|
1314
|
+
}
|
|
1315
|
+
function TeamsGet200ResponseInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
1316
|
+
if (json == null) {
|
|
1317
|
+
return json;
|
|
1318
|
+
}
|
|
1319
|
+
return {
|
|
1320
|
+
"id": json["id"],
|
|
1321
|
+
"name": json["name"],
|
|
1322
|
+
"key": json["key"],
|
|
1323
|
+
"icon": json["icon"],
|
|
1324
|
+
"color": json["color"]
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
// src/generated/models/TeamsIdIngestKeysGet200ResponseInner.ts
|
|
1329
|
+
function TeamsIdIngestKeysGet200ResponseInnerFromJSON(json) {
|
|
1330
|
+
return TeamsIdIngestKeysGet200ResponseInnerFromJSONTyped(json, false);
|
|
1331
|
+
}
|
|
1332
|
+
function TeamsIdIngestKeysGet200ResponseInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
1333
|
+
if (json == null) {
|
|
1334
|
+
return json;
|
|
1335
|
+
}
|
|
1336
|
+
return {
|
|
1337
|
+
"id": json["id"],
|
|
1338
|
+
"team_id": json["team_id"],
|
|
1339
|
+
"label": json["label"],
|
|
1340
|
+
"key_hint": json["key_hint"],
|
|
1341
|
+
"dsn": json["dsn"],
|
|
1342
|
+
"status": json["status"],
|
|
1343
|
+
"allowed_origins": json["allowed_origins"] == null ? null : json["allowed_origins"],
|
|
1344
|
+
"rate_limit_events": json["rate_limit_events"],
|
|
1345
|
+
"rate_window_seconds": json["rate_window_seconds"],
|
|
1346
|
+
"last_used_at": json["last_used_at"] == null ? null : new Date(json["last_used_at"]),
|
|
1347
|
+
"created_at": new Date(json["created_at"]),
|
|
1348
|
+
"rotated_at": json["rotated_at"] == null ? null : new Date(json["rotated_at"]),
|
|
1349
|
+
"grace_until": json["grace_until"] == null ? null : new Date(json["grace_until"])
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
// src/generated/models/TeamsIdIngestKeysPostRequest.ts
|
|
1354
|
+
function TeamsIdIngestKeysPostRequestToJSON(json) {
|
|
1355
|
+
return TeamsIdIngestKeysPostRequestToJSONTyped(json, false);
|
|
1356
|
+
}
|
|
1357
|
+
function TeamsIdIngestKeysPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1358
|
+
if (value == null) {
|
|
1359
|
+
return value;
|
|
1360
|
+
}
|
|
1361
|
+
return {
|
|
1362
|
+
"label": value["label"]
|
|
1363
|
+
};
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
// src/generated/models/TemplatesGet200ResponseInner.ts
|
|
1367
|
+
function TemplatesGet200ResponseInnerFromJSON(json) {
|
|
1368
|
+
return TemplatesGet200ResponseInnerFromJSONTyped(json, false);
|
|
1369
|
+
}
|
|
1370
|
+
function TemplatesGet200ResponseInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
1371
|
+
if (json == null) {
|
|
1372
|
+
return json;
|
|
1373
|
+
}
|
|
1374
|
+
return {
|
|
1375
|
+
"id": json["id"],
|
|
1376
|
+
"team_id": json["team_id"],
|
|
1377
|
+
"name": json["name"],
|
|
1378
|
+
"title": json["title"],
|
|
1379
|
+
"description": json["description"],
|
|
1380
|
+
"priority": json["priority"],
|
|
1381
|
+
"preset_label_ids": json["preset_label_ids"],
|
|
1382
|
+
"is_default": json["is_default"],
|
|
1383
|
+
"created_by": json["created_by"] == null ? void 0 : json["created_by"],
|
|
1384
|
+
"created_at": json["created_at"] == null ? void 0 : json["created_at"],
|
|
1385
|
+
"updated_at": json["updated_at"] == null ? void 0 : json["updated_at"]
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
// src/generated/models/TemplatesIdPatchRequest.ts
|
|
1390
|
+
function TemplatesIdPatchRequestToJSON(json) {
|
|
1391
|
+
return TemplatesIdPatchRequestToJSONTyped(json, false);
|
|
1392
|
+
}
|
|
1393
|
+
function TemplatesIdPatchRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1394
|
+
if (value == null) {
|
|
1395
|
+
return value;
|
|
1396
|
+
}
|
|
1397
|
+
return {
|
|
1398
|
+
"name": value["name"],
|
|
1399
|
+
"title": value["title"],
|
|
1400
|
+
"description": value["description"],
|
|
1401
|
+
"priority": value["priority"],
|
|
1402
|
+
"preset_label_ids": value["preset_label_ids"],
|
|
1403
|
+
"is_default": value["is_default"]
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
// src/generated/models/TemplatesPostRequest.ts
|
|
1408
|
+
function TemplatesPostRequestToJSON(json) {
|
|
1409
|
+
return TemplatesPostRequestToJSONTyped(json, false);
|
|
1410
|
+
}
|
|
1411
|
+
function TemplatesPostRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1412
|
+
if (value == null) {
|
|
1413
|
+
return value;
|
|
1414
|
+
}
|
|
1415
|
+
return {
|
|
1416
|
+
"team_id": value["team_id"],
|
|
1417
|
+
"name": value["name"],
|
|
1418
|
+
"title": value["title"],
|
|
1419
|
+
"description": value["description"],
|
|
1420
|
+
"priority": value["priority"],
|
|
1421
|
+
"preset_label_ids": value["preset_label_ids"],
|
|
1422
|
+
"is_default": value["is_default"]
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
// src/generated/apis/DefaultApi.ts
|
|
1427
|
+
var DefaultApi = class extends BaseAPI {
|
|
1428
|
+
/**
|
|
1429
|
+
* Distinct ingested event ids with counts and last-seen timestamps, ordered by volume (default limit 100, max 500). ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/analytics/events?team_id=$TEAM_ID ``` ```bash onus analytics events --team $TEAM_ID ```
|
|
1430
|
+
* List ingested event names with counts
|
|
1431
|
+
*/
|
|
1432
|
+
async analyticsEventsGetRaw(requestParameters, initOverrides) {
|
|
1433
|
+
if (requestParameters["teamId"] == null) {
|
|
1434
|
+
throw new RequiredError(
|
|
1435
|
+
"teamId",
|
|
1436
|
+
'Required parameter "teamId" was null or undefined when calling analyticsEventsGet().'
|
|
1437
|
+
);
|
|
1438
|
+
}
|
|
1439
|
+
const queryParameters = {};
|
|
1440
|
+
if (requestParameters["teamId"] != null) {
|
|
1441
|
+
queryParameters["team_id"] = requestParameters["teamId"];
|
|
1442
|
+
}
|
|
1443
|
+
if (requestParameters["limit"] != null) {
|
|
1444
|
+
queryParameters["limit"] = requestParameters["limit"];
|
|
1445
|
+
}
|
|
1446
|
+
const headerParameters = {};
|
|
1447
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1448
|
+
const token = this.configuration.accessToken;
|
|
1449
|
+
const tokenString = await token("bearerAuth", []);
|
|
1450
|
+
if (tokenString) {
|
|
1451
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
const response = await this.request({
|
|
1455
|
+
path: `/analytics/events`,
|
|
1456
|
+
method: "GET",
|
|
1457
|
+
headers: headerParameters,
|
|
1458
|
+
query: queryParameters
|
|
1459
|
+
}, initOverrides);
|
|
1460
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(AnalyticsEventsGet200ResponseInnerFromJSON));
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Distinct ingested event ids with counts and last-seen timestamps, ordered by volume (default limit 100, max 500). ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/analytics/events?team_id=$TEAM_ID ``` ```bash onus analytics events --team $TEAM_ID ```
|
|
1464
|
+
* List ingested event names with counts
|
|
1465
|
+
*/
|
|
1466
|
+
async analyticsEventsGet(requestParameters, initOverrides) {
|
|
1467
|
+
const response = await this.analyticsEventsGetRaw(requestParameters, initOverrides);
|
|
1468
|
+
return await response.value();
|
|
1469
|
+
}
|
|
1470
|
+
/**
|
|
1471
|
+
* Analytics overview for a team: visitors, pageviews, sessions, bounce rate and median session duration, with the equal-length previous period for delta computation. Defaults to the trailing 30 days; windows are capped at 365 days (retention). Rate limits mirror the workspace API defaults. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/analytics/overview?team_id=$TEAM_ID ``` ```bash onus analytics overview --team $TEAM_ID ```
|
|
1472
|
+
* Get the analytics overview for a team
|
|
1473
|
+
*/
|
|
1474
|
+
async analyticsOverviewGetRaw(requestParameters, initOverrides) {
|
|
1475
|
+
if (requestParameters["teamId"] == null) {
|
|
1476
|
+
throw new RequiredError(
|
|
1477
|
+
"teamId",
|
|
1478
|
+
'Required parameter "teamId" was null or undefined when calling analyticsOverviewGet().'
|
|
1479
|
+
);
|
|
1480
|
+
}
|
|
1481
|
+
const queryParameters = {};
|
|
1482
|
+
if (requestParameters["teamId"] != null) {
|
|
1483
|
+
queryParameters["team_id"] = requestParameters["teamId"];
|
|
1484
|
+
}
|
|
1485
|
+
if (requestParameters["from"] != null) {
|
|
1486
|
+
queryParameters["from"] = requestParameters["from"].toISOString();
|
|
1487
|
+
}
|
|
1488
|
+
if (requestParameters["to"] != null) {
|
|
1489
|
+
queryParameters["to"] = requestParameters["to"].toISOString();
|
|
1490
|
+
}
|
|
1491
|
+
const headerParameters = {};
|
|
1492
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1493
|
+
const token = this.configuration.accessToken;
|
|
1494
|
+
const tokenString = await token("bearerAuth", []);
|
|
1495
|
+
if (tokenString) {
|
|
1496
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
const response = await this.request({
|
|
1500
|
+
path: `/analytics/overview`,
|
|
1501
|
+
method: "GET",
|
|
1502
|
+
headers: headerParameters,
|
|
1503
|
+
query: queryParameters
|
|
1504
|
+
}, initOverrides);
|
|
1505
|
+
return new JSONApiResponse(response, (jsonValue) => AnalyticsOverviewGet200ResponseFromJSON(jsonValue));
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* Analytics overview for a team: visitors, pageviews, sessions, bounce rate and median session duration, with the equal-length previous period for delta computation. Defaults to the trailing 30 days; windows are capped at 365 days (retention). Rate limits mirror the workspace API defaults. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/analytics/overview?team_id=$TEAM_ID ``` ```bash onus analytics overview --team $TEAM_ID ```
|
|
1509
|
+
* Get the analytics overview for a team
|
|
1510
|
+
*/
|
|
1511
|
+
async analyticsOverviewGet(requestParameters, initOverrides) {
|
|
1512
|
+
const response = await this.analyticsOverviewGetRaw(requestParameters, initOverrides);
|
|
1513
|
+
return await response.value();
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* Execute a read-only trends or funnel analytics query. Enforces the same limits as the UI (≤5 series / ≤10 steps) and rejects path queries and series math other than total/dau (400) — object property math is not yet exposed over the public API. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"team_id\":\"...\",\"query\":{\"type\":\"trends\",\"series\":[{\"event\":\"signup\"}]}}\' \\ https://onus.example/v1/analytics/query ``` ```bash onus analytics query --team $TEAM_ID --query \'{\"type\":\"trends\",\"series\":[{\"event\":\"signup\"}]}\' ```
|
|
1517
|
+
* Execute a trends or funnel analytics query
|
|
1518
|
+
*/
|
|
1519
|
+
async analyticsQueryPostRaw(requestParameters, initOverrides) {
|
|
1520
|
+
const queryParameters = {};
|
|
1521
|
+
const headerParameters = {};
|
|
1522
|
+
headerParameters["Content-Type"] = "application/json";
|
|
1523
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1524
|
+
const token = this.configuration.accessToken;
|
|
1525
|
+
const tokenString = await token("bearerAuth", []);
|
|
1526
|
+
if (tokenString) {
|
|
1527
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
const response = await this.request({
|
|
1531
|
+
path: `/analytics/query`,
|
|
1532
|
+
method: "POST",
|
|
1533
|
+
headers: headerParameters,
|
|
1534
|
+
query: queryParameters,
|
|
1535
|
+
body: AnalyticsQueryPostRequestToJSON(requestParameters["analyticsQueryPostRequest"])
|
|
1536
|
+
}, initOverrides);
|
|
1537
|
+
return new JSONApiResponse(response, (jsonValue) => AnalyticsQueryPost200ResponseFromJSON(jsonValue));
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* Execute a read-only trends or funnel analytics query. Enforces the same limits as the UI (≤5 series / ≤10 steps) and rejects path queries and series math other than total/dau (400) — object property math is not yet exposed over the public API. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"team_id\":\"...\",\"query\":{\"type\":\"trends\",\"series\":[{\"event\":\"signup\"}]}}\' \\ https://onus.example/v1/analytics/query ``` ```bash onus analytics query --team $TEAM_ID --query \'{\"type\":\"trends\",\"series\":[{\"event\":\"signup\"}]}\' ```
|
|
1541
|
+
* Execute a trends or funnel analytics query
|
|
1542
|
+
*/
|
|
1543
|
+
async analyticsQueryPost(requestParameters = {}, initOverrides) {
|
|
1544
|
+
const response = await this.analyticsQueryPostRaw(requestParameters, initOverrides);
|
|
1545
|
+
return await response.value();
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Delete an attachment. ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/attachments/$ATTACHMENT_ID ```
|
|
1549
|
+
* Delete attachment
|
|
1550
|
+
*/
|
|
1551
|
+
async attachmentsIdDeleteRaw(requestParameters, initOverrides) {
|
|
1552
|
+
if (requestParameters["id"] == null) {
|
|
1553
|
+
throw new RequiredError(
|
|
1554
|
+
"id",
|
|
1555
|
+
'Required parameter "id" was null or undefined when calling attachmentsIdDelete().'
|
|
1556
|
+
);
|
|
1557
|
+
}
|
|
1558
|
+
const queryParameters = {};
|
|
1559
|
+
const headerParameters = {};
|
|
1560
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1561
|
+
const token = this.configuration.accessToken;
|
|
1562
|
+
const tokenString = await token("bearerAuth", []);
|
|
1563
|
+
if (tokenString) {
|
|
1564
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
const response = await this.request({
|
|
1568
|
+
path: `/attachments/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
1569
|
+
method: "DELETE",
|
|
1570
|
+
headers: headerParameters,
|
|
1571
|
+
query: queryParameters
|
|
1572
|
+
}, initOverrides);
|
|
1573
|
+
return new VoidApiResponse(response);
|
|
1574
|
+
}
|
|
1575
|
+
/**
|
|
1576
|
+
* Delete an attachment. ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/attachments/$ATTACHMENT_ID ```
|
|
1577
|
+
* Delete attachment
|
|
1578
|
+
*/
|
|
1579
|
+
async attachmentsIdDelete(requestParameters, initOverrides) {
|
|
1580
|
+
await this.attachmentsIdDeleteRaw(requestParameters, initOverrides);
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Get a short-lived signed download URL for an attachment. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/attachments/$ATTACHMENT_ID/download-url ```
|
|
1584
|
+
* Get attachment download URL
|
|
1585
|
+
*/
|
|
1586
|
+
async attachmentsIdDownloadUrlGetRaw(requestParameters, initOverrides) {
|
|
1587
|
+
if (requestParameters["id"] == null) {
|
|
1588
|
+
throw new RequiredError(
|
|
1589
|
+
"id",
|
|
1590
|
+
'Required parameter "id" was null or undefined when calling attachmentsIdDownloadUrlGet().'
|
|
1591
|
+
);
|
|
1592
|
+
}
|
|
1593
|
+
const queryParameters = {};
|
|
1594
|
+
const headerParameters = {};
|
|
1595
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1596
|
+
const token = this.configuration.accessToken;
|
|
1597
|
+
const tokenString = await token("bearerAuth", []);
|
|
1598
|
+
if (tokenString) {
|
|
1599
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
const response = await this.request({
|
|
1603
|
+
path: `/attachments/{id}/download-url`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
1604
|
+
method: "GET",
|
|
1605
|
+
headers: headerParameters,
|
|
1606
|
+
query: queryParameters
|
|
1607
|
+
}, initOverrides);
|
|
1608
|
+
return new JSONApiResponse(response, (jsonValue) => AttachmentsIdDownloadUrlGet200ResponseFromJSON(jsonValue));
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* Get a short-lived signed download URL for an attachment. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/attachments/$ATTACHMENT_ID/download-url ```
|
|
1612
|
+
* Get attachment download URL
|
|
1613
|
+
*/
|
|
1614
|
+
async attachmentsIdDownloadUrlGet(requestParameters, initOverrides) {
|
|
1615
|
+
const response = await this.attachmentsIdDownloadUrlGetRaw(requestParameters, initOverrides);
|
|
1616
|
+
return await response.value();
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1619
|
+
* See summary. Authenticate with a bearer token.
|
|
1620
|
+
* Delete comment
|
|
1621
|
+
*/
|
|
1622
|
+
async commentsCommentIdDeleteRaw(requestParameters, initOverrides) {
|
|
1623
|
+
if (requestParameters["commentId"] == null) {
|
|
1624
|
+
throw new RequiredError(
|
|
1625
|
+
"commentId",
|
|
1626
|
+
'Required parameter "commentId" was null or undefined when calling commentsCommentIdDelete().'
|
|
1627
|
+
);
|
|
1628
|
+
}
|
|
1629
|
+
const queryParameters = {};
|
|
1630
|
+
const headerParameters = {};
|
|
1631
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1632
|
+
const token = this.configuration.accessToken;
|
|
1633
|
+
const tokenString = await token("bearerAuth", []);
|
|
1634
|
+
if (tokenString) {
|
|
1635
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
const response = await this.request({
|
|
1639
|
+
path: `/comments/{commentId}`.replace(`{${"commentId"}}`, encodeURIComponent(String(requestParameters["commentId"]))),
|
|
1640
|
+
method: "DELETE",
|
|
1641
|
+
headers: headerParameters,
|
|
1642
|
+
query: queryParameters
|
|
1643
|
+
}, initOverrides);
|
|
1644
|
+
return new VoidApiResponse(response);
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* See summary. Authenticate with a bearer token.
|
|
1648
|
+
* Delete comment
|
|
1649
|
+
*/
|
|
1650
|
+
async commentsCommentIdDelete(requestParameters, initOverrides) {
|
|
1651
|
+
await this.commentsCommentIdDeleteRaw(requestParameters, initOverrides);
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* See summary. Authenticate with a bearer token.
|
|
1655
|
+
* Update comment
|
|
1656
|
+
*/
|
|
1657
|
+
async commentsCommentIdPatchRaw(requestParameters, initOverrides) {
|
|
1658
|
+
if (requestParameters["commentId"] == null) {
|
|
1659
|
+
throw new RequiredError(
|
|
1660
|
+
"commentId",
|
|
1661
|
+
'Required parameter "commentId" was null or undefined when calling commentsCommentIdPatch().'
|
|
1662
|
+
);
|
|
1663
|
+
}
|
|
1664
|
+
const queryParameters = {};
|
|
1665
|
+
const headerParameters = {};
|
|
1666
|
+
headerParameters["Content-Type"] = "application/json";
|
|
1667
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1668
|
+
const token = this.configuration.accessToken;
|
|
1669
|
+
const tokenString = await token("bearerAuth", []);
|
|
1670
|
+
if (tokenString) {
|
|
1671
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
const response = await this.request({
|
|
1675
|
+
path: `/comments/{commentId}`.replace(`{${"commentId"}}`, encodeURIComponent(String(requestParameters["commentId"]))),
|
|
1676
|
+
method: "PATCH",
|
|
1677
|
+
headers: headerParameters,
|
|
1678
|
+
query: queryParameters,
|
|
1679
|
+
body: CommentsCommentIdPatchRequestToJSON(requestParameters["commentsCommentIdPatchRequest"])
|
|
1680
|
+
}, initOverrides);
|
|
1681
|
+
return new JSONApiResponse(response, (jsonValue) => CommentsCommentIdPatch200ResponseFromJSON(jsonValue));
|
|
1682
|
+
}
|
|
1683
|
+
/**
|
|
1684
|
+
* See summary. Authenticate with a bearer token.
|
|
1685
|
+
* Update comment
|
|
1686
|
+
*/
|
|
1687
|
+
async commentsCommentIdPatch(requestParameters, initOverrides) {
|
|
1688
|
+
const response = await this.commentsCommentIdPatchRaw(requestParameters, initOverrides);
|
|
1689
|
+
return await response.value();
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Server-Sent Events stream of issue/comment/error-group events with cursor-based replay. Resume after disconnect by sending the last seen id: value as the Last-Event-ID header (or ?cursor=). The server closes gracefully at ~50s with a stream.close event carrying last_seq — reconnect immediately with that cursor to continue without loss. Replay is capped at 5000 events per connection (a reason:\"overflow\" close means more remain). ```bash curl -N -H \"Authorization: Bearer $ONUS_TOKEN\" \'https://onus.example/v1/events/stream?team_id=$TEAM_ID&type=issue.status_changed,error_group.regressed\' ``` ```bash onus watch --team HOT --type issue.status_changed ```
|
|
1693
|
+
* Stream events
|
|
1694
|
+
*/
|
|
1695
|
+
async eventsStreamGetRaw(requestParameters, initOverrides) {
|
|
1696
|
+
const queryParameters = {};
|
|
1697
|
+
if (requestParameters["teamId"] != null) {
|
|
1698
|
+
queryParameters["team_id"] = requestParameters["teamId"];
|
|
1699
|
+
}
|
|
1700
|
+
if (requestParameters["type"] != null) {
|
|
1701
|
+
queryParameters["type"] = requestParameters["type"];
|
|
1702
|
+
}
|
|
1703
|
+
if (requestParameters["cursor"] != null) {
|
|
1704
|
+
queryParameters["cursor"] = requestParameters["cursor"];
|
|
1705
|
+
}
|
|
1706
|
+
const headerParameters = {};
|
|
1707
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1708
|
+
const token = this.configuration.accessToken;
|
|
1709
|
+
const tokenString = await token("bearerAuth", []);
|
|
1710
|
+
if (tokenString) {
|
|
1711
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
const response = await this.request({
|
|
1715
|
+
path: `/events/stream`,
|
|
1716
|
+
method: "GET",
|
|
1717
|
+
headers: headerParameters,
|
|
1718
|
+
query: queryParameters
|
|
1719
|
+
}, initOverrides);
|
|
1720
|
+
return new JSONApiResponse(response, (jsonValue) => EventsStreamGet200ResponseFromJSON(jsonValue));
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Server-Sent Events stream of issue/comment/error-group events with cursor-based replay. Resume after disconnect by sending the last seen id: value as the Last-Event-ID header (or ?cursor=). The server closes gracefully at ~50s with a stream.close event carrying last_seq — reconnect immediately with that cursor to continue without loss. Replay is capped at 5000 events per connection (a reason:\"overflow\" close means more remain). ```bash curl -N -H \"Authorization: Bearer $ONUS_TOKEN\" \'https://onus.example/v1/events/stream?team_id=$TEAM_ID&type=issue.status_changed,error_group.regressed\' ``` ```bash onus watch --team HOT --type issue.status_changed ```
|
|
1724
|
+
* Stream events
|
|
1725
|
+
*/
|
|
1726
|
+
async eventsStreamGet(requestParameters = {}, initOverrides) {
|
|
1727
|
+
const response = await this.eventsStreamGetRaw(requestParameters, initOverrides);
|
|
1728
|
+
return await response.value();
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* Revoke an ingest key (terminal — the key stops working immediately). ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/ingest-keys/$KEY_ID ``` ```bash onus dsn revoke $KEY_ID ```
|
|
1732
|
+
* Revoke an ingest key (terminal)
|
|
1733
|
+
*/
|
|
1734
|
+
async ingestKeysIdDeleteRaw(requestParameters, initOverrides) {
|
|
1735
|
+
if (requestParameters["id"] == null) {
|
|
1736
|
+
throw new RequiredError(
|
|
1737
|
+
"id",
|
|
1738
|
+
'Required parameter "id" was null or undefined when calling ingestKeysIdDelete().'
|
|
1739
|
+
);
|
|
1740
|
+
}
|
|
1741
|
+
const queryParameters = {};
|
|
1742
|
+
const headerParameters = {};
|
|
1743
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1744
|
+
const token = this.configuration.accessToken;
|
|
1745
|
+
const tokenString = await token("bearerAuth", []);
|
|
1746
|
+
if (tokenString) {
|
|
1747
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
const response = await this.request({
|
|
1751
|
+
path: `/ingest-keys/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
1752
|
+
method: "DELETE",
|
|
1753
|
+
headers: headerParameters,
|
|
1754
|
+
query: queryParameters
|
|
1755
|
+
}, initOverrides);
|
|
1756
|
+
return new JSONApiResponse(response, (jsonValue) => IngestKeysIdDelete200ResponseFromJSON(jsonValue));
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Revoke an ingest key (terminal — the key stops working immediately). ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/ingest-keys/$KEY_ID ``` ```bash onus dsn revoke $KEY_ID ```
|
|
1760
|
+
* Revoke an ingest key (terminal)
|
|
1761
|
+
*/
|
|
1762
|
+
async ingestKeysIdDelete(requestParameters, initOverrides) {
|
|
1763
|
+
const response = await this.ingestKeysIdDeleteRaw(requestParameters, initOverrides);
|
|
1764
|
+
return await response.value();
|
|
1765
|
+
}
|
|
1766
|
+
/**
|
|
1767
|
+
* Update an ingest key\'s status (active/disabled/revoked; revoke is terminal). ```bash curl -X PATCH -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"status\":\"disabled\"}\' https://onus.example/v1/ingest-keys/$KEY_ID ``` ```bash onus dsn disable $KEY_ID ```
|
|
1768
|
+
* Update ingest key status (active/disabled/revoked)
|
|
1769
|
+
*/
|
|
1770
|
+
async ingestKeysIdPatchRaw(requestParameters, initOverrides) {
|
|
1771
|
+
if (requestParameters["id"] == null) {
|
|
1772
|
+
throw new RequiredError(
|
|
1773
|
+
"id",
|
|
1774
|
+
'Required parameter "id" was null or undefined when calling ingestKeysIdPatch().'
|
|
1775
|
+
);
|
|
1776
|
+
}
|
|
1777
|
+
const queryParameters = {};
|
|
1778
|
+
const headerParameters = {};
|
|
1779
|
+
headerParameters["Content-Type"] = "application/json";
|
|
1780
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1781
|
+
const token = this.configuration.accessToken;
|
|
1782
|
+
const tokenString = await token("bearerAuth", []);
|
|
1783
|
+
if (tokenString) {
|
|
1784
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
const response = await this.request({
|
|
1788
|
+
path: `/ingest-keys/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
1789
|
+
method: "PATCH",
|
|
1790
|
+
headers: headerParameters,
|
|
1791
|
+
query: queryParameters,
|
|
1792
|
+
body: IngestKeysIdPatchRequestToJSON(requestParameters["ingestKeysIdPatchRequest"])
|
|
1793
|
+
}, initOverrides);
|
|
1794
|
+
return new JSONApiResponse(response, (jsonValue) => IngestKeysIdDelete200ResponseFromJSON(jsonValue));
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* Update an ingest key\'s status (active/disabled/revoked; revoke is terminal). ```bash curl -X PATCH -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"status\":\"disabled\"}\' https://onus.example/v1/ingest-keys/$KEY_ID ``` ```bash onus dsn disable $KEY_ID ```
|
|
1798
|
+
* Update ingest key status (active/disabled/revoked)
|
|
1799
|
+
*/
|
|
1800
|
+
async ingestKeysIdPatch(requestParameters, initOverrides) {
|
|
1801
|
+
const response = await this.ingestKeysIdPatchRaw(requestParameters, initOverrides);
|
|
1802
|
+
return await response.value();
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Rotate an ingest key: mints a new secret and keeps the old one accepted until the grace window closes (zero-downtime cutover). The new secret is returned exactly once. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"grace_seconds\":604800}\' https://onus.example/v1/ingest-keys/$KEY_ID/rotate ``` ```bash onus dsn rotate $KEY_ID ```
|
|
1806
|
+
* Rotate an ingest key with a zero-downtime grace window
|
|
1807
|
+
*/
|
|
1808
|
+
async ingestKeysIdRotatePostRaw(requestParameters, initOverrides) {
|
|
1809
|
+
if (requestParameters["id"] == null) {
|
|
1810
|
+
throw new RequiredError(
|
|
1811
|
+
"id",
|
|
1812
|
+
'Required parameter "id" was null or undefined when calling ingestKeysIdRotatePost().'
|
|
1813
|
+
);
|
|
1814
|
+
}
|
|
1815
|
+
const queryParameters = {};
|
|
1816
|
+
const headerParameters = {};
|
|
1817
|
+
headerParameters["Content-Type"] = "application/json";
|
|
1818
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1819
|
+
const token = this.configuration.accessToken;
|
|
1820
|
+
const tokenString = await token("bearerAuth", []);
|
|
1821
|
+
if (tokenString) {
|
|
1822
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
const response = await this.request({
|
|
1826
|
+
path: `/ingest-keys/{id}/rotate`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
1827
|
+
method: "POST",
|
|
1828
|
+
headers: headerParameters,
|
|
1829
|
+
query: queryParameters,
|
|
1830
|
+
body: IngestKeysIdRotatePostRequestToJSON(requestParameters["ingestKeysIdRotatePostRequest"])
|
|
1831
|
+
}, initOverrides);
|
|
1832
|
+
return new JSONApiResponse(response, (jsonValue) => IngestKeysIdRotatePost200ResponseFromJSON(jsonValue));
|
|
1833
|
+
}
|
|
1834
|
+
/**
|
|
1835
|
+
* Rotate an ingest key: mints a new secret and keeps the old one accepted until the grace window closes (zero-downtime cutover). The new secret is returned exactly once. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"grace_seconds\":604800}\' https://onus.example/v1/ingest-keys/$KEY_ID/rotate ``` ```bash onus dsn rotate $KEY_ID ```
|
|
1836
|
+
* Rotate an ingest key with a zero-downtime grace window
|
|
1837
|
+
*/
|
|
1838
|
+
async ingestKeysIdRotatePost(requestParameters, initOverrides) {
|
|
1839
|
+
const response = await this.ingestKeysIdRotatePostRaw(requestParameters, initOverrides);
|
|
1840
|
+
return await response.value();
|
|
1841
|
+
}
|
|
1842
|
+
/**
|
|
1843
|
+
* Batched issue update or comment (max 100 items) with per-item partial success: always answers 200 with results/succeeded/failed; each item resolves UUID or KEY-NUM refs independently. Comment retries dedupe per-item via client_token; whole-request retries via the Idempotency-Key header return the stored response for 24h. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' -H \"Idempotency-Key: run-17\" \\ -d \'{\"operation\":\"update\",\"items\":[{\"ref\":\"ENG-42\",\"set\":{\"status\":\"done\"}}]}\' https://onus.example/v1/issues/bulk ``` ```bash onus issue bulk-update ENG-42 ENG-43 --status done onus issue bulk-comment ENG-42 --body \"Deployed\" --idempotency-key run-17 ```
|
|
1844
|
+
* Bulk update/comment issues
|
|
1845
|
+
*/
|
|
1846
|
+
async issuesBulkPostRaw(requestParameters, initOverrides) {
|
|
1847
|
+
const queryParameters = {};
|
|
1848
|
+
const headerParameters = {};
|
|
1849
|
+
headerParameters["Content-Type"] = "application/json";
|
|
1850
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1851
|
+
const token = this.configuration.accessToken;
|
|
1852
|
+
const tokenString = await token("bearerAuth", []);
|
|
1853
|
+
if (tokenString) {
|
|
1854
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
const response = await this.request({
|
|
1858
|
+
path: `/issues/bulk`,
|
|
1859
|
+
method: "POST",
|
|
1860
|
+
headers: headerParameters,
|
|
1861
|
+
query: queryParameters,
|
|
1862
|
+
body: IssuesBulkPostRequestToJSON(requestParameters["issuesBulkPostRequest"])
|
|
1863
|
+
}, initOverrides);
|
|
1864
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesBulkPost200ResponseFromJSON(jsonValue));
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Batched issue update or comment (max 100 items) with per-item partial success: always answers 200 with results/succeeded/failed; each item resolves UUID or KEY-NUM refs independently. Comment retries dedupe per-item via client_token; whole-request retries via the Idempotency-Key header return the stored response for 24h. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' -H \"Idempotency-Key: run-17\" \\ -d \'{\"operation\":\"update\",\"items\":[{\"ref\":\"ENG-42\",\"set\":{\"status\":\"done\"}}]}\' https://onus.example/v1/issues/bulk ``` ```bash onus issue bulk-update ENG-42 ENG-43 --status done onus issue bulk-comment ENG-42 --body \"Deployed\" --idempotency-key run-17 ```
|
|
1868
|
+
* Bulk update/comment issues
|
|
1869
|
+
*/
|
|
1870
|
+
async issuesBulkPost(requestParameters = {}, initOverrides) {
|
|
1871
|
+
const response = await this.issuesBulkPostRaw(requestParameters, initOverrides);
|
|
1872
|
+
return await response.value();
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* List issues with filters and cursor pagination (`next_cursor` feeds `?cursor=`). ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" \'https://onus.example/v1/issues?status=todo&limit=50\' ``` ```bash onus issue list --status todo ```
|
|
1876
|
+
* List issues
|
|
1877
|
+
*/
|
|
1878
|
+
async issuesGetRaw(requestParameters, initOverrides) {
|
|
1879
|
+
const queryParameters = {};
|
|
1880
|
+
if (requestParameters["status"] != null) {
|
|
1881
|
+
queryParameters["status"] = requestParameters["status"];
|
|
1882
|
+
}
|
|
1883
|
+
if (requestParameters["teamId"] != null) {
|
|
1884
|
+
queryParameters["team_id"] = requestParameters["teamId"];
|
|
1885
|
+
}
|
|
1886
|
+
if (requestParameters["assigneeId"] != null) {
|
|
1887
|
+
queryParameters["assignee_id"] = requestParameters["assigneeId"];
|
|
1888
|
+
}
|
|
1889
|
+
if (requestParameters["projectId"] != null) {
|
|
1890
|
+
queryParameters["project_id"] = requestParameters["projectId"];
|
|
1891
|
+
}
|
|
1892
|
+
if (requestParameters["parentId"] != null) {
|
|
1893
|
+
queryParameters["parent_id"] = requestParameters["parentId"];
|
|
1894
|
+
}
|
|
1895
|
+
if (requestParameters["q"] != null) {
|
|
1896
|
+
queryParameters["q"] = requestParameters["q"];
|
|
1897
|
+
}
|
|
1898
|
+
if (requestParameters["createdAfter"] != null) {
|
|
1899
|
+
queryParameters["created_after"] = requestParameters["createdAfter"];
|
|
1900
|
+
}
|
|
1901
|
+
if (requestParameters["createdBefore"] != null) {
|
|
1902
|
+
queryParameters["created_before"] = requestParameters["createdBefore"];
|
|
1903
|
+
}
|
|
1904
|
+
if (requestParameters["updatedAfter"] != null) {
|
|
1905
|
+
queryParameters["updated_after"] = requestParameters["updatedAfter"];
|
|
1906
|
+
}
|
|
1907
|
+
if (requestParameters["updatedBefore"] != null) {
|
|
1908
|
+
queryParameters["updated_before"] = requestParameters["updatedBefore"];
|
|
1909
|
+
}
|
|
1910
|
+
if (requestParameters["completedAfter"] != null) {
|
|
1911
|
+
queryParameters["completed_after"] = requestParameters["completedAfter"];
|
|
1912
|
+
}
|
|
1913
|
+
if (requestParameters["completedBefore"] != null) {
|
|
1914
|
+
queryParameters["completed_before"] = requestParameters["completedBefore"];
|
|
1915
|
+
}
|
|
1916
|
+
if (requestParameters["dueAfter"] != null) {
|
|
1917
|
+
queryParameters["due_after"] = requestParameters["dueAfter"];
|
|
1918
|
+
}
|
|
1919
|
+
if (requestParameters["dueBefore"] != null) {
|
|
1920
|
+
queryParameters["due_before"] = requestParameters["dueBefore"];
|
|
1921
|
+
}
|
|
1922
|
+
if (requestParameters["limit"] != null) {
|
|
1923
|
+
queryParameters["limit"] = requestParameters["limit"];
|
|
1924
|
+
}
|
|
1925
|
+
if (requestParameters["cursor"] != null) {
|
|
1926
|
+
queryParameters["cursor"] = requestParameters["cursor"];
|
|
1927
|
+
}
|
|
1928
|
+
const headerParameters = {};
|
|
1929
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1930
|
+
const token = this.configuration.accessToken;
|
|
1931
|
+
const tokenString = await token("bearerAuth", []);
|
|
1932
|
+
if (tokenString) {
|
|
1933
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
const response = await this.request({
|
|
1937
|
+
path: `/issues`,
|
|
1938
|
+
method: "GET",
|
|
1939
|
+
headers: headerParameters,
|
|
1940
|
+
query: queryParameters
|
|
1941
|
+
}, initOverrides);
|
|
1942
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesGet200ResponseFromJSON(jsonValue));
|
|
1943
|
+
}
|
|
1944
|
+
/**
|
|
1945
|
+
* List issues with filters and cursor pagination (`next_cursor` feeds `?cursor=`). ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" \'https://onus.example/v1/issues?status=todo&limit=50\' ``` ```bash onus issue list --status todo ```
|
|
1946
|
+
* List issues
|
|
1947
|
+
*/
|
|
1948
|
+
async issuesGet(requestParameters = {}, initOverrides) {
|
|
1949
|
+
const response = await this.issuesGetRaw(requestParameters, initOverrides);
|
|
1950
|
+
return await response.value();
|
|
1951
|
+
}
|
|
1952
|
+
/**
|
|
1953
|
+
* Register an attachment, then upload bytes to the returned upload_url. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"filename\":\"log.txt\",\"content_type\":\"text/plain\",\"size_bytes\":1024}\' https://onus.example/v1/issues/ENG-42/attachments ```
|
|
1954
|
+
* Create attachment upload
|
|
1955
|
+
*/
|
|
1956
|
+
async issuesIdAttachmentsPostRaw(requestParameters, initOverrides) {
|
|
1957
|
+
if (requestParameters["id"] == null) {
|
|
1958
|
+
throw new RequiredError(
|
|
1959
|
+
"id",
|
|
1960
|
+
'Required parameter "id" was null or undefined when calling issuesIdAttachmentsPost().'
|
|
1961
|
+
);
|
|
1962
|
+
}
|
|
1963
|
+
const queryParameters = {};
|
|
1964
|
+
const headerParameters = {};
|
|
1965
|
+
headerParameters["Content-Type"] = "application/json";
|
|
1966
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1967
|
+
const token = this.configuration.accessToken;
|
|
1968
|
+
const tokenString = await token("bearerAuth", []);
|
|
1969
|
+
if (tokenString) {
|
|
1970
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
const response = await this.request({
|
|
1974
|
+
path: `/issues/{id}/attachments`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
1975
|
+
method: "POST",
|
|
1976
|
+
headers: headerParameters,
|
|
1977
|
+
query: queryParameters,
|
|
1978
|
+
body: IssuesIdAttachmentsPostRequestToJSON(requestParameters["issuesIdAttachmentsPostRequest"])
|
|
1979
|
+
}, initOverrides);
|
|
1980
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesIdAttachmentsPost200ResponseFromJSON(jsonValue));
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* Register an attachment, then upload bytes to the returned upload_url. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"filename\":\"log.txt\",\"content_type\":\"text/plain\",\"size_bytes\":1024}\' https://onus.example/v1/issues/ENG-42/attachments ```
|
|
1984
|
+
* Create attachment upload
|
|
1985
|
+
*/
|
|
1986
|
+
async issuesIdAttachmentsPost(requestParameters, initOverrides) {
|
|
1987
|
+
const response = await this.issuesIdAttachmentsPostRaw(requestParameters, initOverrides);
|
|
1988
|
+
return await response.value();
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* List an issue\'s comments. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/comments ``` ```bash onus comment list ENG-42 ```
|
|
1992
|
+
* List comments
|
|
1993
|
+
*/
|
|
1994
|
+
async issuesIdCommentsGetRaw(requestParameters, initOverrides) {
|
|
1995
|
+
if (requestParameters["id"] == null) {
|
|
1996
|
+
throw new RequiredError(
|
|
1997
|
+
"id",
|
|
1998
|
+
'Required parameter "id" was null or undefined when calling issuesIdCommentsGet().'
|
|
1999
|
+
);
|
|
2000
|
+
}
|
|
2001
|
+
const queryParameters = {};
|
|
2002
|
+
const headerParameters = {};
|
|
2003
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2004
|
+
const token = this.configuration.accessToken;
|
|
2005
|
+
const tokenString = await token("bearerAuth", []);
|
|
2006
|
+
if (tokenString) {
|
|
2007
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
const response = await this.request({
|
|
2011
|
+
path: `/issues/{id}/comments`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2012
|
+
method: "GET",
|
|
2013
|
+
headers: headerParameters,
|
|
2014
|
+
query: queryParameters
|
|
2015
|
+
}, initOverrides);
|
|
2016
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(CommentsCommentIdPatch200ResponseFromJSON));
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* List an issue\'s comments. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/comments ``` ```bash onus comment list ENG-42 ```
|
|
2020
|
+
* List comments
|
|
2021
|
+
*/
|
|
2022
|
+
async issuesIdCommentsGet(requestParameters, initOverrides) {
|
|
2023
|
+
const response = await this.issuesIdCommentsGetRaw(requestParameters, initOverrides);
|
|
2024
|
+
return await response.value();
|
|
2025
|
+
}
|
|
2026
|
+
/**
|
|
2027
|
+
* Comment on an issue. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"body\":\"Deployed to prod\"}\' https://onus.example/v1/issues/ENG-42/comments ``` ```bash onus comment add ENG-42 \"Deployed to prod\" ```
|
|
2028
|
+
* Create comment
|
|
2029
|
+
*/
|
|
2030
|
+
async issuesIdCommentsPostRaw(requestParameters, initOverrides) {
|
|
2031
|
+
if (requestParameters["id"] == null) {
|
|
2032
|
+
throw new RequiredError(
|
|
2033
|
+
"id",
|
|
2034
|
+
'Required parameter "id" was null or undefined when calling issuesIdCommentsPost().'
|
|
2035
|
+
);
|
|
2036
|
+
}
|
|
2037
|
+
const queryParameters = {};
|
|
2038
|
+
const headerParameters = {};
|
|
2039
|
+
headerParameters["Content-Type"] = "application/json";
|
|
2040
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2041
|
+
const token = this.configuration.accessToken;
|
|
2042
|
+
const tokenString = await token("bearerAuth", []);
|
|
2043
|
+
if (tokenString) {
|
|
2044
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
const response = await this.request({
|
|
2048
|
+
path: `/issues/{id}/comments`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2049
|
+
method: "POST",
|
|
2050
|
+
headers: headerParameters,
|
|
2051
|
+
query: queryParameters,
|
|
2052
|
+
body: CommentsCommentIdPatchRequestToJSON(requestParameters["commentsCommentIdPatchRequest"])
|
|
2053
|
+
}, initOverrides);
|
|
2054
|
+
return new JSONApiResponse(response, (jsonValue) => CommentsCommentIdPatch200ResponseFromJSON(jsonValue));
|
|
2055
|
+
}
|
|
2056
|
+
/**
|
|
2057
|
+
* Comment on an issue. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"body\":\"Deployed to prod\"}\' https://onus.example/v1/issues/ENG-42/comments ``` ```bash onus comment add ENG-42 \"Deployed to prod\" ```
|
|
2058
|
+
* Create comment
|
|
2059
|
+
*/
|
|
2060
|
+
async issuesIdCommentsPost(requestParameters, initOverrides) {
|
|
2061
|
+
const response = await this.issuesIdCommentsPostRaw(requestParameters, initOverrides);
|
|
2062
|
+
return await response.value();
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* Delete an issue. ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42 ``` ```bash onus issue delete ENG-42 ```
|
|
2066
|
+
* Delete issue
|
|
2067
|
+
*/
|
|
2068
|
+
async issuesIdDeleteRaw(requestParameters, initOverrides) {
|
|
2069
|
+
if (requestParameters["id"] == null) {
|
|
2070
|
+
throw new RequiredError(
|
|
2071
|
+
"id",
|
|
2072
|
+
'Required parameter "id" was null or undefined when calling issuesIdDelete().'
|
|
2073
|
+
);
|
|
2074
|
+
}
|
|
2075
|
+
const queryParameters = {};
|
|
2076
|
+
const headerParameters = {};
|
|
2077
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2078
|
+
const token = this.configuration.accessToken;
|
|
2079
|
+
const tokenString = await token("bearerAuth", []);
|
|
2080
|
+
if (tokenString) {
|
|
2081
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
const response = await this.request({
|
|
2085
|
+
path: `/issues/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2086
|
+
method: "DELETE",
|
|
2087
|
+
headers: headerParameters,
|
|
2088
|
+
query: queryParameters
|
|
2089
|
+
}, initOverrides);
|
|
2090
|
+
return new VoidApiResponse(response);
|
|
2091
|
+
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Delete an issue. ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42 ``` ```bash onus issue delete ENG-42 ```
|
|
2094
|
+
* Delete issue
|
|
2095
|
+
*/
|
|
2096
|
+
async issuesIdDelete(requestParameters, initOverrides) {
|
|
2097
|
+
await this.issuesIdDeleteRaw(requestParameters, initOverrides);
|
|
2098
|
+
}
|
|
2099
|
+
/**
|
|
2100
|
+
* Full issue detail: description, comments, activity, relations, PR links, attachments. `id` accepts a UUID or KEY-NUM. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42 ``` ```bash onus issue get ENG-42 ```
|
|
2101
|
+
* Get issue details
|
|
2102
|
+
*/
|
|
2103
|
+
async issuesIdGetRaw(requestParameters, initOverrides) {
|
|
2104
|
+
if (requestParameters["id"] == null) {
|
|
2105
|
+
throw new RequiredError(
|
|
2106
|
+
"id",
|
|
2107
|
+
'Required parameter "id" was null or undefined when calling issuesIdGet().'
|
|
2108
|
+
);
|
|
2109
|
+
}
|
|
2110
|
+
const queryParameters = {};
|
|
2111
|
+
const headerParameters = {};
|
|
2112
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2113
|
+
const token = this.configuration.accessToken;
|
|
2114
|
+
const tokenString = await token("bearerAuth", []);
|
|
2115
|
+
if (tokenString) {
|
|
2116
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
const response = await this.request({
|
|
2120
|
+
path: `/issues/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2121
|
+
method: "GET",
|
|
2122
|
+
headers: headerParameters,
|
|
2123
|
+
query: queryParameters
|
|
2124
|
+
}, initOverrides);
|
|
2125
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesPost200ResponseFromJSON(jsonValue));
|
|
2126
|
+
}
|
|
2127
|
+
/**
|
|
2128
|
+
* Full issue detail: description, comments, activity, relations, PR links, attachments. `id` accepts a UUID or KEY-NUM. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42 ``` ```bash onus issue get ENG-42 ```
|
|
2129
|
+
* Get issue details
|
|
2130
|
+
*/
|
|
2131
|
+
async issuesIdGet(requestParameters, initOverrides) {
|
|
2132
|
+
const response = await this.issuesIdGetRaw(requestParameters, initOverrides);
|
|
2133
|
+
return await response.value();
|
|
2134
|
+
}
|
|
2135
|
+
/**
|
|
2136
|
+
* List an issue\'s labels. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/labels ```
|
|
2137
|
+
* List issue labels
|
|
2138
|
+
*/
|
|
2139
|
+
async issuesIdLabelsGetRaw(requestParameters, initOverrides) {
|
|
2140
|
+
if (requestParameters["id"] == null) {
|
|
2141
|
+
throw new RequiredError(
|
|
2142
|
+
"id",
|
|
2143
|
+
'Required parameter "id" was null or undefined when calling issuesIdLabelsGet().'
|
|
2144
|
+
);
|
|
2145
|
+
}
|
|
2146
|
+
const queryParameters = {};
|
|
2147
|
+
const headerParameters = {};
|
|
2148
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2149
|
+
const token = this.configuration.accessToken;
|
|
2150
|
+
const tokenString = await token("bearerAuth", []);
|
|
2151
|
+
if (tokenString) {
|
|
2152
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
const response = await this.request({
|
|
2156
|
+
path: `/issues/{id}/labels`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2157
|
+
method: "GET",
|
|
2158
|
+
headers: headerParameters,
|
|
2159
|
+
query: queryParameters
|
|
2160
|
+
}, initOverrides);
|
|
2161
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(IssuesGet200ResponseDataInnerLabelsInnerFromJSON));
|
|
2162
|
+
}
|
|
2163
|
+
/**
|
|
2164
|
+
* List an issue\'s labels. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/labels ```
|
|
2165
|
+
* List issue labels
|
|
2166
|
+
*/
|
|
2167
|
+
async issuesIdLabelsGet(requestParameters, initOverrides) {
|
|
2168
|
+
const response = await this.issuesIdLabelsGetRaw(requestParameters, initOverrides);
|
|
2169
|
+
return await response.value();
|
|
2170
|
+
}
|
|
2171
|
+
/**
|
|
2172
|
+
* Detach a label from an issue. ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/labels/$LABEL_ID ```
|
|
2173
|
+
* Remove issue label
|
|
2174
|
+
*/
|
|
2175
|
+
async issuesIdLabelsLabelIdDeleteRaw(requestParameters, initOverrides) {
|
|
2176
|
+
if (requestParameters["id"] == null) {
|
|
2177
|
+
throw new RequiredError(
|
|
2178
|
+
"id",
|
|
2179
|
+
'Required parameter "id" was null or undefined when calling issuesIdLabelsLabelIdDelete().'
|
|
2180
|
+
);
|
|
2181
|
+
}
|
|
2182
|
+
if (requestParameters["labelId"] == null) {
|
|
2183
|
+
throw new RequiredError(
|
|
2184
|
+
"labelId",
|
|
2185
|
+
'Required parameter "labelId" was null or undefined when calling issuesIdLabelsLabelIdDelete().'
|
|
2186
|
+
);
|
|
2187
|
+
}
|
|
2188
|
+
const queryParameters = {};
|
|
2189
|
+
const headerParameters = {};
|
|
2190
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2191
|
+
const token = this.configuration.accessToken;
|
|
2192
|
+
const tokenString = await token("bearerAuth", []);
|
|
2193
|
+
if (tokenString) {
|
|
2194
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
const response = await this.request({
|
|
2198
|
+
path: `/issues/{id}/labels/{labelId}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))).replace(`{${"labelId"}}`, encodeURIComponent(String(requestParameters["labelId"]))),
|
|
2199
|
+
method: "DELETE",
|
|
2200
|
+
headers: headerParameters,
|
|
2201
|
+
query: queryParameters
|
|
2202
|
+
}, initOverrides);
|
|
2203
|
+
return new VoidApiResponse(response);
|
|
2204
|
+
}
|
|
2205
|
+
/**
|
|
2206
|
+
* Detach a label from an issue. ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/labels/$LABEL_ID ```
|
|
2207
|
+
* Remove issue label
|
|
2208
|
+
*/
|
|
2209
|
+
async issuesIdLabelsLabelIdDelete(requestParameters, initOverrides) {
|
|
2210
|
+
await this.issuesIdLabelsLabelIdDeleteRaw(requestParameters, initOverrides);
|
|
2211
|
+
}
|
|
2212
|
+
/**
|
|
2213
|
+
* Attach a label to an issue. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"label_id\":\"...\"}\' https://onus.example/v1/issues/ENG-42/labels ```
|
|
2214
|
+
* Attach issue label
|
|
2215
|
+
*/
|
|
2216
|
+
async issuesIdLabelsPostRaw(requestParameters, initOverrides) {
|
|
2217
|
+
if (requestParameters["id"] == null) {
|
|
2218
|
+
throw new RequiredError(
|
|
2219
|
+
"id",
|
|
2220
|
+
'Required parameter "id" was null or undefined when calling issuesIdLabelsPost().'
|
|
2221
|
+
);
|
|
2222
|
+
}
|
|
2223
|
+
const queryParameters = {};
|
|
2224
|
+
const headerParameters = {};
|
|
2225
|
+
headerParameters["Content-Type"] = "application/json";
|
|
2226
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2227
|
+
const token = this.configuration.accessToken;
|
|
2228
|
+
const tokenString = await token("bearerAuth", []);
|
|
2229
|
+
if (tokenString) {
|
|
2230
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
const response = await this.request({
|
|
2234
|
+
path: `/issues/{id}/labels`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2235
|
+
method: "POST",
|
|
2236
|
+
headers: headerParameters,
|
|
2237
|
+
query: queryParameters,
|
|
2238
|
+
body: IssuesIdLabelsPostRequestToJSON(requestParameters["issuesIdLabelsPostRequest"])
|
|
2239
|
+
}, initOverrides);
|
|
2240
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesGet200ResponseDataInnerLabelsInnerFromJSON(jsonValue));
|
|
2241
|
+
}
|
|
2242
|
+
/**
|
|
2243
|
+
* Attach a label to an issue. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"label_id\":\"...\"}\' https://onus.example/v1/issues/ENG-42/labels ```
|
|
2244
|
+
* Attach issue label
|
|
2245
|
+
*/
|
|
2246
|
+
async issuesIdLabelsPost(requestParameters, initOverrides) {
|
|
2247
|
+
const response = await this.issuesIdLabelsPostRaw(requestParameters, initOverrides);
|
|
2248
|
+
return await response.value();
|
|
2249
|
+
}
|
|
2250
|
+
/**
|
|
2251
|
+
* See summary. Authenticate with a bearer token.
|
|
2252
|
+
* Update issue
|
|
2253
|
+
*/
|
|
2254
|
+
async issuesIdPatchRaw(requestParameters, initOverrides) {
|
|
2255
|
+
if (requestParameters["id"] == null) {
|
|
2256
|
+
throw new RequiredError(
|
|
2257
|
+
"id",
|
|
2258
|
+
'Required parameter "id" was null or undefined when calling issuesIdPatch().'
|
|
2259
|
+
);
|
|
2260
|
+
}
|
|
2261
|
+
const queryParameters = {};
|
|
2262
|
+
const headerParameters = {};
|
|
2263
|
+
headerParameters["Content-Type"] = "application/json";
|
|
2264
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2265
|
+
const token = this.configuration.accessToken;
|
|
2266
|
+
const tokenString = await token("bearerAuth", []);
|
|
2267
|
+
if (tokenString) {
|
|
2268
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
const response = await this.request({
|
|
2272
|
+
path: `/issues/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2273
|
+
method: "PATCH",
|
|
2274
|
+
headers: headerParameters,
|
|
2275
|
+
query: queryParameters,
|
|
2276
|
+
body: IssuesIdPatchRequestToJSON(requestParameters["issuesIdPatchRequest"])
|
|
2277
|
+
}, initOverrides);
|
|
2278
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesPost200ResponseFromJSON(jsonValue));
|
|
2279
|
+
}
|
|
2280
|
+
/**
|
|
2281
|
+
* See summary. Authenticate with a bearer token.
|
|
2282
|
+
* Update issue
|
|
2283
|
+
*/
|
|
2284
|
+
async issuesIdPatch(requestParameters, initOverrides) {
|
|
2285
|
+
const response = await this.issuesIdPatchRaw(requestParameters, initOverrides);
|
|
2286
|
+
return await response.value();
|
|
2287
|
+
}
|
|
2288
|
+
/**
|
|
2289
|
+
* Unlink a pull request from an issue. ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/pull-requests/$LINK_ID ```
|
|
2290
|
+
* Unlink issue PR
|
|
2291
|
+
*/
|
|
2292
|
+
async issuesIdPullRequestsLinkIdDeleteRaw(requestParameters, initOverrides) {
|
|
2293
|
+
if (requestParameters["id"] == null) {
|
|
2294
|
+
throw new RequiredError(
|
|
2295
|
+
"id",
|
|
2296
|
+
'Required parameter "id" was null or undefined when calling issuesIdPullRequestsLinkIdDelete().'
|
|
2297
|
+
);
|
|
2298
|
+
}
|
|
2299
|
+
if (requestParameters["linkId"] == null) {
|
|
2300
|
+
throw new RequiredError(
|
|
2301
|
+
"linkId",
|
|
2302
|
+
'Required parameter "linkId" was null or undefined when calling issuesIdPullRequestsLinkIdDelete().'
|
|
2303
|
+
);
|
|
2304
|
+
}
|
|
2305
|
+
const queryParameters = {};
|
|
2306
|
+
const headerParameters = {};
|
|
2307
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2308
|
+
const token = this.configuration.accessToken;
|
|
2309
|
+
const tokenString = await token("bearerAuth", []);
|
|
2310
|
+
if (tokenString) {
|
|
2311
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
const response = await this.request({
|
|
2315
|
+
path: `/issues/{id}/pull-requests/{linkId}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))).replace(`{${"linkId"}}`, encodeURIComponent(String(requestParameters["linkId"]))),
|
|
2316
|
+
method: "DELETE",
|
|
2317
|
+
headers: headerParameters,
|
|
2318
|
+
query: queryParameters
|
|
2319
|
+
}, initOverrides);
|
|
2320
|
+
return new VoidApiResponse(response);
|
|
2321
|
+
}
|
|
2322
|
+
/**
|
|
2323
|
+
* Unlink a pull request from an issue. ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/pull-requests/$LINK_ID ```
|
|
2324
|
+
* Unlink issue PR
|
|
2325
|
+
*/
|
|
2326
|
+
async issuesIdPullRequestsLinkIdDelete(requestParameters, initOverrides) {
|
|
2327
|
+
await this.issuesIdPullRequestsLinkIdDeleteRaw(requestParameters, initOverrides);
|
|
2328
|
+
}
|
|
2329
|
+
/**
|
|
2330
|
+
* Link a GitHub pull request to an issue. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"repo\":\"org/repo\",\"number\":123}\' https://onus.example/v1/issues/ENG-42/pull-requests ```
|
|
2331
|
+
* Link issue PR
|
|
2332
|
+
*/
|
|
2333
|
+
async issuesIdPullRequestsPostRaw(requestParameters, initOverrides) {
|
|
2334
|
+
if (requestParameters["id"] == null) {
|
|
2335
|
+
throw new RequiredError(
|
|
2336
|
+
"id",
|
|
2337
|
+
'Required parameter "id" was null or undefined when calling issuesIdPullRequestsPost().'
|
|
2338
|
+
);
|
|
2339
|
+
}
|
|
2340
|
+
const queryParameters = {};
|
|
2341
|
+
const headerParameters = {};
|
|
2342
|
+
headerParameters["Content-Type"] = "application/json";
|
|
2343
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2344
|
+
const token = this.configuration.accessToken;
|
|
2345
|
+
const tokenString = await token("bearerAuth", []);
|
|
2346
|
+
if (tokenString) {
|
|
2347
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
const response = await this.request({
|
|
2351
|
+
path: `/issues/{id}/pull-requests`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2352
|
+
method: "POST",
|
|
2353
|
+
headers: headerParameters,
|
|
2354
|
+
query: queryParameters,
|
|
2355
|
+
body: IssuesIdPullRequestsPostRequestToJSON(requestParameters["issuesIdPullRequestsPostRequest"])
|
|
2356
|
+
}, initOverrides);
|
|
2357
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesIdPullRequestsPost200ResponseFromJSON(jsonValue));
|
|
2358
|
+
}
|
|
2359
|
+
/**
|
|
2360
|
+
* Link a GitHub pull request to an issue. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"repo\":\"org/repo\",\"number\":123}\' https://onus.example/v1/issues/ENG-42/pull-requests ```
|
|
2361
|
+
* Link issue PR
|
|
2362
|
+
*/
|
|
2363
|
+
async issuesIdPullRequestsPost(requestParameters, initOverrides) {
|
|
2364
|
+
const response = await this.issuesIdPullRequestsPostRaw(requestParameters, initOverrides);
|
|
2365
|
+
return await response.value();
|
|
2366
|
+
}
|
|
2367
|
+
/**
|
|
2368
|
+
* Create a relation to another issue. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"related_issue_ref\":\"ENG-7\",\"type\":\"blocks\"}\' https://onus.example/v1/issues/ENG-42/relations ``` ```bash onus issue relate ENG-42 ENG-7 blocks ```
|
|
2369
|
+
* Create issue relation
|
|
2370
|
+
*/
|
|
2371
|
+
async issuesIdRelationsPostRaw(requestParameters, initOverrides) {
|
|
2372
|
+
if (requestParameters["id"] == null) {
|
|
2373
|
+
throw new RequiredError(
|
|
2374
|
+
"id",
|
|
2375
|
+
'Required parameter "id" was null or undefined when calling issuesIdRelationsPost().'
|
|
2376
|
+
);
|
|
2377
|
+
}
|
|
2378
|
+
const queryParameters = {};
|
|
2379
|
+
const headerParameters = {};
|
|
2380
|
+
headerParameters["Content-Type"] = "application/json";
|
|
2381
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2382
|
+
const token = this.configuration.accessToken;
|
|
2383
|
+
const tokenString = await token("bearerAuth", []);
|
|
2384
|
+
if (tokenString) {
|
|
2385
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
const response = await this.request({
|
|
2389
|
+
path: `/issues/{id}/relations`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2390
|
+
method: "POST",
|
|
2391
|
+
headers: headerParameters,
|
|
2392
|
+
query: queryParameters,
|
|
2393
|
+
body: IssuesIdRelationsPostRequestToJSON(requestParameters["issuesIdRelationsPostRequest"])
|
|
2394
|
+
}, initOverrides);
|
|
2395
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesPost200ResponseRelationsInnerFromJSON(jsonValue));
|
|
2396
|
+
}
|
|
2397
|
+
/**
|
|
2398
|
+
* Create a relation to another issue. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"related_issue_ref\":\"ENG-7\",\"type\":\"blocks\"}\' https://onus.example/v1/issues/ENG-42/relations ``` ```bash onus issue relate ENG-42 ENG-7 blocks ```
|
|
2399
|
+
* Create issue relation
|
|
2400
|
+
*/
|
|
2401
|
+
async issuesIdRelationsPost(requestParameters, initOverrides) {
|
|
2402
|
+
const response = await this.issuesIdRelationsPostRaw(requestParameters, initOverrides);
|
|
2403
|
+
return await response.value();
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
* Remove a relation. ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/relations/$RELATION_ID ```
|
|
2407
|
+
* Delete issue relation
|
|
2408
|
+
*/
|
|
2409
|
+
async issuesIdRelationsRelationIdDeleteRaw(requestParameters, initOverrides) {
|
|
2410
|
+
if (requestParameters["id"] == null) {
|
|
2411
|
+
throw new RequiredError(
|
|
2412
|
+
"id",
|
|
2413
|
+
'Required parameter "id" was null or undefined when calling issuesIdRelationsRelationIdDelete().'
|
|
2414
|
+
);
|
|
2415
|
+
}
|
|
2416
|
+
if (requestParameters["relationId"] == null) {
|
|
2417
|
+
throw new RequiredError(
|
|
2418
|
+
"relationId",
|
|
2419
|
+
'Required parameter "relationId" was null or undefined when calling issuesIdRelationsRelationIdDelete().'
|
|
2420
|
+
);
|
|
2421
|
+
}
|
|
2422
|
+
const queryParameters = {};
|
|
2423
|
+
const headerParameters = {};
|
|
2424
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2425
|
+
const token = this.configuration.accessToken;
|
|
2426
|
+
const tokenString = await token("bearerAuth", []);
|
|
2427
|
+
if (tokenString) {
|
|
2428
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
const response = await this.request({
|
|
2432
|
+
path: `/issues/{id}/relations/{relationId}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))).replace(`{${"relationId"}}`, encodeURIComponent(String(requestParameters["relationId"]))),
|
|
2433
|
+
method: "DELETE",
|
|
2434
|
+
headers: headerParameters,
|
|
2435
|
+
query: queryParameters
|
|
2436
|
+
}, initOverrides);
|
|
2437
|
+
return new VoidApiResponse(response);
|
|
2438
|
+
}
|
|
2439
|
+
/**
|
|
2440
|
+
* Remove a relation. ```bash curl -X DELETE -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/relations/$RELATION_ID ```
|
|
2441
|
+
* Delete issue relation
|
|
2442
|
+
*/
|
|
2443
|
+
async issuesIdRelationsRelationIdDelete(requestParameters, initOverrides) {
|
|
2444
|
+
await this.issuesIdRelationsRelationIdDeleteRaw(requestParameters, initOverrides);
|
|
2445
|
+
}
|
|
2446
|
+
/**
|
|
2447
|
+
* Check whether the caller is subscribed to an issue\'s notifications. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/subscription ```
|
|
2448
|
+
* Get subscription state
|
|
2449
|
+
*/
|
|
2450
|
+
async issuesIdSubscriptionGetRaw(requestParameters, initOverrides) {
|
|
2451
|
+
if (requestParameters["id"] == null) {
|
|
2452
|
+
throw new RequiredError(
|
|
2453
|
+
"id",
|
|
2454
|
+
'Required parameter "id" was null or undefined when calling issuesIdSubscriptionGet().'
|
|
2455
|
+
);
|
|
2456
|
+
}
|
|
2457
|
+
const queryParameters = {};
|
|
2458
|
+
const headerParameters = {};
|
|
2459
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2460
|
+
const token = this.configuration.accessToken;
|
|
2461
|
+
const tokenString = await token("bearerAuth", []);
|
|
2462
|
+
if (tokenString) {
|
|
2463
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
const response = await this.request({
|
|
2467
|
+
path: `/issues/{id}/subscription`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2468
|
+
method: "GET",
|
|
2469
|
+
headers: headerParameters,
|
|
2470
|
+
query: queryParameters
|
|
2471
|
+
}, initOverrides);
|
|
2472
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesIdSubscriptionGet200ResponseFromJSON(jsonValue));
|
|
2473
|
+
}
|
|
2474
|
+
/**
|
|
2475
|
+
* Check whether the caller is subscribed to an issue\'s notifications. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/issues/ENG-42/subscription ```
|
|
2476
|
+
* Get subscription state
|
|
2477
|
+
*/
|
|
2478
|
+
async issuesIdSubscriptionGet(requestParameters, initOverrides) {
|
|
2479
|
+
const response = await this.issuesIdSubscriptionGetRaw(requestParameters, initOverrides);
|
|
2480
|
+
return await response.value();
|
|
2481
|
+
}
|
|
2482
|
+
/**
|
|
2483
|
+
* See summary. Authenticate with a bearer token.
|
|
2484
|
+
* Update subscription state
|
|
2485
|
+
*/
|
|
2486
|
+
async issuesIdSubscriptionPostRaw(requestParameters, initOverrides) {
|
|
2487
|
+
if (requestParameters["id"] == null) {
|
|
2488
|
+
throw new RequiredError(
|
|
2489
|
+
"id",
|
|
2490
|
+
'Required parameter "id" was null or undefined when calling issuesIdSubscriptionPost().'
|
|
2491
|
+
);
|
|
2492
|
+
}
|
|
2493
|
+
const queryParameters = {};
|
|
2494
|
+
const headerParameters = {};
|
|
2495
|
+
headerParameters["Content-Type"] = "application/json";
|
|
2496
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2497
|
+
const token = this.configuration.accessToken;
|
|
2498
|
+
const tokenString = await token("bearerAuth", []);
|
|
2499
|
+
if (tokenString) {
|
|
2500
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
const response = await this.request({
|
|
2504
|
+
path: `/issues/{id}/subscription`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2505
|
+
method: "POST",
|
|
2506
|
+
headers: headerParameters,
|
|
2507
|
+
query: queryParameters,
|
|
2508
|
+
body: IssuesIdSubscriptionPostRequestToJSON(requestParameters["issuesIdSubscriptionPostRequest"])
|
|
2509
|
+
}, initOverrides);
|
|
2510
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesIdSubscriptionGet200ResponseFromJSON(jsonValue));
|
|
2511
|
+
}
|
|
2512
|
+
/**
|
|
2513
|
+
* See summary. Authenticate with a bearer token.
|
|
2514
|
+
* Update subscription state
|
|
2515
|
+
*/
|
|
2516
|
+
async issuesIdSubscriptionPost(requestParameters, initOverrides) {
|
|
2517
|
+
const response = await this.issuesIdSubscriptionPostRaw(requestParameters, initOverrides);
|
|
2518
|
+
return await response.value();
|
|
2519
|
+
}
|
|
2520
|
+
/**
|
|
2521
|
+
* Create an issue. Ref fields accept UUIDs or KEY-NUM identifiers. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"team_id\":\"...\",\"title\":\"Fix login\"}\' https://onus.example/v1/issues ``` ```bash onus issue create --team HOT --title \"Fix login\" ```
|
|
2522
|
+
* Create issue
|
|
2523
|
+
*/
|
|
2524
|
+
async issuesPostRaw(requestParameters, initOverrides) {
|
|
2525
|
+
const queryParameters = {};
|
|
2526
|
+
const headerParameters = {};
|
|
2527
|
+
headerParameters["Content-Type"] = "application/json";
|
|
2528
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2529
|
+
const token = this.configuration.accessToken;
|
|
2530
|
+
const tokenString = await token("bearerAuth", []);
|
|
2531
|
+
if (tokenString) {
|
|
2532
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
const response = await this.request({
|
|
2536
|
+
path: `/issues`,
|
|
2537
|
+
method: "POST",
|
|
2538
|
+
headers: headerParameters,
|
|
2539
|
+
query: queryParameters,
|
|
2540
|
+
body: IssuesPostRequestToJSON(requestParameters["issuesPostRequest"])
|
|
2541
|
+
}, initOverrides);
|
|
2542
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesPost200ResponseFromJSON(jsonValue));
|
|
2543
|
+
}
|
|
2544
|
+
/**
|
|
2545
|
+
* Create an issue. Ref fields accept UUIDs or KEY-NUM identifiers. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"team_id\":\"...\",\"title\":\"Fix login\"}\' https://onus.example/v1/issues ``` ```bash onus issue create --team HOT --title \"Fix login\" ```
|
|
2546
|
+
* Create issue
|
|
2547
|
+
*/
|
|
2548
|
+
async issuesPost(requestParameters = {}, initOverrides) {
|
|
2549
|
+
const response = await this.issuesPostRaw(requestParameters, initOverrides);
|
|
2550
|
+
return await response.value();
|
|
2551
|
+
}
|
|
2552
|
+
/**
|
|
2553
|
+
* List labels across visible teams. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/labels ``` ```bash onus label list ```
|
|
2554
|
+
* List labels
|
|
2555
|
+
*/
|
|
2556
|
+
async labelsGetRaw(initOverrides) {
|
|
2557
|
+
const queryParameters = {};
|
|
2558
|
+
const headerParameters = {};
|
|
2559
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2560
|
+
const token = this.configuration.accessToken;
|
|
2561
|
+
const tokenString = await token("bearerAuth", []);
|
|
2562
|
+
if (tokenString) {
|
|
2563
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
const response = await this.request({
|
|
2567
|
+
path: `/labels`,
|
|
2568
|
+
method: "GET",
|
|
2569
|
+
headers: headerParameters,
|
|
2570
|
+
query: queryParameters
|
|
2571
|
+
}, initOverrides);
|
|
2572
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(IssuesGet200ResponseDataInnerLabelsInnerFromJSON));
|
|
2573
|
+
}
|
|
2574
|
+
/**
|
|
2575
|
+
* List labels across visible teams. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/labels ``` ```bash onus label list ```
|
|
2576
|
+
* List labels
|
|
2577
|
+
*/
|
|
2578
|
+
async labelsGet(initOverrides) {
|
|
2579
|
+
const response = await this.labelsGetRaw(initOverrides);
|
|
2580
|
+
return await response.value();
|
|
2581
|
+
}
|
|
2582
|
+
/**
|
|
2583
|
+
* Create a label. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"team_id\":\"...\",\"name\":\"bug\",\"color\":\"#ff0000\"}\' https://onus.example/v1/labels ``` ```bash onus label create --team HOT --name bug ```
|
|
2584
|
+
* Create label
|
|
2585
|
+
*/
|
|
2586
|
+
async labelsPostRaw(requestParameters, initOverrides) {
|
|
2587
|
+
const queryParameters = {};
|
|
2588
|
+
const headerParameters = {};
|
|
2589
|
+
headerParameters["Content-Type"] = "application/json";
|
|
2590
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2591
|
+
const token = this.configuration.accessToken;
|
|
2592
|
+
const tokenString = await token("bearerAuth", []);
|
|
2593
|
+
if (tokenString) {
|
|
2594
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
const response = await this.request({
|
|
2598
|
+
path: `/labels`,
|
|
2599
|
+
method: "POST",
|
|
2600
|
+
headers: headerParameters,
|
|
2601
|
+
query: queryParameters,
|
|
2602
|
+
body: LabelsPostRequestToJSON(requestParameters["labelsPostRequest"])
|
|
2603
|
+
}, initOverrides);
|
|
2604
|
+
return new JSONApiResponse(response, (jsonValue) => IssuesGet200ResponseDataInnerLabelsInnerFromJSON(jsonValue));
|
|
2605
|
+
}
|
|
2606
|
+
/**
|
|
2607
|
+
* Create a label. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"team_id\":\"...\",\"name\":\"bug\",\"color\":\"#ff0000\"}\' https://onus.example/v1/labels ``` ```bash onus label create --team HOT --name bug ```
|
|
2608
|
+
* Create label
|
|
2609
|
+
*/
|
|
2610
|
+
async labelsPost(requestParameters = {}, initOverrides) {
|
|
2611
|
+
const response = await this.labelsPostRaw(requestParameters, initOverrides);
|
|
2612
|
+
return await response.value();
|
|
2613
|
+
}
|
|
2614
|
+
/**
|
|
2615
|
+
* Current viewer profile and workspace role. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/me ``` ```bash onus me ```
|
|
2616
|
+
* Get current user
|
|
2617
|
+
*/
|
|
2618
|
+
async meGetRaw(initOverrides) {
|
|
2619
|
+
const queryParameters = {};
|
|
2620
|
+
const headerParameters = {};
|
|
2621
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2622
|
+
const token = this.configuration.accessToken;
|
|
2623
|
+
const tokenString = await token("bearerAuth", []);
|
|
2624
|
+
if (tokenString) {
|
|
2625
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
const response = await this.request({
|
|
2629
|
+
path: `/me`,
|
|
2630
|
+
method: "GET",
|
|
2631
|
+
headers: headerParameters,
|
|
2632
|
+
query: queryParameters
|
|
2633
|
+
}, initOverrides);
|
|
2634
|
+
return new JSONApiResponse(response, (jsonValue) => MeGet200ResponseFromJSON(jsonValue));
|
|
2635
|
+
}
|
|
2636
|
+
/**
|
|
2637
|
+
* Current viewer profile and workspace role. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/me ``` ```bash onus me ```
|
|
2638
|
+
* Get current user
|
|
2639
|
+
*/
|
|
2640
|
+
async meGet(initOverrides) {
|
|
2641
|
+
const response = await this.meGetRaw(initOverrides);
|
|
2642
|
+
return await response.value();
|
|
2643
|
+
}
|
|
2644
|
+
/**
|
|
2645
|
+
* List projects across visible teams. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/projects ``` ```bash onus project list ```
|
|
2646
|
+
* List projects
|
|
2647
|
+
*/
|
|
2648
|
+
async projectsGetRaw(initOverrides) {
|
|
2649
|
+
const queryParameters = {};
|
|
2650
|
+
const headerParameters = {};
|
|
2651
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2652
|
+
const token = this.configuration.accessToken;
|
|
2653
|
+
const tokenString = await token("bearerAuth", []);
|
|
2654
|
+
if (tokenString) {
|
|
2655
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
const response = await this.request({
|
|
2659
|
+
path: `/projects`,
|
|
2660
|
+
method: "GET",
|
|
2661
|
+
headers: headerParameters,
|
|
2662
|
+
query: queryParameters
|
|
2663
|
+
}, initOverrides);
|
|
2664
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(ProjectsGet200ResponseInnerFromJSON));
|
|
2665
|
+
}
|
|
2666
|
+
/**
|
|
2667
|
+
* List projects across visible teams. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/projects ``` ```bash onus project list ```
|
|
2668
|
+
* List projects
|
|
2669
|
+
*/
|
|
2670
|
+
async projectsGet(initOverrides) {
|
|
2671
|
+
const response = await this.projectsGetRaw(initOverrides);
|
|
2672
|
+
return await response.value();
|
|
2673
|
+
}
|
|
2674
|
+
/**
|
|
2675
|
+
* List a project\'s attachments. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/projects/$PROJECT_ID/attachments ```
|
|
2676
|
+
* List project attachments
|
|
2677
|
+
*/
|
|
2678
|
+
async projectsIdAttachmentsGetRaw(requestParameters, initOverrides) {
|
|
2679
|
+
if (requestParameters["id"] == null) {
|
|
2680
|
+
throw new RequiredError(
|
|
2681
|
+
"id",
|
|
2682
|
+
'Required parameter "id" was null or undefined when calling projectsIdAttachmentsGet().'
|
|
2683
|
+
);
|
|
2684
|
+
}
|
|
2685
|
+
const queryParameters = {};
|
|
2686
|
+
const headerParameters = {};
|
|
2687
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2688
|
+
const token = this.configuration.accessToken;
|
|
2689
|
+
const tokenString = await token("bearerAuth", []);
|
|
2690
|
+
if (tokenString) {
|
|
2691
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
const response = await this.request({
|
|
2695
|
+
path: `/projects/{id}/attachments`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2696
|
+
method: "GET",
|
|
2697
|
+
headers: headerParameters,
|
|
2698
|
+
query: queryParameters
|
|
2699
|
+
}, initOverrides);
|
|
2700
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(IssuesPost200ResponseAttachmentsInnerFromJSON));
|
|
2701
|
+
}
|
|
2702
|
+
/**
|
|
2703
|
+
* List a project\'s attachments. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/projects/$PROJECT_ID/attachments ```
|
|
2704
|
+
* List project attachments
|
|
2705
|
+
*/
|
|
2706
|
+
async projectsIdAttachmentsGet(requestParameters, initOverrides) {
|
|
2707
|
+
const response = await this.projectsIdAttachmentsGetRaw(requestParameters, initOverrides);
|
|
2708
|
+
return await response.value();
|
|
2709
|
+
}
|
|
2710
|
+
/**
|
|
2711
|
+
* Fetch a single project by UUID. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/projects/$PROJECT_ID ``` ```bash onus project get $PROJECT_ID ```
|
|
2712
|
+
* Get project
|
|
2713
|
+
*/
|
|
2714
|
+
async projectsIdGetRaw(requestParameters, initOverrides) {
|
|
2715
|
+
if (requestParameters["id"] == null) {
|
|
2716
|
+
throw new RequiredError(
|
|
2717
|
+
"id",
|
|
2718
|
+
'Required parameter "id" was null or undefined when calling projectsIdGet().'
|
|
2719
|
+
);
|
|
2720
|
+
}
|
|
2721
|
+
const queryParameters = {};
|
|
2722
|
+
const headerParameters = {};
|
|
2723
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2724
|
+
const token = this.configuration.accessToken;
|
|
2725
|
+
const tokenString = await token("bearerAuth", []);
|
|
2726
|
+
if (tokenString) {
|
|
2727
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
const response = await this.request({
|
|
2731
|
+
path: `/projects/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2732
|
+
method: "GET",
|
|
2733
|
+
headers: headerParameters,
|
|
2734
|
+
query: queryParameters
|
|
2735
|
+
}, initOverrides);
|
|
2736
|
+
return new JSONApiResponse(response, (jsonValue) => ProjectsGet200ResponseInnerFromJSON(jsonValue));
|
|
2737
|
+
}
|
|
2738
|
+
/**
|
|
2739
|
+
* Fetch a single project by UUID. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/projects/$PROJECT_ID ``` ```bash onus project get $PROJECT_ID ```
|
|
2740
|
+
* Get project
|
|
2741
|
+
*/
|
|
2742
|
+
async projectsIdGet(requestParameters, initOverrides) {
|
|
2743
|
+
const response = await this.projectsIdGetRaw(requestParameters, initOverrides);
|
|
2744
|
+
return await response.value();
|
|
2745
|
+
}
|
|
2746
|
+
/**
|
|
2747
|
+
* See summary. Authenticate with a bearer token.
|
|
2748
|
+
* Update project
|
|
2749
|
+
*/
|
|
2750
|
+
async projectsIdPatchRaw(requestParameters, initOverrides) {
|
|
2751
|
+
if (requestParameters["id"] == null) {
|
|
2752
|
+
throw new RequiredError(
|
|
2753
|
+
"id",
|
|
2754
|
+
'Required parameter "id" was null or undefined when calling projectsIdPatch().'
|
|
2755
|
+
);
|
|
2756
|
+
}
|
|
2757
|
+
const queryParameters = {};
|
|
2758
|
+
const headerParameters = {};
|
|
2759
|
+
headerParameters["Content-Type"] = "application/json";
|
|
2760
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2761
|
+
const token = this.configuration.accessToken;
|
|
2762
|
+
const tokenString = await token("bearerAuth", []);
|
|
2763
|
+
if (tokenString) {
|
|
2764
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
const response = await this.request({
|
|
2768
|
+
path: `/projects/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2769
|
+
method: "PATCH",
|
|
2770
|
+
headers: headerParameters,
|
|
2771
|
+
query: queryParameters,
|
|
2772
|
+
body: ProjectsIdPatchRequestToJSON(requestParameters["projectsIdPatchRequest"])
|
|
2773
|
+
}, initOverrides);
|
|
2774
|
+
return new JSONApiResponse(response, (jsonValue) => ProjectsGet200ResponseInnerFromJSON(jsonValue));
|
|
2775
|
+
}
|
|
2776
|
+
/**
|
|
2777
|
+
* See summary. Authenticate with a bearer token.
|
|
2778
|
+
* Update project
|
|
2779
|
+
*/
|
|
2780
|
+
async projectsIdPatch(requestParameters, initOverrides) {
|
|
2781
|
+
const response = await this.projectsIdPatchRaw(requestParameters, initOverrides);
|
|
2782
|
+
return await response.value();
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* Create a project (team leads and workspace admins). ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"team_id\":\"...\",\"name\":\"Launch\"}\' https://onus.example/v1/projects ``` ```bash onus project create --team HOT --name Launch ```
|
|
2786
|
+
* Create project
|
|
2787
|
+
*/
|
|
2788
|
+
async projectsPostRaw(requestParameters, initOverrides) {
|
|
2789
|
+
const queryParameters = {};
|
|
2790
|
+
const headerParameters = {};
|
|
2791
|
+
headerParameters["Content-Type"] = "application/json";
|
|
2792
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2793
|
+
const token = this.configuration.accessToken;
|
|
2794
|
+
const tokenString = await token("bearerAuth", []);
|
|
2795
|
+
if (tokenString) {
|
|
2796
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
const response = await this.request({
|
|
2800
|
+
path: `/projects`,
|
|
2801
|
+
method: "POST",
|
|
2802
|
+
headers: headerParameters,
|
|
2803
|
+
query: queryParameters,
|
|
2804
|
+
body: ProjectsPostRequestToJSON(requestParameters["projectsPostRequest"])
|
|
2805
|
+
}, initOverrides);
|
|
2806
|
+
return new JSONApiResponse(response, (jsonValue) => ProjectsGet200ResponseInnerFromJSON(jsonValue));
|
|
2807
|
+
}
|
|
2808
|
+
/**
|
|
2809
|
+
* Create a project (team leads and workspace admins). ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"team_id\":\"...\",\"name\":\"Launch\"}\' https://onus.example/v1/projects ``` ```bash onus project create --team HOT --name Launch ```
|
|
2810
|
+
* Create project
|
|
2811
|
+
*/
|
|
2812
|
+
async projectsPost(requestParameters = {}, initOverrides) {
|
|
2813
|
+
const response = await this.projectsPostRaw(requestParameters, initOverrides);
|
|
2814
|
+
return await response.value();
|
|
2815
|
+
}
|
|
2816
|
+
/**
|
|
2817
|
+
* List teams visible to the caller (workspace admins see all; members see joined teams). ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/teams ``` ```bash onus team list ```
|
|
2818
|
+
* List teams
|
|
2819
|
+
*/
|
|
2820
|
+
async teamsGetRaw(initOverrides) {
|
|
2821
|
+
const queryParameters = {};
|
|
2822
|
+
const headerParameters = {};
|
|
2823
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2824
|
+
const token = this.configuration.accessToken;
|
|
2825
|
+
const tokenString = await token("bearerAuth", []);
|
|
2826
|
+
if (tokenString) {
|
|
2827
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
const response = await this.request({
|
|
2831
|
+
path: `/teams`,
|
|
2832
|
+
method: "GET",
|
|
2833
|
+
headers: headerParameters,
|
|
2834
|
+
query: queryParameters
|
|
2835
|
+
}, initOverrides);
|
|
2836
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(TeamsGet200ResponseInnerFromJSON));
|
|
2837
|
+
}
|
|
2838
|
+
/**
|
|
2839
|
+
* List teams visible to the caller (workspace admins see all; members see joined teams). ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/teams ``` ```bash onus team list ```
|
|
2840
|
+
* List teams
|
|
2841
|
+
*/
|
|
2842
|
+
async teamsGet(initOverrides) {
|
|
2843
|
+
const response = await this.teamsGetRaw(initOverrides);
|
|
2844
|
+
return await response.value();
|
|
2845
|
+
}
|
|
2846
|
+
/**
|
|
2847
|
+
* Fetch a single team by UUID. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/teams/$TEAM_ID ``` ```bash onus team get $TEAM_ID ```
|
|
2848
|
+
* Get team
|
|
2849
|
+
*/
|
|
2850
|
+
async teamsIdGetRaw(requestParameters, initOverrides) {
|
|
2851
|
+
if (requestParameters["id"] == null) {
|
|
2852
|
+
throw new RequiredError(
|
|
2853
|
+
"id",
|
|
2854
|
+
'Required parameter "id" was null or undefined when calling teamsIdGet().'
|
|
2855
|
+
);
|
|
2856
|
+
}
|
|
2857
|
+
const queryParameters = {};
|
|
2858
|
+
const headerParameters = {};
|
|
2859
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2860
|
+
const token = this.configuration.accessToken;
|
|
2861
|
+
const tokenString = await token("bearerAuth", []);
|
|
2862
|
+
if (tokenString) {
|
|
2863
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
const response = await this.request({
|
|
2867
|
+
path: `/teams/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2868
|
+
method: "GET",
|
|
2869
|
+
headers: headerParameters,
|
|
2870
|
+
query: queryParameters
|
|
2871
|
+
}, initOverrides);
|
|
2872
|
+
return new JSONApiResponse(response, (jsonValue) => TeamsGet200ResponseInnerFromJSON(jsonValue));
|
|
2873
|
+
}
|
|
2874
|
+
/**
|
|
2875
|
+
* Fetch a single team by UUID. ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/teams/$TEAM_ID ``` ```bash onus team get $TEAM_ID ```
|
|
2876
|
+
* Get team
|
|
2877
|
+
*/
|
|
2878
|
+
async teamsIdGet(requestParameters, initOverrides) {
|
|
2879
|
+
const response = await this.teamsIdGetRaw(requestParameters, initOverrides);
|
|
2880
|
+
return await response.value();
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* List a team’s ingest keys (masked — the full secret is only returned on create/rotate). ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/teams/$TEAM_ID/ingest-keys ``` ```bash onus dsn list --team $TEAM_ID ```
|
|
2884
|
+
* List a team’s ingest keys (masked)
|
|
2885
|
+
*/
|
|
2886
|
+
async teamsIdIngestKeysGetRaw(requestParameters, initOverrides) {
|
|
2887
|
+
if (requestParameters["id"] == null) {
|
|
2888
|
+
throw new RequiredError(
|
|
2889
|
+
"id",
|
|
2890
|
+
'Required parameter "id" was null or undefined when calling teamsIdIngestKeysGet().'
|
|
2891
|
+
);
|
|
2892
|
+
}
|
|
2893
|
+
const queryParameters = {};
|
|
2894
|
+
const headerParameters = {};
|
|
2895
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2896
|
+
const token = this.configuration.accessToken;
|
|
2897
|
+
const tokenString = await token("bearerAuth", []);
|
|
2898
|
+
if (tokenString) {
|
|
2899
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
const response = await this.request({
|
|
2903
|
+
path: `/teams/{id}/ingest-keys`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2904
|
+
method: "GET",
|
|
2905
|
+
headers: headerParameters,
|
|
2906
|
+
query: queryParameters
|
|
2907
|
+
}, initOverrides);
|
|
2908
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(TeamsIdIngestKeysGet200ResponseInnerFromJSON));
|
|
2909
|
+
}
|
|
2910
|
+
/**
|
|
2911
|
+
* List a team’s ingest keys (masked — the full secret is only returned on create/rotate). ```bash curl -H \"Authorization: Bearer $ONUS_TOKEN\" https://onus.example/v1/teams/$TEAM_ID/ingest-keys ``` ```bash onus dsn list --team $TEAM_ID ```
|
|
2912
|
+
* List a team’s ingest keys (masked)
|
|
2913
|
+
*/
|
|
2914
|
+
async teamsIdIngestKeysGet(requestParameters, initOverrides) {
|
|
2915
|
+
const response = await this.teamsIdIngestKeysGetRaw(requestParameters, initOverrides);
|
|
2916
|
+
return await response.value();
|
|
2917
|
+
}
|
|
2918
|
+
/**
|
|
2919
|
+
* Create an ingest key. The full secret is returned exactly once — store it immediately. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"label\":\"ci\"}\' https://onus.example/v1/teams/$TEAM_ID/ingest-keys ``` ```bash onus dsn create --team $TEAM_ID --label ci ```
|
|
2920
|
+
* Create an ingest key
|
|
2921
|
+
*/
|
|
2922
|
+
async teamsIdIngestKeysPostRaw(requestParameters, initOverrides) {
|
|
2923
|
+
if (requestParameters["id"] == null) {
|
|
2924
|
+
throw new RequiredError(
|
|
2925
|
+
"id",
|
|
2926
|
+
'Required parameter "id" was null or undefined when calling teamsIdIngestKeysPost().'
|
|
2927
|
+
);
|
|
2928
|
+
}
|
|
2929
|
+
const queryParameters = {};
|
|
2930
|
+
const headerParameters = {};
|
|
2931
|
+
headerParameters["Content-Type"] = "application/json";
|
|
2932
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2933
|
+
const token = this.configuration.accessToken;
|
|
2934
|
+
const tokenString = await token("bearerAuth", []);
|
|
2935
|
+
if (tokenString) {
|
|
2936
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
const response = await this.request({
|
|
2940
|
+
path: `/teams/{id}/ingest-keys`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
2941
|
+
method: "POST",
|
|
2942
|
+
headers: headerParameters,
|
|
2943
|
+
query: queryParameters,
|
|
2944
|
+
body: TeamsIdIngestKeysPostRequestToJSON(requestParameters["teamsIdIngestKeysPostRequest"])
|
|
2945
|
+
}, initOverrides);
|
|
2946
|
+
return new JSONApiResponse(response, (jsonValue) => IngestKeysIdRotatePost200ResponseFromJSON(jsonValue));
|
|
2947
|
+
}
|
|
2948
|
+
/**
|
|
2949
|
+
* Create an ingest key. The full secret is returned exactly once — store it immediately. ```bash curl -X POST -H \"Authorization: Bearer $ONUS_TOKEN\" -H \'Content-Type: application/json\' \\ -d \'{\"label\":\"ci\"}\' https://onus.example/v1/teams/$TEAM_ID/ingest-keys ``` ```bash onus dsn create --team $TEAM_ID --label ci ```
|
|
2950
|
+
* Create an ingest key
|
|
2951
|
+
*/
|
|
2952
|
+
async teamsIdIngestKeysPost(requestParameters, initOverrides) {
|
|
2953
|
+
const response = await this.teamsIdIngestKeysPostRaw(requestParameters, initOverrides);
|
|
2954
|
+
return await response.value();
|
|
2955
|
+
}
|
|
2956
|
+
/**
|
|
2957
|
+
* List issue templates
|
|
2958
|
+
*/
|
|
2959
|
+
async templatesGetRaw(requestParameters, initOverrides) {
|
|
2960
|
+
const queryParameters = {};
|
|
2961
|
+
if (requestParameters["teamId"] != null) {
|
|
2962
|
+
queryParameters["team_id"] = requestParameters["teamId"];
|
|
2963
|
+
}
|
|
2964
|
+
const headerParameters = {};
|
|
2965
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2966
|
+
const token = this.configuration.accessToken;
|
|
2967
|
+
const tokenString = await token("bearerAuth", []);
|
|
2968
|
+
if (tokenString) {
|
|
2969
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
const response = await this.request({
|
|
2973
|
+
path: `/templates`,
|
|
2974
|
+
method: "GET",
|
|
2975
|
+
headers: headerParameters,
|
|
2976
|
+
query: queryParameters
|
|
2977
|
+
}, initOverrides);
|
|
2978
|
+
return new JSONApiResponse(response, (jsonValue) => jsonValue.map(TemplatesGet200ResponseInnerFromJSON));
|
|
2979
|
+
}
|
|
2980
|
+
/**
|
|
2981
|
+
* List issue templates
|
|
2982
|
+
*/
|
|
2983
|
+
async templatesGet(requestParameters = {}, initOverrides) {
|
|
2984
|
+
const response = await this.templatesGetRaw(requestParameters, initOverrides);
|
|
2985
|
+
return await response.value();
|
|
2986
|
+
}
|
|
2987
|
+
/**
|
|
2988
|
+
* Delete issue template
|
|
2989
|
+
*/
|
|
2990
|
+
async templatesIdDeleteRaw(requestParameters, initOverrides) {
|
|
2991
|
+
if (requestParameters["id"] == null) {
|
|
2992
|
+
throw new RequiredError(
|
|
2993
|
+
"id",
|
|
2994
|
+
'Required parameter "id" was null or undefined when calling templatesIdDelete().'
|
|
2995
|
+
);
|
|
2996
|
+
}
|
|
2997
|
+
const queryParameters = {};
|
|
2998
|
+
const headerParameters = {};
|
|
2999
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
3000
|
+
const token = this.configuration.accessToken;
|
|
3001
|
+
const tokenString = await token("bearerAuth", []);
|
|
3002
|
+
if (tokenString) {
|
|
3003
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
const response = await this.request({
|
|
3007
|
+
path: `/templates/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
3008
|
+
method: "DELETE",
|
|
3009
|
+
headers: headerParameters,
|
|
3010
|
+
query: queryParameters
|
|
3011
|
+
}, initOverrides);
|
|
3012
|
+
return new VoidApiResponse(response);
|
|
3013
|
+
}
|
|
3014
|
+
/**
|
|
3015
|
+
* Delete issue template
|
|
3016
|
+
*/
|
|
3017
|
+
async templatesIdDelete(requestParameters, initOverrides) {
|
|
3018
|
+
await this.templatesIdDeleteRaw(requestParameters, initOverrides);
|
|
3019
|
+
}
|
|
3020
|
+
/**
|
|
3021
|
+
* Get issue template
|
|
3022
|
+
*/
|
|
3023
|
+
async templatesIdGetRaw(requestParameters, initOverrides) {
|
|
3024
|
+
if (requestParameters["id"] == null) {
|
|
3025
|
+
throw new RequiredError(
|
|
3026
|
+
"id",
|
|
3027
|
+
'Required parameter "id" was null or undefined when calling templatesIdGet().'
|
|
3028
|
+
);
|
|
3029
|
+
}
|
|
3030
|
+
const queryParameters = {};
|
|
3031
|
+
const headerParameters = {};
|
|
3032
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
3033
|
+
const token = this.configuration.accessToken;
|
|
3034
|
+
const tokenString = await token("bearerAuth", []);
|
|
3035
|
+
if (tokenString) {
|
|
3036
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
const response = await this.request({
|
|
3040
|
+
path: `/templates/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
3041
|
+
method: "GET",
|
|
3042
|
+
headers: headerParameters,
|
|
3043
|
+
query: queryParameters
|
|
3044
|
+
}, initOverrides);
|
|
3045
|
+
return new JSONApiResponse(response, (jsonValue) => TemplatesGet200ResponseInnerFromJSON(jsonValue));
|
|
3046
|
+
}
|
|
3047
|
+
/**
|
|
3048
|
+
* Get issue template
|
|
3049
|
+
*/
|
|
3050
|
+
async templatesIdGet(requestParameters, initOverrides) {
|
|
3051
|
+
const response = await this.templatesIdGetRaw(requestParameters, initOverrides);
|
|
3052
|
+
return await response.value();
|
|
3053
|
+
}
|
|
3054
|
+
/**
|
|
3055
|
+
* Update issue template
|
|
3056
|
+
*/
|
|
3057
|
+
async templatesIdPatchRaw(requestParameters, initOverrides) {
|
|
3058
|
+
if (requestParameters["id"] == null) {
|
|
3059
|
+
throw new RequiredError(
|
|
3060
|
+
"id",
|
|
3061
|
+
'Required parameter "id" was null or undefined when calling templatesIdPatch().'
|
|
3062
|
+
);
|
|
3063
|
+
}
|
|
3064
|
+
const queryParameters = {};
|
|
3065
|
+
const headerParameters = {};
|
|
3066
|
+
headerParameters["Content-Type"] = "application/json";
|
|
3067
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
3068
|
+
const token = this.configuration.accessToken;
|
|
3069
|
+
const tokenString = await token("bearerAuth", []);
|
|
3070
|
+
if (tokenString) {
|
|
3071
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
const response = await this.request({
|
|
3075
|
+
path: `/templates/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"]))),
|
|
3076
|
+
method: "PATCH",
|
|
3077
|
+
headers: headerParameters,
|
|
3078
|
+
query: queryParameters,
|
|
3079
|
+
body: TemplatesIdPatchRequestToJSON(requestParameters["templatesIdPatchRequest"])
|
|
3080
|
+
}, initOverrides);
|
|
3081
|
+
return new JSONApiResponse(response, (jsonValue) => TemplatesGet200ResponseInnerFromJSON(jsonValue));
|
|
3082
|
+
}
|
|
3083
|
+
/**
|
|
3084
|
+
* Update issue template
|
|
3085
|
+
*/
|
|
3086
|
+
async templatesIdPatch(requestParameters, initOverrides) {
|
|
3087
|
+
const response = await this.templatesIdPatchRaw(requestParameters, initOverrides);
|
|
3088
|
+
return await response.value();
|
|
3089
|
+
}
|
|
3090
|
+
/**
|
|
3091
|
+
* Create issue template
|
|
3092
|
+
*/
|
|
3093
|
+
async templatesPostRaw(requestParameters, initOverrides) {
|
|
3094
|
+
const queryParameters = {};
|
|
3095
|
+
const headerParameters = {};
|
|
3096
|
+
headerParameters["Content-Type"] = "application/json";
|
|
3097
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
3098
|
+
const token = this.configuration.accessToken;
|
|
3099
|
+
const tokenString = await token("bearerAuth", []);
|
|
3100
|
+
if (tokenString) {
|
|
3101
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
const response = await this.request({
|
|
3105
|
+
path: `/templates`,
|
|
3106
|
+
method: "POST",
|
|
3107
|
+
headers: headerParameters,
|
|
3108
|
+
query: queryParameters,
|
|
3109
|
+
body: TemplatesPostRequestToJSON(requestParameters["templatesPostRequest"])
|
|
3110
|
+
}, initOverrides);
|
|
3111
|
+
return new JSONApiResponse(response, (jsonValue) => TemplatesGet200ResponseInnerFromJSON(jsonValue));
|
|
3112
|
+
}
|
|
3113
|
+
/**
|
|
3114
|
+
* Create issue template
|
|
3115
|
+
*/
|
|
3116
|
+
async templatesPost(requestParameters = {}, initOverrides) {
|
|
3117
|
+
const response = await this.templatesPostRaw(requestParameters, initOverrides);
|
|
3118
|
+
return await response.value();
|
|
3119
|
+
}
|
|
3120
|
+
};
|
|
3121
|
+
|
|
3122
|
+
// src/oauth.ts
|
|
3123
|
+
import http from "http";
|
|
3124
|
+
import crypto from "crypto";
|
|
3125
|
+
import { spawn } from "child_process";
|
|
3126
|
+
import readline from "readline/promises";
|
|
3127
|
+
import { stdin as input, stdout as output } from "process";
|
|
3128
|
+
import pc from "picocolors";
|
|
3129
|
+
var OAUTH_CLIENT_ID = "onus-api";
|
|
3130
|
+
var OOB_REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob";
|
|
3131
|
+
function getOAuthBaseUrl(apiUrl) {
|
|
3132
|
+
return apiUrl.replace(/\/+$/, "").replace(/\/v1$/, "");
|
|
3133
|
+
}
|
|
3134
|
+
function createVerifier() {
|
|
3135
|
+
return crypto.randomBytes(32).toString("base64url");
|
|
3136
|
+
}
|
|
3137
|
+
function createCodeChallenge(verifier) {
|
|
3138
|
+
return crypto.createHash("sha256").update(verifier).digest("base64url");
|
|
3139
|
+
}
|
|
3140
|
+
function createState() {
|
|
3141
|
+
return crypto.randomBytes(16).toString("base64url");
|
|
3142
|
+
}
|
|
3143
|
+
function escapeHtml(s) {
|
|
3144
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3145
|
+
}
|
|
3146
|
+
function successHtml(logoUrl) {
|
|
3147
|
+
const brandImg = logoUrl ? `<img src="${escapeHtml(logoUrl)}" alt="Brunyee Studio" width="28" height="28"/>` : "";
|
|
3148
|
+
return `<!doctype html>
|
|
3149
|
+
<html lang="en">
|
|
3150
|
+
<head>
|
|
3151
|
+
<meta charset="utf-8"/>
|
|
3152
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
3153
|
+
<title>Onus CLI \u2014 Authenticated</title>
|
|
3154
|
+
<style>
|
|
3155
|
+
:root { color-scheme: dark; }
|
|
3156
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
3157
|
+
body {
|
|
3158
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
3159
|
+
background-color: oklch(0.153 0.006 107.1);
|
|
3160
|
+
color: oklch(0.988 0.003 106.5);
|
|
3161
|
+
display: flex;
|
|
3162
|
+
align-items: center;
|
|
3163
|
+
justify-content: center;
|
|
3164
|
+
min-height: 100vh;
|
|
3165
|
+
margin: 0;
|
|
3166
|
+
padding: 24px;
|
|
3167
|
+
font-size: 13px;
|
|
3168
|
+
line-height: 1.5;
|
|
3169
|
+
-webkit-font-smoothing: antialiased;
|
|
3170
|
+
}
|
|
3171
|
+
.card {
|
|
3172
|
+
background-color: oklch(0.228 0.013 107.4);
|
|
3173
|
+
border: 1px solid oklch(1 0 0 / 10%);
|
|
3174
|
+
border-radius: 0;
|
|
3175
|
+
padding: 32px;
|
|
3176
|
+
width: 100%;
|
|
3177
|
+
max-width: 420px;
|
|
3178
|
+
display: flex;
|
|
3179
|
+
flex-direction: column;
|
|
3180
|
+
gap: 16px;
|
|
3181
|
+
}
|
|
3182
|
+
.brand {
|
|
3183
|
+
display: flex;
|
|
3184
|
+
align-items: center;
|
|
3185
|
+
gap: 8px;
|
|
3186
|
+
}
|
|
3187
|
+
.brand img {
|
|
3188
|
+
width: 28px;
|
|
3189
|
+
height: 28px;
|
|
3190
|
+
display: block;
|
|
3191
|
+
}
|
|
3192
|
+
.brand span {
|
|
3193
|
+
color: oklch(0.988 0.003 106.5);
|
|
3194
|
+
font-size: 13px;
|
|
3195
|
+
font-weight: 600;
|
|
3196
|
+
}
|
|
3197
|
+
h1 {
|
|
3198
|
+
font-size: 18px;
|
|
3199
|
+
font-weight: 600;
|
|
3200
|
+
line-height: 1.3;
|
|
3201
|
+
color: oklch(0.988 0.003 106.5);
|
|
3202
|
+
}
|
|
3203
|
+
p {
|
|
3204
|
+
font-size: 13px;
|
|
3205
|
+
line-height: 1.5;
|
|
3206
|
+
color: oklch(0.737 0.021 106.9);
|
|
3207
|
+
}
|
|
3208
|
+
</style>
|
|
3209
|
+
</head>
|
|
3210
|
+
<body>
|
|
3211
|
+
<div class="card">
|
|
3212
|
+
<div class="brand">
|
|
3213
|
+
${brandImg}
|
|
3214
|
+
<span>Onus</span>
|
|
3215
|
+
</div>
|
|
3216
|
+
<h1>Authentication Successful</h1>
|
|
3217
|
+
<p>You have authorized the Onus CLI. You can close this browser tab and return to your terminal.</p>
|
|
3218
|
+
</div>
|
|
3219
|
+
</body>
|
|
3220
|
+
</html>`;
|
|
3221
|
+
}
|
|
3222
|
+
function errorHtml(message, logoUrl) {
|
|
3223
|
+
const brandImg = logoUrl ? `<img src="${escapeHtml(logoUrl)}" alt="Brunyee Studio" width="28" height="28"/>` : "";
|
|
3224
|
+
return `<!doctype html>
|
|
3225
|
+
<html lang="en">
|
|
3226
|
+
<head>
|
|
3227
|
+
<meta charset="utf-8"/>
|
|
3228
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
3229
|
+
<title>Onus CLI \u2014 Authentication Failed</title>
|
|
3230
|
+
<style>
|
|
3231
|
+
:root { color-scheme: dark; }
|
|
3232
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
3233
|
+
body {
|
|
3234
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
3235
|
+
background-color: oklch(0.153 0.006 107.1);
|
|
3236
|
+
color: oklch(0.988 0.003 106.5);
|
|
3237
|
+
display: flex;
|
|
3238
|
+
align-items: center;
|
|
3239
|
+
justify-content: center;
|
|
3240
|
+
min-height: 100vh;
|
|
3241
|
+
margin: 0;
|
|
3242
|
+
padding: 24px;
|
|
3243
|
+
font-size: 13px;
|
|
3244
|
+
line-height: 1.5;
|
|
3245
|
+
-webkit-font-smoothing: antialiased;
|
|
3246
|
+
}
|
|
3247
|
+
.card {
|
|
3248
|
+
background-color: oklch(0.228 0.013 107.4);
|
|
3249
|
+
border: 1px solid oklch(1 0 0 / 10%);
|
|
3250
|
+
border-radius: 0;
|
|
3251
|
+
padding: 32px;
|
|
3252
|
+
width: 100%;
|
|
3253
|
+
max-width: 420px;
|
|
3254
|
+
display: flex;
|
|
3255
|
+
flex-direction: column;
|
|
3256
|
+
gap: 16px;
|
|
3257
|
+
}
|
|
3258
|
+
.brand {
|
|
3259
|
+
display: flex;
|
|
3260
|
+
align-items: center;
|
|
3261
|
+
gap: 8px;
|
|
3262
|
+
}
|
|
3263
|
+
.brand img {
|
|
3264
|
+
width: 28px;
|
|
3265
|
+
height: 28px;
|
|
3266
|
+
display: block;
|
|
3267
|
+
}
|
|
3268
|
+
.brand span {
|
|
3269
|
+
color: oklch(0.988 0.003 106.5);
|
|
3270
|
+
font-size: 13px;
|
|
3271
|
+
font-weight: 600;
|
|
3272
|
+
}
|
|
3273
|
+
h1 {
|
|
3274
|
+
font-size: 18px;
|
|
3275
|
+
font-weight: 600;
|
|
3276
|
+
line-height: 1.3;
|
|
3277
|
+
color: oklch(0.704 0.191 22.216);
|
|
3278
|
+
}
|
|
3279
|
+
p {
|
|
3280
|
+
font-size: 13px;
|
|
3281
|
+
line-height: 1.5;
|
|
3282
|
+
color: oklch(0.737 0.021 106.9);
|
|
3283
|
+
}
|
|
3284
|
+
</style>
|
|
3285
|
+
</head>
|
|
3286
|
+
<body>
|
|
3287
|
+
<div class="card">
|
|
3288
|
+
<div class="brand">
|
|
3289
|
+
${brandImg}
|
|
3290
|
+
<span>Onus</span>
|
|
3291
|
+
</div>
|
|
3292
|
+
<h1>Authentication Failed</h1>
|
|
3293
|
+
<p>${escapeHtml(message)}</p>
|
|
3294
|
+
</div>
|
|
3295
|
+
</body>
|
|
3296
|
+
</html>`;
|
|
3297
|
+
}
|
|
3298
|
+
async function startLoopbackServer(opts) {
|
|
3299
|
+
let callbackResolve = null;
|
|
3300
|
+
let callbackReject = null;
|
|
3301
|
+
let timer = null;
|
|
3302
|
+
const callbackPromise = new Promise((resolve, reject) => {
|
|
3303
|
+
callbackResolve = resolve;
|
|
3304
|
+
callbackReject = reject;
|
|
3305
|
+
});
|
|
3306
|
+
const server = http.createServer((req, res) => {
|
|
3307
|
+
try {
|
|
3308
|
+
const host = req.headers.host || opts.host || "127.0.0.1";
|
|
3309
|
+
const reqUrl = new URL(req.url || "/", `http://${host}`);
|
|
3310
|
+
if (reqUrl.pathname !== "/callback") {
|
|
3311
|
+
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
3312
|
+
res.end("Not Found");
|
|
3313
|
+
return;
|
|
3314
|
+
}
|
|
3315
|
+
const queryError = reqUrl.searchParams.get("error");
|
|
3316
|
+
const queryErrorDesc = reqUrl.searchParams.get("error_description");
|
|
3317
|
+
if (queryError) {
|
|
3318
|
+
const errorMsg = queryErrorDesc || queryError;
|
|
3319
|
+
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
3320
|
+
res.end(errorHtml(`Authorization error: ${errorMsg}`, opts.logoUrl));
|
|
3321
|
+
if (callbackReject) {
|
|
3322
|
+
callbackReject(new Error(`OAuth error: ${errorMsg}`));
|
|
3323
|
+
callbackReject = null;
|
|
3324
|
+
}
|
|
3325
|
+
return;
|
|
3326
|
+
}
|
|
3327
|
+
const state = reqUrl.searchParams.get("state");
|
|
3328
|
+
if (state !== opts.expectedState) {
|
|
3329
|
+
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
3330
|
+
res.end(errorHtml("Invalid CSRF state. Authorization request aborted.", opts.logoUrl));
|
|
3331
|
+
if (callbackReject) {
|
|
3332
|
+
callbackReject(new Error("State mismatch: potential CSRF detected"));
|
|
3333
|
+
callbackReject = null;
|
|
3334
|
+
}
|
|
3335
|
+
return;
|
|
3336
|
+
}
|
|
3337
|
+
const code = reqUrl.searchParams.get("code");
|
|
3338
|
+
if (!code) {
|
|
3339
|
+
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
3340
|
+
res.end(errorHtml("Missing authorization code in callback.", opts.logoUrl));
|
|
3341
|
+
if (callbackReject) {
|
|
3342
|
+
callbackReject(new Error("Missing authorization code in callback"));
|
|
3343
|
+
callbackReject = null;
|
|
3344
|
+
}
|
|
3345
|
+
return;
|
|
3346
|
+
}
|
|
3347
|
+
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
3348
|
+
res.end(successHtml(opts.logoUrl));
|
|
3349
|
+
if (callbackResolve) {
|
|
3350
|
+
callbackResolve(code);
|
|
3351
|
+
callbackResolve = null;
|
|
3352
|
+
}
|
|
3353
|
+
} catch (err) {
|
|
3354
|
+
res.writeHead(500, { "Content-Type": "text/plain" });
|
|
3355
|
+
res.end("Internal Server Error");
|
|
3356
|
+
if (callbackReject) {
|
|
3357
|
+
callbackReject(err instanceof Error ? err : new Error(String(err)));
|
|
3358
|
+
callbackReject = null;
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
});
|
|
3362
|
+
const bindHost = opts.host || "127.0.0.1";
|
|
3363
|
+
const redirectHost = opts.redirectHost || bindHost;
|
|
3364
|
+
await new Promise((resolve, reject) => {
|
|
3365
|
+
server.once("error", reject);
|
|
3366
|
+
server.listen(opts.port || 0, bindHost, () => {
|
|
3367
|
+
server.removeListener("error", reject);
|
|
3368
|
+
resolve();
|
|
3369
|
+
});
|
|
3370
|
+
});
|
|
3371
|
+
const address = server.address();
|
|
3372
|
+
const port = typeof address === "object" && address ? address.port : 0;
|
|
3373
|
+
const redirectUri = `http://${redirectHost}:${port}/callback`;
|
|
3374
|
+
const close = async () => {
|
|
3375
|
+
if (timer) {
|
|
3376
|
+
clearTimeout(timer);
|
|
3377
|
+
timer = null;
|
|
3378
|
+
}
|
|
3379
|
+
return new Promise((resolve) => {
|
|
3380
|
+
server.close(() => resolve());
|
|
3381
|
+
});
|
|
3382
|
+
};
|
|
3383
|
+
const timeoutMs = opts.timeoutMs ?? 12e4;
|
|
3384
|
+
if (timeoutMs > 0) {
|
|
3385
|
+
timer = setTimeout(() => {
|
|
3386
|
+
if (callbackReject) {
|
|
3387
|
+
callbackReject(new Error("Authentication timed out waiting for browser callback"));
|
|
3388
|
+
callbackReject = null;
|
|
3389
|
+
}
|
|
3390
|
+
close().catch(() => {
|
|
3391
|
+
});
|
|
3392
|
+
}, timeoutMs);
|
|
3393
|
+
}
|
|
3394
|
+
const waitForCallback = async () => {
|
|
3395
|
+
try {
|
|
3396
|
+
return await callbackPromise;
|
|
3397
|
+
} finally {
|
|
3398
|
+
await close();
|
|
3399
|
+
}
|
|
3400
|
+
};
|
|
3401
|
+
return {
|
|
3402
|
+
port,
|
|
3403
|
+
redirectUri,
|
|
3404
|
+
waitForCallback,
|
|
3405
|
+
close
|
|
3406
|
+
};
|
|
3407
|
+
}
|
|
3408
|
+
function openBrowser(url) {
|
|
3409
|
+
return new Promise((resolve) => {
|
|
3410
|
+
let cmd = "open";
|
|
3411
|
+
let args = [url];
|
|
3412
|
+
if (process.platform === "win32") {
|
|
3413
|
+
cmd = "cmd";
|
|
3414
|
+
args = ["/c", "start", '""', url];
|
|
3415
|
+
} else if (process.platform !== "darwin") {
|
|
3416
|
+
cmd = "xdg-open";
|
|
3417
|
+
args = [url];
|
|
3418
|
+
}
|
|
3419
|
+
try {
|
|
3420
|
+
const cp = spawn(cmd, args, { stdio: "ignore", detached: true });
|
|
3421
|
+
cp.on("error", () => resolve(false));
|
|
3422
|
+
cp.unref();
|
|
3423
|
+
resolve(true);
|
|
3424
|
+
} catch {
|
|
3425
|
+
resolve(false);
|
|
3426
|
+
}
|
|
3427
|
+
});
|
|
3428
|
+
}
|
|
3429
|
+
async function exchangeAuthorizationCode(opts) {
|
|
3430
|
+
const tokenUrl = `${opts.baseUrl}/oauth/token`;
|
|
3431
|
+
const params = new URLSearchParams({
|
|
3432
|
+
grant_type: "authorization_code",
|
|
3433
|
+
client_id: OAUTH_CLIENT_ID,
|
|
3434
|
+
code: opts.code,
|
|
3435
|
+
code_verifier: opts.verifier,
|
|
3436
|
+
redirect_uri: opts.redirectUri
|
|
3437
|
+
});
|
|
3438
|
+
const response = await fetch(tokenUrl, {
|
|
3439
|
+
method: "POST",
|
|
3440
|
+
headers: {
|
|
3441
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3442
|
+
},
|
|
3443
|
+
body: params.toString()
|
|
3444
|
+
});
|
|
3445
|
+
if (!response.ok) {
|
|
3446
|
+
let errorMessage = `Token exchange failed with status ${response.status}`;
|
|
3447
|
+
try {
|
|
3448
|
+
const errBody = await response.json();
|
|
3449
|
+
if (errBody.error_description) {
|
|
3450
|
+
errorMessage = errBody.error_description;
|
|
3451
|
+
} else if (errBody.error) {
|
|
3452
|
+
errorMessage = `OAuth error: ${errBody.error}`;
|
|
3453
|
+
}
|
|
3454
|
+
} catch {
|
|
3455
|
+
}
|
|
3456
|
+
throw new Error(errorMessage);
|
|
3457
|
+
}
|
|
3458
|
+
return await response.json();
|
|
3459
|
+
}
|
|
3460
|
+
async function refreshAccessToken(opts) {
|
|
3461
|
+
const tokenUrl = `${opts.baseUrl}/oauth/token`;
|
|
3462
|
+
const params = new URLSearchParams({
|
|
3463
|
+
grant_type: "refresh_token",
|
|
3464
|
+
client_id: OAUTH_CLIENT_ID,
|
|
3465
|
+
refresh_token: opts.refreshToken
|
|
3466
|
+
});
|
|
3467
|
+
const response = await fetch(tokenUrl, {
|
|
3468
|
+
method: "POST",
|
|
3469
|
+
headers: {
|
|
3470
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3471
|
+
},
|
|
3472
|
+
body: params.toString()
|
|
3473
|
+
});
|
|
3474
|
+
if (!response.ok) {
|
|
3475
|
+
let errorMessage = `Token refresh failed with status ${response.status}`;
|
|
3476
|
+
try {
|
|
3477
|
+
const errBody = await response.json();
|
|
3478
|
+
if (errBody.error_description) {
|
|
3479
|
+
errorMessage = errBody.error_description;
|
|
3480
|
+
} else if (errBody.error) {
|
|
3481
|
+
errorMessage = `OAuth error: ${errBody.error}`;
|
|
3482
|
+
}
|
|
3483
|
+
} catch {
|
|
3484
|
+
}
|
|
3485
|
+
throw new Error(errorMessage);
|
|
3486
|
+
}
|
|
3487
|
+
return await response.json();
|
|
3488
|
+
}
|
|
3489
|
+
async function loginWithOAuth(opts) {
|
|
3490
|
+
const baseUrl = getOAuthBaseUrl(opts.apiUrl);
|
|
3491
|
+
const verifier = createVerifier();
|
|
3492
|
+
const challenge = createCodeChallenge(verifier);
|
|
3493
|
+
const timeoutMs = (opts.timeoutSeconds ?? 120) * 1e3;
|
|
3494
|
+
if (opts.manual) {
|
|
3495
|
+
const redirectUri = OOB_REDIRECT_URI;
|
|
3496
|
+
const authorizeUrl2 = new URL(`${baseUrl}/oauth/authorize`);
|
|
3497
|
+
authorizeUrl2.searchParams.set("client_id", OAUTH_CLIENT_ID);
|
|
3498
|
+
authorizeUrl2.searchParams.set("redirect_uri", redirectUri);
|
|
3499
|
+
authorizeUrl2.searchParams.set("response_type", "code");
|
|
3500
|
+
authorizeUrl2.searchParams.set("code_challenge", challenge);
|
|
3501
|
+
authorizeUrl2.searchParams.set("code_challenge_method", "S256");
|
|
3502
|
+
console.log(pc.bold("\nManual Onus OAuth Authorization:"));
|
|
3503
|
+
console.log("Open the following URL in your browser:\n");
|
|
3504
|
+
console.log(pc.cyan(authorizeUrl2.toString()));
|
|
3505
|
+
console.log("\nApprove access and copy the authorization code.\n");
|
|
3506
|
+
let code = "";
|
|
3507
|
+
if (opts.promptFn) {
|
|
3508
|
+
code = (await opts.promptFn("Enter authorization code: ")).trim();
|
|
3509
|
+
} else {
|
|
3510
|
+
const rl = readline.createInterface({ input, output });
|
|
3511
|
+
try {
|
|
3512
|
+
code = (await rl.question("Enter authorization code: ")).trim();
|
|
3513
|
+
} finally {
|
|
3514
|
+
rl.close();
|
|
3515
|
+
}
|
|
3516
|
+
}
|
|
3517
|
+
if (!code) {
|
|
3518
|
+
throw new Error("Authorization code cannot be empty.");
|
|
3519
|
+
}
|
|
3520
|
+
const tokens = await exchangeAuthorizationCode({
|
|
3521
|
+
baseUrl,
|
|
3522
|
+
code,
|
|
3523
|
+
verifier,
|
|
3524
|
+
redirectUri
|
|
3525
|
+
});
|
|
3526
|
+
return {
|
|
3527
|
+
token: tokens.access_token,
|
|
3528
|
+
refreshToken: tokens.refresh_token,
|
|
3529
|
+
apiUrl: opts.apiUrl
|
|
3530
|
+
};
|
|
3531
|
+
}
|
|
3532
|
+
const state = createState();
|
|
3533
|
+
const server = await startLoopbackServer({
|
|
3534
|
+
expectedState: state,
|
|
3535
|
+
timeoutMs,
|
|
3536
|
+
logoUrl: `${baseUrl}/images/logo.png`,
|
|
3537
|
+
...opts.loopbackHost ? { host: opts.loopbackHost } : {}
|
|
3538
|
+
});
|
|
3539
|
+
const authorizeUrl = new URL(`${baseUrl}/oauth/authorize`);
|
|
3540
|
+
authorizeUrl.searchParams.set("client_id", OAUTH_CLIENT_ID);
|
|
3541
|
+
authorizeUrl.searchParams.set("redirect_uri", server.redirectUri);
|
|
3542
|
+
authorizeUrl.searchParams.set("response_type", "code");
|
|
3543
|
+
authorizeUrl.searchParams.set("code_challenge", challenge);
|
|
3544
|
+
authorizeUrl.searchParams.set("code_challenge_method", "S256");
|
|
3545
|
+
authorizeUrl.searchParams.set("state", state);
|
|
3546
|
+
console.log(pc.bold("\nInitiating Onus OAuth login..."));
|
|
3547
|
+
console.log("If your browser does not open automatically, visit:");
|
|
3548
|
+
console.log(pc.cyan(authorizeUrl.toString()));
|
|
3549
|
+
console.log("\nWaiting for authentication in browser...");
|
|
3550
|
+
const opener = opts.openBrowserFn || openBrowser;
|
|
3551
|
+
await opener(authorizeUrl.toString());
|
|
3552
|
+
try {
|
|
3553
|
+
const code = await server.waitForCallback();
|
|
3554
|
+
const tokens = await exchangeAuthorizationCode({
|
|
3555
|
+
baseUrl,
|
|
3556
|
+
code,
|
|
3557
|
+
verifier,
|
|
3558
|
+
redirectUri: server.redirectUri
|
|
3559
|
+
});
|
|
3560
|
+
return {
|
|
3561
|
+
token: tokens.access_token,
|
|
3562
|
+
refreshToken: tokens.refresh_token,
|
|
3563
|
+
apiUrl: opts.apiUrl
|
|
3564
|
+
};
|
|
3565
|
+
} catch (err) {
|
|
3566
|
+
await server.close().catch(() => {
|
|
3567
|
+
});
|
|
3568
|
+
throw err;
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
|
|
3572
|
+
// src/version.ts
|
|
3573
|
+
import { readFileSync } from "fs";
|
|
3574
|
+
import { dirname, join } from "path";
|
|
3575
|
+
import { fileURLToPath } from "url";
|
|
3576
|
+
var moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
3577
|
+
var pkg = JSON.parse(readFileSync(join(moduleDir, "../package.json"), "utf8"));
|
|
3578
|
+
var cliVersion = pkg.version;
|
|
3579
|
+
|
|
3580
|
+
// src/client.ts
|
|
3581
|
+
function createApiClient(options = {}) {
|
|
3582
|
+
const config = loadConfig();
|
|
3583
|
+
const basePath = (options.apiUrl || config.apiUrl || "").replace(/\/+$/, "");
|
|
3584
|
+
const customFetch = async (url, init) => {
|
|
3585
|
+
const baseFetch = options.fetchApi || fetch;
|
|
3586
|
+
const response = await baseFetch(url, init);
|
|
3587
|
+
if (response.status === 401 && !url.toString().includes("/oauth/token")) {
|
|
3588
|
+
const activeConfig = loadConfig();
|
|
3589
|
+
if (activeConfig.refreshToken) {
|
|
3590
|
+
try {
|
|
3591
|
+
const baseUrl = getOAuthBaseUrl(basePath);
|
|
3592
|
+
const refreshed = await refreshAccessToken({
|
|
3593
|
+
baseUrl,
|
|
3594
|
+
refreshToken: activeConfig.refreshToken
|
|
3595
|
+
});
|
|
3596
|
+
saveConfig({
|
|
3597
|
+
token: refreshed.access_token,
|
|
3598
|
+
...refreshed.refresh_token ? { refreshToken: refreshed.refresh_token } : {}
|
|
3599
|
+
});
|
|
3600
|
+
const newHeaders = new Headers(init?.headers);
|
|
3601
|
+
newHeaders.set("Authorization", `Bearer ${refreshed.access_token}`);
|
|
3602
|
+
return await baseFetch(url, {
|
|
3603
|
+
...init,
|
|
3604
|
+
headers: newHeaders
|
|
3605
|
+
});
|
|
3606
|
+
} catch {
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
return response;
|
|
3611
|
+
};
|
|
3612
|
+
const apiConfig = new Configuration({
|
|
3613
|
+
basePath,
|
|
3614
|
+
// Return dynamic/current token so refreshed tokens are automatically used
|
|
3615
|
+
accessToken: () => {
|
|
3616
|
+
const current = options.token || loadConfig().token;
|
|
3617
|
+
return current || "";
|
|
3618
|
+
},
|
|
3619
|
+
fetchApi: customFetch,
|
|
3620
|
+
headers: {
|
|
3621
|
+
"User-Agent": `Onus-CLI/${cliVersion}`
|
|
3622
|
+
}
|
|
3623
|
+
});
|
|
3624
|
+
return new DefaultApi(apiConfig);
|
|
3625
|
+
}
|
|
3626
|
+
|
|
3627
|
+
export {
|
|
3628
|
+
cliVersion,
|
|
3629
|
+
loginWithOAuth,
|
|
3630
|
+
createApiClient
|
|
3631
|
+
};
|