Skip to content

Commit 30eaa6b

Browse files
feat: Include URL into FetchOptions (box/box-codegen#549) (#319)
1 parent 340fbd8 commit 30eaa6b

File tree

74 files changed

+2811
-3293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2811
-3293
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "6dfffba", "specHash": "57614c2", "version": "1.4.0" }
1+
{ "engineHash": "2bf4a47", "specHash": "57614c2", "version": "1.4.0" }

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/managers/ai.generated.ts

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -221,19 +221,20 @@ export class AiManager {
221221
const headersMap: {
222222
readonly [key: string]: string;
223223
} = prepareParams({ ...{}, ...headers.extraHeaders });
224-
const response: FetchResponse = (await fetch(
225-
''.concat(this.networkSession.baseUrls.baseUrl, '/2.0/ai/ask') as string,
226-
{
227-
method: 'POST',
228-
headers: headersMap,
229-
data: serializeAiAsk(requestBody),
230-
contentType: 'application/json',
231-
responseFormat: 'json',
232-
auth: this.auth,
233-
networkSession: this.networkSession,
234-
cancellationToken: cancellationToken,
235-
} satisfies FetchOptions
236-
)) as FetchResponse;
224+
const response: FetchResponse = (await fetch({
225+
url: ''.concat(
226+
this.networkSession.baseUrls.baseUrl,
227+
'/2.0/ai/ask'
228+
) as string,
229+
method: 'POST',
230+
headers: headersMap,
231+
data: serializeAiAsk(requestBody),
232+
contentType: 'application/json',
233+
responseFormat: 'json',
234+
auth: this.auth,
235+
networkSession: this.networkSession,
236+
cancellationToken: cancellationToken,
237+
} satisfies FetchOptions)) as FetchResponse;
237238
return deserializeAiResponseFull(response.data);
238239
}
239240
/**
@@ -255,22 +256,20 @@ export class AiManager {
255256
const headersMap: {
256257
readonly [key: string]: string;
257258
} = prepareParams({ ...{}, ...headers.extraHeaders });
258-
const response: FetchResponse = (await fetch(
259-
''.concat(
259+
const response: FetchResponse = (await fetch({
260+
url: ''.concat(
260261
this.networkSession.baseUrls.baseUrl,
261262
'/2.0/ai/text_gen'
262263
) as string,
263-
{
264-
method: 'POST',
265-
headers: headersMap,
266-
data: serializeAiTextGen(requestBody),
267-
contentType: 'application/json',
268-
responseFormat: 'json',
269-
auth: this.auth,
270-
networkSession: this.networkSession,
271-
cancellationToken: cancellationToken,
272-
} satisfies FetchOptions
273-
)) as FetchResponse;
264+
method: 'POST',
265+
headers: headersMap,
266+
data: serializeAiTextGen(requestBody),
267+
contentType: 'application/json',
268+
responseFormat: 'json',
269+
auth: this.auth,
270+
networkSession: this.networkSession,
271+
cancellationToken: cancellationToken,
272+
} satisfies FetchOptions)) as FetchResponse;
274273
return deserializeAiResponse(response.data);
275274
}
276275
/**
@@ -300,21 +299,19 @@ export class AiManager {
300299
const headersMap: {
301300
readonly [key: string]: string;
302301
} = prepareParams({ ...{}, ...headers.extraHeaders });
303-
const response: FetchResponse = (await fetch(
304-
''.concat(
302+
const response: FetchResponse = (await fetch({
303+
url: ''.concat(
305304
this.networkSession.baseUrls.baseUrl,
306305
'/2.0/ai_agent_default'
307306
) as string,
308-
{
309-
method: 'GET',
310-
params: queryParamsMap,
311-
headers: headersMap,
312-
responseFormat: 'json',
313-
auth: this.auth,
314-
networkSession: this.networkSession,
315-
cancellationToken: cancellationToken,
316-
} satisfies FetchOptions
317-
)) as FetchResponse;
307+
method: 'GET',
308+
params: queryParamsMap,
309+
headers: headersMap,
310+
responseFormat: 'json',
311+
auth: this.auth,
312+
networkSession: this.networkSession,
313+
cancellationToken: cancellationToken,
314+
} satisfies FetchOptions)) as FetchResponse;
318315
return deserializeAiAgentAskOrAiAgentTextGen(response.data);
319316
}
320317
}

src/managers/authorization.generated.ts

Lines changed: 46 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,19 @@ export class AuthorizationManager {
303303
const headersMap: {
304304
readonly [key: string]: string;
305305
} = prepareParams({ ...{}, ...headers.extraHeaders });
306-
const response: FetchResponse = (await fetch(
307-
''.concat(this.networkSession.baseUrls.oauth2Url, '/authorize') as string,
308-
{
309-
method: 'GET',
310-
params: queryParamsMap,
311-
headers: headersMap,
312-
responseFormat: void 0,
313-
auth: this.auth,
314-
networkSession: this.networkSession,
315-
cancellationToken: cancellationToken,
316-
} satisfies FetchOptions
317-
)) as FetchResponse;
306+
const response: FetchResponse = (await fetch({
307+
url: ''.concat(
308+
this.networkSession.baseUrls.oauth2Url,
309+
'/authorize'
310+
) as string,
311+
method: 'GET',
312+
params: queryParamsMap,
313+
headers: headersMap,
314+
responseFormat: void 0,
315+
auth: this.auth,
316+
networkSession: this.networkSession,
317+
cancellationToken: cancellationToken,
318+
} satisfies FetchOptions)) as FetchResponse;
318319
return void 0;
319320
}
320321
/**
@@ -348,22 +349,20 @@ export class AuthorizationManager {
348349
const headersMap: {
349350
readonly [key: string]: string;
350351
} = prepareParams({ ...{}, ...headers.extraHeaders });
351-
const response: FetchResponse = (await fetch(
352-
''.concat(
352+
const response: FetchResponse = (await fetch({
353+
url: ''.concat(
353354
this.networkSession.baseUrls.baseUrl,
354355
'/oauth2/token'
355356
) as string,
356-
{
357-
method: 'POST',
358-
headers: headersMap,
359-
data: serializePostOAuth2Token(requestBody),
360-
contentType: 'application/x-www-form-urlencoded',
361-
responseFormat: 'json',
362-
auth: this.auth,
363-
networkSession: this.networkSession,
364-
cancellationToken: cancellationToken,
365-
} satisfies FetchOptions
366-
)) as FetchResponse;
357+
method: 'POST',
358+
headers: headersMap,
359+
data: serializePostOAuth2Token(requestBody),
360+
contentType: 'application/x-www-form-urlencoded',
361+
responseFormat: 'json',
362+
auth: this.auth,
363+
networkSession: this.networkSession,
364+
cancellationToken: cancellationToken,
365+
} satisfies FetchOptions)) as FetchResponse;
367366
return deserializeAccessToken(response.data);
368367
}
369368
/**
@@ -393,22 +392,20 @@ export class AuthorizationManager {
393392
const headersMap: {
394393
readonly [key: string]: string;
395394
} = prepareParams({ ...{}, ...headers.extraHeaders });
396-
const response: FetchResponse = (await fetch(
397-
''.concat(
395+
const response: FetchResponse = (await fetch({
396+
url: ''.concat(
398397
this.networkSession.baseUrls.baseUrl,
399398
'/oauth2/token#refresh'
400399
) as string,
401-
{
402-
method: 'POST',
403-
headers: headersMap,
404-
data: serializePostOAuth2TokenRefreshAccessToken(requestBody),
405-
contentType: 'application/x-www-form-urlencoded',
406-
responseFormat: 'json',
407-
auth: this.auth,
408-
networkSession: this.networkSession,
409-
cancellationToken: cancellationToken,
410-
} satisfies FetchOptions
411-
)) as FetchResponse;
400+
method: 'POST',
401+
headers: headersMap,
402+
data: serializePostOAuth2TokenRefreshAccessToken(requestBody),
403+
contentType: 'application/x-www-form-urlencoded',
404+
responseFormat: 'json',
405+
auth: this.auth,
406+
networkSession: this.networkSession,
407+
cancellationToken: cancellationToken,
408+
} satisfies FetchOptions)) as FetchResponse;
412409
return deserializeAccessToken(response.data);
413410
}
414411
/**
@@ -432,22 +429,20 @@ export class AuthorizationManager {
432429
const headersMap: {
433430
readonly [key: string]: string;
434431
} = prepareParams({ ...{}, ...headers.extraHeaders });
435-
const response: FetchResponse = (await fetch(
436-
''.concat(
432+
const response: FetchResponse = (await fetch({
433+
url: ''.concat(
437434
this.networkSession.baseUrls.baseUrl,
438435
'/oauth2/revoke'
439436
) as string,
440-
{
441-
method: 'POST',
442-
headers: headersMap,
443-
data: serializePostOAuth2Revoke(requestBody),
444-
contentType: 'application/x-www-form-urlencoded',
445-
responseFormat: void 0,
446-
auth: this.auth,
447-
networkSession: this.networkSession,
448-
cancellationToken: cancellationToken,
449-
} satisfies FetchOptions
450-
)) as FetchResponse;
437+
method: 'POST',
438+
headers: headersMap,
439+
data: serializePostOAuth2Revoke(requestBody),
440+
contentType: 'application/x-www-form-urlencoded',
441+
responseFormat: void 0,
442+
auth: this.auth,
443+
networkSession: this.networkSession,
444+
cancellationToken: cancellationToken,
445+
} satisfies FetchOptions)) as FetchResponse;
451446
return void 0;
452447
}
453448
}

src/managers/avatars.generated.ts

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,20 @@ export class AvatarsManager {
200200
const headersMap: {
201201
readonly [key: string]: string;
202202
} = prepareParams({ ...{}, ...headers.extraHeaders });
203-
const response: FetchResponse = (await fetch(
204-
''.concat(
203+
const response: FetchResponse = (await fetch({
204+
url: ''.concat(
205205
this.networkSession.baseUrls.baseUrl,
206206
'/2.0/users/',
207207
toString(userId) as string,
208208
'/avatar'
209209
) as string,
210-
{
211-
method: 'GET',
212-
headers: headersMap,
213-
responseFormat: 'binary',
214-
auth: this.auth,
215-
networkSession: this.networkSession,
216-
cancellationToken: cancellationToken,
217-
} satisfies FetchOptions
218-
)) as FetchResponse;
210+
method: 'GET',
211+
headers: headersMap,
212+
responseFormat: 'binary',
213+
auth: this.auth,
214+
networkSession: this.networkSession,
215+
cancellationToken: cancellationToken,
216+
} satisfies FetchOptions)) as FetchResponse;
219217
return response.content;
220218
}
221219
/**
@@ -240,31 +238,29 @@ export class AvatarsManager {
240238
const headersMap: {
241239
readonly [key: string]: string;
242240
} = prepareParams({ ...{}, ...headers.extraHeaders });
243-
const response: FetchResponse = (await fetch(
244-
''.concat(
241+
const response: FetchResponse = (await fetch({
242+
url: ''.concat(
245243
this.networkSession.baseUrls.baseUrl,
246244
'/2.0/users/',
247245
toString(userId) as string,
248246
'/avatar'
249247
) as string,
250-
{
251-
method: 'POST',
252-
headers: headersMap,
253-
multipartData: [
254-
{
255-
partName: 'pic',
256-
fileStream: requestBody.pic,
257-
fileName: requestBody.picFileName,
258-
contentType: requestBody.picContentType,
259-
} satisfies MultipartItem,
260-
],
261-
contentType: 'multipart/form-data',
262-
responseFormat: 'json',
263-
auth: this.auth,
264-
networkSession: this.networkSession,
265-
cancellationToken: cancellationToken,
266-
} satisfies FetchOptions
267-
)) as FetchResponse;
248+
method: 'POST',
249+
headers: headersMap,
250+
multipartData: [
251+
{
252+
partName: 'pic',
253+
fileStream: requestBody.pic,
254+
fileName: requestBody.picFileName,
255+
contentType: requestBody.picContentType,
256+
} satisfies MultipartItem,
257+
],
258+
contentType: 'multipart/form-data',
259+
responseFormat: 'json',
260+
auth: this.auth,
261+
networkSession: this.networkSession,
262+
cancellationToken: cancellationToken,
263+
} satisfies FetchOptions)) as FetchResponse;
268264
return deserializeUserAvatar(response.data);
269265
}
270266
/**
@@ -288,22 +284,20 @@ export class AvatarsManager {
288284
const headersMap: {
289285
readonly [key: string]: string;
290286
} = prepareParams({ ...{}, ...headers.extraHeaders });
291-
const response: FetchResponse = (await fetch(
292-
''.concat(
287+
const response: FetchResponse = (await fetch({
288+
url: ''.concat(
293289
this.networkSession.baseUrls.baseUrl,
294290
'/2.0/users/',
295291
toString(userId) as string,
296292
'/avatar'
297293
) as string,
298-
{
299-
method: 'DELETE',
300-
headers: headersMap,
301-
responseFormat: void 0,
302-
auth: this.auth,
303-
networkSession: this.networkSession,
304-
cancellationToken: cancellationToken,
305-
} satisfies FetchOptions
306-
)) as FetchResponse;
294+
method: 'DELETE',
295+
headers: headersMap,
296+
responseFormat: void 0,
297+
auth: this.auth,
298+
networkSession: this.networkSession,
299+
cancellationToken: cancellationToken,
300+
} satisfies FetchOptions)) as FetchResponse;
307301
return void 0;
308302
}
309303
}

0 commit comments

Comments
 (0)