diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ArrayParameterTests.When_parameter_is_array_then_TypeScript_is_correct.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ArrayParameterTests.When_parameter_is_array_then_TypeScript_is_correct.verified.txt index f3b2d8b6a..155b67b28 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ArrayParameterTests.When_parameter_is_array_then_TypeScript_is_correct.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ArrayParameterTests.When_parameter_is_array_then_TypeScript_is_correct.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class MyClass { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "http://localhost:8080/"; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ArrayParameterTests.when_content_is_formdata_with_property_array_then_content_should_be_added_in_foreach_in_typescript.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ArrayParameterTests.when_content_is_formdata_with_property_array_then_content_should_be_added_in_foreach_in_typescript.verified.txt index 6e898ee9d..4223bcd3e 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ArrayParameterTests.when_content_is_formdata_with_property_array_then_content_should_be_added_in_foreach_in_typescript.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ArrayParameterTests.when_content_is_formdata_with_property_array_then_content_should_be_added_in_foreach_in_typescript.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class FileUploadClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInMultipartFileArray_ThenFormDataIsUsedInTypeScript.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInMultipartFileArray_ThenFormDataIsUsedInTypeScript.verified.txt index ab2543b40..c76e06a76 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInMultipartFileArray_ThenFormDataIsUsedInTypeScript.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInMultipartFileArray_ThenFormDataIsUsedInTypeScript.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class FileUploadClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInNestedMultipartForm_ThenFormDataIsUsedInTypeScript.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInNestedMultipartForm_ThenFormDataIsUsedInTypeScript.verified.txt index a2a798ff6..0d1ecb05f 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInNestedMultipartForm_ThenFormDataIsUsedInTypeScript.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInNestedMultipartForm_ThenFormDataIsUsedInTypeScript.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class FileUploadClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInSingleMultipartFile_ThenFormDataIsUsedInTypeScript.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInSingleMultipartFile_ThenFormDataIsUsedInTypeScript.verified.txt index 9962319b7..5b355df1c 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInSingleMultipartFile_ThenFormDataIsUsedInTypeScript.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.WhenSpecContainsFormDataInSingleMultipartFile_ThenFormDataIsUsedInTypeScript.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class FileUploadClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.When_body_is_binary_then_blob_is_used_as_parameter_in_TypeScript.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.When_body_is_binary_then_blob_is_used_as_parameter_in_TypeScript.verified.txt index 9fbd5556b..142db2b20 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.When_body_is_binary_then_blob_is_used_as_parameter_in_TypeScript.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/BinaryTests.When_body_is_binary_then_blob_is_used_as_parameter_in_TypeScript.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class Client { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://www.example.com/"; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/CodeGenerationTests.When_generating_TypeScript_code_then_output_contains_expected_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/CodeGenerationTests.When_generating_TypeScript_code_then_output_contains_expected_classes.verified.txt index c4899bfb5..e022a187e 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/CodeGenerationTests.When_generating_TypeScript_code_then_output_contains_expected_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/CodeGenerationTests.When_generating_TypeScript_code_then_output_contains_expected_classes.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class MyClass { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/CodeGenerationTests.When_path_starts_with_numeric_can_generate_client.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/CodeGenerationTests.When_path_starts_with_numeric_can_generate_client.verified.txt index 12c27726b..1a4af9ec6 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/CodeGenerationTests.When_path_starts_with_numeric_can_generate_client.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/CodeGenerationTests.When_path_starts_with_numeric_can_generate_client.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class Client { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://myapi.centralus-01.azurewebsites.net/"; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_abort_signal.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_abort_signal.verified.txt index cf919b886..fbaf6628e 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_abort_signal.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_abort_signal.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class UrlEncodedRequestConsumingClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_abort_signal_and_generate_client_interfaces_interface_contains_signal_param.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_abort_signal_and_generate_client_interfaces_interface_contains_signal_param.verified.txt index 930590b58..33c0c6d20 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_abort_signal_and_generate_client_interfaces_interface_contains_signal_param.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_abort_signal_and_generate_client_interfaces_interface_contains_signal_param.verified.txt @@ -9,12 +9,12 @@ export interface IUrlEncodedRequestConsumingClient { } export class UrlEncodedRequestConsumingClient implements IUrlEncodedRequestConsumingClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt index 2413419e3..7c31c91cc 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class UrlEncodedRequestConsumingClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt index 930f14de6..c4ee1cb2c 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt @@ -7,12 +7,12 @@ interface IDiscussionClient { } class DiscussionClient implements IDiscussionClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_export_types_is_true_then_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_export_types_is_true_then_add_export_before_classes.verified.txt index ac37aed29..8bd92a822 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_export_types_is_true_then_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_export_types_is_true_then_add_export_before_classes.verified.txt @@ -7,12 +7,12 @@ export interface IDiscussionClient { } export class DiscussionClient implements IDiscussionClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_include_RequestCredentialsType_Include.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_include_RequestCredentialsType_Include.verified.txt index 689b5f3e8..3f2450e6b 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_include_RequestCredentialsType_Include.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_include_RequestCredentialsType_Include.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class UrlEncodedRequestConsumingClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_include_RequestModeType_Cors.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_include_RequestModeType_Cors.verified.txt index f47420ce1..34ae1a61e 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_include_RequestModeType_Cors.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_include_RequestModeType_Cors.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class UrlEncodedRequestConsumingClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_no_abort_signal.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_no_abort_signal.verified.txt index 2413419e3..7c31c91cc 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_no_abort_signal.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_no_abort_signal.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class UrlEncodedRequestConsumingClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Aurelia.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Aurelia.verified.txt index 38a1caf27..347da19ea 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Aurelia.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Aurelia.verified.txt @@ -7,12 +7,12 @@ import { HttpClient, RequestInit } from 'aurelia-fetch-client'; @inject(String, HttpClient) export class Client { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37289,12 +37289,12 @@ export class Client { @inject(String, HttpClient) export class AddonPropertiesResource_getAddonPropertiesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37350,12 +37350,12 @@ export class AddonPropertiesResource_getAddonPropertiesClient { @inject(String, HttpClient) export class AddonPropertiesResource_deleteAddonPropertyClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37425,12 +37425,12 @@ export class AddonPropertiesResource_deleteAddonPropertyClient { @inject(String, HttpClient) export class AddonPropertiesResource_getAddonPropertyClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37504,12 +37504,12 @@ export class AddonPropertiesResource_getAddonPropertyClient { @inject(String, HttpClient) export class AddonPropertiesResource_putAddonPropertyClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37587,12 +37587,12 @@ export class AddonPropertiesResource_putAddonPropertyClient { @inject(String, HttpClient) export class DynamicModulesResource_removeModulesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37647,12 +37647,12 @@ export class DynamicModulesResource_removeModulesClient { @inject(String, HttpClient) export class DynamicModulesResource_getModulesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37704,12 +37704,12 @@ export class DynamicModulesResource_getModulesClient { @inject(String, HttpClient) export class DynamicModulesResource_registerModulesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37768,12 +37768,12 @@ export class DynamicModulesResource_registerModulesClient { @inject(String, HttpClient) export class AppIssueFieldValueUpdateResource_updateIssueFieldsClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37833,12 +37833,12 @@ export class AppIssueFieldValueUpdateResource_updateIssueFieldsClient { @inject(String, HttpClient) export class MigrationResource_updateEntityPropertiesValueClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37897,12 +37897,12 @@ export class MigrationResource_updateEntityPropertiesValueClient { @inject(String, HttpClient) export class MigrationResource_workflowRuleSearchClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37961,12 +37961,12 @@ export class MigrationResource_workflowRuleSearchClient { @inject(String, HttpClient) export class ServiceRegistryResource_servicesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Fetch.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Fetch.verified.txt index 84df8e886..f2b52388d 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Fetch.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Fetch.verified.txt @@ -3,12 +3,12 @@ // ReSharper disable InconsistentNaming export class Client { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37284,12 +37284,12 @@ export class Client { } export class AddonPropertiesResource_getAddonPropertiesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37344,12 +37344,12 @@ export class AddonPropertiesResource_getAddonPropertiesClient { } export class AddonPropertiesResource_deleteAddonPropertyClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37418,12 +37418,12 @@ export class AddonPropertiesResource_deleteAddonPropertyClient { } export class AddonPropertiesResource_getAddonPropertyClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37496,12 +37496,12 @@ export class AddonPropertiesResource_getAddonPropertyClient { } export class AddonPropertiesResource_putAddonPropertyClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37578,12 +37578,12 @@ export class AddonPropertiesResource_putAddonPropertyClient { } export class DynamicModulesResource_removeModulesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37637,12 +37637,12 @@ export class DynamicModulesResource_removeModulesClient { } export class DynamicModulesResource_getModulesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37693,12 +37693,12 @@ export class DynamicModulesResource_getModulesClient { } export class DynamicModulesResource_registerModulesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37756,12 +37756,12 @@ export class DynamicModulesResource_registerModulesClient { } export class AppIssueFieldValueUpdateResource_updateIssueFieldsClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37820,12 +37820,12 @@ export class AppIssueFieldValueUpdateResource_updateIssueFieldsClient { } export class MigrationResource_updateEntityPropertiesValueClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37883,12 +37883,12 @@ export class MigrationResource_updateEntityPropertiesValueClient { } export class MigrationResource_workflowRuleSearchClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } @@ -37946,12 +37946,12 @@ export class MigrationResource_workflowRuleSearchClient { } export class ServiceRegistryResource_servicesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? "https://your-domain.atlassian.net"; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ObjectParameterTests.when_content_is_formdata_with_property_object_then_content_should_be_json_typescript.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ObjectParameterTests.when_content_is_formdata_with_property_object_then_content_should_be_json_typescript.verified.txt index 8bb79ace9..d960c3830 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ObjectParameterTests.when_content_is_formdata_with_property_object_then_content_should_be_json_typescript.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/ObjectParameterTests.when_content_is_formdata_with_property_object_then_content_should_be_json_typescript.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class FileUploadClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/OptionalParameterTests.When_optional_parameter_comes_before_required.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/OptionalParameterTests.When_optional_parameter_comes_before_required.verified.txt index aa00b1de8..b8bf38cf5 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/OptionalParameterTests.When_optional_parameter_comes_before_required.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/OptionalParameterTests.When_optional_parameter_comes_before_required.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class Client { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptDiscriminatorTests.When_parameter_is_abstract_then_generate_union.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptDiscriminatorTests.When_parameter_is_abstract_then_generate_union.verified.txt index 84d6005a0..2020da42c 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptDiscriminatorTests.When_parameter_is_abstract_then_generate_union.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptDiscriminatorTests.When_parameter_is_abstract_then_generate_union.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class DiscriminatorClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_and_ts20_then_it_is_a_union_type_with_undefined.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_and_ts20_then_it_is_a_union_type_with_undefined.verified.txt index 7c7f694ea..d468a7126 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_and_ts20_then_it_is_a_union_type_with_undefined.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_and_ts20_then_it_is_a_union_type_with_undefined.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class NullableParameterClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_and_ts20_then_it_is_not_included_in_query_string.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_and_ts20_then_it_is_not_included_in_query_string.verified.txt index 7c7f694ea..d468a7126 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_and_ts20_then_it_is_not_included_in_query_string.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_and_ts20_then_it_is_not_included_in_query_string.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class NullableParameterClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_optional_and_ts20_then_it_is_a_union_type_with_undefined.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_optional_and_ts20_then_it_is_a_union_type_with_undefined.verified.txt index 3c77a69ae..f12ecedb5 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_optional_and_ts20_then_it_is_a_union_type_with_undefined.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_optional_and_ts20_then_it_is_a_union_type_with_undefined.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class NullableOptionalParameterClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_optional_and_ts20_then_it_is_not_included_in_query_string.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_optional_and_ts20_then_it_is_not_included_in_query_string.verified.txt index 3c77a69ae..f12ecedb5 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_optional_and_ts20_then_it_is_not_included_in_query_string.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/TypeScriptOperationParameterTests.When_parameter_is_nullable_optional_and_ts20_then_it_is_not_included_in_query_string.verified.txt @@ -2,12 +2,12 @@ // ReSharper disable InconsistentNaming export class NullableOptionalParameterClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/temp_7aa36f3f-17b9-44df-818f-20a51fb73bb5.ts b/src/NSwag.CodeGeneration.TypeScript.Tests/temp_7aa36f3f-17b9-44df-818f-20a51fb73bb5.ts index 60ee6bd73..2533c796b 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/temp_7aa36f3f-17b9-44df-818f-20a51fb73bb5.ts +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/temp_7aa36f3f-17b9-44df-818f-20a51fb73bb5.ts @@ -8,12 +8,12 @@ // ReSharper disable InconsistentNaming export class UrlEncodedRequestConsumingClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.CodeGeneration.TypeScript/Templates/FetchClient.liquid b/src/NSwag.CodeGeneration.TypeScript/Templates/FetchClient.liquid index 1dd1a597b..551aedc1c 100644 --- a/src/NSwag.CodeGeneration.TypeScript/Templates/FetchClient.liquid +++ b/src/NSwag.CodeGeneration.TypeScript/Templates/FetchClient.liquid @@ -12,16 +12,16 @@ @inject({% if HasConfigurationClass %}{{ ConfigurationClass }}, {% endif %}String, HttpClient) {%- endif -%} {% if ExportTypes %}export {% endif %}class {{ Class }} {% if HasBaseClass %}extends {{ BaseClass }} {% endif %}{% if GenerateClientInterfaces %}implements I{{ Class }} {% endif %}{ - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; {{ '' }} {%- if HasExtendedConstructor == false -%} - constructor({% if HasConfigurationClass %}configuration: {{ ConfigurationClass }}, {% endif %}baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { + constructor({% if HasConfigurationClass %}configuration: {{ ConfigurationClass }}, {% endif %}baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { {%- if HasBaseClass -%} super({% if HasConfigurationClass %}configuration{% endif %}); {%- endif -%} - this.http = http ? http : window as any; + this.http = http ? http : globalThis as any; {%- if UseGetBaseUrlMethod -%} this.baseUrl = this.getBaseUrl("{{ BaseUrl }}", baseUrl); {%- else -%} diff --git a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET100Minimal_targetFramework=net10.0_generatesCode=True.verified.txt b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET100Minimal_targetFramework=net10.0_generatesCode=True.verified.txt index 7762dc0d9..8d9992407 100644 --- a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET100Minimal_targetFramework=net10.0_generatesCode=True.verified.txt +++ b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET100Minimal_targetFramework=net10.0_generatesCode=True.verified.txt @@ -8,12 +8,12 @@ // ReSharper disable InconsistentNaming export class Client { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } @@ -171,12 +171,12 @@ export class Client { } export class ExampleClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET100_targetFramework=net10.0_generatesCode=True.verified.txt b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET100_targetFramework=net10.0_generatesCode=True.verified.txt index fc50add7c..c0c40d9b7 100644 --- a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET100_targetFramework=net10.0_generatesCode=True.verified.txt +++ b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET100_targetFramework=net10.0_generatesCode=True.verified.txt @@ -8,12 +8,12 @@ // ReSharper disable InconsistentNaming export class ValuesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET70Minimal_targetFramework=net7.0_generatesCode=True.verified.txt b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET70Minimal_targetFramework=net7.0_generatesCode=True.verified.txt index 2dbd64304..1a92b8635 100644 --- a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET70Minimal_targetFramework=net7.0_generatesCode=True.verified.txt +++ b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET70Minimal_targetFramework=net7.0_generatesCode=True.verified.txt @@ -8,12 +8,12 @@ // ReSharper disable InconsistentNaming export class Client { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } @@ -171,12 +171,12 @@ export class Client { } export class ExampleClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET80Minimal_targetFramework=net8.0_generatesCode=True.verified.txt b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET80Minimal_targetFramework=net8.0_generatesCode=True.verified.txt index 7762dc0d9..8d9992407 100644 --- a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET80Minimal_targetFramework=net8.0_generatesCode=True.verified.txt +++ b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET80Minimal_targetFramework=net8.0_generatesCode=True.verified.txt @@ -8,12 +8,12 @@ // ReSharper disable InconsistentNaming export class Client { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } @@ -171,12 +171,12 @@ export class Client { } export class ExampleClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET80_targetFramework=net8.0_generatesCode=True.verified.txt b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET80_targetFramework=net8.0_generatesCode=True.verified.txt index 1841a98f8..ee43afd9b 100644 --- a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET80_targetFramework=net8.0_generatesCode=True.verified.txt +++ b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET80_targetFramework=net8.0_generatesCode=True.verified.txt @@ -8,12 +8,12 @@ // ReSharper disable InconsistentNaming export class ValuesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET90Minimal_targetFramework=net9.0_generatesCode=True.verified.txt b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET90Minimal_targetFramework=net9.0_generatesCode=True.verified.txt index 7762dc0d9..8d9992407 100644 --- a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET90Minimal_targetFramework=net9.0_generatesCode=True.verified.txt +++ b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET90Minimal_targetFramework=net9.0_generatesCode=True.verified.txt @@ -8,12 +8,12 @@ // ReSharper disable InconsistentNaming export class Client { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } @@ -171,12 +171,12 @@ export class Client { } export class ExampleClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; } diff --git a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET90_targetFramework=net9.0_generatesCode=True.verified.txt b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET90_targetFramework=net9.0_generatesCode=True.verified.txt index fc50add7c..c0c40d9b7 100644 --- a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET90_targetFramework=net9.0_generatesCode=True.verified.txt +++ b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckTypeScriptAsync_projectName=NSwag.Sample.NET90_targetFramework=net9.0_generatesCode=True.verified.txt @@ -8,12 +8,12 @@ // ReSharper disable InconsistentNaming export class ValuesClient { - private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; + private http: { fetch(input: string | URL | Request, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { - this.http = http ? http : window as any; + constructor(baseUrl?: string, http?: { fetch(input: string | URL | Request, init?: RequestInit): Promise }) { + this.http = http ? http : globalThis as any; this.baseUrl = baseUrl ?? ""; }