diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt index 3c4719c00..99be7f090 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt @@ -16,15 +16,16 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined): ng.IPromise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - content_ = content_.replace(/&$/, ""); + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -134,4 +135,68 @@ function blobToText(blob: Blob, q: ng.IQService): ng.IPromise { reader.onload = event => resolve((event.target as any).result); reader.readAsText(blob); }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt index 9343d6fd3..bfe645874 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt @@ -20,8 +20,8 @@ class DiscussionClient implements IDiscussionClient { } addMessage(message: Foo | null | undefined): ng.IPromise { - let url_ = this.baseUrl + "/api/Discussion"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/Discussion") + .toString(); const content_ = JSON.stringify(message); @@ -133,4 +133,68 @@ function blobToText(blob: Blob, q: ng.IQService): ng.IPromise { reader.onload = event => resolve((event.target as any).result); reader.readAsText(blob); }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_export_types_is_true_then_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_export_types_is_true_then_add_export_before_classes.verified.txt index cfcde1c3a..48efbf797 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_export_types_is_true_then_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularJSTests.When_export_types_is_true_then_add_export_before_classes.verified.txt @@ -20,8 +20,8 @@ export class DiscussionClient implements IDiscussionClient { } addMessage(message: Foo | null | undefined): ng.IPromise { - let url_ = this.baseUrl + "/api/Discussion"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/Discussion") + .toString(); const content_ = JSON.stringify(message); @@ -133,4 +133,68 @@ function blobToText(blob: Blob, q: ng.IQService): ng.IPromise { reader.onload = event => resolve((event.target as any).result); reader.readAsText(blob); }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt index fa20d5f8e..720e756cf 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt @@ -20,15 +20,16 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined): Observable { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - content_ = content_.replace(/&$/, ""); + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .toString(); let options_ : any = { body: content_, @@ -154,4 +155,68 @@ function blobToText(blob: any): Observable { reader.readAsText(blob); } }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt index 7e8df0a10..6635d3121 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt @@ -26,8 +26,8 @@ class DiscussionClient implements IDiscussionClient { } addMessage(message: Foo): Observable { - let url_ = this.baseUrl + "/Discussion/AddMessage"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/AddMessage") + .toString(); const content_ = JSON.stringify(message); @@ -74,8 +74,8 @@ class DiscussionClient implements IDiscussionClient { } genericRequestTest1(request: GenericRequest1 | null | undefined): Observable { - let url_ = this.baseUrl + "/Discussion/GenericRequestTest1"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest1") + .toString(); const content_ = JSON.stringify(request); @@ -122,8 +122,8 @@ class DiscussionClient implements IDiscussionClient { } genericRequestTest2(request: GenericRequest2 | null | undefined): Observable { - let url_ = this.baseUrl + "/Discussion/GenericRequestTest2"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest2") + .toString(); const content_ = JSON.stringify(request); @@ -440,4 +440,68 @@ function blobToText(blob: any): Observable { reader.readAsText(blob); } }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_export_types_is_true_then_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_export_types_is_true_then_add_export_before_classes.verified.txt index fd2a57b35..ef088f8f4 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_export_types_is_true_then_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_export_types_is_true_then_add_export_before_classes.verified.txt @@ -26,8 +26,8 @@ export class DiscussionClient implements IDiscussionClient { } addMessage(message: Foo): Observable { - let url_ = this.baseUrl + "/Discussion/AddMessage"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/AddMessage") + .toString(); const content_ = JSON.stringify(message); @@ -74,8 +74,8 @@ export class DiscussionClient implements IDiscussionClient { } genericRequestTest1(request: GenericRequest1 | null | undefined): Observable { - let url_ = this.baseUrl + "/Discussion/GenericRequestTest1"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest1") + .toString(); const content_ = JSON.stringify(request); @@ -122,8 +122,8 @@ export class DiscussionClient implements IDiscussionClient { } genericRequestTest2(request: GenericRequest2 | null | undefined): Observable { - let url_ = this.baseUrl + "/Discussion/GenericRequestTest2"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest2") + .toString(); const content_ = JSON.stringify(request); @@ -440,4 +440,68 @@ function blobToText(blob: any): Observable { reader.readAsText(blob); } }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_generic_request.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_generic_request.verified.txt index dfc79dd28..0860c7178 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_generic_request.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_generic_request.verified.txt @@ -20,8 +20,8 @@ class DiscussionClient { } addMessage(message: Foo): Observable { - let url_ = this.baseUrl + "/Discussion/AddMessage"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/AddMessage") + .toString(); const content_ = JSON.stringify(message); @@ -68,8 +68,8 @@ class DiscussionClient { } genericRequestTest1(request: GenericRequest1 | null | undefined): Observable { - let url_ = this.baseUrl + "/Discussion/GenericRequestTest1"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest1") + .toString(); const content_ = JSON.stringify(request); @@ -116,8 +116,8 @@ class DiscussionClient { } genericRequestTest2(request: GenericRequest2 | null | undefined): Observable { - let url_ = this.baseUrl + "/Discussion/GenericRequestTest2"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest2") + .toString(); const content_ = JSON.stringify(request); @@ -434,4 +434,68 @@ function blobToText(blob: any): Observable { reader.readAsText(blob); } }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_return_value_is_void_then_client_returns_observable_of_void.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_return_value_is_void_then_client_returns_observable_of_void.verified.txt index fd2a57b35..ef088f8f4 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_return_value_is_void_then_client_returns_observable_of_void.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AngularTests.When_return_value_is_void_then_client_returns_observable_of_void.verified.txt @@ -26,8 +26,8 @@ export class DiscussionClient implements IDiscussionClient { } addMessage(message: Foo): Observable { - let url_ = this.baseUrl + "/Discussion/AddMessage"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/AddMessage") + .toString(); const content_ = JSON.stringify(message); @@ -74,8 +74,8 @@ export class DiscussionClient implements IDiscussionClient { } genericRequestTest1(request: GenericRequest1 | null | undefined): Observable { - let url_ = this.baseUrl + "/Discussion/GenericRequestTest1"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest1") + .toString(); const content_ = JSON.stringify(request); @@ -122,8 +122,8 @@ export class DiscussionClient implements IDiscussionClient { } genericRequestTest2(request: GenericRequest2 | null | undefined): Observable { - let url_ = this.baseUrl + "/Discussion/GenericRequestTest2"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest2") + .toString(); const content_ = JSON.stringify(request); @@ -440,4 +440,68 @@ function blobToText(blob: any): Observable { reader.readAsText(blob); } }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..bc06ae82f 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 @@ -14,10 +14,9 @@ export class MyClass { /** */ removeElement(x_User: string, elementId: number[] | null | undefined): Promise { - let url_ = this.baseUrl + "/removeElement?"; - if (elementId !== undefined && elementId !== null) - elementId && elementId.forEach(item => { url_ += "elementId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/removeElement") + .paramArray("elementId", elementId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -71,4 +70,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..d94eba755 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 @@ -14,20 +14,16 @@ export class FileUploadClient { /** */ uploadFile(file: FileParameter | undefined, arrayOfIds: string[] | null | undefined, test: string | undefined): Promise { - let url_ = this.baseUrl + "/api/FileUpload/UploadFile"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/FileUpload/UploadFile") + .toString(); + Guard.notNull(file, "file"); + Guard.defined(arrayOfIds, "arrayOfIds"); + Guard.notNull(test, "test"); const content_ = new FormData(); - if (file === null || file === undefined) - throw new globalThis.Error("The parameter 'file' cannot be null."); - else - content_.append("file", file.data, file.fileName ? file.fileName : "file"); - if (arrayOfIds !== null && arrayOfIds !== undefined) - arrayOfIds.forEach(item_ => content_.append("arrayOfIds", item_.toString())); - if (test === null || test === undefined) - throw new globalThis.Error("The parameter 'test' cannot be null."); - else - content_.append("test", test.toString()); + content_.append("file", file.data, file.fileName ? file.fileName : "file"); + arrayOfIds.forEach(item_ => content_.append("arrayOfIds", item_.toString())); + content_.append("test", test.toString()); let options_: RequestInit = { body: content_, @@ -106,4 +102,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.Add_cancel_token_to_every_call.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.Add_cancel_token_to_every_call.verified.txt index e45f4dce1..b4de35162 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.Add_cancel_token_to_every_call.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.Add_cancel_token_to_every_call.verified.txt @@ -18,15 +18,16 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - content_ = content_.replace(/&$/, ""); + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .toString(); let options_: AxiosRequestConfig = { data: content_, @@ -71,12 +72,11 @@ export class UrlEncodedRequestConsumingClient { } getMessage(messageId: string | null, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -192,4 +192,68 @@ function throwException(message: string, status: number, response: string, heade function isAxiosError(obj: any): obj is AxiosError { return obj && obj.isAxiosError === true; +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_abort_signal.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_abort_signal.verified.txt index 1b03d9a0a..4a4189d73 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_abort_signal.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_abort_signal.verified.txt @@ -18,15 +18,16 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, signal?: AbortSignal): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - content_ = content_.replace(/&$/, ""); + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .toString(); let options_: AxiosRequestConfig = { data: content_, @@ -71,12 +72,11 @@ export class UrlEncodedRequestConsumingClient { } getMessage(messageId: string | null, signal?: AbortSignal): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -192,4 +192,68 @@ function throwException(message: string, status: number, response: string, heade function isAxiosError(obj: any): obj is AxiosError { return obj && obj.isAxiosError === true; +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_abort_signal_and_generate_client_interfaces_contains_signal_param_in_both_interface_and_concrete_implementation.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_abort_signal_and_generate_client_interfaces_contains_signal_param_in_both_interface_and_concrete_implementation.verified.txt index 8023de4e7..800dc3ae5 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_abort_signal_and_generate_client_interfaces_contains_signal_param_in_both_interface_and_concrete_implementation.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_abort_signal_and_generate_client_interfaces_contains_signal_param_in_both_interface_and_concrete_implementation.verified.txt @@ -23,15 +23,16 @@ export class UrlEncodedRequestConsumingClient implements IUrlEncodedRequestConsu } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, signal?: AbortSignal): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - content_ = content_.replace(/&$/, ""); + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .toString(); let options_: AxiosRequestConfig = { data: content_, @@ -76,12 +77,11 @@ export class UrlEncodedRequestConsumingClient implements IUrlEncodedRequestConsu } getMessage(messageId: string | null, signal?: AbortSignal): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -197,4 +197,68 @@ function throwException(message: string, status: number, response: string, heade function isAxiosError(obj: any): obj is AxiosError { return obj && obj.isAxiosError === true; +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt index e45f4dce1..b4de35162 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt @@ -18,15 +18,16 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - content_ = content_.replace(/&$/, ""); + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .toString(); let options_: AxiosRequestConfig = { data: content_, @@ -71,12 +72,11 @@ export class UrlEncodedRequestConsumingClient { } getMessage(messageId: string | null, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -192,4 +192,68 @@ function throwException(message: string, status: number, response: string, heade function isAxiosError(obj: any): obj is AxiosError { return obj && obj.isAxiosError === true; +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt index 85c0917c7..ff0af34f1 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt @@ -22,8 +22,8 @@ class DiscussionClient implements IDiscussionClient { } addMessage(message: Foo | null | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/api/Discussion"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/Discussion") + .toString(); const content_ = JSON.stringify(message); @@ -139,4 +139,68 @@ function throwException(message: string, status: number, response: string, heade function isAxiosError(obj: any): obj is AxiosError { return obj && obj.isAxiosError === true; +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_export_types_is_true_then_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_export_types_is_true_then_add_export_before_classes.verified.txt index 4c4adacd5..be2a85ba2 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_export_types_is_true_then_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/AxiosTests.When_export_types_is_true_then_add_export_before_classes.verified.txt @@ -22,8 +22,8 @@ export class DiscussionClient implements IDiscussionClient { } addMessage(message: Foo | null | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/api/Discussion"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/Discussion") + .toString(); const content_ = JSON.stringify(message); @@ -139,4 +139,68 @@ function throwException(message: string, status: number, response: string, heade function isAxiosError(obj: any): obj is AxiosError { return obj && obj.isAxiosError === true; +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..0c8e9d3f3 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 @@ -12,18 +12,14 @@ export class FileUploadClient { } uploadFiles(files: FileParameter[] | undefined, test: string | undefined): Promise { - let url_ = this.baseUrl + "/api/FileUpload/UploadFiles"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/FileUpload/UploadFiles") + .toString(); + Guard.notNull(files, "files"); + Guard.notNull(test, "test"); const content_ = new FormData(); - if (files === null || files === undefined) - throw new globalThis.Error("The parameter 'files' cannot be null."); - else - files.forEach(item_ => content_.append("files", item_.data, item_.fileName ? item_.fileName : "files") ); - if (test === null || test === undefined) - throw new globalThis.Error("The parameter 'test' cannot be null."); - else - content_.append("test", test.toString()); + files.forEach(item_ => content_.append("files", item_.data, item_.fileName ? item_.fileName : "files") ); + content_.append("test", test.toString()); let options_: RequestInit = { body: content_, @@ -102,4 +98,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..5ccd00830 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 @@ -12,17 +12,17 @@ export class FileUploadClient { } uploadAttachment(caseId: string | null, description: string | null | undefined, contents: FileParameter | null | undefined): Promise { - let url_ = this.baseUrl + "/api/FileUpload/UploadAttachment"; - if (caseId === undefined || caseId === null) - throw new globalThis.Error("The parameter 'caseId' must be defined."); - url_ = url_.replace("{caseId}", encodeURIComponent("" + caseId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(caseId, 'caseId'); + const url_ = new UriBuilder(this.baseUrl + "/api/FileUpload/UploadAttachment") + .path("caseId", caseId) + .toString(); + + Guard.defined(description, "description"); + Guard.defined(contents, "contents"); const content_ = new FormData(); - if (description !== null && description !== undefined) - content_.append("Description", description.toString()); - if (contents !== null && contents !== undefined) - content_.append("Contents", contents.data, contents.fileName ? contents.fileName : "Contents"); + content_.append("Description", description.toString()); + content_.append("Contents", contents.data, contents.fileName ? contents.fileName : "Contents"); let options_: RequestInit = { body: content_, @@ -101,4 +101,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..c6f186a19 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 @@ -12,18 +12,14 @@ export class FileUploadClient { } uploadFile(file: FileParameter | undefined, test: string | undefined): Promise { - let url_ = this.baseUrl + "/api/FileUpload/UploadFile"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/FileUpload/UploadFile") + .toString(); + Guard.notNull(file, "file"); + Guard.notNull(test, "test"); const content_ = new FormData(); - if (file === null || file === undefined) - throw new globalThis.Error("The parameter 'file' cannot be null."); - else - content_.append("file", file.data, file.fileName ? file.fileName : "file"); - if (test === null || test === undefined) - throw new globalThis.Error("The parameter 'test' cannot be null."); - else - content_.append("test", test.toString()); + content_.append("file", file.data, file.fileName ? file.fileName : "file"); + content_.append("test", test.toString()); let options_: RequestInit = { body: content_, @@ -102,4 +98,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..dd48f2ef0 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 @@ -14,8 +14,8 @@ export class Client { /** */ addFile(body: Blob | undefined): Promise { - let url_ = this.baseUrl + "/files"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/files") + .toString(); const content_ = body; @@ -134,4 +134,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..b3eb99351 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 @@ -12,8 +12,8 @@ export class MyClass { } person(): Promise { - let url_ = this.baseUrl + "/Person"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Person") + .toString(); let options_: RequestInit = { method: "GET", @@ -92,4 +92,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..71d71d9ff 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 @@ -14,8 +14,8 @@ export class Client { /** */ _2fa(body: TwoFactorRequest): Promise { - let url_ = this.baseUrl + "/manage/2fa"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/manage/2fa") + .toString(); const content_ = JSON.stringify(body); @@ -308,4 +308,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..e87c4451a 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 @@ -12,21 +12,20 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, date: Date | undefined, list: string[] | null | undefined, signal?: AbortSignal): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); - - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - if (date === null) - throw new globalThis.Error("The parameter 'date' cannot be null."); - else if (date !== undefined) - content_ += encodeURIComponent("date") + "=" + encodeURIComponent(date ? "" + date.toJSON() : "") + "&"; - if (list !== undefined) - list && list.forEach(item => { content_ += encodeURIComponent("list") + "=" + encodeURIComponent("" + item) + "&"; }); - content_ = content_.replace(/&$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); + + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + Guard.notNull(date, "date"); + Guard.defined(list, "list"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .param("date", date ? date.toJSON() : "") + .paramArray("list", list) + .toString(); let options_: RequestInit = { body: content_, @@ -58,12 +57,11 @@ export class UrlEncodedRequestConsumingClient { } getMessage(messageId: string | null, signal?: AbortSignal): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_: RequestInit = { method: "GET", @@ -162,4 +160,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..286e3a77a 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 @@ -19,21 +19,20 @@ export class UrlEncodedRequestConsumingClient implements IUrlEncodedRequestConsu } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, date: Date | undefined, list: string[] | null | undefined, signal?: AbortSignal): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); - - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - if (date === null) - throw new globalThis.Error("The parameter 'date' cannot be null."); - else if (date !== undefined) - content_ += encodeURIComponent("date") + "=" + encodeURIComponent(date ? "" + date.toJSON() : "") + "&"; - if (list !== undefined) - list && list.forEach(item => { content_ += encodeURIComponent("list") + "=" + encodeURIComponent("" + item) + "&"; }); - content_ = content_.replace(/&$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); + + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + Guard.notNull(date, "date"); + Guard.defined(list, "list"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .param("date", date ? date.toJSON() : "") + .paramArray("list", list) + .toString(); let options_: RequestInit = { body: content_, @@ -65,12 +64,11 @@ export class UrlEncodedRequestConsumingClient implements IUrlEncodedRequestConsu } getMessage(messageId: string | null, signal?: AbortSignal): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_: RequestInit = { method: "GET", @@ -169,4 +167,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..6c505e800 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 @@ -12,21 +12,20 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, date: Date | undefined, list: string[] | null | undefined): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); - - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - if (date === null) - throw new globalThis.Error("The parameter 'date' cannot be null."); - else if (date !== undefined) - content_ += encodeURIComponent("date") + "=" + encodeURIComponent(date ? "" + date.toJSON() : "") + "&"; - if (list !== undefined) - list && list.forEach(item => { content_ += encodeURIComponent("list") + "=" + encodeURIComponent("" + item) + "&"; }); - content_ = content_.replace(/&$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); + + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + Guard.notNull(date, "date"); + Guard.defined(list, "list"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .param("date", date ? date.toJSON() : "") + .paramArray("list", list) + .toString(); let options_: RequestInit = { body: content_, @@ -57,12 +56,11 @@ export class UrlEncodedRequestConsumingClient { } getMessage(messageId: string | null): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_: RequestInit = { method: "GET", @@ -160,4 +158,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..ab4ef8c8e 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 @@ -17,8 +17,8 @@ class DiscussionClient implements IDiscussionClient { } addMessage(message: Foo | null | undefined): Promise { - let url_ = this.baseUrl + "/api/Discussion"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/Discussion") + .toString(); const content_ = JSON.stringify(message); @@ -116,4 +116,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..d24761216 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 @@ -17,8 +17,8 @@ export class DiscussionClient implements IDiscussionClient { } addMessage(message: Foo | null | undefined): Promise { - let url_ = this.baseUrl + "/api/Discussion"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/Discussion") + .toString(); const content_ = JSON.stringify(message); @@ -116,4 +116,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_includeHttpContext.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_includeHttpContext.verified.txt index 3d85ab80d..a9c78add4 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_includeHttpContext.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_includeHttpContext.verified.txt @@ -20,21 +20,20 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, date: Date | undefined, list: string[] | null | undefined, httpContext?: HttpContext): Observable { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); - - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - if (date === null) - throw new globalThis.Error("The parameter 'date' cannot be null."); - else if (date !== undefined) - content_ += encodeURIComponent("date") + "=" + encodeURIComponent(date ? "" + date.toJSON() : "") + "&"; - if (list !== undefined) - list && list.forEach(item => { content_ += encodeURIComponent("list") + "=" + encodeURIComponent("" + item) + "&"; }); - content_ = content_.replace(/&$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); + + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + Guard.notNull(date, "date"); + Guard.defined(list, "list"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .param("date", date ? date.toJSON() : "") + .paramArray("list", list) + .toString(); let options_ : any = { body: content_, @@ -80,12 +79,11 @@ export class UrlEncodedRequestConsumingClient { } getMessage(messageId: string | null, httpContext?: HttpContext): Observable { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_ : any = { observe: "response", @@ -214,4 +212,68 @@ function blobToText(blob: any): Observable { reader.readAsText(blob); } }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..6c10d9104 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 @@ -12,21 +12,20 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, date: Date | undefined, list: string[] | null | undefined): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); - - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - if (date === null) - throw new globalThis.Error("The parameter 'date' cannot be null."); - else if (date !== undefined) - content_ += encodeURIComponent("date") + "=" + encodeURIComponent(date ? "" + date.toJSON() : "") + "&"; - if (list !== undefined) - list && list.forEach(item => { content_ += encodeURIComponent("list") + "=" + encodeURIComponent("" + item) + "&"; }); - content_ = content_.replace(/&$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); + + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + Guard.notNull(date, "date"); + Guard.defined(list, "list"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .param("date", date ? date.toJSON() : "") + .paramArray("list", list) + .toString(); let options_: RequestInit = { body: content_, @@ -58,12 +57,11 @@ export class UrlEncodedRequestConsumingClient { } getMessage(messageId: string | null): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_: RequestInit = { method: "GET", @@ -162,4 +160,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..57a865789 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 @@ -12,21 +12,20 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, date: Date | undefined, list: string[] | null | undefined): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); - - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - if (date === null) - throw new globalThis.Error("The parameter 'date' cannot be null."); - else if (date !== undefined) - content_ += encodeURIComponent("date") + "=" + encodeURIComponent(date ? "" + date.toJSON() : "") + "&"; - if (list !== undefined) - list && list.forEach(item => { content_ += encodeURIComponent("list") + "=" + encodeURIComponent("" + item) + "&"; }); - content_ = content_.replace(/&$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); + + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + Guard.notNull(date, "date"); + Guard.defined(list, "list"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .param("date", date ? date.toJSON() : "") + .paramArray("list", list) + .toString(); let options_: RequestInit = { body: content_, @@ -58,12 +57,11 @@ export class UrlEncodedRequestConsumingClient { } getMessage(messageId: string | null): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_: RequestInit = { method: "GET", @@ -162,4 +160,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..6c505e800 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 @@ -12,21 +12,20 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, date: Date | undefined, list: string[] | null | undefined): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); - - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - if (date === null) - throw new globalThis.Error("The parameter 'date' cannot be null."); - else if (date !== undefined) - content_ += encodeURIComponent("date") + "=" + encodeURIComponent(date ? "" + date.toJSON() : "") + "&"; - if (list !== undefined) - list && list.forEach(item => { content_ += encodeURIComponent("list") + "=" + encodeURIComponent("" + item) + "&"; }); - content_ = content_.replace(/&$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); + + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + Guard.notNull(date, "date"); + Guard.defined(list, "list"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .param("date", date ? date.toJSON() : "") + .paramArray("list", list) + .toString(); let options_: RequestInit = { body: content_, @@ -57,12 +56,11 @@ export class UrlEncodedRequestConsumingClient { } getMessage(messageId: string | null): Promise { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_: RequestInit = { method: "GET", @@ -160,4 +158,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_no_includeHttpContext.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_no_includeHttpContext.verified.txt index fbc615cbe..bd14d1481 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_no_includeHttpContext.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/FetchTests.When_no_includeHttpContext.verified.txt @@ -20,21 +20,20 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, date: Date | undefined, list: string[] | null | undefined): Observable { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); - - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - if (date === null) - throw new globalThis.Error("The parameter 'date' cannot be null."); - else if (date !== undefined) - content_ += encodeURIComponent("date") + "=" + encodeURIComponent(date ? "" + date.toJSON() : "") + "&"; - if (list !== undefined) - list && list.forEach(item => { content_ += encodeURIComponent("list") + "=" + encodeURIComponent("" + item) + "&"; }); - content_ = content_.replace(/&$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); + + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + Guard.notNull(date, "date"); + Guard.defined(list, "list"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .param("date", date ? date.toJSON() : "") + .paramArray("list", list) + .toString(); let options_ : any = { body: content_, @@ -79,12 +78,11 @@ export class UrlEncodedRequestConsumingClient { } getMessage(messageId: string | null): Observable { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming?"; - if (messageId === undefined) - throw new globalThis.Error("The parameter 'messageId' must be defined."); - else if(messageId !== null) - url_ += "messageId=" + encodeURIComponent("" + messageId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.defined(messageId, 'messageId'); + + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .param("messageId", messageId) + .toString(); let options_ : any = { observe: "response", @@ -212,4 +210,68 @@ function blobToText(blob: any): Observable { reader.readAsText(blob); } }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/InheritanceTests.When_generating_typescript_with_any_inheritance_then_inheritance_is_generated.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/InheritanceTests.When_generating_typescript_with_any_inheritance_then_inheritance_is_generated.verified.txt index 2f1e662e6..ec4492bbe 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/InheritanceTests.When_generating_typescript_with_any_inheritance_then_inheritance_is_generated.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/InheritanceTests.When_generating_typescript_with_any_inheritance_then_inheritance_is_generated.verified.txt @@ -60,3 +60,66 @@ export class SessionStateResent extends SportsbookEventBody implements ISessionS export interface ISessionStateResent extends ISportsbookEventBody { } +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } +} \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Angular.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Angular.verified.txt index 081d32d9b..5f7c3181a 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Angular.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Angular.verified.txt @@ -25,8 +25,8 @@ export class Client { * @return Returned if the request is successful. */ getBanner(): Observable { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); let options_ : any = { observe: "response", @@ -91,8 +91,8 @@ export class Client { * @return Returned if the request is successful. */ setBanner(body: AnnouncementBannerConfigurationUpdate): Observable { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); const content_ = JSON.stringify(body); @@ -176,36 +176,23 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldsConfigurations(body: ConfigurationsListParameters, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/app/field/context/configuration/list?"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/context/configuration/list") + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -277,12 +264,11 @@ export class Client { * @return Returned if the request is successful. */ updateMultipleCustomFieldValues(body: MultipleCustomFieldValuesUpdateDetails, generateChangelog?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/app/field/value?"; - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/value") + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -358,39 +344,25 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldConfiguration(fieldIdOrKey: string, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -458,11 +430,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldConfiguration(fieldIdOrKey: string, body: CustomFieldConfigurations): Observable { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -536,15 +508,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldValue(fieldIdOrKey: string, body: CustomFieldValueUpdateDetails, generateChangelog?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value") + .path("fieldIdOrKey", fieldIdOrKey) + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -615,20 +585,15 @@ export class Client { * @return Returned if the request is successful. */ getApplicationProperty(key?: string | undefined, permissionLevel?: string | undefined, keyFilter?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/application-properties?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (permissionLevel === null) - throw new globalThis.Error("The parameter 'permissionLevel' cannot be null."); - else if (permissionLevel !== undefined) - url_ += "permissionLevel=" + encodeURIComponent("" + permissionLevel) + "&"; - if (keyFilter === null) - throw new globalThis.Error("The parameter 'keyFilter' cannot be null."); - else if (keyFilter !== undefined) - url_ += "keyFilter=" + encodeURIComponent("" + keyFilter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + Guard.notNull(permissionLevel, 'permissionLevel'); + Guard.notNull(keyFilter, 'keyFilter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties") + .param("key", key) + .param("permissionLevel", permissionLevel) + .param("keyFilter", keyFilter) + .toString(); let options_ : any = { observe: "response", @@ -700,8 +665,8 @@ export class Client { * @return Returned if the request is successful. */ getAdvancedSettings(): Observable { - let url_ = this.baseUrl + "/rest/api/3/application-properties/advanced-settings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/advanced-settings") + .toString(); let options_ : any = { observe: "response", @@ -768,11 +733,11 @@ export class Client { * @return Returned if the request is successful. */ setApplicationProperty(id: string, body: SimpleApplicationPropertyBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/application-properties/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -855,8 +820,8 @@ export class Client { * @return Returned if the request is successful. */ getAllApplicationRoles(): Observable { - let url_ = this.baseUrl + "/rest/api/3/applicationrole"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole") + .toString(); let options_ : any = { observe: "response", @@ -923,11 +888,11 @@ export class Client { * @return Returned if the request is successful. */ getApplicationRole(key: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/applicationrole/{key}"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined."); - url_ = url_.replace("{key}", encodeURIComponent("" + key)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole/{key}") + .path("key", key) + .toString(); let options_ : any = { observe: "response", @@ -992,15 +957,13 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentContent(id: string, redirect?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/attachment/content/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/content/{id}") + .path("id", id) + .param("redirect", redirect) + .toString(); let options_ : any = { observe: "response", @@ -1086,8 +1049,8 @@ export class Client { * @return Returned if the request is successful. */ getAttachmentMeta(): Observable { - let url_ = this.baseUrl + "/rest/api/3/attachment/meta"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/meta") + .toString(); let options_ : any = { observe: "response", @@ -1147,27 +1110,19 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentThumbnail(id: string, redirect?: boolean | undefined, fallbackToDefault?: boolean | undefined, width?: number | undefined, height?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - if (fallbackToDefault === null) - throw new globalThis.Error("The parameter 'fallbackToDefault' cannot be null."); - else if (fallbackToDefault !== undefined) - url_ += "fallbackToDefault=" + encodeURIComponent("" + fallbackToDefault) + "&"; - if (width === null) - throw new globalThis.Error("The parameter 'width' cannot be null."); - else if (width !== undefined) - url_ += "width=" + encodeURIComponent("" + width) + "&"; - if (height === null) - throw new globalThis.Error("The parameter 'height' cannot be null."); - else if (height !== undefined) - url_ += "height=" + encodeURIComponent("" + height) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + Guard.notNull(fallbackToDefault, 'fallbackToDefault'); + Guard.notNull(width, 'width'); + Guard.notNull(height, 'height'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}") + .path("id", id) + .param("redirect", redirect) + .param("fallbackToDefault", fallbackToDefault) + .param("width", width) + .param("height", height) + .toString(); let options_ : any = { observe: "response", @@ -1246,11 +1201,11 @@ export class Client { * @return Returned if the request is successful. */ removeAttachment(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -1306,11 +1261,11 @@ export class Client { * @return Returned if the request is successful. */ getAttachment(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -1374,11 +1329,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForHumans(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/human"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/human") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -1446,11 +1401,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForMachines(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -1522,28 +1477,19 @@ export class Client { * @return Returned if the request is successful. */ getAuditRecords(offset?: number | undefined, limit?: number | undefined, filter?: string | undefined, from?: string | undefined, to?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/auditing/record?"; - if (offset === null) - throw new globalThis.Error("The parameter 'offset' cannot be null."); - else if (offset !== undefined) - url_ += "offset=" + encodeURIComponent("" + offset) + "&"; - if (limit === null) - throw new globalThis.Error("The parameter 'limit' cannot be null."); - else if (limit !== undefined) - url_ += "limit=" + encodeURIComponent("" + limit) + "&"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (from === null) - throw new globalThis.Error("The parameter 'from' cannot be null."); - else if (from !== undefined) - url_ += "from=" + encodeURIComponent("" + from) + "&"; - if (to === null) - throw new globalThis.Error("The parameter 'to' cannot be null."); - else if (to !== undefined) - url_ += "to=" + encodeURIComponent("" + to) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(offset, 'offset'); + Guard.notNull(limit, 'limit'); + Guard.notNull(filter, 'filter'); + Guard.notNull(from, 'from'); + Guard.notNull(to, 'to'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/auditing/record") + .param("offset", offset) + .param("limit", limit) + .param("filter", filter) + .param("from", from) + .param("to", to) + .toString(); let options_ : any = { observe: "response", @@ -1609,11 +1555,11 @@ export class Client { * @return Returned if the request is successful. */ getAllSystemAvatars(type: Type): Observable { - let url_ = this.baseUrl + "/rest/api/3/avatar/{type}/system"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/avatar/{type}/system") + .path("type", type) + .toString(); let options_ : any = { observe: "response", @@ -1673,8 +1619,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkDelete(body: IssueBulkDeletePayload): Observable { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/delete") + .toString(); const content_ = JSON.stringify(body); @@ -1754,24 +1700,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkEditableFields(issueIdsOrKeys: string, searchText?: string | undefined, endingBefore?: string | undefined, startingAfter?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (searchText === null) - throw new globalThis.Error("The parameter 'searchText' cannot be null."); - else if (searchText !== undefined) - url_ += "searchText=" + encodeURIComponent("" + searchText) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(searchText, 'searchText'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("searchText", searchText) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); let options_ : any = { observe: "response", @@ -1851,8 +1790,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkEdit(body: IssueBulkEditPayload): Observable { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .toString(); const content_ = JSON.stringify(body); @@ -1921,8 +1860,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkMove(body: IssueBulkMovePayload): Observable { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/move") + .toString(); const content_ = JSON.stringify(body); @@ -1994,20 +1933,15 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTransitions(issueIdsOrKeys: string, endingBefore?: string | undefined, startingAfter?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); let options_ : any = { observe: "response", @@ -2080,8 +2014,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkTransition(body: IssueBulkTransitionPayload): Observable { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .toString(); const content_ = JSON.stringify(body); @@ -2158,8 +2092,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkUnwatch(body: IssueBulkWatchOrUnwatchPayload): Observable { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/unwatch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/unwatch") + .toString(); const content_ = JSON.stringify(body); @@ -2236,8 +2170,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkWatch(body: IssueBulkWatchOrUnwatchPayload): Observable { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/watch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/watch") + .toString(); const content_ = JSON.stringify(body); @@ -2314,11 +2248,11 @@ export class Client { * @return Returned if the request is successful. */ getBulkOperationProgress(taskId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/bulk/queue/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/queue/{taskId}") + .path("taskId", taskId) + .toString(); let options_ : any = { observe: "response", @@ -2384,8 +2318,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkChangelogs(body: BulkChangelogRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/changelog/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/changelog/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -2446,16 +2380,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUserDataClassificationLevels(status?: Status2[] | undefined, orderBy?: OrderBy | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/classification-levels?"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(status, 'status'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/classification-levels") + .paramArray("status", status) + .param("orderBy", orderBy) + .toString(); let options_ : any = { observe: "response", @@ -2515,12 +2446,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentsByIds(body: IssueCommentListRequestBean, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/comment/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -2580,11 +2510,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentPropertyKeys(commentId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties") + .path("commentId", commentId) + .toString(); let options_ : any = { observe: "response", @@ -2653,14 +2583,13 @@ export class Client { * @return Returned if the request is successful. */ deleteCommentProperty(commentId: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -2725,14 +2654,13 @@ export class Client { * @return Returned if the request is successful. */ getCommentProperty(commentId: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -2802,14 +2730,13 @@ export class Client { * @return Returned if the comment property is updated. */ setCommentProperty(commentId: string, propertyKey: string, body: any): Observable { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -2897,28 +2824,19 @@ export class Client { * @return Returned if the request is successful. */ findComponentsForProjects(projectIdsOrKeys?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy2 | undefined, query?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/component?"; - if (projectIdsOrKeys === null) - throw new globalThis.Error("The parameter 'projectIdsOrKeys' cannot be null."); - else if (projectIdsOrKeys !== undefined) - projectIdsOrKeys && projectIdsOrKeys.forEach(item => { url_ += "projectIdsOrKeys=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIdsOrKeys, 'projectIdsOrKeys'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .paramArray("projectIdsOrKeys", projectIdsOrKeys) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .toString(); let options_ : any = { observe: "response", @@ -2977,8 +2895,8 @@ export class Client { * @return Returned if the request is successful. */ createComponent(body: ProjectComponent): Observable { - let url_ = this.baseUrl + "/rest/api/3/component"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .toString(); const content_ = JSON.stringify(body); @@ -3051,15 +2969,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComponent(id: string, moveIssuesTo?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/component/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' cannot be null."); - else if (moveIssuesTo !== undefined) - url_ += "moveIssuesTo=" + encodeURIComponent("" + moveIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .param("moveIssuesTo", moveIssuesTo) + .toString(); let options_ : any = { observe: "response", @@ -3119,11 +3035,11 @@ export class Client { * @return Returned if the request is successful. */ getComponent(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -3183,11 +3099,11 @@ export class Client { * @return Returned if the request is successful. */ updateComponent(id: string, body: ProjectComponent): Observable { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -3259,11 +3175,11 @@ export class Client { * @return Returned if the request is successful. */ getComponentRelatedIssues(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -3322,8 +3238,8 @@ export class Client { * @return Returned if the request is successful. */ getConfiguration(): Observable { - let url_ = this.baseUrl + "/rest/api/3/configuration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration") + .toString(); let options_ : any = { observe: "response", @@ -3378,8 +3294,8 @@ export class Client { * @return Returned if the request is successful and time tracking is enabled. */ getSelectedTimeTrackingImplementation(): Observable { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); let options_ : any = { observe: "response", @@ -3446,8 +3362,8 @@ export class Client { * @return Returned if the request is successful. */ selectTimeTrackingImplementation(body: TimeTrackingProvider): Observable { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); const content_ = JSON.stringify(body); @@ -3515,8 +3431,8 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTimeTrackingImplementations(): Observable { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/list"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/list") + .toString(); let options_ : any = { observe: "response", @@ -3582,8 +3498,8 @@ export class Client { * @return Returned if the request is successful. */ getSharedTimeTrackingConfiguration(): Observable { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); let options_ : any = { observe: "response", @@ -3642,8 +3558,8 @@ export class Client { * @return Returned if the request is successful. */ setSharedTimeTrackingConfiguration(body: TimeTrackingConfiguration): Observable { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); const content_ = JSON.stringify(body); @@ -3711,11 +3627,11 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldOption(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/customFieldOption/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/customFieldOption/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -3780,20 +3696,15 @@ export class Client { * @return Returned if the request is successful. */ getAllDashboards(filter?: Filter2 | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filter, 'filter'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("filter", filter) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -3860,12 +3771,11 @@ export class Client { * @return Returned if the request is successful. */ createDashboard(body: DashboardDetails, extendAdminPermissions?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -3935,8 +3845,8 @@ export class Client { * @return Returned if the request is successful. */ bulkEditDashboards(body: BulkEditShareableEntityRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/bulk/edit"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/bulk/edit") + .toString(); const content_ = JSON.stringify(body); @@ -4005,8 +3915,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAvailableDashboardGadgets(): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/gadgets"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/gadgets") + .toString(); let options_ : any = { observe: "response", @@ -4098,52 +4008,31 @@ export class Client { * @return Returned if the request is successful. */ getDashboardsPaginated(dashboardName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, orderBy?: OrderBy3 | undefined, startAt?: number | undefined, maxResults?: number | undefined, status?: Status3 | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/search?"; - if (dashboardName === null) - throw new globalThis.Error("The parameter 'dashboardName' cannot be null."); - else if (dashboardName !== undefined) - url_ += "dashboardName=" + encodeURIComponent("" + dashboardName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(dashboardName, 'dashboardName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/search") + .param("dashboardName", dashboardName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("status", status) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -4212,23 +4101,17 @@ export class Client { * @return Returned if the request is successful. */ getAllGadgets(dashboardId: number, moduleKey?: string[] | undefined, uri?: string[] | undefined, gadgetId?: number[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget?"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - if (uri === null) - throw new globalThis.Error("The parameter 'uri' cannot be null."); - else if (uri !== undefined) - uri && uri.forEach(item => { url_ += "uri=" + encodeURIComponent("" + item) + "&"; }); - if (gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' cannot be null."); - else if (gadgetId !== undefined) - gadgetId && gadgetId.forEach(item => { url_ += "gadgetId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.notNull(moduleKey, 'moduleKey'); + Guard.notNull(uri, 'uri'); + Guard.notNull(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .paramArray("moduleKey", moduleKey) + .paramArray("uri", uri) + .paramArray("gadgetId", gadgetId) + .toString(); let options_ : any = { observe: "response", @@ -4291,11 +4174,11 @@ export class Client { * @return Returned if the request is successful. */ addGadget(dashboardId: number, body: DashboardGadgetSettings): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .toString(); const content_ = JSON.stringify(body); @@ -4370,14 +4253,13 @@ export class Client { * @return Returned if the request is successful. */ removeGadget(dashboardId: number, gadgetId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); let options_ : any = { observe: "response", @@ -4442,14 +4324,13 @@ export class Client { * @return Returned if the request is successful. */ updateGadget(dashboardId: number, gadgetId: number, body: DashboardGadgetUpdateRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); const content_ = JSON.stringify(body); @@ -4525,14 +4406,13 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemPropertyKeys(dashboardId: string, itemId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .toString(); let options_ : any = { observe: "response", @@ -4600,17 +4480,15 @@ export class Client { * @return Returned if the dashboard item property is deleted. */ deleteDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -4693,17 +4571,15 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -4772,17 +4648,15 @@ export class Client { * @return Returned if the dashboard item property is updated. */ setDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string, body: any): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -4875,11 +4749,11 @@ export class Client { * @return Returned if the dashboard is deleted. */ deleteDashboard(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -4941,11 +4815,11 @@ export class Client { * @return Returned if the request is successful. */ getDashboard(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -5017,15 +4891,13 @@ export class Client { * @return Returned if the request is successful. */ updateDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -5103,15 +4975,13 @@ export class Client { * @return Returned if the request is successful. */ copyDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}/copy?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}/copy") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -5187,8 +5057,8 @@ export class Client { * @return Returned if the request is successful */ getPolicy(): Observable { - let url_ = this.baseUrl + "/rest/api/3/data-policy"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy") + .toString(); let options_ : any = { observe: "response", @@ -5254,12 +5124,11 @@ export class Client { * @return Returned if the request is successful. */ getPolicies(ids?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/data-policy/project?"; - if (ids === null) - throw new globalThis.Error("The parameter 'ids' cannot be null."); - else if (ids !== undefined) - url_ += "ids=" + encodeURIComponent("" + ids) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(ids, 'ids'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy/project") + .param("ids", ids) + .toString(); let options_ : any = { observe: "response", @@ -5331,8 +5200,8 @@ export class Client { * @return Returned if the request is successful. */ getEvents(): Observable { - let url_ = this.baseUrl + "/rest/api/3/events"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/events") + .toString(); let options_ : any = { observe: "response", @@ -5404,12 +5273,11 @@ export class Client { * @return Returned if the request is successful. */ analyseExpression(body: JiraExpressionForAnalysis, check?: Check | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/expression/analyse?"; - if (check === null) - throw new globalThis.Error("The parameter 'check' cannot be null."); - else if (check !== undefined) - url_ += "check=" + encodeURIComponent("" + check) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(check, 'check'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/analyse") + .param("check", check) + .toString(); const content_ = JSON.stringify(body); @@ -5485,12 +5353,11 @@ export class Client { * @deprecated */ evaluateJiraExpression(body: JiraExpressionEvalRequestBean, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/expression/eval?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/eval") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -5565,12 +5432,11 @@ export class Client { * @return Returned if the evaluation results in a value. The result is a JSON primitive value, list, or object. */ evaluateJSISJiraExpression(body: JiraExpressionEvaluateRequestBean, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/expression/evaluate?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/evaluate") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -5643,8 +5509,8 @@ export class Client { * @return Returned if the request is successful. */ getFields(): Observable { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); let options_ : any = { observe: "response", @@ -5707,8 +5573,8 @@ export class Client { * @return Returned if the custom field is created. */ createCustomField(body: CustomFieldDefinitionJsonBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); const content_ = JSON.stringify(body); @@ -5768,8 +5634,8 @@ export class Client { * @return Returned if the field association validation passes. */ removeAssociations(body: FieldAssociationsRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -5838,8 +5704,8 @@ export class Client { * @return Returned if the field association validation passes. */ createAssociations(body: FieldAssociationsRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -5928,40 +5794,25 @@ export class Client { * @return Returned if the request is successful. */ getFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, type?: Type2[] | undefined, id?: string[] | undefined, query?: string | undefined, orderBy?: OrderBy4 | undefined, expand?: string | undefined, projectIds?: number[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (type === null) - throw new globalThis.Error("The parameter 'type' cannot be null."); - else if (type !== undefined) - type && type.forEach(item => { url_ += "type=" + encodeURIComponent("" + item) + "&"; }); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(type, 'type'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectIds, 'projectIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("type", type) + .paramArray("id", id) + .param("query", query) + .param("orderBy", orderBy) + .param("expand", expand) + .paramArray("projectIds", projectIds) + .toString(); let options_ : any = { observe: "response", @@ -6040,32 +5891,21 @@ export class Client { * @return Returned if the request is successful. */ getTrashedFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, id?: string[] | undefined, query?: string | undefined, expand?: Expand | undefined, orderBy?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/search/trashed?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(expand, 'expand'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search/trashed") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("query", query) + .param("expand", expand) + .param("orderBy", orderBy) + .toString(); let options_ : any = { observe: "response", @@ -6136,11 +5976,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomField(fieldId: string, body: UpdateCustomFieldDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -6218,31 +6058,21 @@ export class Client { * @return Returned if the request is successful. */ getContextsForField(fieldId: string, isAnyIssueType?: boolean | undefined, isGlobalContext?: boolean | undefined, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (isAnyIssueType === null) - throw new globalThis.Error("The parameter 'isAnyIssueType' cannot be null."); - else if (isAnyIssueType !== undefined) - url_ += "isAnyIssueType=" + encodeURIComponent("" + isAnyIssueType) + "&"; - if (isGlobalContext === null) - throw new globalThis.Error("The parameter 'isGlobalContext' cannot be null."); - else if (isGlobalContext !== undefined) - url_ += "isGlobalContext=" + encodeURIComponent("" + isGlobalContext) + "&"; - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(isAnyIssueType, 'isAnyIssueType'); + Guard.notNull(isGlobalContext, 'isGlobalContext'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .param("isAnyIssueType", isAnyIssueType) + .param("isGlobalContext", isGlobalContext) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -6306,11 +6136,11 @@ export class Client { * @return Returned if the custom field context is created. */ createCustomFieldContext(fieldId: string, body: CreateCustomFieldContext): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -6385,23 +6215,17 @@ export class Client { * @return Returned if the request is successful. */ getDefaultValues(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -6465,11 +6289,11 @@ export class Client { * @return Returned if operation is successful. */ setDefaultValues(fieldId: string, body: CustomFieldContextDefaultValueUpdate): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -6545,23 +6369,17 @@ export class Client { * @return Returned if operation is successful. */ getIssueTypeMappingsForContexts(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -6624,19 +6442,15 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldContextsForProjectsAndIssueTypes(fieldId: string, body: ProjectIssueTypeMappings, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -6711,23 +6525,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectContextMapping(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -6792,14 +6600,13 @@ export class Client { * @return Returned if the context is deleted. */ deleteCustomFieldContext(fieldId: string, contextId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); let options_ : any = { observe: "response", @@ -6869,14 +6676,13 @@ export class Client { * @return Returned if the context is updated. */ updateCustomFieldContext(fieldId: string, contextId: number, body: CustomFieldContextUpdateDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6950,14 +6756,13 @@ export class Client { * @return Returned if operation is successful. */ addIssueTypesToContext(fieldId: string, contextId: number, body: IssueTypeIds): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7035,14 +6840,13 @@ export class Client { * @return Returned if operation is successful. */ removeIssueTypesFromContext(fieldId: string, contextId: number, body: IssueTypeIds): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7120,30 +6924,21 @@ export class Client { * @return Returned if the request is successful. */ getOptionsForContext(fieldId: string, contextId: number, optionId?: number | undefined, onlyOptions?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === null) - throw new globalThis.Error("The parameter 'optionId' cannot be null."); - else if (optionId !== undefined) - url_ += "optionId=" + encodeURIComponent("" + optionId) + "&"; - if (onlyOptions === null) - throw new globalThis.Error("The parameter 'onlyOptions' cannot be null."); - else if (onlyOptions !== undefined) - url_ += "onlyOptions=" + encodeURIComponent("" + onlyOptions) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(optionId, 'optionId'); + Guard.notNull(onlyOptions, 'onlyOptions'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .param("optionId", optionId) + .param("onlyOptions", onlyOptions) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -7212,14 +7007,13 @@ export class Client { * @return Returned if the request is successful. */ createCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionCreateRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7292,14 +7086,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionUpdateRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7372,14 +7165,13 @@ export class Client { * @return Returned if options are reordered. */ reorderCustomFieldOptions(fieldId: string, contextId: number, body: OrderOfCustomFieldOptions): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7454,17 +7246,15 @@ export class Client { * @return Returned if the option is deleted. */ deleteCustomFieldOption(fieldId: string, contextId: number, optionId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .path("optionId", optionId) + .toString(); let options_ : any = { observe: "response", @@ -7531,25 +7321,19 @@ export class Client { * @param jql (optional) A JQL query that specifies the issues to be updated. For example, *project=10000*. */ replaceCustomFieldOption(fieldId: string, optionId: number, contextId: number, replaceWith?: number | undefined, jql?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(optionId, 'optionId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue") + .path("fieldId", fieldId) + .path("optionId", optionId) + .path("contextId", contextId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .toString(); let options_ : any = { observe: "response", @@ -7613,14 +7397,13 @@ export class Client { * @return Returned if operation is successful. */ assignProjectsToCustomFieldContext(fieldId: string, contextId: number, body: ProjectIds): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7694,14 +7477,13 @@ export class Client { * @return Returned if the custom field context is removed from the projects. */ removeCustomFieldContextFromProjects(fieldId: string, contextId: number, body: ProjectIds): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7777,19 +7559,15 @@ export class Client { * @deprecated */ getContextsForFieldDeprecated(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/contexts?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/contexts") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -7852,23 +7630,17 @@ export class Client { * @return Returned if the request is successful. */ getScreensForField(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/screens?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/screens") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -7933,19 +7705,15 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -8008,11 +7776,11 @@ export class Client { * @return Returned if the request is successful. */ createIssueFieldOption(fieldKey: string, body: IssueFieldOptionCreateBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .toString(); const content_ = JSON.stringify(body); @@ -8086,23 +7854,17 @@ export class Client { * @return Returned if the request is successful. */ getSelectableIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); let options_ : any = { observe: "response", @@ -8168,23 +7930,17 @@ export class Client { * @return Returned if the request is successful. */ getVisibleIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); let options_ : any = { observe: "response", @@ -8248,14 +8004,13 @@ export class Client { * @return Returned if the field option is deleted. */ deleteIssueFieldOption(fieldKey: string, optionId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); let options_ : any = { observe: "response", @@ -8324,14 +8079,13 @@ export class Client { * @return Returned if the requested option is returned. */ getIssueFieldOption(fieldKey: string, optionId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); let options_ : any = { observe: "response", @@ -8399,14 +8153,13 @@ export class Client { * @return Returned if the option is updated or created. */ updateIssueFieldOption(fieldKey: string, optionId: number, body: IssueFieldOption): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); const content_ = JSON.stringify(body); @@ -8481,30 +8234,21 @@ export class Client { * @param overrideEditableFlag (optional) Whether screen security is overridden to enable uneditable fields to be edited. Available to Connect and Forge app users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ replaceIssueFieldOption(fieldKey: string, optionId: number, replaceWith?: number | undefined, jql?: string | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_ : any = { observe: "response", @@ -8566,11 +8310,11 @@ export class Client { * @param id The ID of a custom field. */ deleteCustomField(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -8656,11 +8400,11 @@ export class Client { * @return Returned if the request is successful. */ restoreCustomField(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/restore"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/restore") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -8741,11 +8485,11 @@ export class Client { * @return Returned if the request is successful. */ trashCustomField(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/trash"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/trash") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -8830,28 +8574,19 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurations(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, isDefault?: boolean | undefined, query?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (isDefault === null) - throw new globalThis.Error("The parameter 'isDefault' cannot be null."); - else if (isDefault !== undefined) - url_ += "isDefault=" + encodeURIComponent("" + isDefault) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(isDefault, 'isDefault'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("isDefault", isDefault) + .param("query", query) + .toString(); let options_ : any = { observe: "response", @@ -8910,8 +8645,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfiguration(body: FieldConfigurationDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .toString(); const content_ = JSON.stringify(body); @@ -8979,11 +8714,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfiguration(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -9052,11 +8787,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfiguration(id: number, body: FieldConfigurationDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9131,19 +8866,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationItems(id: number, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -9207,11 +8938,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationItems(id: number, body: FieldConfigurationItemsDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9286,20 +9017,15 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurationSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .toString(); let options_ : any = { observe: "response", @@ -9363,8 +9089,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfigurationScheme(body: UpdateFieldConfigurationSchemeDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -9434,20 +9160,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, fieldConfigurationSchemeId?: number[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fieldConfigurationSchemeId === null) - throw new globalThis.Error("The parameter 'fieldConfigurationSchemeId' cannot be null."); - else if (fieldConfigurationSchemeId !== undefined) - fieldConfigurationSchemeId && fieldConfigurationSchemeId.forEach(item => { url_ += "fieldConfigurationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fieldConfigurationSchemeId, 'fieldConfigurationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("fieldConfigurationSchemeId", fieldConfigurationSchemeId) + .toString(); let options_ : any = { observe: "response", @@ -9517,20 +9238,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeProjectMapping(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -9593,8 +9309,8 @@ export class Client { * @return Returned if the request is successful. */ assignFieldConfigurationSchemeToProject(body: FieldConfigurationSchemeProjectAssociation): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -9667,11 +9383,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfigurationScheme(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -9741,11 +9457,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationScheme(id: number, body: UpdateFieldConfigurationSchemeDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9818,11 +9534,11 @@ export class Client { * @return Returned if the request is successful. */ setFieldConfigurationSchemeMapping(id: number, body: AssociateFieldConfigurationsWithIssueTypesRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9896,11 +9612,11 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypesFromGlobalFieldConfigurationScheme(id: number, body: IssueTypeIdsToRemove): Observable { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9990,16 +9706,13 @@ export class Client { * @return Returned if the request is successful. */ createFilter(body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter") + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -10062,8 +9775,8 @@ export class Client { * @return Returned if the request is successful. */ getDefaultShareScope(): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); let options_ : any = { observe: "response", @@ -10118,8 +9831,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultShareScope(body: DefaultShareScope): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); const content_ = JSON.stringify(body); @@ -10186,12 +9899,11 @@ export class Client { * @return Returned if the request is successful. */ getFavouriteFilters(expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/favourite?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/favourite") + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -10258,16 +9970,13 @@ export class Client { * @return Returned if the request is successful. */ getMyFilters(expand?: string | undefined, includeFavourites?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/my?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (includeFavourites === null) - throw new globalThis.Error("The parameter 'includeFavourites' cannot be null."); - else if (includeFavourites !== undefined) - url_ += "includeFavourites=" + encodeURIComponent("" + includeFavourites) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(includeFavourites, 'includeFavourites'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/my") + .param("expand", expand) + .param("includeFavourites", includeFavourites) + .toString(); let options_ : any = { observe: "response", @@ -10363,60 +10072,35 @@ export class Client { * @return Returned if the request is successful. */ getFiltersPaginated(filterName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy5 | undefined, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, isSubstringMatch?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/search?"; - if (filterName === null) - throw new globalThis.Error("The parameter 'filterName' cannot be null."); - else if (filterName !== undefined) - url_ += "filterName=" + encodeURIComponent("" + filterName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - if (isSubstringMatch === null) - throw new globalThis.Error("The parameter 'isSubstringMatch' cannot be null."); - else if (isSubstringMatch !== undefined) - url_ += "isSubstringMatch=" + encodeURIComponent("" + isSubstringMatch) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filterName, 'filterName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + Guard.notNull(isSubstringMatch, 'isSubstringMatch'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/search") + .param("filterName", filterName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .param("isSubstringMatch", isSubstringMatch) + .toString(); let options_ : any = { observe: "response", @@ -10479,11 +10163,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFilter(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -10544,19 +10228,15 @@ export class Client { * @return Returned if the request is successful. */ getFilter(id: number, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); let options_ : any = { observe: "response", @@ -10622,19 +10302,15 @@ export class Client { * @return Returned if the request is successful. */ updateFilter(id: number, body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -10698,11 +10374,11 @@ export class Client { * @return Returned if the request is successful. */ resetColumns(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -10758,11 +10434,11 @@ export class Client { * @return Returned if the request is successful. */ getColumns(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -10835,17 +10511,15 @@ export class Client { * @return Returned if the request is successful. */ setColumns(id: number, body: ColumnRequestBody, columns?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_ : any = { body: content_, @@ -10912,15 +10586,13 @@ export class Client { * @return Returned if the request is successful. */ deleteFavouriteForFilter(id: number, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -10980,15 +10652,13 @@ export class Client { * @return Returned if the request is successful. */ setFavouriteForFilter(id: number, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -11045,11 +10715,11 @@ export class Client { * @return Returned if the request is successful. */ changeFilterOwner(id: number, body: ChangeFilterOwner): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/owner"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/owner") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -11118,11 +10788,11 @@ export class Client { * @return Returned if the request is successful. */ getSharePermissions(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -11189,11 +10859,11 @@ export class Client { * @return Returned if the request is successful. */ addSharePermission(id: number, body: SharePermissionInputBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -11269,14 +10939,13 @@ export class Client { * @return Returned if the request is successful. */ deleteSharePermission(id: number, permissionId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); let options_ : any = { observe: "response", @@ -11333,14 +11002,13 @@ export class Client { * @return Returned if the request is successful. */ getSharePermission(id: number, permissionId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); let options_ : any = { observe: "response", @@ -11404,24 +11072,17 @@ export class Client { * @return Returned if the request is successful. */ removeGroup(groupname?: string | undefined, groupId?: string | undefined, swapGroup?: string | undefined, swapGroupId?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (swapGroup === null) - throw new globalThis.Error("The parameter 'swapGroup' cannot be null."); - else if (swapGroup !== undefined) - url_ += "swapGroup=" + encodeURIComponent("" + swapGroup) + "&"; - if (swapGroupId === null) - throw new globalThis.Error("The parameter 'swapGroupId' cannot be null."); - else if (swapGroupId !== undefined) - url_ += "swapGroupId=" + encodeURIComponent("" + swapGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(swapGroup, 'swapGroup'); + Guard.notNull(swapGroupId, 'swapGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("swapGroup", swapGroup) + .param("swapGroupId", swapGroupId) + .toString(); let options_ : any = { observe: "response", @@ -11489,20 +11150,15 @@ export class Client { * @deprecated */ getGroup(groupname?: string | undefined, groupId?: string | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -11570,8 +11226,8 @@ export class Client { * @return Returned if the request is successful. */ createGroup(body: AddGroupBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/group"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .toString(); const content_ = JSON.stringify(body); @@ -11644,32 +11300,21 @@ export class Client { * @return Returned if the request is successful. */ bulkGetGroups(startAt?: number | undefined, maxResults?: number | undefined, groupId?: string[] | undefined, groupName?: string[] | undefined, accessType?: string | undefined, applicationKey?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/group/bulk?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - groupId && groupId.forEach(item => { url_ += "groupId=" + encodeURIComponent("" + item) + "&"; }); - if (groupName === null) - throw new globalThis.Error("The parameter 'groupName' cannot be null."); - else if (groupName !== undefined) - groupName && groupName.forEach(item => { url_ += "groupName=" + encodeURIComponent("" + item) + "&"; }); - if (accessType === null) - throw new globalThis.Error("The parameter 'accessType' cannot be null."); - else if (accessType !== undefined) - url_ += "accessType=" + encodeURIComponent("" + accessType) + "&"; - if (applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' cannot be null."); - else if (applicationKey !== undefined) - url_ += "applicationKey=" + encodeURIComponent("" + applicationKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(groupName, 'groupName'); + Guard.notNull(accessType, 'accessType'); + Guard.notNull(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/bulk") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("groupId", groupId) + .paramArray("groupName", groupName) + .param("accessType", accessType) + .param("applicationKey", applicationKey) + .toString(); let options_ : any = { observe: "response", @@ -11742,28 +11387,19 @@ export class Client { * @return Returned if the request is successful. */ getUsersFromGroup(groupname?: string | undefined, groupId?: string | undefined, includeInactiveUsers?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/group/member?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (includeInactiveUsers === null) - throw new globalThis.Error("The parameter 'includeInactiveUsers' cannot be null."); - else if (includeInactiveUsers !== undefined) - url_ += "includeInactiveUsers=" + encodeURIComponent("" + includeInactiveUsers) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(includeInactiveUsers, 'includeInactiveUsers'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/member") + .param("groupname", groupname) + .param("groupId", groupId) + .param("includeInactiveUsers", includeInactiveUsers) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -11835,24 +11471,17 @@ export class Client { * @return Returned if the request is successful. */ removeUserFromGroup(accountId: string, groupname?: string | undefined, groupId?: string | undefined, username?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("accountId", accountId) + .param("groupname", groupname) + .param("groupId", groupId) + .param("username", username) + .toString(); let options_ : any = { observe: "response", @@ -11919,16 +11548,13 @@ export class Client { * @return Returned if the request is successful. */ addUserToGroup(body: UpdateUserToGroupBean, groupname?: string | undefined, groupId?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("groupname", groupname) + .param("groupId", groupId) + .toString(); const content_ = JSON.stringify(body); @@ -12011,36 +11637,23 @@ export class Client { * @return Returned if the request is successful. */ findGroups(accountId?: string | undefined, query?: string | undefined, exclude?: string[] | undefined, excludeId?: string[] | undefined, maxResults?: number | undefined, caseInsensitive?: boolean | undefined, userName?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/groups/picker?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeId === null) - throw new globalThis.Error("The parameter 'excludeId' cannot be null."); - else if (excludeId !== undefined) - excludeId && excludeId.forEach(item => { url_ += "excludeId=" + encodeURIComponent("" + item) + "&"; }); - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (userName === null) - throw new globalThis.Error("The parameter 'userName' cannot be null."); - else if (userName !== undefined) - url_ += "userName=" + encodeURIComponent("" + userName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeId, 'excludeId'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(userName, 'userName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groups/picker") + .param("accountId", accountId) + .param("query", query) + .paramArray("exclude", exclude) + .paramArray("excludeId", excludeId) + .param("maxResults", maxResults) + .param("caseInsensitive", caseInsensitive) + .param("userName", userName) + .toString(); let options_ : any = { observe: "response", @@ -12100,44 +11713,27 @@ export class Client { * @return Returned if the request is successful. */ findUsersAndGroups(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, fieldId?: string | undefined, projectId?: string[] | undefined, issueTypeId?: string[] | undefined, avatarSize?: AvatarSize | undefined, caseInsensitive?: boolean | undefined, excludeConnectAddons?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/groupuserpicker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' cannot be null."); - else if (fieldId !== undefined) - url_ += "fieldId=" + encodeURIComponent("" + fieldId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - issueTypeId && issueTypeId.forEach(item => { url_ += "issueTypeId=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(fieldId, 'fieldId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groupuserpicker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .param("fieldId", fieldId) + .paramArray("projectId", projectId) + .paramArray("issueTypeId", issueTypeId) + .param("avatarSize", avatarSize) + .param("caseInsensitive", caseInsensitive) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); let options_ : any = { observe: "response", @@ -12204,8 +11800,8 @@ export class Client { * @return Returned if the request is successful. */ getLicense(): Observable { - let url_ = this.baseUrl + "/rest/api/3/instance/license"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/instance/license") + .toString(); let options_ : any = { observe: "response", @@ -12261,12 +11857,11 @@ export class Client { * @return Returned if the request is successful. */ createIssue(body: IssueUpdateDetails, updateHistory?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue?"; - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(updateHistory, 'updateHistory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue") + .param("updateHistory", updateHistory) + .toString(); const content_ = JSON.stringify(body); @@ -12350,8 +11945,8 @@ export class Client { * @return Returns the URL to check the status of the submitted request. */ archiveIssues(body: ArchiveIssueAsyncRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -12424,8 +12019,8 @@ export class Client { * @return Returned if there is at least one valid issue to archive in the request. The return message will include the count of archived issues and subtasks, as well as error details for issues which failed to get archived. */ archiveIssues(body: IssueArchivalSyncRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -12504,8 +12099,8 @@ export class Client { * is invalid for any other reason. */ createIssues(body: IssuesUpdateBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/bulk"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulk") + .toString(); const content_ = JSON.stringify(body); @@ -12572,8 +12167,8 @@ export class Client { * @return Returned if the request is successful. A response may contain both successful issues and issue errors. */ bulkFetchIssues(body: BulkFetchIssueRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -12642,28 +12237,19 @@ export class Client { * @deprecated */ getCreateIssueMeta(projectIds?: string[] | undefined, projectKeys?: string[] | undefined, issuetypeIds?: string[] | undefined, issuetypeNames?: string[] | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta?"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - if (projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' cannot be null."); - else if (projectKeys !== undefined) - projectKeys && projectKeys.forEach(item => { url_ += "projectKeys=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeIds === null) - throw new globalThis.Error("The parameter 'issuetypeIds' cannot be null."); - else if (issuetypeIds !== undefined) - issuetypeIds && issuetypeIds.forEach(item => { url_ += "issuetypeIds=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeNames === null) - throw new globalThis.Error("The parameter 'issuetypeNames' cannot be null."); - else if (issuetypeNames !== undefined) - issuetypeNames && issuetypeNames.forEach(item => { url_ += "issuetypeNames=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIds, 'projectIds'); + Guard.notNull(projectKeys, 'projectKeys'); + Guard.notNull(issuetypeIds, 'issuetypeIds'); + Guard.notNull(issuetypeNames, 'issuetypeNames'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta") + .paramArray("projectIds", projectIds) + .paramArray("projectKeys", projectKeys) + .paramArray("issuetypeIds", issuetypeIds) + .paramArray("issuetypeNames", issuetypeNames) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -12721,19 +12307,15 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypes(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -12796,22 +12378,17 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypeId(projectIdOrKey: string, issueTypeId: string, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}") + .path("projectIdOrKey", projectIdOrKey) + .path("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -12873,12 +12450,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLimitReport(isReturningKeys?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/limit/report?"; - if (isReturningKeys === null) - throw new globalThis.Error("The parameter 'isReturningKeys' cannot be null."); - else if (isReturningKeys !== undefined) - url_ += "isReturningKeys=" + encodeURIComponent("" + isReturningKeys) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(isReturningKeys, 'isReturningKeys'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/limit/report") + .param("isReturningKeys", isReturningKeys) + .toString(); let options_ : any = { observe: "response", @@ -12943,32 +12519,21 @@ export class Client { * @return Returned if the request is successful. */ getIssuePickerResource(query?: string | undefined, currentJQL?: string | undefined, currentIssueKey?: string | undefined, currentProjectId?: string | undefined, showSubTasks?: boolean | undefined, showSubTaskParent?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/picker?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (currentJQL === null) - throw new globalThis.Error("The parameter 'currentJQL' cannot be null."); - else if (currentJQL !== undefined) - url_ += "currentJQL=" + encodeURIComponent("" + currentJQL) + "&"; - if (currentIssueKey === null) - throw new globalThis.Error("The parameter 'currentIssueKey' cannot be null."); - else if (currentIssueKey !== undefined) - url_ += "currentIssueKey=" + encodeURIComponent("" + currentIssueKey) + "&"; - if (currentProjectId === null) - throw new globalThis.Error("The parameter 'currentProjectId' cannot be null."); - else if (currentProjectId !== undefined) - url_ += "currentProjectId=" + encodeURIComponent("" + currentProjectId) + "&"; - if (showSubTasks === null) - throw new globalThis.Error("The parameter 'showSubTasks' cannot be null."); - else if (showSubTasks !== undefined) - url_ += "showSubTasks=" + encodeURIComponent("" + showSubTasks) + "&"; - if (showSubTaskParent === null) - throw new globalThis.Error("The parameter 'showSubTaskParent' cannot be null."); - else if (showSubTaskParent !== undefined) - url_ += "showSubTaskParent=" + encodeURIComponent("" + showSubTaskParent) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(currentJQL, 'currentJQL'); + Guard.notNull(currentIssueKey, 'currentIssueKey'); + Guard.notNull(currentProjectId, 'currentProjectId'); + Guard.notNull(showSubTasks, 'showSubTasks'); + Guard.notNull(showSubTaskParent, 'showSubTaskParent'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/picker") + .param("query", query) + .param("currentJQL", currentJQL) + .param("currentIssueKey", currentIssueKey) + .param("currentProjectId", currentProjectId) + .param("showSubTasks", showSubTasks) + .param("showSubTaskParent", showSubTaskParent) + .toString(); let options_ : any = { observe: "response", @@ -13023,8 +12588,8 @@ export class Client { * @param body Issue properties to be set or updated with values. */ bulkSetIssuesPropertiesList(body: IssueEntityProperties): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/properties"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties") + .toString(); const content_ = JSON.stringify(body); @@ -13089,8 +12654,8 @@ export class Client { * @param body Details of the issue properties to be set or updated. Note that if an issue is not found, it is ignored. */ bulkSetIssuePropertiesByIssue(body: MultiIssueEntityProperties): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/multi"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/multi") + .toString(); const content_ = JSON.stringify(body); @@ -13162,11 +12727,11 @@ export class Client { * @param propertyKey The key of the property. */ bulkDeleteIssueProperty(propertyKey: string, body: IssueFilterForBulkPropertyDelete): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -13231,11 +12796,11 @@ export class Client { * @param propertyKey The key of the property. The maximum length is 255 characters. */ bulkSetIssueProperty(propertyKey: string, body: BulkIssuePropertyUpdateRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -13301,8 +12866,8 @@ export class Client { * @return Returned if there is at least one valid issue to unarchive in the request. It will return the count of unarchived issues, which also includes the count of the subtasks unarchived, and it will show the detailed errors for those issues which are not unarchived. */ unarchiveIssues(body: IssueArchivalSyncRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/unarchive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/unarchive") + .toString(); const content_ = JSON.stringify(body); @@ -13374,8 +12939,8 @@ export class Client { * @return Returned if the request is successful */ getIsWatchingIssueBulk(body: IssueList): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/watching"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/watching") + .toString(); const content_ = JSON.stringify(body); @@ -13436,15 +13001,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssue(issueIdOrKey: string, deleteSubtasks?: DeleteSubtasks | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (deleteSubtasks === null) - throw new globalThis.Error("The parameter 'deleteSubtasks' cannot be null."); - else if (deleteSubtasks !== undefined) - url_ += "deleteSubtasks=" + encodeURIComponent("" + deleteSubtasks) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(deleteSubtasks, 'deleteSubtasks'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("deleteSubtasks", deleteSubtasks) + .toString(); let options_ : any = { observe: "response", @@ -13547,35 +13110,23 @@ export class Client { * @return Returned if the request is successful. */ getIssue(issueIdOrKey: string, fields?: string[] | undefined, fieldsByKeys?: boolean | undefined, expand?: string | undefined, properties?: string[] | undefined, updateHistory?: boolean | undefined, failFast?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(fields, 'fields'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(updateHistory, 'updateHistory'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .paramArray("fields", fields) + .param("fieldsByKeys", fieldsByKeys) + .param("expand", expand) + .paramArray("properties", properties) + .param("updateHistory", updateHistory) + .param("failFast", failFast) + .toString(); let options_ : any = { observe: "response", @@ -13640,31 +13191,21 @@ export class Client { * @return Returned if the request is successful and the `returnIssue` parameter is `true` */ editIssue(issueIdOrKey: string, body: IssueUpdateDetails, notifyUsers?: boolean | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined, returnIssue?: boolean | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (returnIssue === null) - throw new globalThis.Error("The parameter 'returnIssue' cannot be null."); - else if (returnIssue !== undefined) - url_ += "returnIssue=" + encodeURIComponent("" + returnIssue) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(returnIssue, 'returnIssue'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .param("returnIssue", returnIssue) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -13754,11 +13295,11 @@ export class Client { * @return Returned if the request is successful. */ assignIssue(issueIdOrKey: string, body: User): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -13827,11 +13368,11 @@ export class Client { * @return Returned if the request is successful. */ addAttachment(issueIdOrKey: string, body: Blob): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = body; @@ -13908,19 +13449,15 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogs(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -13976,11 +13513,11 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogsByIds(issueIdOrKey: string, body: IssueChangelogIds): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -14048,27 +13585,19 @@ export class Client { * @return Returned if the request is successful. */ getComments(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy6 | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -14133,15 +13662,13 @@ export class Client { * @return Returned if the request is successful. */ addComment(issueIdOrKey: string, body: Comment, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -14214,14 +13741,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComment(issueIdOrKey: string, id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -14287,18 +13813,15 @@ export class Client { * @return Returned if the request is successful. */ getComment(issueIdOrKey: string, id: string, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -14362,26 +13885,19 @@ export class Client { * @return Returned if the request is successful. */ updateComment(issueIdOrKey: string, id: string, body: Comment, notifyUsers?: boolean | undefined, overrideEditableFlag?: boolean | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("overrideEditableFlag", overrideEditableFlag) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -14451,19 +13967,15 @@ export class Client { * @return Returned if the request is successful. */ getEditIssueMeta(issueIdOrKey: string, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta") + .path("issueIdOrKey", issueIdOrKey) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_ : any = { observe: "response", @@ -14528,11 +14040,11 @@ export class Client { * @return Returned if the email is queued for sending. */ notify(issueIdOrKey: string, body: Notification): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -14601,11 +14113,11 @@ export class Client { * @return Returned if the request is successful. */ getIssuePropertyKeys(issueIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -14662,14 +14174,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueProperty(issueIdOrKey: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -14726,14 +14237,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueProperty(issueIdOrKey: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -14795,14 +14305,13 @@ export class Client { * @return Returned if the issue property is updated. */ setIssueProperty(issueIdOrKey: string, propertyKey: string, body: any): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -14884,15 +14393,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkByGlobalId(issueIdOrKey: string, globalId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === undefined || globalId === null) - throw new globalThis.Error("The parameter 'globalId' must be defined and cannot be null."); - else - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); let options_ : any = { observe: "response", @@ -14957,15 +14464,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinks(issueIdOrKey: string, globalId?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === null) - throw new globalThis.Error("The parameter 'globalId' cannot be null."); - else if (globalId !== undefined) - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); let options_ : any = { observe: "response", @@ -15037,11 +14542,11 @@ export class Client { * @return Returned if the remote issue link is updated. */ createOrUpdateRemoteIssueLink(issueIdOrKey: string, body: RemoteIssueLinkRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -15121,14 +14626,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkById(issueIdOrKey: string, linkId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); let options_ : any = { observe: "response", @@ -15193,14 +14697,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinkById(issueIdOrKey: string, linkId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); let options_ : any = { observe: "response", @@ -15269,14 +14772,13 @@ export class Client { * @return Returned if the request is successful. */ updateRemoteIssueLink(issueIdOrKey: string, linkId: string, body: RemoteIssueLinkRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); const content_ = JSON.stringify(body); @@ -15354,31 +14856,21 @@ export class Client { * @return Returned if the request is successful. */ getTransitions(issueIdOrKey: string, expand?: string | undefined, transitionId?: string | undefined, skipRemoteOnlyCondition?: boolean | undefined, includeUnavailableTransitions?: boolean | undefined, sortByOpsBarAndStatus?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' cannot be null."); - else if (transitionId !== undefined) - url_ += "transitionId=" + encodeURIComponent("" + transitionId) + "&"; - if (skipRemoteOnlyCondition === null) - throw new globalThis.Error("The parameter 'skipRemoteOnlyCondition' cannot be null."); - else if (skipRemoteOnlyCondition !== undefined) - url_ += "skipRemoteOnlyCondition=" + encodeURIComponent("" + skipRemoteOnlyCondition) + "&"; - if (includeUnavailableTransitions === null) - throw new globalThis.Error("The parameter 'includeUnavailableTransitions' cannot be null."); - else if (includeUnavailableTransitions !== undefined) - url_ += "includeUnavailableTransitions=" + encodeURIComponent("" + includeUnavailableTransitions) + "&"; - if (sortByOpsBarAndStatus === null) - throw new globalThis.Error("The parameter 'sortByOpsBarAndStatus' cannot be null."); - else if (sortByOpsBarAndStatus !== undefined) - url_ += "sortByOpsBarAndStatus=" + encodeURIComponent("" + sortByOpsBarAndStatus) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(transitionId, 'transitionId'); + Guard.notNull(skipRemoteOnlyCondition, 'skipRemoteOnlyCondition'); + Guard.notNull(includeUnavailableTransitions, 'includeUnavailableTransitions'); + Guard.notNull(sortByOpsBarAndStatus, 'sortByOpsBarAndStatus'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .param("transitionId", transitionId) + .param("skipRemoteOnlyCondition", skipRemoteOnlyCondition) + .param("includeUnavailableTransitions", includeUnavailableTransitions) + .param("sortByOpsBarAndStatus", sortByOpsBarAndStatus) + .toString(); let options_ : any = { observe: "response", @@ -15438,11 +14930,11 @@ export class Client { * @return Returned if the request is successful. */ doTransition(issueIdOrKey: string, body: IssueUpdateDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -15523,11 +15015,11 @@ export class Client { * @return Returned if the request is successful. */ removeVote(issueIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -15583,11 +15075,11 @@ export class Client { * @return Returned if the request is successful. */ getVotes(issueIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -15647,11 +15139,11 @@ export class Client { * @return Returned if the request is successful. */ addVote(issueIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -15718,19 +15210,15 @@ export class Client { * @return Returned if the request is successful. */ removeWatcher(issueIdOrKey: string, username?: string | undefined, accountId?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .param("username", username) + .param("accountId", accountId) + .toString(); let options_ : any = { observe: "response", @@ -15794,11 +15282,11 @@ export class Client { * @return Returned if the request is successful */ getIssueWatchers(issueIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -15859,11 +15347,11 @@ export class Client { * @return Returned if the request is successful. */ addWatcher(issueIdOrKey: string, body: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -15942,19 +15430,15 @@ export class Client { * @return Returned if the bulk deletion request was partially successful, with a message indicating partial success. */ bulkDeleteWorklogs(issueIdOrKey: string, body: WorklogIdsRequestBean, adjustEstimate?: AdjustEstimate | undefined, overrideEditableFlag?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -16027,31 +15511,21 @@ export class Client { * @return Returned if the request is successful */ getIssueWorklog(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, startedAfter?: number | undefined, startedBefore?: number | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (startedAfter === null) - throw new globalThis.Error("The parameter 'startedAfter' cannot be null."); - else if (startedAfter !== undefined) - url_ += "startedAfter=" + encodeURIComponent("" + startedAfter) + "&"; - if (startedBefore === null) - throw new globalThis.Error("The parameter 'startedBefore' cannot be null."); - else if (startedBefore !== undefined) - url_ += "startedBefore=" + encodeURIComponent("" + startedBefore) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(startedAfter, 'startedAfter'); + Guard.notNull(startedBefore, 'startedBefore'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("startedAfter", startedAfter) + .param("startedBefore", startedBefore) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -16122,35 +15596,23 @@ export class Client { * @return Returned if the request is successful. */ addWorklog(issueIdOrKey: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate2 | undefined, newEstimate?: string | undefined, reduceBy?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (reduceBy === null) - throw new globalThis.Error("The parameter 'reduceBy' cannot be null."); - else if (reduceBy !== undefined) - url_ += "reduceBy=" + encodeURIComponent("" + reduceBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(reduceBy, 'reduceBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("reduceBy", reduceBy) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -16227,19 +15689,15 @@ export class Client { * @return Returned if the request is partially successful. */ bulkMoveWorklogs(issueIdOrKey: string, body: WorklogsMoveRequestBean, adjustEstimate?: AdjustEstimate3 | undefined, overrideEditableFlag?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -16318,34 +15776,23 @@ export class Client { * @return Returned if the request is successful. */ deleteWorklog(issueIdOrKey: string, id: string, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate4 | undefined, newEstimate?: string | undefined, increaseBy?: string | undefined, overrideEditableFlag?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (increaseBy === null) - throw new globalThis.Error("The parameter 'increaseBy' cannot be null."); - else if (increaseBy !== undefined) - url_ += "increaseBy=" + encodeURIComponent("" + increaseBy) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(increaseBy, 'increaseBy'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("increaseBy", increaseBy) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_ : any = { observe: "response", @@ -16409,18 +15856,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklog(issueIdOrKey: string, id: string, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -16490,34 +15934,23 @@ export class Client { * @return Returned if the request is successful */ updateWorklog(issueIdOrKey: string, id: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate5 | undefined, newEstimate?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -16586,14 +16019,13 @@ export class Client { * @return Returned if the request is successful. */ getWorklogPropertyKeys(issueIdOrKey: string, worklogId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .toString(); let options_ : any = { observe: "response", @@ -16659,17 +16091,15 @@ export class Client { * @return Returned if the worklog property is removed. */ deleteWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -16735,17 +16165,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -16812,17 +16240,15 @@ export class Client { * @return Returned if the worklog property is updated. */ setWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string, body: any): Observable { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -16903,8 +16329,8 @@ export class Client { * @return Returned if the request is successful. */ linkIssues(body: LinkIssueRequestJsonBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/issueLink"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink") + .toString(); const content_ = JSON.stringify(body); @@ -16977,11 +16403,11 @@ export class Client { * @return 200 response */ deleteIssueLink(linkId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); let options_ : any = { observe: "response", @@ -17045,11 +16471,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLink(linkId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); let options_ : any = { observe: "response", @@ -17112,8 +16538,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkTypes(): Observable { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); let options_ : any = { observe: "response", @@ -17172,8 +16598,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueLinkType(body: IssueLinkType): Observable { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); const content_ = JSON.stringify(body); @@ -17241,11 +16667,11 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueLinkType(issueLinkTypeId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); let options_ : any = { observe: "response", @@ -17305,11 +16731,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkType(issueLinkTypeId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); let options_ : any = { observe: "response", @@ -17373,11 +16799,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueLinkType(issueLinkTypeId: string, body: IssueLinkType): Observable { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); const content_ = JSON.stringify(body); @@ -17445,8 +16871,8 @@ export class Client { * @return Returns the details of your export task. You can use the [get task](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/#api-rest-api-3-task-taskid-get) API to view the progress of your request. */ exportArchivedIssues(body: ArchivedIssuesFilterRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/issues/archive/export"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issues/archive/export") + .toString(); const content_ = JSON.stringify(body); @@ -17517,8 +16943,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecuritySchemes(): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); let options_ : any = { observe: "response", @@ -17577,8 +17003,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueSecurityScheme(body: CreateIssueSecuritySchemeDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); const content_ = JSON.stringify(body); @@ -17659,28 +17085,19 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevels(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, onlyDefault?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .param("onlyDefault", onlyDefault) + .toString(); let options_ : any = { observe: "response", @@ -17752,8 +17169,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultLevels(body: SetDefaultLevelsRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default") + .toString(); const content_ = JSON.stringify(body); @@ -17849,32 +17266,21 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelMembers(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, levelId?: string[] | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (levelId === null) - throw new globalThis.Error("The parameter 'levelId' cannot be null."); - else if (levelId !== undefined) - levelId && levelId.forEach(item => { url_ += "levelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(levelId, 'levelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .paramArray("levelId", levelId) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -17941,24 +17347,17 @@ export class Client { * @return Returned if the request is successful. */ searchProjectsUsingSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, issueSecuritySchemeId?: string[] | undefined, projectId?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' cannot be null."); - else if (issueSecuritySchemeId !== undefined) - issueSecuritySchemeId && issueSecuritySchemeId.forEach(item => { url_ += "issueSecuritySchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecuritySchemeId", issueSecuritySchemeId) + .paramArray("projectId", projectId) + .toString(); let options_ : any = { observe: "response", @@ -18029,8 +17428,8 @@ export class Client { * Associate security scheme to project */ associateSchemesToProjects(body: AssociateSecuritySchemeWithProjectDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .toString(); const content_ = JSON.stringify(body); @@ -18123,24 +17522,17 @@ export class Client { * @return Returned if the request is successful. */ searchSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .toString(); let options_ : any = { observe: "response", @@ -18204,11 +17596,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityScheme(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -18268,11 +17660,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueSecurityScheme(id: string, body: UpdateIssueSecuritySchemeRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -18367,27 +17759,19 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevelMembers(issueSecuritySchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, issueSecurityLevelId?: string[] | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members?"; - if (issueSecuritySchemeId === undefined || issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' must be defined."); - url_ = url_.replace("{issueSecuritySchemeId}", encodeURIComponent("" + issueSecuritySchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecurityLevelId === null) - throw new globalThis.Error("The parameter 'issueSecurityLevelId' cannot be null."); - else if (issueSecurityLevelId !== undefined) - issueSecurityLevelId && issueSecurityLevelId.forEach(item => { url_ += "issueSecurityLevelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecurityLevelId, 'issueSecurityLevelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members") + .path("issueSecuritySchemeId", issueSecuritySchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecurityLevelId", issueSecurityLevelId) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -18455,11 +17839,11 @@ export class Client { * @return Returned if the request is successful. */ deleteSecurityScheme(schemeId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_ : any = { observe: "response", @@ -18540,11 +17924,11 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevel(schemeId: string, body: AddSecuritySchemeLevelsRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -18630,18 +18014,15 @@ export class Client { * @param replaceWith (optional) The ID of the issue security level that will replace the currently selected level. */ removeLevel(schemeId: string, levelId: string, replaceWith?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.notNull(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .param("replaceWith", replaceWith) + .toString(); let options_ : any = { observe: "response", @@ -18728,14 +18109,13 @@ export class Client { * @return Returned if the request is successful. */ updateSecurityLevel(schemeId: string, levelId: string, body: UpdateIssueSecurityLevelDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -18821,14 +18201,13 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevelMembers(schemeId: string, levelId: string, body: SecuritySchemeMembersRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -18915,17 +18294,15 @@ export class Client { * @return Returned if the request is successful. */ removeMemberFromSecurityLevel(schemeId: string, levelId: string, memberId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (memberId === undefined || memberId === null) - throw new globalThis.Error("The parameter 'memberId' must be defined."); - url_ = url_.replace("{memberId}", encodeURIComponent("" + memberId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.required(memberId, 'memberId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .path("memberId", memberId) + .toString(); let options_ : any = { observe: "response", @@ -19005,8 +18382,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueAllTypes(): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); let options_ : any = { observe: "response", @@ -19064,8 +18441,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueType(body: IssueTypeCreateBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); const content_ = JSON.stringify(body); @@ -19142,16 +18519,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypesForProject(projectId: number, level?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (level === null) - throw new globalThis.Error("The parameter 'level' cannot be null."); - else if (level !== undefined) - url_ += "level=" + encodeURIComponent("" + level) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(level, 'level'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/project") + .param("projectId", projectId) + .param("level", level) + .toString(); let options_ : any = { observe: "response", @@ -19219,15 +18593,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueType(id: string, alternativeIssueTypeId?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (alternativeIssueTypeId === null) - throw new globalThis.Error("The parameter 'alternativeIssueTypeId' cannot be null."); - else if (alternativeIssueTypeId !== undefined) - url_ += "alternativeIssueTypeId=" + encodeURIComponent("" + alternativeIssueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(alternativeIssueTypeId, 'alternativeIssueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .param("alternativeIssueTypeId", alternativeIssueTypeId) + .toString(); let options_ : any = { observe: "response", @@ -19299,11 +18671,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueType(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -19363,11 +18735,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueType(id: string, body: IssueTypeUpdateBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -19443,11 +18815,11 @@ export class Client { * @return Returned if the request is successful. */ getAlternativeIssueTypes(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -19513,23 +18885,17 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeAvatar(id: string, size: number, body: any, x?: number | undefined, y?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2") + .path("id", id) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -19601,11 +18967,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypePropertyKeys(issueTypeId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties") + .path("issueTypeId", issueTypeId) + .toString(); let options_ : any = { observe: "response", @@ -19666,14 +19032,13 @@ export class Client { * @return Returned if the issue type property is deleted. */ deleteIssueTypeProperty(issueTypeId: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -19738,14 +19103,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeProperty(issueTypeId: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -19811,14 +19175,13 @@ export class Client { * @return Returned if the issue type property is updated. */ setIssueTypeProperty(issueTypeId: string, propertyKey: string, body: any): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -19910,32 +19273,21 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueTypeSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy7 | undefined, expand?: string | undefined, queryString?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("expand", expand) + .param("queryString", queryString) + .toString(); let options_ : any = { observe: "response", @@ -19998,8 +19350,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScheme(body: IssueTypeSchemeDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .toString(); const content_ = JSON.stringify(body); @@ -20073,20 +19425,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemesMapping(startAt?: number | undefined, maxResults?: number | undefined, issueTypeSchemeId?: number[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' cannot be null."); - else if (issueTypeSchemeId !== undefined) - issueTypeSchemeId && issueTypeSchemeId.forEach(item => { url_ += "issueTypeSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeSchemeId", issueTypeSchemeId) + .toString(); let options_ : any = { observe: "response", @@ -20152,20 +19499,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemeForProjects(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -20228,8 +19570,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeSchemeToProject(body: IssueTypeSchemeProjectAssociation): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -20302,11 +19644,11 @@ export class Client { * @return Returned if the issue type scheme is deleted. */ deleteIssueTypeScheme(issueTypeSchemeId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); let options_ : any = { observe: "response", @@ -20375,11 +19717,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeSchemeUpdateDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -20452,11 +19794,11 @@ export class Client { * @return Returned if the request is successful. */ addIssueTypesToIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeIds): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -20529,11 +19871,11 @@ export class Client { * @return Returned if the request is successful. */ reorderIssueTypesInIssueTypeScheme(issueTypeSchemeId: number, body: OrderOfIssueTypes): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -20607,14 +19949,13 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypeFromIssueTypeScheme(issueTypeSchemeId: number, issueTypeId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .path("issueTypeId", issueTypeId) + .toString(); let options_ : any = { observe: "response", @@ -20691,32 +20032,21 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, orderBy?: OrderBy8 | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -20780,8 +20110,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScreenScheme(body: IssueTypeScreenSchemeDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -20859,20 +20189,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, issueTypeScreenSchemeId?: number[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' cannot be null."); - else if (issueTypeScreenSchemeId !== undefined) - issueTypeScreenSchemeId && issueTypeScreenSchemeId.forEach(item => { url_ += "issueTypeScreenSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); let options_ : any = { observe: "response", @@ -20938,20 +20263,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeProjectAssociations(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -21014,8 +20334,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeScreenSchemeToProject(body: IssueTypeScreenSchemeProjectAssociation): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -21088,11 +20408,11 @@ export class Client { * @return Returned if the issue type screen scheme is deleted. */ deleteIssueTypeScreenScheme(issueTypeScreenSchemeId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); let options_ : any = { observe: "response", @@ -21162,11 +20482,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeUpdateDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -21239,11 +20559,11 @@ export class Client { * @return Returned if the request is successful. */ appendMappingsForIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeMappingDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -21320,11 +20640,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultScreenScheme(issueTypeScreenSchemeId: string, body: UpdateDefaultScreenScheme): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -21397,11 +20717,11 @@ export class Client { * @return Returned if the screen scheme mappings are removed from the issue type screen scheme. */ removeMappingsFromIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeIds): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -21477,23 +20797,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectsForIssueTypeScreenScheme(issueTypeScreenSchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, query?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project?"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .toString(); let options_ : any = { observe: "response", @@ -21556,8 +20870,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoComplete(): Observable { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); let options_ : any = { observe: "response", @@ -21612,8 +20926,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoCompletePost(body: SearchAutoCompleteFilter): Observable { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); const content_ = JSON.stringify(body); @@ -21680,24 +20994,17 @@ export class Client { * @return Returned if the request is successful. */ getFieldAutoCompleteForQueryString(fieldName?: string | undefined, fieldValue?: string | undefined, predicateName?: string | undefined, predicateValue?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions?"; - if (fieldName === null) - throw new globalThis.Error("The parameter 'fieldName' cannot be null."); - else if (fieldName !== undefined) - url_ += "fieldName=" + encodeURIComponent("" + fieldName) + "&"; - if (fieldValue === null) - throw new globalThis.Error("The parameter 'fieldValue' cannot be null."); - else if (fieldValue !== undefined) - url_ += "fieldValue=" + encodeURIComponent("" + fieldValue) + "&"; - if (predicateName === null) - throw new globalThis.Error("The parameter 'predicateName' cannot be null."); - else if (predicateName !== undefined) - url_ += "predicateName=" + encodeURIComponent("" + predicateName) + "&"; - if (predicateValue === null) - throw new globalThis.Error("The parameter 'predicateValue' cannot be null."); - else if (predicateValue !== undefined) - url_ += "predicateValue=" + encodeURIComponent("" + predicateValue) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(fieldName, 'fieldName'); + Guard.notNull(fieldValue, 'fieldValue'); + Guard.notNull(predicateName, 'predicateName'); + Guard.notNull(predicateValue, 'predicateValue'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions") + .param("fieldName", fieldName) + .param("fieldValue", fieldValue) + .param("predicateName", predicateName) + .param("predicateValue", predicateValue) + .toString(); let options_ : any = { observe: "response", @@ -21768,24 +21075,17 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputations(functionKey?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (functionKey === null) - throw new globalThis.Error("The parameter 'functionKey' cannot be null."); - else if (functionKey !== undefined) - functionKey && functionKey.forEach(item => { url_ += "functionKey=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(functionKey, 'functionKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .paramArray("functionKey", functionKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .toString(); let options_ : any = { observe: "response", @@ -21853,12 +21153,11 @@ export class Client { * @return 200 response */ updatePrecomputations(body: JqlFunctionPrecomputationUpdateRequestBean, skipNotFoundPrecomputations?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (skipNotFoundPrecomputations === null) - throw new globalThis.Error("The parameter 'skipNotFoundPrecomputations' cannot be null."); - else if (skipNotFoundPrecomputations !== undefined) - url_ += "skipNotFoundPrecomputations=" + encodeURIComponent("" + skipNotFoundPrecomputations) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(skipNotFoundPrecomputations, 'skipNotFoundPrecomputations'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .param("skipNotFoundPrecomputations", skipNotFoundPrecomputations) + .toString(); const content_ = JSON.stringify(body); @@ -21948,12 +21247,11 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputationsByID(body: JqlFunctionPrecomputationGetByIdRequest, orderBy?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation/search?"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation/search") + .param("orderBy", orderBy) + .toString(); const content_ = JSON.stringify(body); @@ -22024,8 +21322,8 @@ export class Client { * @return Returned if the request is successful. */ matchIssues(body: IssuesAndJQLQueries): Observable { - let url_ = this.baseUrl + "/rest/api/3/jql/match"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/match") + .toString(); const content_ = JSON.stringify(body); @@ -22089,12 +21387,11 @@ export class Client { * @return Returned if the request is successful. */ parseJqlQueries(validation: Validation, body: JqlQueriesToParse): Observable { - let url_ = this.baseUrl + "/rest/api/3/jql/parse?"; - if (validation === undefined || validation === null) - throw new globalThis.Error("The parameter 'validation' must be defined and cannot be null."); - else - url_ += "validation=" + encodeURIComponent("" + validation) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(validation, 'validation'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/parse") + .param("validation", validation) + .toString(); const content_ = JSON.stringify(body); @@ -22160,8 +21457,8 @@ export class Client { * @return Returned if the request is successful. Note that the JQL queries are returned in the same order that they were passed. */ migrateQueries(body: JQLPersonalDataMigrationRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/jql/pdcleaner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/pdcleaner") + .toString(); const content_ = JSON.stringify(body); @@ -22232,8 +21529,8 @@ export class Client { * @return Returned if the request is successful. */ sanitiseJqlQueries(body: JqlQueriesToSanitize): Observable { - let url_ = this.baseUrl + "/rest/api/3/jql/sanitize"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/sanitize") + .toString(); const content_ = JSON.stringify(body); @@ -22311,16 +21608,13 @@ export class Client { * @return Returned if the request is successful. */ getAllLabels(startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/label?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/label") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -22371,8 +21665,8 @@ export class Client { * @return Returned if the request is successful. */ getApproximateLicenseCount(): Observable { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount") + .toString(); let options_ : any = { observe: "response", @@ -22438,11 +21732,11 @@ export class Client { * @return Returned if the request is successful. */ getApproximateApplicationLicenseCount(applicationKey: ApplicationKey): Observable { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}"; - if (applicationKey === undefined || applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' must be defined."); - url_ = url_.replace("{applicationKey}", encodeURIComponent("" + applicationKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}") + .path("applicationKey", applicationKey) + .toString(); let options_ : any = { observe: "response", @@ -22515,40 +21809,25 @@ export class Client { * @return Returned if the request is successful. */ getMyPermissions(projectKey?: string | undefined, projectId?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, permissions?: string | undefined, projectUuid?: string | undefined, projectConfigurationUuid?: string | undefined, commentId?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/mypermissions?"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (permissions === null) - throw new globalThis.Error("The parameter 'permissions' cannot be null."); - else if (permissions !== undefined) - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (projectUuid === null) - throw new globalThis.Error("The parameter 'projectUuid' cannot be null."); - else if (projectUuid !== undefined) - url_ += "projectUuid=" + encodeURIComponent("" + projectUuid) + "&"; - if (projectConfigurationUuid === null) - throw new globalThis.Error("The parameter 'projectConfigurationUuid' cannot be null."); - else if (projectConfigurationUuid !== undefined) - url_ += "projectConfigurationUuid=" + encodeURIComponent("" + projectConfigurationUuid) + "&"; - if (commentId === null) - throw new globalThis.Error("The parameter 'commentId' cannot be null."); - else if (commentId !== undefined) - url_ += "commentId=" + encodeURIComponent("" + commentId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(permissions, 'permissions'); + Guard.notNull(projectUuid, 'projectUuid'); + Guard.notNull(projectConfigurationUuid, 'projectConfigurationUuid'); + Guard.notNull(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypermissions") + .param("projectKey", projectKey) + .param("projectId", projectId) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("permissions", permissions) + .param("projectUuid", projectUuid) + .param("projectConfigurationUuid", projectConfigurationUuid) + .param("commentId", commentId) + .toString(); let options_ : any = { observe: "response", @@ -22621,12 +21900,11 @@ export class Client { * @return Returned if the request is successful. */ removePreference(key: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); let options_ : any = { observe: "response", @@ -22682,12 +21960,11 @@ export class Client { * @return Returned if the request is successful. */ getPreference(key: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); let options_ : any = { observe: "response", @@ -22749,12 +22026,11 @@ export class Client { * @return Returned if the request is successful. */ setPreference(key: string, body: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); const content_ = JSON.stringify(body); @@ -22819,8 +22095,8 @@ export class Client { * @deprecated */ deleteLocale(): Observable { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); let options_ : any = { observe: "response", @@ -22876,8 +22152,8 @@ export class Client { * @return Returned if the request is successful. */ getLocale(): Observable { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); let options_ : any = { observe: "response", @@ -22934,8 +22210,8 @@ export class Client { * @deprecated */ setLocale(body: Locale): Observable { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); const content_ = JSON.stringify(body); @@ -23003,12 +22279,11 @@ export class Client { * @return Returned if the request is successful. */ getCurrentUser(expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/myself?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/myself") + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -23076,32 +22351,21 @@ export class Client { * @return Returned if the request is successful. Only returns notification schemes that the user has permission to access. An empty list is returned if the user lacks permission to access all notification schemes. */ getNotificationSchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -23160,8 +22424,8 @@ export class Client { * @return Returned if the request is successful. */ createNotificationScheme(body: CreateNotificationSchemeDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -23241,24 +22505,17 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeToProjectMappings(startAt?: string | undefined, maxResults?: string | undefined, notificationSchemeId?: string[] | undefined, projectId?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' cannot be null."); - else if (notificationSchemeId !== undefined) - notificationSchemeId && notificationSchemeId.forEach(item => { url_ += "notificationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(notificationSchemeId, 'notificationSchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("notificationSchemeId", notificationSchemeId) + .paramArray("projectId", projectId) + .toString(); let options_ : any = { observe: "response", @@ -23332,15 +22589,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationScheme(id: number, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -23404,11 +22659,11 @@ export class Client { * @return Returned if the request is successful. */ updateNotificationScheme(id: string, body: UpdateNotificationSchemeDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -23493,11 +22748,11 @@ export class Client { * @return Returned if the request is successful. */ addNotifications(id: string, body: AddNotificationsDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -23582,11 +22837,11 @@ export class Client { * @return Returned if the request is successful. */ deleteNotificationScheme(notificationSchemeId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}") + .path("notificationSchemeId", notificationSchemeId) + .toString(); let options_ : any = { observe: "response", @@ -23668,14 +22923,13 @@ export class Client { * @return Returned if the request is successful. */ removeNotificationFromNotificationScheme(notificationSchemeId: string, notificationId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - if (notificationId === undefined || notificationId === null) - throw new globalThis.Error("The parameter 'notificationId' must be defined."); - url_ = url_.replace("{notificationId}", encodeURIComponent("" + notificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + Guard.required(notificationId, 'notificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}") + .path("notificationSchemeId", notificationSchemeId) + .path("notificationId", notificationId) + .toString(); let options_ : any = { observe: "response", @@ -23755,8 +23009,8 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissions(): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissions"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions") + .toString(); let options_ : any = { observe: "response", @@ -23816,8 +23070,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkPermissions(body: BulkPermissionsRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissions/check"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/check") + .toString(); const content_ = JSON.stringify(body); @@ -23886,8 +23140,8 @@ export class Client { * @return Returned if the request is successful. */ getPermittedProjects(body: PermissionsKeysBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissions/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/project") + .toString(); const content_ = JSON.stringify(body); @@ -23958,12 +23212,11 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissionSchemes(expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -24027,12 +23280,11 @@ export class Client { * @return Returned if the permission scheme is created. */ createPermissionScheme(body: PermissionScheme, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -24100,11 +23352,11 @@ export class Client { * @return Returned if the permission scheme is deleted. */ deletePermissionScheme(schemeId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_ : any = { observe: "response", @@ -24172,15 +23424,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionScheme(schemeId: number, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -24248,15 +23498,13 @@ export class Client { * @return Returned if the scheme is updated. */ updatePermissionScheme(schemeId: number, body: PermissionScheme, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -24332,15 +23580,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrants(schemeId: number, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -24409,15 +23655,13 @@ export class Client { * @return Returned if the scheme permission is created. */ createPermissionGrant(schemeId: number, body: PermissionGrant, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -24486,14 +23730,13 @@ export class Client { * @return Returned if the permission grant is deleted. */ deletePermissionSchemeEntity(schemeId: number, permissionId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .toString(); let options_ : any = { observe: "response", @@ -24562,18 +23805,15 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrant(schemeId: number, permissionId: number, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -24636,24 +23876,17 @@ export class Client { * @return Returned if the request is successful. */ getPlans(includeTrashed?: boolean | undefined, includeArchived?: boolean | undefined, cursor?: string | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (includeTrashed === null) - throw new globalThis.Error("The parameter 'includeTrashed' cannot be null."); - else if (includeTrashed !== undefined) - url_ += "includeTrashed=" + encodeURIComponent("" + includeTrashed) + "&"; - if (includeArchived === null) - throw new globalThis.Error("The parameter 'includeArchived' cannot be null."); - else if (includeArchived !== undefined) - url_ += "includeArchived=" + encodeURIComponent("" + includeArchived) + "&"; - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(includeTrashed, 'includeTrashed'); + Guard.notNull(includeArchived, 'includeArchived'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("includeTrashed", includeTrashed) + .param("includeArchived", includeArchived) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -24719,12 +23952,11 @@ export class Client { * @return Returned if the request is successful. */ createPlan(body: CreatePlanRequest, useGroupId?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -24803,15 +24035,13 @@ export class Client { * @return Returned if the request is successful. */ getPlan(planId: number, useGroupId?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); let options_ : any = { observe: "response", @@ -24885,15 +24115,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlan(planId: number, body: any, useGroupId?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -24985,11 +24213,11 @@ export class Client { * @return Returned if the request is successful. */ archivePlan(planId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive") + .path("planId", planId) + .toString(); let options_ : any = { observe: "response", @@ -25070,11 +24298,11 @@ export class Client { * @return Returned if the request is successful. */ duplicatePlan(planId: number, body: DuplicatePlanRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -25168,19 +24396,15 @@ export class Client { * @return Returned if the request is successful. */ getTeams(planId: number, cursor?: string | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team") + .path("planId", planId) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -25253,11 +24477,11 @@ export class Client { * @return Returned if the request is successful. */ addAtlassianTeam(planId: number, body: AddAtlassianTeamRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -25350,14 +24574,13 @@ export class Client { * @return Returned if the request is successful. */ removeAtlassianTeam(planId: number, atlassianTeamId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); let options_ : any = { observe: "response", @@ -25439,14 +24662,13 @@ export class Client { * @return Returned if the request is successful. */ getAtlassianTeam(planId: number, atlassianTeamId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); let options_ : any = { observe: "response", @@ -25527,14 +24749,13 @@ export class Client { * @return Returned if the request is successful. */ updateAtlassianTeam(planId: number, atlassianTeamId: string, body: any): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -25626,11 +24847,11 @@ export class Client { * @return Returned if the request is successful. */ createPlanOnlyTeam(planId: number, body: CreatePlanOnlyTeamRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -25723,14 +24944,13 @@ export class Client { * @return Returned if the request is successful. */ deletePlanOnlyTeam(planId: number, planOnlyTeamId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); let options_ : any = { observe: "response", @@ -25812,14 +25032,13 @@ export class Client { * @return Returned if the request is successful. */ getPlanOnlyTeam(planId: number, planOnlyTeamId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); let options_ : any = { observe: "response", @@ -25900,14 +25119,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlanOnlyTeam(planId: number, planOnlyTeamId: number, body: any): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -25999,11 +25217,11 @@ export class Client { * @return Returned if the request is successful. */ trashPlan(planId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash") + .path("planId", planId) + .toString(); let options_ : any = { observe: "response", @@ -26084,8 +25302,8 @@ export class Client { * @deprecated */ getPriorities(): Observable { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); let options_ : any = { observe: "response", @@ -26148,8 +25366,8 @@ export class Client { * @deprecated */ createPriority(body: CreatePriorityDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); const content_ = JSON.stringify(body); @@ -26225,8 +25443,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultPriority(body: SetDefaultPriorityRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/priority/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/default") + .toString(); const content_ = JSON.stringify(body); @@ -26310,8 +25528,8 @@ export class Client { * @return Returned if the request is successful. */ movePriorities(body: ReorderIssuePriorities): Observable { - let url_ = this.baseUrl + "/rest/api/3/priority/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/move") + .toString(); const content_ = JSON.stringify(body); @@ -26403,36 +25621,23 @@ export class Client { * @deprecated */ searchPriorities(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, priorityName?: string | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/priority/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (priorityName === null) - throw new globalThis.Error("The parameter 'priorityName' cannot be null."); - else if (priorityName !== undefined) - url_ += "priorityName=" + encodeURIComponent("" + priorityName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(priorityName, 'priorityName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("priorityName", priorityName) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -26490,11 +25695,11 @@ export class Client { * @param id The ID of the issue priority. */ deletePriority(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -26580,11 +25785,11 @@ export class Client { * @return Returned if the request is successful. */ getPriority(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -26645,11 +25850,11 @@ export class Client { * @deprecated */ updatePriority(id: string, body: UpdatePriorityDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26741,40 +25946,25 @@ export class Client { * @return Returned if the request is successful. */ getPrioritySchemes(startAt?: string | undefined, maxResults?: string | undefined, priorityId?: number[] | undefined, schemeId?: number[] | undefined, schemeName?: string | undefined, onlyDefault?: boolean | undefined, orderBy?: OrderBy9 | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (priorityId === null) - throw new globalThis.Error("The parameter 'priorityId' cannot be null."); - else if (priorityId !== undefined) - priorityId && priorityId.forEach(item => { url_ += "priorityId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeName === null) - throw new globalThis.Error("The parameter 'schemeName' cannot be null."); - else if (schemeName !== undefined) - url_ += "schemeName=" + encodeURIComponent("" + schemeName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(priorityId, 'priorityId'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(schemeName, 'schemeName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("priorityId", priorityId) + .paramArray("schemeId", schemeId) + .param("schemeName", schemeName) + .param("onlyDefault", onlyDefault) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -26833,8 +26023,8 @@ export class Client { * @return Returned if the request is completed. */ createPriorityScheme(body: CreatePrioritySchemeDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .toString(); const content_ = JSON.stringify(body); @@ -26912,8 +26102,8 @@ export class Client { * @return Returned if the request is successful. */ suggestedPrioritiesForMappings(body: SuggestedMappingsRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -26981,28 +26171,19 @@ export class Client { * @return Returned if the request is successful. */ getAvailablePrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, query?: string | undefined, exclude?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/priorities/available?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined and cannot be null."); - else - url_ += "schemeId=" + encodeURIComponent("" + schemeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/priorities/available") + .param("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .paramArray("exclude", exclude) + .toString(); let options_ : any = { observe: "response", @@ -27062,11 +26243,11 @@ export class Client { * @return Returned if the request is successful. */ deletePriorityScheme(schemeId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_ : any = { observe: "response", @@ -27131,11 +26312,11 @@ export class Client { * @return Returned if the request is accepted. */ updatePriorityScheme(schemeId: number, body: UpdatePrioritySchemeRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -27209,19 +26390,15 @@ export class Client { * @return Returned if the request is successful. */ getPrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -27285,27 +26462,19 @@ export class Client { * @return Returned if the request is successful. */ getProjectsByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, projectId?: number[] | undefined, query?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("projectId", projectId) + .param("query", query) + .toString(); let options_ : any = { observe: "response", @@ -27373,20 +26542,15 @@ export class Client { * @deprecated */ getAllProjects(expand?: string | undefined, recent?: number | undefined, properties?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (recent === null) - throw new globalThis.Error("The parameter 'recent' cannot be null."); - else if (recent !== undefined) - url_ += "recent=" + encodeURIComponent("" + recent) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(recent, 'recent'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .param("expand", expand) + .param("recent", recent) + .paramArray("properties", properties) + .toString(); let options_ : any = { observe: "response", @@ -27449,8 +26613,8 @@ export class Client { * @return Returned if the project is created. */ createProject(body: CreateProjectDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .toString(); const content_ = JSON.stringify(body); @@ -27517,8 +26681,8 @@ export class Client { * @param body The JSON payload containing the project details and capabilities */ createProjectWithCustomTemplate(body: ProjectCustomTemplateCreateRequestDTO): Observable { - let url_ = this.baseUrl + "/rest/api/3/project-template"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project-template") + .toString(); const content_ = JSON.stringify(body); @@ -27584,21 +26748,13 @@ export class Client { * @return Returned if the request is successful. */ getRecent(expand?: string | undefined, properties?: StringList[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/recent?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/recent") + .param("expand", expand) + .paramArray("properties", properties) + .toString(); let options_ : any = { observe: "response", @@ -27709,65 +26865,35 @@ export class Client { * @return Returned if the request is successful. */ searchProjects(startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy10 | undefined, id?: number[] | undefined, keys?: string[] | undefined, query?: string | undefined, typeKey?: string | undefined, categoryId?: number | undefined, action?: Action | undefined, expand?: string | undefined, status?: Status4[] | undefined, properties?: StringList[] | undefined, propertyQuery?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (typeKey === null) - throw new globalThis.Error("The parameter 'typeKey' cannot be null."); - else if (typeKey !== undefined) - url_ += "typeKey=" + encodeURIComponent("" + typeKey) + "&"; - if (categoryId === null) - throw new globalThis.Error("The parameter 'categoryId' cannot be null."); - else if (categoryId !== undefined) - url_ += "categoryId=" + encodeURIComponent("" + categoryId) + "&"; - if (action === null) - throw new globalThis.Error("The parameter 'action' cannot be null."); - else if (action !== undefined) - url_ += "action=" + encodeURIComponent("" + action) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - if (propertyQuery === null) - throw new globalThis.Error("The parameter 'propertyQuery' cannot be null."); - else if (propertyQuery !== undefined) - url_ += "propertyQuery=" + encodeURIComponent("" + propertyQuery) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(id, 'id'); + Guard.notNull(keys, 'keys'); + Guard.notNull(query, 'query'); + Guard.notNull(typeKey, 'typeKey'); + Guard.notNull(categoryId, 'categoryId'); + Guard.notNull(action, 'action'); + Guard.notNull(expand, 'expand'); + Guard.notNull(status, 'status'); + Guard.notNull(properties, 'properties'); + Guard.notNull(propertyQuery, 'propertyQuery'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .paramArray("id", id) + .paramArray("keys", keys) + .param("query", query) + .param("typeKey", typeKey) + .param("categoryId", categoryId) + .param("action", action) + .param("expand", expand) + .paramArray("status", status) + .paramArray("properties", properties) + .param("propertyQuery", propertyQuery) + .toString(); let options_ : any = { observe: "response", @@ -27830,8 +26956,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectTypes(): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/type"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type") + .toString(); let options_ : any = { observe: "response", @@ -27893,8 +27019,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAccessibleProjectTypes(): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/type/accessible"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/accessible") + .toString(); let options_ : any = { observe: "response", @@ -27953,11 +27079,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectTypeByKey(projectTypeKey: ProjectTypeKey): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}") + .path("projectTypeKey", projectTypeKey) + .toString(); let options_ : any = { observe: "response", @@ -28017,11 +27143,11 @@ export class Client { * @return Returned if the request is successful. */ getAccessibleProjectTypeByKey(projectTypeKey: ProjectTypeKey2): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible") + .path("projectTypeKey", projectTypeKey) + .toString(); let options_ : any = { observe: "response", @@ -28082,15 +27208,13 @@ export class Client { * @return Returned if the project is deleted. */ deleteProject(projectIdOrKey: string, enableUndo?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (enableUndo === null) - throw new globalThis.Error("The parameter 'enableUndo' cannot be null."); - else if (enableUndo !== undefined) - url_ += "enableUndo=" + encodeURIComponent("" + enableUndo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(enableUndo, 'enableUndo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("enableUndo", enableUndo) + .toString(); let options_ : any = { observe: "response", @@ -28154,19 +27278,15 @@ export class Client { * @return Returned if successful. */ getProject(projectIdOrKey: string, expand?: string | undefined, properties?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .paramArray("properties", properties) + .toString(); let options_ : any = { observe: "response", @@ -28233,15 +27353,13 @@ export class Client { * @return Returned if the project is updated. */ updateProject(projectIdOrKey: string, body: UpdateProjectDetails, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -28313,11 +27431,11 @@ export class Client { * @return Returned if the request is successful. */ archiveProject(projectIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -28386,11 +27504,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectAvatar(projectIdOrKey: string, body: Avatar): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -28460,14 +27578,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectAvatar(projectIdOrKey: string, id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -28530,23 +27647,17 @@ export class Client { * @return Returned if the request is successful. */ createProjectAvatar(projectIdOrKey: string, body: any, x?: number | undefined, y?: number | undefined, size?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + Guard.notNull(size, 'size'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2") + .path("projectIdOrKey", projectIdOrKey) + .param("x", x) + .param("y", y) + .param("size", size) + .toString(); const content_ = JSON.stringify(body); @@ -28618,11 +27729,11 @@ export class Client { * @return Returned if request is successful. */ getAllProjectAvatars(projectIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -28682,11 +27793,11 @@ export class Client { * @return Returned if the request is successful. */ removeDefaultProjectClassification(projectIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -28751,11 +27862,11 @@ export class Client { * @return Returned if the request is successful. */ getDefaultProjectClassification(projectIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -28816,11 +27927,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultProjectClassification(projectIdOrKey: string, body: UpdateDefaultProjectClassificationBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -28899,31 +28010,21 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponentsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy11 | undefined, componentSource?: ComponentSource | undefined, query?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(componentSource, 'componentSource'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("componentSource", componentSource) + .param("query", query) + .toString(); let options_ : any = { observe: "response", @@ -28984,15 +28085,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponents(projectIdOrKey: string, componentSource?: ComponentSource2 | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(componentSource, 'componentSource'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components") + .path("projectIdOrKey", projectIdOrKey) + .param("componentSource", componentSource) + .toString(); let options_ : any = { observe: "response", @@ -29058,11 +28157,11 @@ export class Client { * @param projectIdOrKey The project ID or project key (case sensitive). */ deleteProjectAsynchronously(projectIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -29125,11 +28224,11 @@ export class Client { * @return Returned if the request is successful. */ getFeaturesForProject(projectIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -29199,14 +28298,13 @@ export class Client { * @return Returned if the request is successful. */ toggleFeatureForProject(projectIdOrKey: string, featureKey: string, body: ProjectFeatureState): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (featureKey === undefined || featureKey === null) - throw new globalThis.Error("The parameter 'featureKey' must be defined."); - url_ = url_.replace("{featureKey}", encodeURIComponent("" + featureKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(featureKey, 'featureKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("featureKey", featureKey) + .toString(); const content_ = JSON.stringify(body); @@ -29278,11 +28376,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectPropertyKeys(projectIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -29351,14 +28449,13 @@ export class Client { * @return Returned if the project property is deleted. */ deleteProjectProperty(projectIdOrKey: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -29423,14 +28520,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectProperty(projectIdOrKey: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -29500,14 +28596,13 @@ export class Client { * @return Returned if the project property is updated. */ setProjectProperty(projectIdOrKey: string, propertyKey: string, body: any): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -29588,11 +28683,11 @@ export class Client { * @return Returned if the request is successful. */ restore(projectIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -29656,11 +28751,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoles(projectIdOrKey: string): Observable<{ [key: string]: string; }> { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -29733,26 +28828,19 @@ export class Client { * @return Returned if the request is successful. */ deleteActor(projectIdOrKey: string, id: number, user?: string | undefined, group?: string | undefined, groupId?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(group, 'group'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("user", user) + .param("group", group) + .param("groupId", groupId) + .toString(); let options_ : any = { observe: "response", @@ -29810,18 +28898,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRole(projectIdOrKey: string, id: number, excludeInactiveUsers?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (excludeInactiveUsers === null) - throw new globalThis.Error("The parameter 'excludeInactiveUsers' cannot be null."); - else if (excludeInactiveUsers !== undefined) - url_ += "excludeInactiveUsers=" + encodeURIComponent("" + excludeInactiveUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(excludeInactiveUsers, 'excludeInactiveUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("excludeInactiveUsers", excludeInactiveUsers) + .toString(); let options_ : any = { observe: "response", @@ -29889,14 +28974,13 @@ export class Client { For example, the cURL request above adds a group, *jira-developers*. For the response below to be returned as a result of that request, the user *Mia Krystof* would have previously been added as a `user` actor for this project. */ addActorUsers(projectIdOrKey: string, id: number, body: ActorsMap): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -29966,14 +29050,13 @@ export class Client { * @return Returned if the request is successful. The complete list of actors for the project is returned. */ setActors(projectIdOrKey: string, id: number, body: ProjectRoleActorsUpdateBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -30043,19 +29126,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleDetails(projectIdOrKey: string, currentMember?: boolean | undefined, excludeConnectAddons?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (currentMember === null) - throw new globalThis.Error("The parameter 'currentMember' cannot be null."); - else if (currentMember !== undefined) - url_ += "currentMember=" + encodeURIComponent("" + currentMember) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(currentMember, 'currentMember'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails") + .path("projectIdOrKey", projectIdOrKey) + .param("currentMember", currentMember) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); let options_ : any = { observe: "response", @@ -30122,11 +29201,11 @@ export class Client { * @return Returned if the request is successful. */ getAllStatuses(projectIdOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_ : any = { observe: "response", @@ -30210,35 +29289,23 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersionsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy12 | undefined, query?: string | undefined, status?: string | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .param("status", status) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -30295,15 +29362,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersions(projectIdOrKey: string, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -30366,11 +29431,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectEmail(projectId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); let options_ : any = { observe: "response", @@ -30435,11 +29500,11 @@ export class Client { * @return Returned if the project's sender email address is successfully set. */ updateProjectEmail(projectId: number, body: ProjectEmailAddress): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); const content_ = JSON.stringify(body); @@ -30512,11 +29577,11 @@ export class Client { * @return Returned if the request is successful. */ getHierarchy(projectId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy") + .path("projectId", projectId) + .toString(); let options_ : any = { observe: "response", @@ -30580,11 +29645,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueSecurityScheme(projectKeyOrId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme") + .path("projectKeyOrId", projectKeyOrId) + .toString(); let options_ : any = { observe: "response", @@ -30660,15 +29725,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeForProject(projectKeyOrId: string, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -30740,15 +29803,13 @@ export class Client { * @return Returned if the request is successful. */ getAssignedPermissionScheme(projectKeyOrId: string, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -30820,15 +29881,13 @@ export class Client { * @return Returned if the request is successful. */ assignPermissionScheme(projectKeyOrId: string, body: IdBean, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -30896,11 +29955,11 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelsForProject(projectKeyOrId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel") + .path("projectKeyOrId", projectKeyOrId) + .toString(); let options_ : any = { observe: "response", @@ -30955,8 +30014,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectCategories(): Observable { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); let options_ : any = { observe: "response", @@ -31018,8 +30077,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectCategory(body: ProjectCategory): Observable { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); const content_ = JSON.stringify(body); @@ -31091,11 +30150,11 @@ export class Client { * @return Returned if the request is successful. */ removeProjectCategory(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -31155,11 +30214,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectCategoryById(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -31218,11 +30277,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectCategory(id: number, body: ProjectCategory): Observable { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -31294,12 +30353,11 @@ export class Client { * @return Returned if the request is successful. */ validateProjectKey(key?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/key?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/key") + .param("key", key) + .toString(); let options_ : any = { observe: "response", @@ -31355,12 +30413,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectKey(key?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey") + .param("key", key) + .toString(); let options_ : any = { observe: "response", @@ -31417,12 +30474,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectName(name: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectName?"; - if (name === undefined || name === null) - throw new globalThis.Error("The parameter 'name' must be defined and cannot be null."); - else - url_ += "name=" + encodeURIComponent("" + name) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(name, 'name'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectName") + .param("name", name) + .toString(); let options_ : any = { observe: "response", @@ -31487,8 +30543,8 @@ export class Client { * @deprecated */ getResolutions(): Observable { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); let options_ : any = { observe: "response", @@ -31550,8 +30606,8 @@ export class Client { * @return Returned if the request is successful. */ createResolution(body: CreateResolutionDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); const content_ = JSON.stringify(body); @@ -31627,8 +30683,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultResolution(body: SetDefaultResolutionRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/resolution/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/default") + .toString(); const content_ = JSON.stringify(body); @@ -31712,8 +30768,8 @@ export class Client { * @return Returned if the request is successful. */ moveResolutions(body: ReorderIssueResolutionsRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/resolution/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/move") + .toString(); const content_ = JSON.stringify(body); @@ -31801,24 +30857,17 @@ export class Client { * @return Returned if the request is successful. */ searchResolutions(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, onlyDefault?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/resolution/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("onlyDefault", onlyDefault) + .toString(); let options_ : any = { observe: "response", @@ -31877,15 +30926,13 @@ export class Client { * @param replaceWith The ID of the issue resolution that will replace the currently selected resolution. */ deleteResolution(id: string, replaceWith: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (replaceWith === undefined || replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' must be defined and cannot be null."); - else - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .param("replaceWith", replaceWith) + .toString(); let options_ : any = { observe: "response", @@ -31971,11 +31018,11 @@ export class Client { * @return Returned if the request is successful. */ getResolution(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -32035,11 +31082,11 @@ export class Client { * @return Returned if the request is successful. */ updateResolution(id: string, body: UpdateResolutionDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32123,8 +31170,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectRoles(): Observable { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); let options_ : any = { observe: "response", @@ -32190,8 +31237,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectRole(body: CreateUpdateRoleRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); const content_ = JSON.stringify(body); @@ -32264,15 +31311,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRole(id: number, swap?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/role/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (swap === null) - throw new globalThis.Error("The parameter 'swap' cannot be null."); - else if (swap !== undefined) - url_ += "swap=" + encodeURIComponent("" + swap) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(swap, 'swap'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .param("swap", swap) + .toString(); let options_ : any = { observe: "response", @@ -32340,11 +31385,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleById(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -32408,11 +31453,11 @@ export class Client { * @return Returned if the request is successful. */ partialUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32484,11 +31529,11 @@ export class Client { * @return Returned if the request is successful. */ fullyUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32563,23 +31608,17 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRoleActorsFromRole(id: number, user?: string | undefined, groupId?: string | undefined, group?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(group, 'group'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .param("user", user) + .param("groupId", groupId) + .param("group", group) + .toString(); let options_ : any = { observe: "response", @@ -32647,11 +31686,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleActorsForRole(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -32719,11 +31758,11 @@ export class Client { * @return Returned if the request is successful. */ addProjectRoleActorsToRole(id: number, body: ActorInputBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32803,32 +31842,21 @@ export class Client { * @return Returned if the request is successful. */ getScreens(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, scope?: Scope2[] | undefined, orderBy?: OrderBy13 | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - scope && scope.forEach(item => { url_ += "scope=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(scope, 'scope'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .paramArray("scope", scope) + .param("orderBy", orderBy) + .toString(); let options_ : any = { observe: "response", @@ -32887,8 +31915,8 @@ export class Client { * @return Returned if the request is successful. */ createScreen(body: ScreenDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .toString(); const content_ = JSON.stringify(body); @@ -32956,11 +31984,11 @@ export class Client { * @return Returned if the request is successful. */ addFieldToDefaultScreen(fieldId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}") + .path("fieldId", fieldId) + .toString(); let options_ : any = { observe: "response", @@ -33032,24 +32060,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkScreenTabs(screenId?: number[] | undefined, tabId?: number[] | undefined, startAt?: number | undefined, maxResult?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/tabs?"; - if (screenId === null) - throw new globalThis.Error("The parameter 'screenId' cannot be null."); - else if (screenId !== undefined) - screenId && screenId.forEach(item => { url_ += "screenId=" + encodeURIComponent("" + item) + "&"; }); - if (tabId === null) - throw new globalThis.Error("The parameter 'tabId' cannot be null."); - else if (tabId !== undefined) - tabId && tabId.forEach(item => { url_ += "tabId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(screenId, 'screenId'); + Guard.notNull(tabId, 'tabId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/tabs") + .paramArray("screenId", screenId) + .paramArray("tabId", tabId) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); let options_ : any = { observe: "response", @@ -33110,11 +32131,11 @@ export class Client { * @return Returned if the request is successful. */ deleteScreen(screenId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); let options_ : any = { observe: "response", @@ -33178,11 +32199,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreen(screenId: number, body: UpdateScreenDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -33254,11 +32275,11 @@ export class Client { * @return Returned if the request is successful. */ getAvailableScreenFields(screenId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields") + .path("screenId", screenId) + .toString(); let options_ : any = { observe: "response", @@ -33330,15 +32351,13 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabs(screenId: number, projectKey?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .param("projectKey", projectKey) + .toString(); let options_ : any = { observe: "response", @@ -33413,11 +32432,11 @@ export class Client { * @return Returned if the request is successful. */ addScreenTab(screenId: number, body: ScreenableTab): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -33490,14 +32509,13 @@ export class Client { * @return Returned if the request is successful. */ deleteScreenTab(screenId: number, tabId: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); let options_ : any = { observe: "response", @@ -33558,14 +32576,13 @@ export class Client { * @return Returned if the request is successful. */ renameScreenTab(screenId: number, tabId: number, body: ScreenableTab): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -33639,18 +32656,15 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabFields(screenId: number, tabId: number, projectKey?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .param("projectKey", projectKey) + .toString(); let options_ : any = { observe: "response", @@ -33722,14 +32736,13 @@ export class Client { * @return Returned if the request is successful. */ addScreenTabField(screenId: number, tabId: number, body: AddFieldBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -33803,17 +32816,15 @@ export class Client { * @return Returned if the request is successful. */ removeScreenTabField(screenId: number, tabId: number, id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -33879,17 +32890,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTabField(screenId: number, tabId: number, id: string, body: MoveFieldBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -33964,17 +32973,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTab(screenId: number, tabId: number, pos: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (pos === undefined || pos === null) - throw new globalThis.Error("The parameter 'pos' must be defined."); - url_ = url_.replace("{pos}", encodeURIComponent("" + pos)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(pos, 'pos'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("pos", pos) + .toString(); let options_ : any = { observe: "response", @@ -34051,32 +33058,21 @@ export class Client { * @return Returned if the request is successful. */ getScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy14 | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/screenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .toString(); let options_ : any = { observe: "response", @@ -34135,8 +33131,8 @@ export class Client { * @return Returned if the request is successful. */ createScreenScheme(body: ScreenSchemeDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/screenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -34208,11 +33204,11 @@ export class Client { * @return Returned if the screen scheme is deleted. */ deleteScreenScheme(screenSchemeId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); let options_ : any = { observe: "response", @@ -34277,11 +33273,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreenScheme(screenSchemeId: string, body: UpdateScreenSchemeDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -34398,44 +33394,27 @@ export class Client { * @deprecated */ searchForIssuesUsingJql(jql?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, validateQuery?: ValidateQuery | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/search?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (validateQuery === null) - throw new globalThis.Error("The parameter 'validateQuery' cannot be null."); - else if (validateQuery !== undefined) - url_ += "validateQuery=" + encodeURIComponent("" + validateQuery) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(validateQuery, 'validateQuery'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .param("jql", jql) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("validateQuery", validateQuery) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .toString(); let options_ : any = { observe: "response", @@ -34496,8 +33475,8 @@ export class Client { * @deprecated */ searchForIssuesUsingJqlPost(body: SearchRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .toString(); const content_ = JSON.stringify(body); @@ -34561,8 +33540,8 @@ export class Client { * @return Returned if the request is successful. */ countIssues(body: JQLCountRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/search/approximate-count"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/approximate-count") + .toString(); const content_ = JSON.stringify(body); @@ -34627,8 +33606,8 @@ export class Client { * @deprecated */ searchForIssuesIds(body: IdSearchRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/search/id"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/id") + .toString(); const content_ = JSON.stringify(body); @@ -34735,44 +33714,27 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJql(jql?: string | undefined, nextPageToken?: string | undefined, maxResults?: number | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined, reconcileIssues?: number[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/search/jql?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - if (reconcileIssues === null) - throw new globalThis.Error("The parameter 'reconcileIssues' cannot be null."); - else if (reconcileIssues !== undefined) - reconcileIssues && reconcileIssues.forEach(item => { url_ += "reconcileIssues=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + Guard.notNull(reconcileIssues, 'reconcileIssues'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .param("jql", jql) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .paramArray("reconcileIssues", reconcileIssues) + .toString(); let options_ : any = { observe: "response", @@ -34831,8 +33793,8 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJqlPost(body: SearchAndReconcileRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/search/jql"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .toString(); const content_ = JSON.stringify(body); @@ -34896,11 +33858,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevel(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/securitylevel/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/securitylevel/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -34959,8 +33921,8 @@ export class Client { * @return Returned if the request is successful. */ getServerInfo(): Observable { - let url_ = this.baseUrl + "/rest/api/3/serverInfo"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/serverInfo") + .toString(); let options_ : any = { observe: "response", @@ -35015,8 +33977,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueNavigatorDefaultColumns(): Observable { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); let options_ : any = { observe: "response", @@ -35090,14 +34052,12 @@ export class Client { * @return Returned if the request is successful. */ setIssueNavigatorDefaultColumns(body: ColumnRequestBody, columns?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_ : any = { body: content_, @@ -35162,8 +34122,8 @@ export class Client { * @return Returned if the request is successful. */ getStatuses(): Observable { - let url_ = this.baseUrl + "/rest/api/3/status"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status") + .toString(); let options_ : any = { observe: "response", @@ -35226,11 +34186,11 @@ export class Client { * @return Returned if the request is successful. */ getStatus(idOrName: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/status/{idOrName}"; - if (idOrName === undefined || idOrName === null) - throw new globalThis.Error("The parameter 'idOrName' must be defined."); - url_ = url_.replace("{idOrName}", encodeURIComponent("" + idOrName)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrName, 'idOrName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status/{idOrName}") + .path("idOrName", idOrName) + .toString(); let options_ : any = { observe: "response", @@ -35289,8 +34249,8 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategories(): Observable { - let url_ = this.baseUrl + "/rest/api/3/statuscategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory") + .toString(); let options_ : any = { observe: "response", @@ -35353,11 +34313,11 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategory(idOrKey: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}"; - if (idOrKey === undefined || idOrKey === null) - throw new globalThis.Error("The parameter 'idOrKey' must be defined."); - url_ = url_.replace("{idOrKey}", encodeURIComponent("" + idOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrKey, 'idOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}") + .path("idOrKey", idOrKey) + .toString(); let options_ : any = { observe: "response", @@ -35419,12 +34379,11 @@ export class Client { * @return Returned if the request is successful. */ deleteStatusesById(id: string[]): Observable { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .toString(); let options_ : any = { observe: "response", @@ -35493,16 +34452,13 @@ export class Client { * @return Returned if the request is successful. */ getStatusesById(id: string[], expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -35569,8 +34525,8 @@ export class Client { * @return Returned if the request is successful. */ createStatuses(body: StatusCreateRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -35645,8 +34601,8 @@ export class Client { * @return Returned if the request is successful. */ updateStatuses(body: StatusUpdateRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -35725,32 +34681,21 @@ export class Client { * @return Returned if the request is successful. */ search(expand?: string | undefined, projectId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, searchString?: string | undefined, statusCategory?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/statuses/search?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (searchString === null) - throw new globalThis.Error("The parameter 'searchString' cannot be null."); - else if (searchString !== undefined) - url_ += "searchString=" + encodeURIComponent("" + searchString) + "&"; - if (statusCategory === null) - throw new globalThis.Error("The parameter 'statusCategory' cannot be null."); - else if (statusCategory !== undefined) - url_ += "statusCategory=" + encodeURIComponent("" + statusCategory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(searchString, 'searchString'); + Guard.notNull(statusCategory, 'statusCategory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/search") + .param("expand", expand) + .param("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("searchString", searchString) + .param("statusCategory", statusCategory) + .toString(); let options_ : any = { observe: "response", @@ -35813,22 +34758,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueTypeUsagesForStatus(statusId: string, projectId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages") + .path("statusId", statusId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -35894,19 +34834,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -35972,19 +34908,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -36048,11 +34980,11 @@ export class Client { * @return Returned if the request is successful. */ getTask(taskId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}") + .path("taskId", taskId) + .toString(); let options_ : any = { observe: "response", @@ -36116,11 +35048,11 @@ export class Client { * @return Returned if the request is successful. */ cancelTask(taskId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}/cancel"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}/cancel") + .path("taskId", taskId) + .toString(); let options_ : any = { observe: "response", @@ -36234,20 +35166,15 @@ export class Client { * @return Returned if the request is successful. */ getUiModifications(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/uiModifications?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -36311,8 +35238,8 @@ export class Client { * @return Returned if the UI modification is created. */ createUiModification(body: CreateUiModificationDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/uiModifications"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .toString(); const content_ = JSON.stringify(body); @@ -36387,11 +35314,11 @@ export class Client { * @return Returned if the UI modification is deleted. */ deleteUiModification(uiModificationId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); let options_ : any = { observe: "response", @@ -36457,11 +35384,11 @@ export class Client { * @return Returned if the UI modification is updated. */ updateUiModification(uiModificationId: string, body: UpdateUiModificationDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); const content_ = JSON.stringify(body); @@ -36538,14 +35465,13 @@ export class Client { * @return Returned if the request is successful. */ getAvatars(type: Type3, entityId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .toString(); let options_ : any = { observe: "response", @@ -36609,26 +35535,19 @@ export class Client { * @return Returned if the request is successful. */ storeAvatar(type: Type4, entityId: string, size: number, body: any, x?: number | undefined, y?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -36702,17 +35621,15 @@ export class Client { * @return Returned if the request is successful. */ deleteAvatar(type: Type5, owningObjectId: string, id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (owningObjectId === undefined || owningObjectId === null) - throw new globalThis.Error("The parameter 'owningObjectId' must be defined."); - url_ = url_.replace("{owningObjectId}", encodeURIComponent("" + owningObjectId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(owningObjectId, 'owningObjectId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}") + .path("type", type) + .path("owningObjectId", owningObjectId) + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -36774,19 +35691,15 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByType(type: Type6, size?: Size | undefined, format?: Format | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}") + .path("type", type) + .param("size", size) + .param("format", format) + .toString(); let options_ : any = { observe: "response", @@ -36862,22 +35775,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByID(type: Type7, id: number, size?: Size2 | undefined, format?: Format2 | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(id, 'id'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}") + .path("type", type) + .path("id", id) + .param("size", size) + .param("format", format) + .toString(); let options_ : any = { observe: "response", @@ -36960,22 +35868,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByOwner(type: Type8, entityId: string, size?: Size3 | undefined, format?: Format3 | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("format", format) + .toString(); let options_ : any = { observe: "response", @@ -37057,20 +35960,15 @@ export class Client { * @return Returned if the request is successful. */ removeUser(accountId: string, username?: string | undefined, key?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); let options_ : any = { observe: "response", @@ -37140,24 +36038,17 @@ export class Client { * @return Returned if the request is successful. */ getUser(accountId?: string | undefined, username?: string | undefined, key?: string | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -37221,8 +36112,8 @@ export class Client { * @return Returned if the request is successful. */ createUser(body: NewUserDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/user"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .toString(); const content_ = JSON.stringify(body); @@ -37295,32 +36186,21 @@ export class Client { * @return Returned if the request is successful. */ findBulkAssignableUsers(projectKeys: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch?"; - if (projectKeys === undefined || projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' must be defined and cannot be null."); - else - url_ += "projectKeys=" + encodeURIComponent("" + projectKeys) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeys, 'projectKeys'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch") + .param("projectKeys", projectKeys) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -37405,52 +36285,31 @@ export class Client { * @return Returned if the request is successful. */ findAssignableUsers(query?: string | undefined, sessionId?: string | undefined, username?: string | undefined, accountId?: string | undefined, project?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, actionDescriptorId?: number | undefined, recommend?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (sessionId === null) - throw new globalThis.Error("The parameter 'sessionId' cannot be null."); - else if (sessionId !== undefined) - url_ += "sessionId=" + encodeURIComponent("" + sessionId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (project === null) - throw new globalThis.Error("The parameter 'project' cannot be null."); - else if (project !== undefined) - url_ += "project=" + encodeURIComponent("" + project) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (actionDescriptorId === null) - throw new globalThis.Error("The parameter 'actionDescriptorId' cannot be null."); - else if (actionDescriptorId !== undefined) - url_ += "actionDescriptorId=" + encodeURIComponent("" + actionDescriptorId) + "&"; - if (recommend === null) - throw new globalThis.Error("The parameter 'recommend' cannot be null."); - else if (recommend !== undefined) - url_ += "recommend=" + encodeURIComponent("" + recommend) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(sessionId, 'sessionId'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(project, 'project'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(actionDescriptorId, 'actionDescriptorId'); + Guard.notNull(recommend, 'recommend'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/search") + .param("query", query) + .param("sessionId", sessionId) + .param("username", username) + .param("accountId", accountId) + .param("project", project) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("actionDescriptorId", actionDescriptorId) + .param("recommend", recommend) + .toString(); let options_ : any = { observe: "response", @@ -37529,28 +36388,19 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsers(accountId: string[], startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk") + .paramArray("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); let options_ : any = { observe: "response", @@ -37613,24 +36463,17 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsersMigration(startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/bulk/migration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk/migration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); let options_ : any = { observe: "response", @@ -37698,16 +36541,13 @@ export class Client { * @return Returned if the request is successful. */ resetUserColumns(accountId?: string | undefined, username?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); let options_ : any = { observe: "response", @@ -37764,16 +36604,13 @@ export class Client { * @return Returned if the request is successful. */ getUserDefaultColumns(accountId?: string | undefined, username?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); let options_ : any = { observe: "response", @@ -37846,18 +36683,15 @@ export class Client { * @return Returned if the request is successful. */ setUserColumns(body: UserColumnRequestBody, accountId?: string | undefined, columns?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .toString(); + + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_ : any = { body: content_, @@ -37932,12 +36766,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmail(accountId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/email?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email") + .param("accountId", accountId) + .toString(); let options_ : any = { observe: "response", @@ -38005,12 +36838,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmailBulk(accountId: string[]): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/email/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email/bulk") + .paramArray("accountId", accountId) + .toString(); let options_ : any = { observe: "response", @@ -38076,20 +36908,15 @@ export class Client { * @return Returned if the request is successful. */ getUserGroups(accountId: string, username?: string | undefined, key?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/groups?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/groups") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); let options_ : any = { observe: "response", @@ -38161,15 +36988,13 @@ export class Client { * @return Returned if the request is successful. */ getUserNavProperty(propertyKey: string, accountId?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); let options_ : any = { observe: "response", @@ -38239,15 +37064,13 @@ export class Client { * @return Returned if the user property is updated/created. */ setUserNavProperty(propertyKey: string, body: any, accountId?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); const content_ = JSON.stringify(body); @@ -38368,40 +37191,25 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithAllPermissions(permissions: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/permission/search?"; - if (permissions === undefined || permissions === null) - throw new globalThis.Error("The parameter 'permissions' must be defined and cannot be null."); - else - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(permissions, 'permissions'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/permission/search") + .param("permissions", permissions) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -38486,36 +37294,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersForPicker(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, exclude?: string[] | undefined, excludeAccountIds?: string[] | undefined, avatarSize?: string | undefined, excludeConnectUsers?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/picker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeAccountIds === null) - throw new globalThis.Error("The parameter 'excludeAccountIds' cannot be null."); - else if (excludeAccountIds !== undefined) - excludeAccountIds && excludeAccountIds.forEach(item => { url_ += "excludeAccountIds=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (excludeConnectUsers === null) - throw new globalThis.Error("The parameter 'excludeConnectUsers' cannot be null."); - else if (excludeConnectUsers !== undefined) - url_ += "excludeConnectUsers=" + encodeURIComponent("" + excludeConnectUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeAccountIds, 'excludeAccountIds'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(excludeConnectUsers, 'excludeConnectUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/picker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .paramArray("exclude", exclude) + .paramArray("excludeAccountIds", excludeAccountIds) + .param("avatarSize", avatarSize) + .param("excludeConnectUsers", excludeConnectUsers) + .toString(); let options_ : any = { observe: "response", @@ -38581,20 +37376,15 @@ export class Client { * @return Returned if the request is successful. */ getUserPropertyKeys(accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/properties?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties") + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_ : any = { observe: "response", @@ -38665,23 +37455,17 @@ export class Client { * @return Returned if the user property is deleted. */ deleteUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_ : any = { observe: "response", @@ -38748,23 +37532,17 @@ export class Client { * @return Returned if the request is successful. */ getUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_ : any = { observe: "response", @@ -38836,23 +37614,17 @@ export class Client { * @return Returned if the user property is updated. */ setUserProperty(propertyKey: string, body: any, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); const content_ = JSON.stringify(body); @@ -38942,32 +37714,21 @@ export class Client { * @return Returned if the request is successful. */ findUsers(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, property?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (property === null) - throw new globalThis.Error("The parameter 'property' cannot be null."); - else if (property !== undefined) - url_ += "property=" + encodeURIComponent("" + property) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(property, 'property'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("property", property) + .toString(); let options_ : any = { observe: "response", @@ -39040,20 +37801,15 @@ export class Client { * @return Returned if the request is successful. */ findUsersByQuery(query: string, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/search/query?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query") + .param("query", query) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -39135,20 +37891,15 @@ export class Client { * @return Returned if the request is successful. */ findUserKeysByQuery(query: string, startAt?: number | undefined, maxResult?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/search/query/key?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query/key") + .param("query", query) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); let options_ : any = { observe: "response", @@ -39234,36 +37985,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithBrowsePermission(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/user/viewissue/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/viewissue/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -39339,16 +38077,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsersDefault(startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/users?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -39420,16 +38155,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsers(startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/users/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -39499,8 +38231,8 @@ export class Client { * @return Returned if the request is successful. */ createVersion(body: Version): Observable { - let url_ = this.baseUrl + "/rest/api/3/version"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version") + .toString(); const content_ = JSON.stringify(body); @@ -39571,19 +38303,15 @@ export class Client { * @deprecated */ deleteVersion(id: string, moveFixIssuesTo?: string | undefined, moveAffectedIssuesTo?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveFixIssuesTo === null) - throw new globalThis.Error("The parameter 'moveFixIssuesTo' cannot be null."); - else if (moveFixIssuesTo !== undefined) - url_ += "moveFixIssuesTo=" + encodeURIComponent("" + moveFixIssuesTo) + "&"; - if (moveAffectedIssuesTo === null) - throw new globalThis.Error("The parameter 'moveAffectedIssuesTo' cannot be null."); - else if (moveAffectedIssuesTo !== undefined) - url_ += "moveAffectedIssuesTo=" + encodeURIComponent("" + moveAffectedIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveFixIssuesTo, 'moveFixIssuesTo'); + Guard.notNull(moveAffectedIssuesTo, 'moveAffectedIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("moveFixIssuesTo", moveFixIssuesTo) + .param("moveAffectedIssuesTo", moveAffectedIssuesTo) + .toString(); let options_ : any = { observe: "response", @@ -39649,15 +38377,13 @@ export class Client { * @return Returned if the request is successful. */ getVersion(id: string, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -39717,11 +38443,11 @@ export class Client { * @return Returned if the request is successful. */ updateVersion(id: string, body: Version): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -39790,14 +38516,13 @@ export class Client { * @return Returned if the version is deleted. */ mergeVersions(id: string, moveIssuesTo: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === undefined || moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' must be defined."); - url_ = url_.replace("{moveIssuesTo}", encodeURIComponent("" + moveIssuesTo)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}") + .path("id", id) + .path("moveIssuesTo", moveIssuesTo) + .toString(); let options_ : any = { observe: "response", @@ -39862,11 +38587,11 @@ export class Client { * @return Returned if the request is successful. */ moveVersion(id: string, body: VersionMoveBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/move"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/move") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -39934,11 +38659,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionRelatedIssues(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -39998,11 +38723,11 @@ export class Client { * @return Returned if the request is successful. */ getRelatedWork(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -40072,11 +38797,11 @@ export class Client { * @return Returned if the request is successful. */ createRelatedWork(id: string, body: VersionRelatedWork): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -40148,11 +38873,11 @@ export class Client { * @return Returned if the request is successful together with updated related work. */ updateRelatedWork(id: string, body: VersionRelatedWork): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -40224,11 +38949,11 @@ export class Client { * @return Returned if the version is deleted. */ deleteAndReplaceVersion(id: string, body: DeleteAndReplaceVersionBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -40297,11 +39022,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionUnresolvedIssues(id: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -40362,14 +39087,13 @@ export class Client { * @return Returned if the related work is deleted. */ deleteRelatedWork(versionId: string, relatedWorkId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}"; - if (versionId === undefined || versionId === null) - throw new globalThis.Error("The parameter 'versionId' must be defined."); - url_ = url_.replace("{versionId}", encodeURIComponent("" + versionId)); - if (relatedWorkId === undefined || relatedWorkId === null) - throw new globalThis.Error("The parameter 'relatedWorkId' must be defined."); - url_ = url_.replace("{relatedWorkId}", encodeURIComponent("" + relatedWorkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(versionId, 'versionId'); + Guard.required(relatedWorkId, 'relatedWorkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}") + .path("versionId", versionId) + .path("relatedWorkId", relatedWorkId) + .toString(); let options_ : any = { observe: "response", @@ -40432,8 +39156,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWebhookById(body: ContainerForWebhookIDs): Observable { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -40500,16 +39224,13 @@ export class Client { * @return Returned if the request is successful. */ getDynamicWebhooksForApp(startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/webhook?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -40574,8 +39295,8 @@ export class Client { * @return Returned if the request is successful. */ registerDynamicWebhooks(body: WebhookRegistrationDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -40646,16 +39367,13 @@ export class Client { * @return Returned if the request is successful. */ getFailedWebhooks(maxResults?: number | undefined, after?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/webhook/failed?"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (after === null) - throw new globalThis.Error("The parameter 'after' cannot be null."); - else if (after !== undefined) - url_ += "after=" + encodeURIComponent("" + after) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(after, 'after'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/failed") + .param("maxResults", maxResults) + .param("after", after) + .toString(); let options_ : any = { observe: "response", @@ -40720,8 +39438,8 @@ export class Client { * @return Returned if the request is successful. */ refreshWebhooks(body: ContainerForWebhookIDs): Observable { - let url_ = this.baseUrl + "/rest/api/3/webhook/refresh"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/refresh") + .toString(); const content_ = JSON.stringify(body); @@ -40792,12 +39510,11 @@ export class Client { * @deprecated */ getAllWorkflows(workflowName?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow?"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .param("workflowName", workflowName) + .toString(); let options_ : any = { observe: "response", @@ -40861,8 +39578,8 @@ export class Client { * @deprecated */ createWorkflow(body: CreateWorkflowDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .toString(); const content_ = JSON.stringify(body); @@ -40941,40 +39658,25 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowTransitionRuleConfigurations(types: Types[], startAt?: number | undefined, maxResults?: number | undefined, keys?: string[] | undefined, workflowNames?: string[] | undefined, withTags?: string[] | undefined, draft?: boolean | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config?"; - if (types === undefined || types === null) - throw new globalThis.Error("The parameter 'types' must be defined and cannot be null."); - else - types && types.forEach(item => { url_ += "types=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (workflowNames === null) - throw new globalThis.Error("The parameter 'workflowNames' cannot be null."); - else if (workflowNames !== undefined) - workflowNames && workflowNames.forEach(item => { url_ += "workflowNames=" + encodeURIComponent("" + item) + "&"; }); - if (withTags === null) - throw new globalThis.Error("The parameter 'withTags' cannot be null."); - else if (withTags !== undefined) - withTags && withTags.forEach(item => { url_ += "withTags=" + encodeURIComponent("" + item) + "&"; }); - if (draft === null) - throw new globalThis.Error("The parameter 'draft' cannot be null."); - else if (draft !== undefined) - url_ += "draft=" + encodeURIComponent("" + draft) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(types, 'types'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(keys, 'keys'); + Guard.notNull(workflowNames, 'workflowNames'); + Guard.notNull(withTags, 'withTags'); + Guard.notNull(draft, 'draft'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .paramArray("types", types) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("keys", keys) + .paramArray("workflowNames", workflowNames) + .paramArray("withTags", withTags) + .param("draft", draft) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -41047,8 +39749,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowTransitionRuleConfigurations(body: WorkflowTransitionRulesUpdate): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .toString(); const content_ = JSON.stringify(body); @@ -41121,8 +39823,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowTransitionRuleConfigurations(body: WorkflowsWithTransitionRulesDetails): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config/delete") + .toString(); const content_ = JSON.stringify(body); @@ -41213,36 +39915,23 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowsPaginated(startAt?: number | undefined, maxResults?: number | undefined, workflowName?: string[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy15 | undefined, isActive?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - workflowName && workflowName.forEach(item => { url_ += "workflowName=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("workflowName", workflowName) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("isActive", isActive) + .toString(); let options_ : any = { observe: "response", @@ -41308,23 +39997,17 @@ export class Client { * @return 200 response */ deleteWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, workflowMode?: WorkflowMode | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); let options_ : any = { observe: "response", @@ -41396,27 +40079,19 @@ export class Client { * @return 200 response */ getWorkflowTransitionProperties(transitionId: number, workflowName: string, includeReservedKeys?: boolean | undefined, key?: string | undefined, workflowMode?: WorkflowMode2 | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (includeReservedKeys === null) - throw new globalThis.Error("The parameter 'includeReservedKeys' cannot be null."); - else if (includeReservedKeys !== undefined) - url_ += "includeReservedKeys=" + encodeURIComponent("" + includeReservedKeys) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(includeReservedKeys, 'includeReservedKeys'); + Guard.notNull(key, 'key'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("workflowName", workflowName) + .param("includeReservedKeys", includeReservedKeys) + .param("key", key) + .param("workflowMode", workflowMode) + .toString(); let options_ : any = { observe: "response", @@ -41487,23 +40162,17 @@ export class Client { * @return 200 response */ createWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode3 | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -41578,23 +40247,17 @@ export class Client { * @return 200 response */ updateWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode4 | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -41670,11 +40333,11 @@ export class Client { * @return Returned if the workflow is deleted. */ deleteInactiveWorkflow(entityId: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/{entityId}"; - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{entityId}") + .path("entityId", entityId) + .toString(); let options_ : any = { observe: "response", @@ -41741,22 +40404,17 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowProjectIssueTypeUsages(workflowId: string, projectId: number, nextPageToken?: string | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages") + .path("workflowId", workflowId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -41822,19 +40480,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -41900,19 +40554,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -41982,16 +40632,13 @@ export class Client { * @return Returned if the request is successful. */ readWorkflows(body: WorkflowReadRequest, expand?: string | undefined, useApprovalConfiguration?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflows?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (useApprovalConfiguration === null) - throw new globalThis.Error("The parameter 'useApprovalConfiguration' cannot be null."); - else if (useApprovalConfiguration !== undefined) - url_ += "useApprovalConfiguration=" + encodeURIComponent("" + useApprovalConfiguration) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(useApprovalConfiguration, 'useApprovalConfiguration'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows") + .param("expand", expand) + .param("useApprovalConfiguration", useApprovalConfiguration) + .toString(); const content_ = JSON.stringify(body); @@ -42057,20 +40704,15 @@ export class Client { * @return Returned if the request is successful. */ workflowCapabilities(workflowId?: string | undefined, projectId?: string | undefined, issueTypeId?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflows/capabilities?"; - if (workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' cannot be null."); - else if (workflowId !== undefined) - url_ += "workflowId=" + encodeURIComponent("" + workflowId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowId, 'workflowId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/capabilities") + .param("workflowId", workflowId) + .param("projectId", projectId) + .param("issueTypeId", issueTypeId) + .toString(); let options_ : any = { observe: "response", @@ -42129,8 +40771,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflows(body: WorkflowCreateRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflows/create"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create") + .toString(); const content_ = JSON.stringify(body); @@ -42197,8 +40839,8 @@ export class Client { * @return Returned if the request is successful. */ validateCreateWorkflows(body: WorkflowCreateValidateRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflows/create/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create/validation") + .toString(); const content_ = JSON.stringify(body); @@ -42274,36 +40916,23 @@ export class Client { * @return Returned if the request is successful. */ searchWorkflows(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: string | undefined, scope?: string | undefined, isActive?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflows/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - url_ += "scope=" + encodeURIComponent("" + scope) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(scope, 'scope'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("scope", scope) + .param("isActive", isActive) + .toString(); let options_ : any = { observe: "response", @@ -42366,12 +40995,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflows(body: WorkflowUpdateRequest, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflows/update?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -42438,8 +41066,8 @@ export class Client { * @return Returned if the request is successful. */ validateUpdateWorkflows(body: WorkflowUpdateValidateRequestBean): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflows/update/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update/validation") + .toString(); const content_ = JSON.stringify(body); @@ -42504,16 +41132,13 @@ export class Client { * @return Returned if the request is successful. */ getAllWorkflowSchemes(startAt?: number | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -42572,8 +41197,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowScheme(body: WorkflowScheme): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .toString(); const content_ = JSON.stringify(body); @@ -42641,12 +41266,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeProjectAssociations(projectId: number[]): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .paramArray("projectId", projectId) + .toString(); let options_ : any = { observe: "response", @@ -42709,8 +41333,8 @@ export class Client { * @return Returned if the request is successful. */ assignSchemeToProject(body: WorkflowSchemeProjectAssociation): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -42787,12 +41411,11 @@ export class Client { * @return Returned if the request is successful. */ readWorkflowSchemes(body: WorkflowSchemeReadRequest, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/read?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/read") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -42862,8 +41485,8 @@ export class Client { * @return Returned if the request is successful and there is no asynchronous task. */ updateSchemes(body: WorkflowSchemeUpdateRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update") + .toString(); const content_ = JSON.stringify(body); @@ -42938,8 +41561,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeMappings(body: WorkflowSchemeUpdateRequiredMappingsRequest): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -43003,11 +41626,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowScheme(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -43077,15 +41700,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowScheme(id: number, returnDraftIfExists?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_ : any = { observe: "response", @@ -43149,11 +41770,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowScheme(id: number, body: WorkflowScheme): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -43225,11 +41846,11 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowSchemeDraftFromParent(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -43294,15 +41915,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDefaultWorkflow(id: number, updateDraftIfNeeded?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_ : any = { observe: "response", @@ -43371,15 +41990,13 @@ export class Client { * @return Returned if the request is successful. */ getDefaultWorkflow(id: number, returnDraftIfExists?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_ : any = { observe: "response", @@ -43444,11 +42061,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultWorkflow(id: number, body: DefaultWorkflow): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -43520,11 +42137,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraft(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -43584,11 +42201,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraft(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -43652,11 +42269,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeDraft(id: number, body: WorkflowScheme): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -43728,11 +42345,11 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftDefaultWorkflow(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -43796,11 +42413,11 @@ export class Client { * @return Returned if the request is successful. */ getDraftDefaultWorkflow(id: number): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); let options_ : any = { observe: "response", @@ -43865,11 +42482,11 @@ export class Client { * @return Returned if the request is successful. */ updateDraftDefaultWorkflow(id: number, body: DefaultWorkflow): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -43942,14 +42559,13 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraftIssueType(id: number, issueType: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); let options_ : any = { observe: "response", @@ -44014,14 +42630,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraftIssueType(id: number, issueType: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); let options_ : any = { observe: "response", @@ -44087,14 +42702,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeDraftIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -44168,15 +42782,13 @@ export class Client { * @return Returned if the request is only for validation and is successful. */ publishDraftWorkflowScheme(id: number, body: PublishDraftWorkflowScheme, validateOnly?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (validateOnly === null) - throw new globalThis.Error("The parameter 'validateOnly' cannot be null."); - else if (validateOnly !== undefined) - url_ += "validateOnly=" + encodeURIComponent("" + validateOnly) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(validateOnly, 'validateOnly'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish") + .path("id", id) + .param("validateOnly", validateOnly) + .toString(); const content_ = JSON.stringify(body); @@ -44252,15 +42864,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftWorkflowMapping(id: number, workflowName: string): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); let options_ : any = { observe: "response", @@ -44321,15 +42931,13 @@ export class Client { * @return Returned if the request is successful. */ getDraftWorkflow(id: number, workflowName?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); let options_ : any = { observe: "response", @@ -44394,15 +43002,13 @@ export class Client { * @return Returned if the request is successful. */ updateDraftWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -44476,18 +43082,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeIssueType(id: number, issueType: string, updateDraftIfNeeded?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_ : any = { observe: "response", @@ -44557,18 +43160,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeIssueType(id: number, issueType: string, returnDraftIfExists?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_ : any = { observe: "response", @@ -44634,14 +43234,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -44715,19 +43314,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowMapping(id: number, workflowName: string, updateDraftIfNeeded?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_ : any = { observe: "response", @@ -44793,19 +43388,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflow(id: number, workflowName?: string | undefined, returnDraftIfExists?: boolean | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_ : any = { observe: "response", @@ -44870,15 +43461,13 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -44952,19 +43541,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflowScheme(workflowSchemeId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages?"; - if (workflowSchemeId === undefined || workflowSchemeId === null) - throw new globalThis.Error("The parameter 'workflowSchemeId' must be defined."); - url_ = url_.replace("{workflowSchemeId}", encodeURIComponent("" + workflowSchemeId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowSchemeId, 'workflowSchemeId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages") + .path("workflowSchemeId", workflowSchemeId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_ : any = { observe: "response", @@ -45028,12 +43613,11 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsDeletedSince(since?: number | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/worklog/deleted?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/deleted") + .param("since", since) + .toString(); let options_ : any = { observe: "response", @@ -45090,12 +43674,11 @@ export class Client { * @return Returned if the request is successful. */ getWorklogsForIds(body: WorklogIdsRequestBean, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/worklog/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -45167,16 +43750,13 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsModifiedSince(since?: number | undefined, expand?: string | undefined): Observable { - let url_ = this.baseUrl + "/rest/api/3/worklog/updated?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/updated") + .param("since", since) + .param("expand", expand) + .toString(); let options_ : any = { observe: "response", @@ -45232,11 +43812,11 @@ export class Client { * @return Returned if the request is successful. */ deleteForgeAppProperty(propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -45306,11 +43886,11 @@ export class Client { * @return Returned if the property is updated. */ putForgeAppProperty(propertyKey: string, body: any): Observable { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -45400,11 +43980,11 @@ export class AddonPropertiesResource_getAddonPropertiesClient { * @return Returned if the request is successful. */ get(addonKey: string): Observable { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties") + .path("addonKey", addonKey) + .toString(); let options_ : any = { observe: "response", @@ -45476,14 +44056,13 @@ export class AddonPropertiesResource_deleteAddonPropertyClient { * @return Returned if the request is successful. */ delete(addonKey: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -45565,14 +44144,13 @@ export class AddonPropertiesResource_getAddonPropertyClient { * @return Returned if the request is successful. */ get(addonKey: string, propertyKey: string): Observable { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); let options_ : any = { observe: "response", @@ -45658,14 +44236,13 @@ export class AddonPropertiesResource_putAddonPropertyClient { * @return Returned if the property is updated. */ put(addonKey: string, propertyKey: string, body: any): Observable { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -45756,12 +44333,11 @@ export class DynamicModulesResource_removeModulesClient { * @return Returned if the request is successful. */ delete(moduleKey?: string[] | undefined): Observable { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic?"; - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(moduleKey, 'moduleKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .paramArray("moduleKey", moduleKey) + .toString(); let options_ : any = { observe: "response", @@ -45827,8 +44403,8 @@ export class DynamicModulesResource_getModulesClient { * @return Returned if the request is successful. */ get(): Observable { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); let options_ : any = { observe: "response", @@ -45898,8 +44474,8 @@ export class DynamicModulesResource_registerModulesClient { * @return Returned if the request is successful. */ post(body: ConnectModules): Observable { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); const content_ = JSON.stringify(body); @@ -45977,8 +44553,8 @@ export class AppIssueFieldValueUpdateResource_updateIssueFieldsClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, body: ConnectCustomFieldValues): Observable { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/field") + .toString(); const content_ = JSON.stringify(body); @@ -46057,11 +44633,11 @@ export class MigrationResource_updateEntityPropertiesValueClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, entityType: EntityType, body: EntityPropertyDetails[]): Observable { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}"; - if (entityType === undefined || entityType === null) - throw new globalThis.Error("The parameter 'entityType' must be defined."); - url_ = url_.replace("{entityType}", encodeURIComponent("" + entityType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityType, 'entityType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}") + .path("entityType", entityType) + .toString(); const content_ = JSON.stringify(body); @@ -46134,8 +44710,8 @@ export class MigrationResource_workflowRuleSearchClient { * @return Returned if the request is successful. */ post(atlassian_Transfer_Id: string, body: WorkflowRulesSearch): Observable { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search") + .toString(); const content_ = JSON.stringify(body); @@ -46212,12 +44788,11 @@ export class ServiceRegistryResource_servicesClient { * @return Returned if the request is successful. */ get(serviceIds: string[]): Observable { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/service-registry?"; - if (serviceIds === undefined || serviceIds === null) - throw new globalThis.Error("The parameter 'serviceIds' must be defined and cannot be null."); - else - serviceIds && serviceIds.forEach(item => { url_ += "serviceIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(serviceIds, 'serviceIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/service-registry") + .paramArray("serviceIds", serviceIds) + .toString(); let options_ : any = { observe: "response", @@ -104988,4 +103563,68 @@ function blobToText(blob: any): Observable { reader.readAsText(blob); } }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_AngularJS.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_AngularJS.verified.txt index 9e264021b..fff03006d 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_AngularJS.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_AngularJS.verified.txt @@ -21,8 +21,8 @@ export class Client { * @return Returned if the request is successful. */ getBanner(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -79,8 +79,8 @@ export class Client { * @return Returned if the request is successful. */ setBanner(body: AnnouncementBannerConfigurationUpdate): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); const content_ = JSON.stringify(body); @@ -156,36 +156,23 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldsConfigurations(body: ConfigurationsListParameters, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/app/field/context/configuration/list?"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/context/configuration/list") + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -249,12 +236,11 @@ export class Client { * @return Returned if the request is successful. */ updateMultipleCustomFieldValues(body: MultipleCustomFieldValuesUpdateDetails, generateChangelog?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/app/field/value?"; - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/value") + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -322,39 +308,25 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldConfiguration(fieldIdOrKey: string, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -414,11 +386,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldConfiguration(fieldIdOrKey: string, body: CustomFieldConfigurations): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -484,15 +456,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldValue(fieldIdOrKey: string, body: CustomFieldValueUpdateDetails, generateChangelog?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value") + .path("fieldIdOrKey", fieldIdOrKey) + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -555,20 +525,15 @@ export class Client { * @return Returned if the request is successful. */ getApplicationProperty(key?: string | undefined, permissionLevel?: string | undefined, keyFilter?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/application-properties?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (permissionLevel === null) - throw new globalThis.Error("The parameter 'permissionLevel' cannot be null."); - else if (permissionLevel !== undefined) - url_ += "permissionLevel=" + encodeURIComponent("" + permissionLevel) + "&"; - if (keyFilter === null) - throw new globalThis.Error("The parameter 'keyFilter' cannot be null."); - else if (keyFilter !== undefined) - url_ += "keyFilter=" + encodeURIComponent("" + keyFilter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + Guard.notNull(permissionLevel, 'permissionLevel'); + Guard.notNull(keyFilter, 'keyFilter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties") + .param("key", key) + .param("permissionLevel", permissionLevel) + .param("keyFilter", keyFilter) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -632,8 +597,8 @@ export class Client { * @return Returned if the request is successful. */ getAdvancedSettings(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/application-properties/advanced-settings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/advanced-settings") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -692,11 +657,11 @@ export class Client { * @return Returned if the request is successful. */ setApplicationProperty(id: string, body: SimpleApplicationPropertyBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/application-properties/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -771,8 +736,8 @@ export class Client { * @return Returned if the request is successful. */ getAllApplicationRoles(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/applicationrole"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -831,11 +796,11 @@ export class Client { * @return Returned if the request is successful. */ getApplicationRole(key: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/applicationrole/{key}"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined."); - url_ = url_.replace("{key}", encodeURIComponent("" + key)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole/{key}") + .path("key", key) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -892,15 +857,13 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentContent(id: string, redirect?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/attachment/content/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/content/{id}") + .path("id", id) + .param("redirect", redirect) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -978,8 +941,8 @@ export class Client { * @return Returned if the request is successful. */ getAttachmentMeta(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/attachment/meta"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/meta") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -1031,27 +994,19 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentThumbnail(id: string, redirect?: boolean | undefined, fallbackToDefault?: boolean | undefined, width?: number | undefined, height?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - if (fallbackToDefault === null) - throw new globalThis.Error("The parameter 'fallbackToDefault' cannot be null."); - else if (fallbackToDefault !== undefined) - url_ += "fallbackToDefault=" + encodeURIComponent("" + fallbackToDefault) + "&"; - if (width === null) - throw new globalThis.Error("The parameter 'width' cannot be null."); - else if (width !== undefined) - url_ += "width=" + encodeURIComponent("" + width) + "&"; - if (height === null) - throw new globalThis.Error("The parameter 'height' cannot be null."); - else if (height !== undefined) - url_ += "height=" + encodeURIComponent("" + height) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + Guard.notNull(fallbackToDefault, 'fallbackToDefault'); + Guard.notNull(width, 'width'); + Guard.notNull(height, 'height'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}") + .path("id", id) + .param("redirect", redirect) + .param("fallbackToDefault", fallbackToDefault) + .param("width", width) + .param("height", height) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -1122,11 +1077,11 @@ export class Client { * @return Returned if the request is successful. */ removeAttachment(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -1174,11 +1129,11 @@ export class Client { * @return Returned if the request is successful. */ getAttachment(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -1234,11 +1189,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForHumans(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/human"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/human") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -1298,11 +1253,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForMachines(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -1366,28 +1321,19 @@ export class Client { * @return Returned if the request is successful. */ getAuditRecords(offset?: number | undefined, limit?: number | undefined, filter?: string | undefined, from?: string | undefined, to?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/auditing/record?"; - if (offset === null) - throw new globalThis.Error("The parameter 'offset' cannot be null."); - else if (offset !== undefined) - url_ += "offset=" + encodeURIComponent("" + offset) + "&"; - if (limit === null) - throw new globalThis.Error("The parameter 'limit' cannot be null."); - else if (limit !== undefined) - url_ += "limit=" + encodeURIComponent("" + limit) + "&"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (from === null) - throw new globalThis.Error("The parameter 'from' cannot be null."); - else if (from !== undefined) - url_ += "from=" + encodeURIComponent("" + from) + "&"; - if (to === null) - throw new globalThis.Error("The parameter 'to' cannot be null."); - else if (to !== undefined) - url_ += "to=" + encodeURIComponent("" + to) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(offset, 'offset'); + Guard.notNull(limit, 'limit'); + Guard.notNull(filter, 'filter'); + Guard.notNull(from, 'from'); + Guard.notNull(to, 'to'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/auditing/record") + .param("offset", offset) + .param("limit", limit) + .param("filter", filter) + .param("from", from) + .param("to", to) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -1445,11 +1391,11 @@ export class Client { * @return Returned if the request is successful. */ getAllSystemAvatars(type: Type): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/avatar/{type}/system"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/avatar/{type}/system") + .path("type", type) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -1501,8 +1447,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkDelete(body: IssueBulkDeletePayload): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/delete") + .toString(); const content_ = JSON.stringify(body); @@ -1574,24 +1520,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkEditableFields(issueIdsOrKeys: string, searchText?: string | undefined, endingBefore?: string | undefined, startingAfter?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (searchText === null) - throw new globalThis.Error("The parameter 'searchText' cannot be null."); - else if (searchText !== undefined) - url_ += "searchText=" + encodeURIComponent("" + searchText) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(searchText, 'searchText'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("searchText", searchText) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -1663,8 +1602,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkEdit(body: IssueBulkEditPayload): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .toString(); const content_ = JSON.stringify(body); @@ -1725,8 +1664,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkMove(body: IssueBulkMovePayload): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/move") + .toString(); const content_ = JSON.stringify(body); @@ -1790,20 +1729,15 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTransitions(issueIdsOrKeys: string, endingBefore?: string | undefined, startingAfter?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -1868,8 +1802,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkTransition(body: IssueBulkTransitionPayload): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .toString(); const content_ = JSON.stringify(body); @@ -1938,8 +1872,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkUnwatch(body: IssueBulkWatchOrUnwatchPayload): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/unwatch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/unwatch") + .toString(); const content_ = JSON.stringify(body); @@ -2008,8 +1942,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkWatch(body: IssueBulkWatchOrUnwatchPayload): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/watch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/watch") + .toString(); const content_ = JSON.stringify(body); @@ -2078,11 +2012,11 @@ export class Client { * @return Returned if the request is successful. */ getBulkOperationProgress(taskId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/bulk/queue/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/queue/{taskId}") + .path("taskId", taskId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -2140,8 +2074,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkChangelogs(body: BulkChangelogRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/changelog/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/changelog/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -2194,16 +2128,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUserDataClassificationLevels(status?: Status2[] | undefined, orderBy?: OrderBy | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/classification-levels?"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(status, 'status'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/classification-levels") + .paramArray("status", status) + .param("orderBy", orderBy) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -2255,12 +2186,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentsByIds(body: IssueCommentListRequestBean, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/comment/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -2312,11 +2242,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentPropertyKeys(commentId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties") + .path("commentId", commentId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -2377,14 +2307,13 @@ export class Client { * @return Returned if the request is successful. */ deleteCommentProperty(commentId: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -2441,14 +2370,13 @@ export class Client { * @return Returned if the request is successful. */ getCommentProperty(commentId: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -2510,14 +2438,13 @@ export class Client { * @return Returned if the comment property is updated. */ setCommentProperty(commentId: string, propertyKey: string, body: any): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -2597,28 +2524,19 @@ export class Client { * @return Returned if the request is successful. */ findComponentsForProjects(projectIdsOrKeys?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy2 | undefined, query?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/component?"; - if (projectIdsOrKeys === null) - throw new globalThis.Error("The parameter 'projectIdsOrKeys' cannot be null."); - else if (projectIdsOrKeys !== undefined) - projectIdsOrKeys && projectIdsOrKeys.forEach(item => { url_ += "projectIdsOrKeys=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIdsOrKeys, 'projectIdsOrKeys'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .paramArray("projectIdsOrKeys", projectIdsOrKeys) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -2669,8 +2587,8 @@ export class Client { * @return Returned if the request is successful. */ createComponent(body: ProjectComponent): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/component"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .toString(); const content_ = JSON.stringify(body); @@ -2735,15 +2653,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComponent(id: string, moveIssuesTo?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' cannot be null."); - else if (moveIssuesTo !== undefined) - url_ += "moveIssuesTo=" + encodeURIComponent("" + moveIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .param("moveIssuesTo", moveIssuesTo) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -2795,11 +2711,11 @@ export class Client { * @return Returned if the request is successful. */ getComponent(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -2851,11 +2767,11 @@ export class Client { * @return Returned if the request is successful. */ updateComponent(id: string, body: ProjectComponent): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -2919,11 +2835,11 @@ export class Client { * @return Returned if the request is successful. */ getComponentRelatedIssues(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -2974,8 +2890,8 @@ export class Client { * @return Returned if the request is successful. */ getConfiguration(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/configuration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -3022,8 +2938,8 @@ export class Client { * @return Returned if the request is successful and time tracking is enabled. */ getSelectedTimeTrackingImplementation(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -3082,8 +2998,8 @@ export class Client { * @return Returned if the request is successful. */ selectTimeTrackingImplementation(body: TimeTrackingProvider): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); const content_ = JSON.stringify(body); @@ -3143,8 +3059,8 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTimeTrackingImplementations(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/list"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/list") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -3202,8 +3118,8 @@ export class Client { * @return Returned if the request is successful. */ getSharedTimeTrackingConfiguration(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -3254,8 +3170,8 @@ export class Client { * @return Returned if the request is successful. */ setSharedTimeTrackingConfiguration(body: TimeTrackingConfiguration): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); const content_ = JSON.stringify(body); @@ -3315,11 +3231,11 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldOption(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/customFieldOption/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/customFieldOption/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -3376,20 +3292,15 @@ export class Client { * @return Returned if the request is successful. */ getAllDashboards(filter?: Filter2 | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filter, 'filter'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("filter", filter) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -3448,12 +3359,11 @@ export class Client { * @return Returned if the request is successful. */ createDashboard(body: DashboardDetails, extendAdminPermissions?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -3515,8 +3425,8 @@ export class Client { * @return Returned if the request is successful. */ bulkEditDashboards(body: BulkEditShareableEntityRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/bulk/edit"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/bulk/edit") + .toString(); const content_ = JSON.stringify(body); @@ -3577,8 +3487,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAvailableDashboardGadgets(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/gadgets"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/gadgets") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -3662,52 +3572,31 @@ export class Client { * @return Returned if the request is successful. */ getDashboardsPaginated(dashboardName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, orderBy?: OrderBy3 | undefined, startAt?: number | undefined, maxResults?: number | undefined, status?: Status3 | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/search?"; - if (dashboardName === null) - throw new globalThis.Error("The parameter 'dashboardName' cannot be null."); - else if (dashboardName !== undefined) - url_ += "dashboardName=" + encodeURIComponent("" + dashboardName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(dashboardName, 'dashboardName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/search") + .param("dashboardName", dashboardName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("status", status) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -3768,23 +3657,17 @@ export class Client { * @return Returned if the request is successful. */ getAllGadgets(dashboardId: number, moduleKey?: string[] | undefined, uri?: string[] | undefined, gadgetId?: number[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget?"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - if (uri === null) - throw new globalThis.Error("The parameter 'uri' cannot be null."); - else if (uri !== undefined) - uri && uri.forEach(item => { url_ += "uri=" + encodeURIComponent("" + item) + "&"; }); - if (gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' cannot be null."); - else if (gadgetId !== undefined) - gadgetId && gadgetId.forEach(item => { url_ += "gadgetId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.notNull(moduleKey, 'moduleKey'); + Guard.notNull(uri, 'uri'); + Guard.notNull(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .paramArray("moduleKey", moduleKey) + .paramArray("uri", uri) + .paramArray("gadgetId", gadgetId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -3839,11 +3722,11 @@ export class Client { * @return Returned if the request is successful. */ addGadget(dashboardId: number, body: DashboardGadgetSettings): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .toString(); const content_ = JSON.stringify(body); @@ -3910,14 +3793,13 @@ export class Client { * @return Returned if the request is successful. */ removeGadget(dashboardId: number, gadgetId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -3974,14 +3856,13 @@ export class Client { * @return Returned if the request is successful. */ updateGadget(dashboardId: number, gadgetId: number, body: DashboardGadgetUpdateRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); const content_ = JSON.stringify(body); @@ -4049,14 +3930,13 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemPropertyKeys(dashboardId: string, itemId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -4116,17 +3996,15 @@ export class Client { * @return Returned if the dashboard item property is deleted. */ deleteDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -4201,17 +4079,15 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -4272,17 +4148,15 @@ export class Client { * @return Returned if the dashboard item property is updated. */ setDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string, body: any): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -4367,11 +4241,11 @@ export class Client { * @return Returned if the dashboard is deleted. */ deleteDashboard(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -4425,11 +4299,11 @@ export class Client { * @return Returned if the request is successful. */ getDashboard(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -4493,15 +4367,13 @@ export class Client { * @return Returned if the request is successful. */ updateDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -4571,15 +4443,13 @@ export class Client { * @return Returned if the request is successful. */ copyDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}/copy?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}/copy") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -4647,8 +4517,8 @@ export class Client { * @return Returned if the request is successful */ getPolicy(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/data-policy"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -4706,12 +4576,11 @@ export class Client { * @return Returned if the request is successful. */ getPolicies(ids?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/data-policy/project?"; - if (ids === null) - throw new globalThis.Error("The parameter 'ids' cannot be null."); - else if (ids !== undefined) - url_ += "ids=" + encodeURIComponent("" + ids) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(ids, 'ids'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy/project") + .param("ids", ids) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -4775,8 +4644,8 @@ export class Client { * @return Returned if the request is successful. */ getEvents(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/events"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/events") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -4840,12 +4709,11 @@ export class Client { * @return Returned if the request is successful. */ analyseExpression(body: JiraExpressionForAnalysis, check?: Check | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/expression/analyse?"; - if (check === null) - throw new globalThis.Error("The parameter 'check' cannot be null."); - else if (check !== undefined) - url_ += "check=" + encodeURIComponent("" + check) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(check, 'check'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/analyse") + .param("check", check) + .toString(); const content_ = JSON.stringify(body); @@ -4913,12 +4781,11 @@ export class Client { * @deprecated */ evaluateJiraExpression(body: JiraExpressionEvalRequestBean, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/expression/eval?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/eval") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -4985,12 +4852,11 @@ export class Client { * @return Returned if the evaluation results in a value. The result is a JSON primitive value, list, or object. */ evaluateJSISJiraExpression(body: JiraExpressionEvaluateRequestBean, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/expression/evaluate?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/evaluate") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -5055,8 +4921,8 @@ export class Client { * @return Returned if the request is successful. */ getFields(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -5111,8 +4977,8 @@ export class Client { * @return Returned if the custom field is created. */ createCustomField(body: CustomFieldDefinitionJsonBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); const content_ = JSON.stringify(body); @@ -5164,8 +5030,8 @@ export class Client { * @return Returned if the field association validation passes. */ removeAssociations(body: FieldAssociationsRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -5226,8 +5092,8 @@ export class Client { * @return Returned if the field association validation passes. */ createAssociations(body: FieldAssociationsRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -5308,40 +5174,25 @@ export class Client { * @return Returned if the request is successful. */ getFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, type?: Type2[] | undefined, id?: string[] | undefined, query?: string | undefined, orderBy?: OrderBy4 | undefined, expand?: string | undefined, projectIds?: number[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (type === null) - throw new globalThis.Error("The parameter 'type' cannot be null."); - else if (type !== undefined) - type && type.forEach(item => { url_ += "type=" + encodeURIComponent("" + item) + "&"; }); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(type, 'type'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectIds, 'projectIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("type", type) + .paramArray("id", id) + .param("query", query) + .param("orderBy", orderBy) + .param("expand", expand) + .paramArray("projectIds", projectIds) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -5412,32 +5263,21 @@ export class Client { * @return Returned if the request is successful. */ getTrashedFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, id?: string[] | undefined, query?: string | undefined, expand?: Expand | undefined, orderBy?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/search/trashed?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(expand, 'expand'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search/trashed") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("query", query) + .param("expand", expand) + .param("orderBy", orderBy) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -5500,11 +5340,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomField(fieldId: string, body: UpdateCustomFieldDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -5574,31 +5414,21 @@ export class Client { * @return Returned if the request is successful. */ getContextsForField(fieldId: string, isAnyIssueType?: boolean | undefined, isGlobalContext?: boolean | undefined, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (isAnyIssueType === null) - throw new globalThis.Error("The parameter 'isAnyIssueType' cannot be null."); - else if (isAnyIssueType !== undefined) - url_ += "isAnyIssueType=" + encodeURIComponent("" + isAnyIssueType) + "&"; - if (isGlobalContext === null) - throw new globalThis.Error("The parameter 'isGlobalContext' cannot be null."); - else if (isGlobalContext !== undefined) - url_ += "isGlobalContext=" + encodeURIComponent("" + isGlobalContext) + "&"; - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(isAnyIssueType, 'isAnyIssueType'); + Guard.notNull(isGlobalContext, 'isGlobalContext'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .param("isAnyIssueType", isAnyIssueType) + .param("isGlobalContext", isGlobalContext) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -5654,11 +5484,11 @@ export class Client { * @return Returned if the custom field context is created. */ createCustomFieldContext(fieldId: string, body: CreateCustomFieldContext): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -5725,23 +5555,17 @@ export class Client { * @return Returned if the request is successful. */ getDefaultValues(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -5797,11 +5621,11 @@ export class Client { * @return Returned if operation is successful. */ setDefaultValues(fieldId: string, body: CustomFieldContextDefaultValueUpdate): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -5869,23 +5693,17 @@ export class Client { * @return Returned if operation is successful. */ getIssueTypeMappingsForContexts(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -5940,19 +5758,15 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldContextsForProjectsAndIssueTypes(fieldId: string, body: ProjectIssueTypeMappings, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -6019,23 +5833,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectContextMapping(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -6092,14 +5900,13 @@ export class Client { * @return Returned if the context is deleted. */ deleteCustomFieldContext(fieldId: string, contextId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -6161,14 +5968,13 @@ export class Client { * @return Returned if the context is updated. */ updateCustomFieldContext(fieldId: string, contextId: number, body: CustomFieldContextUpdateDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6234,14 +6040,13 @@ export class Client { * @return Returned if operation is successful. */ addIssueTypesToContext(fieldId: string, contextId: number, body: IssueTypeIds): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6311,14 +6116,13 @@ export class Client { * @return Returned if operation is successful. */ removeIssueTypesFromContext(fieldId: string, contextId: number, body: IssueTypeIds): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6388,30 +6192,21 @@ export class Client { * @return Returned if the request is successful. */ getOptionsForContext(fieldId: string, contextId: number, optionId?: number | undefined, onlyOptions?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === null) - throw new globalThis.Error("The parameter 'optionId' cannot be null."); - else if (optionId !== undefined) - url_ += "optionId=" + encodeURIComponent("" + optionId) + "&"; - if (onlyOptions === null) - throw new globalThis.Error("The parameter 'onlyOptions' cannot be null."); - else if (onlyOptions !== undefined) - url_ += "onlyOptions=" + encodeURIComponent("" + onlyOptions) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(optionId, 'optionId'); + Guard.notNull(onlyOptions, 'onlyOptions'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .param("optionId", optionId) + .param("onlyOptions", onlyOptions) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -6472,14 +6267,13 @@ export class Client { * @return Returned if the request is successful. */ createCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionCreateRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6544,14 +6338,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionUpdateRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6616,14 +6409,13 @@ export class Client { * @return Returned if options are reordered. */ reorderCustomFieldOptions(fieldId: string, contextId: number, body: OrderOfCustomFieldOptions): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6690,17 +6482,15 @@ export class Client { * @return Returned if the option is deleted. */ deleteCustomFieldOption(fieldId: string, contextId: number, optionId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .path("optionId", optionId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -6759,25 +6549,19 @@ export class Client { * @param jql (optional) A JQL query that specifies the issues to be updated. For example, *project=10000*. */ replaceCustomFieldOption(fieldId: string, optionId: number, contextId: number, replaceWith?: number | undefined, jql?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(optionId, 'optionId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue") + .path("fieldId", fieldId) + .path("optionId", optionId) + .path("contextId", contextId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -6833,14 +6617,13 @@ export class Client { * @return Returned if operation is successful. */ assignProjectsToCustomFieldContext(fieldId: string, contextId: number, body: ProjectIds): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6906,14 +6689,13 @@ export class Client { * @return Returned if the custom field context is removed from the projects. */ removeCustomFieldContextFromProjects(fieldId: string, contextId: number, body: ProjectIds): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6981,19 +6763,15 @@ export class Client { * @deprecated */ getContextsForFieldDeprecated(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/contexts?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/contexts") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -7048,23 +6826,17 @@ export class Client { * @return Returned if the request is successful. */ getScreensForField(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/screens?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/screens") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -7121,19 +6893,15 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -7188,11 +6956,11 @@ export class Client { * @return Returned if the request is successful. */ createIssueFieldOption(fieldKey: string, body: IssueFieldOptionCreateBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .toString(); const content_ = JSON.stringify(body); @@ -7258,23 +7026,17 @@ export class Client { * @return Returned if the request is successful. */ getSelectableIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -7332,23 +7094,17 @@ export class Client { * @return Returned if the request is successful. */ getVisibleIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -7404,14 +7160,13 @@ export class Client { * @return Returned if the field option is deleted. */ deleteIssueFieldOption(fieldKey: string, optionId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -7472,14 +7227,13 @@ export class Client { * @return Returned if the requested option is returned. */ getIssueFieldOption(fieldKey: string, optionId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -7539,14 +7293,13 @@ export class Client { * @return Returned if the option is updated or created. */ updateIssueFieldOption(fieldKey: string, optionId: number, body: IssueFieldOption): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); const content_ = JSON.stringify(body); @@ -7613,30 +7366,21 @@ export class Client { * @param overrideEditableFlag (optional) Whether screen security is overridden to enable uneditable fields to be edited. Available to Connect and Forge app users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ replaceIssueFieldOption(fieldKey: string, optionId: number, replaceWith?: number | undefined, jql?: string | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -7690,11 +7434,11 @@ export class Client { * @param id The ID of a custom field. */ deleteCustomField(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -7772,11 +7516,11 @@ export class Client { * @return Returned if the request is successful. */ restoreCustomField(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/restore"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/restore") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -7849,11 +7593,11 @@ export class Client { * @return Returned if the request is successful. */ trashCustomField(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/trash"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/trash") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -7930,28 +7674,19 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurations(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, isDefault?: boolean | undefined, query?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (isDefault === null) - throw new globalThis.Error("The parameter 'isDefault' cannot be null."); - else if (isDefault !== undefined) - url_ += "isDefault=" + encodeURIComponent("" + isDefault) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(isDefault, 'isDefault'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("isDefault", isDefault) + .param("query", query) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -8002,8 +7737,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfiguration(body: FieldConfigurationDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .toString(); const content_ = JSON.stringify(body); @@ -8063,11 +7798,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfiguration(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -8128,11 +7863,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfiguration(id: number, body: FieldConfigurationDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -8199,19 +7934,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationItems(id: number, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -8267,11 +7998,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationItems(id: number, body: FieldConfigurationItemsDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -8338,20 +8069,15 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurationSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -8407,8 +8133,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfigurationScheme(body: UpdateFieldConfigurationSchemeDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -8470,20 +8196,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, fieldConfigurationSchemeId?: number[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fieldConfigurationSchemeId === null) - throw new globalThis.Error("The parameter 'fieldConfigurationSchemeId' cannot be null."); - else if (fieldConfigurationSchemeId !== undefined) - fieldConfigurationSchemeId && fieldConfigurationSchemeId.forEach(item => { url_ += "fieldConfigurationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fieldConfigurationSchemeId, 'fieldConfigurationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("fieldConfigurationSchemeId", fieldConfigurationSchemeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -8545,20 +8266,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeProjectMapping(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -8613,8 +8329,8 @@ export class Client { * @return Returned if the request is successful. */ assignFieldConfigurationSchemeToProject(body: FieldConfigurationSchemeProjectAssociation): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -8679,11 +8395,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfigurationScheme(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -8745,11 +8461,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationScheme(id: number, body: UpdateFieldConfigurationSchemeDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -8814,11 +8530,11 @@ export class Client { * @return Returned if the request is successful. */ setFieldConfigurationSchemeMapping(id: number, body: AssociateFieldConfigurationsWithIssueTypesRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -8884,11 +8600,11 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypesFromGlobalFieldConfigurationScheme(id: number, body: IssueTypeIdsToRemove): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -8970,16 +8686,13 @@ export class Client { * @return Returned if the request is successful. */ createFilter(body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter") + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -9034,8 +8747,8 @@ export class Client { * @return Returned if the request is successful. */ getDefaultShareScope(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -9082,8 +8795,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultShareScope(body: DefaultShareScope): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); const content_ = JSON.stringify(body); @@ -9142,12 +8855,11 @@ export class Client { * @return Returned if the request is successful. */ getFavouriteFilters(expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/favourite?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/favourite") + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -9206,16 +8918,13 @@ export class Client { * @return Returned if the request is successful. */ getMyFilters(expand?: string | undefined, includeFavourites?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/my?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (includeFavourites === null) - throw new globalThis.Error("The parameter 'includeFavourites' cannot be null."); - else if (includeFavourites !== undefined) - url_ += "includeFavourites=" + encodeURIComponent("" + includeFavourites) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(includeFavourites, 'includeFavourites'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/my") + .param("expand", expand) + .param("includeFavourites", includeFavourites) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -9303,60 +9012,35 @@ export class Client { * @return Returned if the request is successful. */ getFiltersPaginated(filterName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy5 | undefined, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, isSubstringMatch?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/search?"; - if (filterName === null) - throw new globalThis.Error("The parameter 'filterName' cannot be null."); - else if (filterName !== undefined) - url_ += "filterName=" + encodeURIComponent("" + filterName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - if (isSubstringMatch === null) - throw new globalThis.Error("The parameter 'isSubstringMatch' cannot be null."); - else if (isSubstringMatch !== undefined) - url_ += "isSubstringMatch=" + encodeURIComponent("" + isSubstringMatch) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filterName, 'filterName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + Guard.notNull(isSubstringMatch, 'isSubstringMatch'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/search") + .param("filterName", filterName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .param("isSubstringMatch", isSubstringMatch) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -9411,11 +9095,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFilter(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -9468,19 +9152,15 @@ export class Client { * @return Returned if the request is successful. */ getFilter(id: number, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -9538,19 +9218,15 @@ export class Client { * @return Returned if the request is successful. */ updateFilter(id: number, body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -9606,11 +9282,11 @@ export class Client { * @return Returned if the request is successful. */ resetColumns(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -9658,11 +9334,11 @@ export class Client { * @return Returned if the request is successful. */ getColumns(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -9727,17 +9403,15 @@ export class Client { * @return Returned if the request is successful. */ setColumns(id: number, body: ColumnRequestBody, columns?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); var options_: ng.IRequestConfig = { url: url_, @@ -9796,15 +9470,13 @@ export class Client { * @return Returned if the request is successful. */ deleteFavouriteForFilter(id: number, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -9856,15 +9528,13 @@ export class Client { * @return Returned if the request is successful. */ setFavouriteForFilter(id: number, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -9913,11 +9583,11 @@ export class Client { * @return Returned if the request is successful. */ changeFilterOwner(id: number, body: ChangeFilterOwner): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/owner"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/owner") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9978,11 +9648,11 @@ export class Client { * @return Returned if the request is successful. */ getSharePermissions(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -10041,11 +9711,11 @@ export class Client { * @return Returned if the request is successful. */ addSharePermission(id: number, body: SharePermissionInputBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -10113,14 +9783,13 @@ export class Client { * @return Returned if the request is successful. */ deleteSharePermission(id: number, permissionId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -10169,14 +9838,13 @@ export class Client { * @return Returned if the request is successful. */ getSharePermission(id: number, permissionId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -10232,24 +9900,17 @@ export class Client { * @return Returned if the request is successful. */ removeGroup(groupname?: string | undefined, groupId?: string | undefined, swapGroup?: string | undefined, swapGroupId?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (swapGroup === null) - throw new globalThis.Error("The parameter 'swapGroup' cannot be null."); - else if (swapGroup !== undefined) - url_ += "swapGroup=" + encodeURIComponent("" + swapGroup) + "&"; - if (swapGroupId === null) - throw new globalThis.Error("The parameter 'swapGroupId' cannot be null."); - else if (swapGroupId !== undefined) - url_ += "swapGroupId=" + encodeURIComponent("" + swapGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(swapGroup, 'swapGroup'); + Guard.notNull(swapGroupId, 'swapGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("swapGroup", swapGroup) + .param("swapGroupId", swapGroupId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -10309,20 +9970,15 @@ export class Client { * @deprecated */ getGroup(groupname?: string | undefined, groupId?: string | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -10382,8 +10038,8 @@ export class Client { * @return Returned if the request is successful. */ createGroup(body: AddGroupBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/group"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .toString(); const content_ = JSON.stringify(body); @@ -10448,32 +10104,21 @@ export class Client { * @return Returned if the request is successful. */ bulkGetGroups(startAt?: number | undefined, maxResults?: number | undefined, groupId?: string[] | undefined, groupName?: string[] | undefined, accessType?: string | undefined, applicationKey?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/group/bulk?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - groupId && groupId.forEach(item => { url_ += "groupId=" + encodeURIComponent("" + item) + "&"; }); - if (groupName === null) - throw new globalThis.Error("The parameter 'groupName' cannot be null."); - else if (groupName !== undefined) - groupName && groupName.forEach(item => { url_ += "groupName=" + encodeURIComponent("" + item) + "&"; }); - if (accessType === null) - throw new globalThis.Error("The parameter 'accessType' cannot be null."); - else if (accessType !== undefined) - url_ += "accessType=" + encodeURIComponent("" + accessType) + "&"; - if (applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' cannot be null."); - else if (applicationKey !== undefined) - url_ += "applicationKey=" + encodeURIComponent("" + applicationKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(groupName, 'groupName'); + Guard.notNull(accessType, 'accessType'); + Guard.notNull(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/bulk") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("groupId", groupId) + .paramArray("groupName", groupName) + .param("accessType", accessType) + .param("applicationKey", applicationKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -10538,28 +10183,19 @@ export class Client { * @return Returned if the request is successful. */ getUsersFromGroup(groupname?: string | undefined, groupId?: string | undefined, includeInactiveUsers?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/group/member?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (includeInactiveUsers === null) - throw new globalThis.Error("The parameter 'includeInactiveUsers' cannot be null."); - else if (includeInactiveUsers !== undefined) - url_ += "includeInactiveUsers=" + encodeURIComponent("" + includeInactiveUsers) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(includeInactiveUsers, 'includeInactiveUsers'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/member") + .param("groupname", groupname) + .param("groupId", groupId) + .param("includeInactiveUsers", includeInactiveUsers) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -10623,24 +10259,17 @@ export class Client { * @return Returned if the request is successful. */ removeUserFromGroup(accountId: string, groupname?: string | undefined, groupId?: string | undefined, username?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("accountId", accountId) + .param("groupname", groupname) + .param("groupId", groupId) + .param("username", username) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -10699,16 +10328,13 @@ export class Client { * @return Returned if the request is successful. */ addUserToGroup(body: UpdateUserToGroupBean, groupname?: string | undefined, groupId?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("groupname", groupname) + .param("groupId", groupId) + .toString(); const content_ = JSON.stringify(body); @@ -10783,36 +10409,23 @@ export class Client { * @return Returned if the request is successful. */ findGroups(accountId?: string | undefined, query?: string | undefined, exclude?: string[] | undefined, excludeId?: string[] | undefined, maxResults?: number | undefined, caseInsensitive?: boolean | undefined, userName?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/groups/picker?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeId === null) - throw new globalThis.Error("The parameter 'excludeId' cannot be null."); - else if (excludeId !== undefined) - excludeId && excludeId.forEach(item => { url_ += "excludeId=" + encodeURIComponent("" + item) + "&"; }); - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (userName === null) - throw new globalThis.Error("The parameter 'userName' cannot be null."); - else if (userName !== undefined) - url_ += "userName=" + encodeURIComponent("" + userName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeId, 'excludeId'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(userName, 'userName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groups/picker") + .param("accountId", accountId) + .param("query", query) + .paramArray("exclude", exclude) + .paramArray("excludeId", excludeId) + .param("maxResults", maxResults) + .param("caseInsensitive", caseInsensitive) + .param("userName", userName) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -10864,44 +10477,27 @@ export class Client { * @return Returned if the request is successful. */ findUsersAndGroups(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, fieldId?: string | undefined, projectId?: string[] | undefined, issueTypeId?: string[] | undefined, avatarSize?: AvatarSize | undefined, caseInsensitive?: boolean | undefined, excludeConnectAddons?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/groupuserpicker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' cannot be null."); - else if (fieldId !== undefined) - url_ += "fieldId=" + encodeURIComponent("" + fieldId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - issueTypeId && issueTypeId.forEach(item => { url_ += "issueTypeId=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(fieldId, 'fieldId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groupuserpicker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .param("fieldId", fieldId) + .paramArray("projectId", projectId) + .paramArray("issueTypeId", issueTypeId) + .param("avatarSize", avatarSize) + .param("caseInsensitive", caseInsensitive) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -10960,8 +10556,8 @@ export class Client { * @return Returned if the request is successful. */ getLicense(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/instance/license"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/instance/license") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -11009,12 +10605,11 @@ export class Client { * @return Returned if the request is successful. */ createIssue(body: IssueUpdateDetails, updateHistory?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue?"; - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(updateHistory, 'updateHistory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue") + .param("updateHistory", updateHistory) + .toString(); const content_ = JSON.stringify(body); @@ -11090,8 +10685,8 @@ export class Client { * @return Returns the URL to check the status of the submitted request. */ archiveIssues(body: ArchiveIssueAsyncRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -11156,8 +10751,8 @@ export class Client { * @return Returned if there is at least one valid issue to archive in the request. The return message will include the count of archived issues and subtasks, as well as error details for issues which failed to get archived. */ archiveIssues(body: IssueArchivalSyncRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -11228,8 +10823,8 @@ export class Client { * is invalid for any other reason. */ createIssues(body: IssuesUpdateBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/bulk"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulk") + .toString(); const content_ = JSON.stringify(body); @@ -11288,8 +10883,8 @@ export class Client { * @return Returned if the request is successful. A response may contain both successful issues and issue errors. */ bulkFetchIssues(body: BulkFetchIssueRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -11350,28 +10945,19 @@ export class Client { * @deprecated */ getCreateIssueMeta(projectIds?: string[] | undefined, projectKeys?: string[] | undefined, issuetypeIds?: string[] | undefined, issuetypeNames?: string[] | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta?"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - if (projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' cannot be null."); - else if (projectKeys !== undefined) - projectKeys && projectKeys.forEach(item => { url_ += "projectKeys=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeIds === null) - throw new globalThis.Error("The parameter 'issuetypeIds' cannot be null."); - else if (issuetypeIds !== undefined) - issuetypeIds && issuetypeIds.forEach(item => { url_ += "issuetypeIds=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeNames === null) - throw new globalThis.Error("The parameter 'issuetypeNames' cannot be null."); - else if (issuetypeNames !== undefined) - issuetypeNames && issuetypeNames.forEach(item => { url_ += "issuetypeNames=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIds, 'projectIds'); + Guard.notNull(projectKeys, 'projectKeys'); + Guard.notNull(issuetypeIds, 'issuetypeIds'); + Guard.notNull(issuetypeNames, 'issuetypeNames'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta") + .paramArray("projectIds", projectIds) + .paramArray("projectKeys", projectKeys) + .paramArray("issuetypeIds", issuetypeIds) + .paramArray("issuetypeNames", issuetypeNames) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -11421,19 +11007,15 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypes(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -11488,22 +11070,17 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypeId(projectIdOrKey: string, issueTypeId: string, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}") + .path("projectIdOrKey", projectIdOrKey) + .path("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -11557,12 +11134,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLimitReport(isReturningKeys?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/limit/report?"; - if (isReturningKeys === null) - throw new globalThis.Error("The parameter 'isReturningKeys' cannot be null."); - else if (isReturningKeys !== undefined) - url_ += "isReturningKeys=" + encodeURIComponent("" + isReturningKeys) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(isReturningKeys, 'isReturningKeys'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/limit/report") + .param("isReturningKeys", isReturningKeys) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -11619,32 +11195,21 @@ export class Client { * @return Returned if the request is successful. */ getIssuePickerResource(query?: string | undefined, currentJQL?: string | undefined, currentIssueKey?: string | undefined, currentProjectId?: string | undefined, showSubTasks?: boolean | undefined, showSubTaskParent?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/picker?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (currentJQL === null) - throw new globalThis.Error("The parameter 'currentJQL' cannot be null."); - else if (currentJQL !== undefined) - url_ += "currentJQL=" + encodeURIComponent("" + currentJQL) + "&"; - if (currentIssueKey === null) - throw new globalThis.Error("The parameter 'currentIssueKey' cannot be null."); - else if (currentIssueKey !== undefined) - url_ += "currentIssueKey=" + encodeURIComponent("" + currentIssueKey) + "&"; - if (currentProjectId === null) - throw new globalThis.Error("The parameter 'currentProjectId' cannot be null."); - else if (currentProjectId !== undefined) - url_ += "currentProjectId=" + encodeURIComponent("" + currentProjectId) + "&"; - if (showSubTasks === null) - throw new globalThis.Error("The parameter 'showSubTasks' cannot be null."); - else if (showSubTasks !== undefined) - url_ += "showSubTasks=" + encodeURIComponent("" + showSubTasks) + "&"; - if (showSubTaskParent === null) - throw new globalThis.Error("The parameter 'showSubTaskParent' cannot be null."); - else if (showSubTaskParent !== undefined) - url_ += "showSubTaskParent=" + encodeURIComponent("" + showSubTaskParent) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(currentJQL, 'currentJQL'); + Guard.notNull(currentIssueKey, 'currentIssueKey'); + Guard.notNull(currentProjectId, 'currentProjectId'); + Guard.notNull(showSubTasks, 'showSubTasks'); + Guard.notNull(showSubTaskParent, 'showSubTaskParent'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/picker") + .param("query", query) + .param("currentJQL", currentJQL) + .param("currentIssueKey", currentIssueKey) + .param("currentProjectId", currentProjectId) + .param("showSubTasks", showSubTasks) + .param("showSubTaskParent", showSubTaskParent) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -11691,8 +11256,8 @@ export class Client { * @param body Issue properties to be set or updated with values. */ bulkSetIssuesPropertiesList(body: IssueEntityProperties): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties") + .toString(); const content_ = JSON.stringify(body); @@ -11749,8 +11314,8 @@ export class Client { * @param body Details of the issue properties to be set or updated. Note that if an issue is not found, it is ignored. */ bulkSetIssuePropertiesByIssue(body: MultiIssueEntityProperties): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/multi"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/multi") + .toString(); const content_ = JSON.stringify(body); @@ -11814,11 +11379,11 @@ export class Client { * @param propertyKey The key of the property. */ bulkDeleteIssueProperty(propertyKey: string, body: IssueFilterForBulkPropertyDelete): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -11875,11 +11440,11 @@ export class Client { * @param propertyKey The key of the property. The maximum length is 255 characters. */ bulkSetIssueProperty(propertyKey: string, body: BulkIssuePropertyUpdateRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -11937,8 +11502,8 @@ export class Client { * @return Returned if there is at least one valid issue to unarchive in the request. It will return the count of unarchived issues, which also includes the count of the subtasks unarchived, and it will show the detailed errors for those issues which are not unarchived. */ unarchiveIssues(body: IssueArchivalSyncRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/unarchive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/unarchive") + .toString(); const content_ = JSON.stringify(body); @@ -12002,8 +11567,8 @@ export class Client { * @return Returned if the request is successful */ getIsWatchingIssueBulk(body: IssueList): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/watching"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/watching") + .toString(); const content_ = JSON.stringify(body); @@ -12056,15 +11621,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssue(issueIdOrKey: string, deleteSubtasks?: DeleteSubtasks | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (deleteSubtasks === null) - throw new globalThis.Error("The parameter 'deleteSubtasks' cannot be null."); - else if (deleteSubtasks !== undefined) - url_ += "deleteSubtasks=" + encodeURIComponent("" + deleteSubtasks) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(deleteSubtasks, 'deleteSubtasks'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("deleteSubtasks", deleteSubtasks) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -12159,35 +11722,23 @@ export class Client { * @return Returned if the request is successful. */ getIssue(issueIdOrKey: string, fields?: string[] | undefined, fieldsByKeys?: boolean | undefined, expand?: string | undefined, properties?: string[] | undefined, updateHistory?: boolean | undefined, failFast?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(fields, 'fields'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(updateHistory, 'updateHistory'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .paramArray("fields", fields) + .param("fieldsByKeys", fieldsByKeys) + .param("expand", expand) + .paramArray("properties", properties) + .param("updateHistory", updateHistory) + .param("failFast", failFast) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -12244,31 +11795,21 @@ export class Client { * @return Returned if the request is successful and the `returnIssue` parameter is `true` */ editIssue(issueIdOrKey: string, body: IssueUpdateDetails, notifyUsers?: boolean | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined, returnIssue?: boolean | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (returnIssue === null) - throw new globalThis.Error("The parameter 'returnIssue' cannot be null."); - else if (returnIssue !== undefined) - url_ += "returnIssue=" + encodeURIComponent("" + returnIssue) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(returnIssue, 'returnIssue'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .param("returnIssue", returnIssue) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -12350,11 +11891,11 @@ export class Client { * @return Returned if the request is successful. */ assignIssue(issueIdOrKey: string, body: User): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -12415,11 +11956,11 @@ export class Client { * @return Returned if the request is successful. */ addAttachment(issueIdOrKey: string, body: Blob): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = body; @@ -12488,19 +12029,15 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogs(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -12548,11 +12085,11 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogsByIds(issueIdOrKey: string, body: IssueChangelogIds): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -12612,27 +12149,19 @@ export class Client { * @return Returned if the request is successful. */ getComments(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy6 | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -12689,15 +12218,13 @@ export class Client { * @return Returned if the request is successful. */ addComment(issueIdOrKey: string, body: Comment, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -12762,14 +12289,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComment(issueIdOrKey: string, id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -12827,18 +12353,15 @@ export class Client { * @return Returned if the request is successful. */ getComment(issueIdOrKey: string, id: string, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -12894,26 +12417,19 @@ export class Client { * @return Returned if the request is successful. */ updateComment(issueIdOrKey: string, id: string, body: Comment, notifyUsers?: boolean | undefined, overrideEditableFlag?: boolean | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("overrideEditableFlag", overrideEditableFlag) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -12975,19 +12491,15 @@ export class Client { * @return Returned if the request is successful. */ getEditIssueMeta(issueIdOrKey: string, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta") + .path("issueIdOrKey", issueIdOrKey) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -13044,11 +12556,11 @@ export class Client { * @return Returned if the email is queued for sending. */ notify(issueIdOrKey: string, body: Notification): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -13109,11 +12621,11 @@ export class Client { * @return Returned if the request is successful. */ getIssuePropertyKeys(issueIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties") + .path("issueIdOrKey", issueIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -13162,14 +12674,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueProperty(issueIdOrKey: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -13218,14 +12729,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueProperty(issueIdOrKey: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -13279,14 +12789,13 @@ export class Client { * @return Returned if the issue property is updated. */ setIssueProperty(issueIdOrKey: string, propertyKey: string, body: any): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -13360,15 +12869,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkByGlobalId(issueIdOrKey: string, globalId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === undefined || globalId === null) - throw new globalThis.Error("The parameter 'globalId' must be defined and cannot be null."); - else - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -13425,15 +12932,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinks(issueIdOrKey: string, globalId?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === null) - throw new globalThis.Error("The parameter 'globalId' cannot be null."); - else if (globalId !== undefined) - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -13497,11 +13002,11 @@ export class Client { * @return Returned if the remote issue link is updated. */ createOrUpdateRemoteIssueLink(issueIdOrKey: string, body: RemoteIssueLinkRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -13573,14 +13078,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkById(issueIdOrKey: string, linkId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -13637,14 +13141,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinkById(issueIdOrKey: string, linkId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -13705,14 +13208,13 @@ export class Client { * @return Returned if the request is successful. */ updateRemoteIssueLink(issueIdOrKey: string, linkId: string, body: RemoteIssueLinkRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); const content_ = JSON.stringify(body); @@ -13782,31 +13284,21 @@ export class Client { * @return Returned if the request is successful. */ getTransitions(issueIdOrKey: string, expand?: string | undefined, transitionId?: string | undefined, skipRemoteOnlyCondition?: boolean | undefined, includeUnavailableTransitions?: boolean | undefined, sortByOpsBarAndStatus?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' cannot be null."); - else if (transitionId !== undefined) - url_ += "transitionId=" + encodeURIComponent("" + transitionId) + "&"; - if (skipRemoteOnlyCondition === null) - throw new globalThis.Error("The parameter 'skipRemoteOnlyCondition' cannot be null."); - else if (skipRemoteOnlyCondition !== undefined) - url_ += "skipRemoteOnlyCondition=" + encodeURIComponent("" + skipRemoteOnlyCondition) + "&"; - if (includeUnavailableTransitions === null) - throw new globalThis.Error("The parameter 'includeUnavailableTransitions' cannot be null."); - else if (includeUnavailableTransitions !== undefined) - url_ += "includeUnavailableTransitions=" + encodeURIComponent("" + includeUnavailableTransitions) + "&"; - if (sortByOpsBarAndStatus === null) - throw new globalThis.Error("The parameter 'sortByOpsBarAndStatus' cannot be null."); - else if (sortByOpsBarAndStatus !== undefined) - url_ += "sortByOpsBarAndStatus=" + encodeURIComponent("" + sortByOpsBarAndStatus) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(transitionId, 'transitionId'); + Guard.notNull(skipRemoteOnlyCondition, 'skipRemoteOnlyCondition'); + Guard.notNull(includeUnavailableTransitions, 'includeUnavailableTransitions'); + Guard.notNull(sortByOpsBarAndStatus, 'sortByOpsBarAndStatus'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .param("transitionId", transitionId) + .param("skipRemoteOnlyCondition", skipRemoteOnlyCondition) + .param("includeUnavailableTransitions", includeUnavailableTransitions) + .param("sortByOpsBarAndStatus", sortByOpsBarAndStatus) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -13858,11 +13350,11 @@ export class Client { * @return Returned if the request is successful. */ doTransition(issueIdOrKey: string, body: IssueUpdateDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -13935,11 +13427,11 @@ export class Client { * @return Returned if the request is successful. */ removeVote(issueIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -13987,11 +13479,11 @@ export class Client { * @return Returned if the request is successful. */ getVotes(issueIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -14043,11 +13535,11 @@ export class Client { * @return Returned if the request is successful. */ addVote(issueIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -14106,19 +13598,15 @@ export class Client { * @return Returned if the request is successful. */ removeWatcher(issueIdOrKey: string, username?: string | undefined, accountId?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .param("username", username) + .param("accountId", accountId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -14174,11 +13662,11 @@ export class Client { * @return Returned if the request is successful */ getIssueWatchers(issueIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -14231,11 +13719,11 @@ export class Client { * @return Returned if the request is successful. */ addWatcher(issueIdOrKey: string, body: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -14306,19 +13794,15 @@ export class Client { * @return Returned if the bulk deletion request was partially successful, with a message indicating partial success. */ bulkDeleteWorklogs(issueIdOrKey: string, body: WorklogIdsRequestBean, adjustEstimate?: AdjustEstimate | undefined, overrideEditableFlag?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -14383,31 +13867,21 @@ export class Client { * @return Returned if the request is successful */ getIssueWorklog(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, startedAfter?: number | undefined, startedBefore?: number | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (startedAfter === null) - throw new globalThis.Error("The parameter 'startedAfter' cannot be null."); - else if (startedAfter !== undefined) - url_ += "startedAfter=" + encodeURIComponent("" + startedAfter) + "&"; - if (startedBefore === null) - throw new globalThis.Error("The parameter 'startedBefore' cannot be null."); - else if (startedBefore !== undefined) - url_ += "startedBefore=" + encodeURIComponent("" + startedBefore) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(startedAfter, 'startedAfter'); + Guard.notNull(startedBefore, 'startedBefore'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("startedAfter", startedAfter) + .param("startedBefore", startedBefore) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -14470,35 +13944,23 @@ export class Client { * @return Returned if the request is successful. */ addWorklog(issueIdOrKey: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate2 | undefined, newEstimate?: string | undefined, reduceBy?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (reduceBy === null) - throw new globalThis.Error("The parameter 'reduceBy' cannot be null."); - else if (reduceBy !== undefined) - url_ += "reduceBy=" + encodeURIComponent("" + reduceBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(reduceBy, 'reduceBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("reduceBy", reduceBy) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -14567,19 +14029,15 @@ export class Client { * @return Returned if the request is partially successful. */ bulkMoveWorklogs(issueIdOrKey: string, body: WorklogsMoveRequestBean, adjustEstimate?: AdjustEstimate3 | undefined, overrideEditableFlag?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -14650,34 +14108,23 @@ export class Client { * @return Returned if the request is successful. */ deleteWorklog(issueIdOrKey: string, id: string, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate4 | undefined, newEstimate?: string | undefined, increaseBy?: string | undefined, overrideEditableFlag?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (increaseBy === null) - throw new globalThis.Error("The parameter 'increaseBy' cannot be null."); - else if (increaseBy !== undefined) - url_ += "increaseBy=" + encodeURIComponent("" + increaseBy) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(increaseBy, 'increaseBy'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("increaseBy", increaseBy) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -14733,18 +14180,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklog(issueIdOrKey: string, id: string, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -14806,34 +14250,23 @@ export class Client { * @return Returned if the request is successful */ updateWorklog(issueIdOrKey: string, id: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate5 | undefined, newEstimate?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -14894,14 +14327,13 @@ export class Client { * @return Returned if the request is successful. */ getWorklogPropertyKeys(issueIdOrKey: string, worklogId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -14959,17 +14391,15 @@ export class Client { * @return Returned if the worklog property is removed. */ deleteWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -15027,17 +14457,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -15096,17 +14524,15 @@ export class Client { * @return Returned if the worklog property is updated. */ setWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string, body: any): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -15179,8 +14605,8 @@ export class Client { * @return Returned if the request is successful. */ linkIssues(body: LinkIssueRequestJsonBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issueLink"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink") + .toString(); const content_ = JSON.stringify(body); @@ -15245,11 +14671,11 @@ export class Client { * @return 200 response */ deleteIssueLink(linkId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -15305,11 +14731,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLink(linkId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -15364,8 +14790,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkTypes(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -15416,8 +14842,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueLinkType(body: IssueLinkType): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); const content_ = JSON.stringify(body); @@ -15477,11 +14903,11 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueLinkType(issueLinkTypeId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -15533,11 +14959,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkType(issueLinkTypeId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -15593,11 +15019,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueLinkType(issueLinkTypeId: string, body: IssueLinkType): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); const content_ = JSON.stringify(body); @@ -15657,8 +15083,8 @@ export class Client { * @return Returns the details of your export task. You can use the [get task](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/#api-rest-api-3-task-taskid-get) API to view the progress of your request. */ exportArchivedIssues(body: ArchivedIssuesFilterRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issues/archive/export"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issues/archive/export") + .toString(); const content_ = JSON.stringify(body); @@ -15721,8 +15147,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecuritySchemes(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -15773,8 +15199,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueSecurityScheme(body: CreateIssueSecuritySchemeDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); const content_ = JSON.stringify(body); @@ -15847,28 +15273,19 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevels(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, onlyDefault?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .param("onlyDefault", onlyDefault) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -15932,8 +15349,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultLevels(body: SetDefaultLevelsRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default") + .toString(); const content_ = JSON.stringify(body); @@ -16021,32 +15438,21 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelMembers(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, levelId?: string[] | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (levelId === null) - throw new globalThis.Error("The parameter 'levelId' cannot be null."); - else if (levelId !== undefined) - levelId && levelId.forEach(item => { url_ += "levelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(levelId, 'levelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .paramArray("levelId", levelId) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -16105,24 +15511,17 @@ export class Client { * @return Returned if the request is successful. */ searchProjectsUsingSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, issueSecuritySchemeId?: string[] | undefined, projectId?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' cannot be null."); - else if (issueSecuritySchemeId !== undefined) - issueSecuritySchemeId && issueSecuritySchemeId.forEach(item => { url_ += "issueSecuritySchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecuritySchemeId", issueSecuritySchemeId) + .paramArray("projectId", projectId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -16185,8 +15584,8 @@ export class Client { * Associate security scheme to project */ associateSchemesToProjects(body: AssociateSecuritySchemeWithProjectDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .toString(); const content_ = JSON.stringify(body); @@ -16271,24 +15670,17 @@ export class Client { * @return Returned if the request is successful. */ searchSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -16344,11 +15736,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityScheme(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -16400,11 +15792,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueSecurityScheme(id: string, body: UpdateIssueSecuritySchemeRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -16491,27 +15883,19 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevelMembers(issueSecuritySchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, issueSecurityLevelId?: string[] | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members?"; - if (issueSecuritySchemeId === undefined || issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' must be defined."); - url_ = url_.replace("{issueSecuritySchemeId}", encodeURIComponent("" + issueSecuritySchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecurityLevelId === null) - throw new globalThis.Error("The parameter 'issueSecurityLevelId' cannot be null."); - else if (issueSecurityLevelId !== undefined) - issueSecurityLevelId && issueSecurityLevelId.forEach(item => { url_ += "issueSecurityLevelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecurityLevelId, 'issueSecurityLevelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members") + .path("issueSecuritySchemeId", issueSecuritySchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecurityLevelId", issueSecurityLevelId) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -16571,11 +15955,11 @@ export class Client { * @return Returned if the request is successful. */ deleteSecurityScheme(schemeId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}") + .path("schemeId", schemeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -16648,11 +16032,11 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevel(schemeId: string, body: AddSecuritySchemeLevelsRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -16730,18 +16114,15 @@ export class Client { * @param replaceWith (optional) The ID of the issue security level that will replace the currently selected level. */ removeLevel(schemeId: string, levelId: string, replaceWith?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.notNull(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .param("replaceWith", replaceWith) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -16820,14 +16201,13 @@ export class Client { * @return Returned if the request is successful. */ updateSecurityLevel(schemeId: string, levelId: string, body: UpdateIssueSecurityLevelDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -16905,14 +16285,13 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevelMembers(schemeId: string, levelId: string, body: SecuritySchemeMembersRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -16991,17 +16370,15 @@ export class Client { * @return Returned if the request is successful. */ removeMemberFromSecurityLevel(schemeId: string, levelId: string, memberId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (memberId === undefined || memberId === null) - throw new globalThis.Error("The parameter 'memberId' must be defined."); - url_ = url_.replace("{memberId}", encodeURIComponent("" + memberId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.required(memberId, 'memberId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .path("memberId", memberId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -17073,8 +16450,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueAllTypes(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -17124,8 +16501,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueType(body: IssueTypeCreateBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); const content_ = JSON.stringify(body); @@ -17194,16 +16571,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypesForProject(projectId: number, level?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (level === null) - throw new globalThis.Error("The parameter 'level' cannot be null."); - else if (level !== undefined) - url_ += "level=" + encodeURIComponent("" + level) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(level, 'level'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/project") + .param("projectId", projectId) + .param("level", level) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -17263,15 +16637,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueType(id: string, alternativeIssueTypeId?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (alternativeIssueTypeId === null) - throw new globalThis.Error("The parameter 'alternativeIssueTypeId' cannot be null."); - else if (alternativeIssueTypeId !== undefined) - url_ += "alternativeIssueTypeId=" + encodeURIComponent("" + alternativeIssueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(alternativeIssueTypeId, 'alternativeIssueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .param("alternativeIssueTypeId", alternativeIssueTypeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -17335,11 +16707,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueType(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -17391,11 +16763,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueType(id: string, body: IssueTypeUpdateBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -17463,11 +16835,11 @@ export class Client { * @return Returned if the request is successful. */ getAlternativeIssueTypes(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -17525,23 +16897,17 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeAvatar(id: string, size: number, body: any, x?: number | undefined, y?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2") + .path("id", id) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -17605,11 +16971,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypePropertyKeys(issueTypeId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties") + .path("issueTypeId", issueTypeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -17662,14 +17028,13 @@ export class Client { * @return Returned if the issue type property is deleted. */ deleteIssueTypeProperty(issueTypeId: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -17726,14 +17091,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeProperty(issueTypeId: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -17791,14 +17155,13 @@ export class Client { * @return Returned if the issue type property is updated. */ setIssueTypeProperty(issueTypeId: string, propertyKey: string, body: any): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -17882,32 +17245,21 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueTypeSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy7 | undefined, expand?: string | undefined, queryString?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("expand", expand) + .param("queryString", queryString) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -17962,8 +17314,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScheme(body: IssueTypeSchemeDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .toString(); const content_ = JSON.stringify(body); @@ -18029,20 +17381,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemesMapping(startAt?: number | undefined, maxResults?: number | undefined, issueTypeSchemeId?: number[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' cannot be null."); - else if (issueTypeSchemeId !== undefined) - issueTypeSchemeId && issueTypeSchemeId.forEach(item => { url_ += "issueTypeSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeSchemeId", issueTypeSchemeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -18100,20 +17447,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemeForProjects(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -18168,8 +17510,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeSchemeToProject(body: IssueTypeSchemeProjectAssociation): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -18234,11 +17576,11 @@ export class Client { * @return Returned if the issue type scheme is deleted. */ deleteIssueTypeScheme(issueTypeSchemeId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -18299,11 +17641,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeSchemeUpdateDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -18368,11 +17710,11 @@ export class Client { * @return Returned if the request is successful. */ addIssueTypesToIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeIds): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -18437,11 +17779,11 @@ export class Client { * @return Returned if the request is successful. */ reorderIssueTypesInIssueTypeScheme(issueTypeSchemeId: number, body: OrderOfIssueTypes): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -18507,14 +17849,13 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypeFromIssueTypeScheme(issueTypeSchemeId: number, issueTypeId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .path("issueTypeId", issueTypeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -18583,32 +17924,21 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, orderBy?: OrderBy8 | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -18664,8 +17994,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScreenScheme(body: IssueTypeScreenSchemeDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -18735,20 +18065,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, issueTypeScreenSchemeId?: number[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' cannot be null."); - else if (issueTypeScreenSchemeId !== undefined) - issueTypeScreenSchemeId && issueTypeScreenSchemeId.forEach(item => { url_ += "issueTypeScreenSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -18806,20 +18131,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeProjectAssociations(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -18874,8 +18194,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeScreenSchemeToProject(body: IssueTypeScreenSchemeProjectAssociation): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -18940,11 +18260,11 @@ export class Client { * @return Returned if the issue type screen scheme is deleted. */ deleteIssueTypeScreenScheme(issueTypeScreenSchemeId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -19006,11 +18326,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeUpdateDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -19075,11 +18395,11 @@ export class Client { * @return Returned if the request is successful. */ appendMappingsForIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeMappingDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -19148,11 +18468,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultScreenScheme(issueTypeScreenSchemeId: string, body: UpdateDefaultScreenScheme): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -19217,11 +18537,11 @@ export class Client { * @return Returned if the screen scheme mappings are removed from the issue type screen scheme. */ removeMappingsFromIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeIds): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -19289,23 +18609,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectsForIssueTypeScreenScheme(issueTypeScreenSchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, query?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project?"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -19360,8 +18674,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoComplete(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -19408,8 +18722,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoCompletePost(body: SearchAutoCompleteFilter): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); const content_ = JSON.stringify(body); @@ -19468,24 +18782,17 @@ export class Client { * @return Returned if the request is successful. */ getFieldAutoCompleteForQueryString(fieldName?: string | undefined, fieldValue?: string | undefined, predicateName?: string | undefined, predicateValue?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions?"; - if (fieldName === null) - throw new globalThis.Error("The parameter 'fieldName' cannot be null."); - else if (fieldName !== undefined) - url_ += "fieldName=" + encodeURIComponent("" + fieldName) + "&"; - if (fieldValue === null) - throw new globalThis.Error("The parameter 'fieldValue' cannot be null."); - else if (fieldValue !== undefined) - url_ += "fieldValue=" + encodeURIComponent("" + fieldValue) + "&"; - if (predicateName === null) - throw new globalThis.Error("The parameter 'predicateName' cannot be null."); - else if (predicateName !== undefined) - url_ += "predicateName=" + encodeURIComponent("" + predicateName) + "&"; - if (predicateValue === null) - throw new globalThis.Error("The parameter 'predicateValue' cannot be null."); - else if (predicateValue !== undefined) - url_ += "predicateValue=" + encodeURIComponent("" + predicateValue) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(fieldName, 'fieldName'); + Guard.notNull(fieldValue, 'fieldValue'); + Guard.notNull(predicateName, 'predicateName'); + Guard.notNull(predicateValue, 'predicateValue'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions") + .param("fieldName", fieldName) + .param("fieldValue", fieldValue) + .param("predicateName", predicateName) + .param("predicateValue", predicateValue) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -19548,24 +18855,17 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputations(functionKey?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (functionKey === null) - throw new globalThis.Error("The parameter 'functionKey' cannot be null."); - else if (functionKey !== undefined) - functionKey && functionKey.forEach(item => { url_ += "functionKey=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(functionKey, 'functionKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .paramArray("functionKey", functionKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -19625,12 +18925,11 @@ export class Client { * @return 200 response */ updatePrecomputations(body: JqlFunctionPrecomputationUpdateRequestBean, skipNotFoundPrecomputations?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (skipNotFoundPrecomputations === null) - throw new globalThis.Error("The parameter 'skipNotFoundPrecomputations' cannot be null."); - else if (skipNotFoundPrecomputations !== undefined) - url_ += "skipNotFoundPrecomputations=" + encodeURIComponent("" + skipNotFoundPrecomputations) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(skipNotFoundPrecomputations, 'skipNotFoundPrecomputations'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .param("skipNotFoundPrecomputations", skipNotFoundPrecomputations) + .toString(); const content_ = JSON.stringify(body); @@ -19712,12 +19011,11 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputationsByID(body: JqlFunctionPrecomputationGetByIdRequest, orderBy?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation/search?"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation/search") + .param("orderBy", orderBy) + .toString(); const content_ = JSON.stringify(body); @@ -19780,8 +19078,8 @@ export class Client { * @return Returned if the request is successful. */ matchIssues(body: IssuesAndJQLQueries): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/jql/match"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/match") + .toString(); const content_ = JSON.stringify(body); @@ -19837,12 +19135,11 @@ export class Client { * @return Returned if the request is successful. */ parseJqlQueries(validation: Validation, body: JqlQueriesToParse): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/jql/parse?"; - if (validation === undefined || validation === null) - throw new globalThis.Error("The parameter 'validation' must be defined and cannot be null."); - else - url_ += "validation=" + encodeURIComponent("" + validation) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(validation, 'validation'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/parse") + .param("validation", validation) + .toString(); const content_ = JSON.stringify(body); @@ -19900,8 +19197,8 @@ export class Client { * @return Returned if the request is successful. Note that the JQL queries are returned in the same order that they were passed. */ migrateQueries(body: JQLPersonalDataMigrationRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/jql/pdcleaner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/pdcleaner") + .toString(); const content_ = JSON.stringify(body); @@ -19964,8 +19261,8 @@ export class Client { * @return Returned if the request is successful. */ sanitiseJqlQueries(body: JqlQueriesToSanitize): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/jql/sanitize"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/sanitize") + .toString(); const content_ = JSON.stringify(body); @@ -20035,16 +19332,13 @@ export class Client { * @return Returned if the request is successful. */ getAllLabels(startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/label?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/label") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -20087,8 +19381,8 @@ export class Client { * @return Returned if the request is successful. */ getApproximateLicenseCount(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -20146,11 +19440,11 @@ export class Client { * @return Returned if the request is successful. */ getApproximateApplicationLicenseCount(applicationKey: ApplicationKey): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}"; - if (applicationKey === undefined || applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' must be defined."); - url_ = url_.replace("{applicationKey}", encodeURIComponent("" + applicationKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}") + .path("applicationKey", applicationKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -20215,40 +19509,25 @@ export class Client { * @return Returned if the request is successful. */ getMyPermissions(projectKey?: string | undefined, projectId?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, permissions?: string | undefined, projectUuid?: string | undefined, projectConfigurationUuid?: string | undefined, commentId?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/mypermissions?"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (permissions === null) - throw new globalThis.Error("The parameter 'permissions' cannot be null."); - else if (permissions !== undefined) - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (projectUuid === null) - throw new globalThis.Error("The parameter 'projectUuid' cannot be null."); - else if (projectUuid !== undefined) - url_ += "projectUuid=" + encodeURIComponent("" + projectUuid) + "&"; - if (projectConfigurationUuid === null) - throw new globalThis.Error("The parameter 'projectConfigurationUuid' cannot be null."); - else if (projectConfigurationUuid !== undefined) - url_ += "projectConfigurationUuid=" + encodeURIComponent("" + projectConfigurationUuid) + "&"; - if (commentId === null) - throw new globalThis.Error("The parameter 'commentId' cannot be null."); - else if (commentId !== undefined) - url_ += "commentId=" + encodeURIComponent("" + commentId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(permissions, 'permissions'); + Guard.notNull(projectUuid, 'projectUuid'); + Guard.notNull(projectConfigurationUuid, 'projectConfigurationUuid'); + Guard.notNull(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypermissions") + .param("projectKey", projectKey) + .param("projectId", projectId) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("permissions", permissions) + .param("projectUuid", projectUuid) + .param("projectConfigurationUuid", projectConfigurationUuid) + .param("commentId", commentId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -20313,12 +19592,11 @@ export class Client { * @return Returned if the request is successful. */ removePreference(key: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -20366,12 +19644,11 @@ export class Client { * @return Returned if the request is successful. */ getPreference(key: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -20425,12 +19702,11 @@ export class Client { * @return Returned if the request is successful. */ setPreference(key: string, body: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); const content_ = JSON.stringify(body); @@ -20487,8 +19763,8 @@ export class Client { * @deprecated */ deleteLocale(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -20536,8 +19812,8 @@ export class Client { * @return Returned if the request is successful. */ getLocale(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -20586,8 +19862,8 @@ export class Client { * @deprecated */ setLocale(body: Locale): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); const content_ = JSON.stringify(body); @@ -20647,12 +19923,11 @@ export class Client { * @return Returned if the request is successful. */ getCurrentUser(expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/myself?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/myself") + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -20712,32 +19987,21 @@ export class Client { * @return Returned if the request is successful. Only returns notification schemes that the user has permission to access. An empty list is returned if the user lacks permission to access all notification schemes. */ getNotificationSchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -20788,8 +20052,8 @@ export class Client { * @return Returned if the request is successful. */ createNotificationScheme(body: CreateNotificationSchemeDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -20861,24 +20125,17 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeToProjectMappings(startAt?: string | undefined, maxResults?: string | undefined, notificationSchemeId?: string[] | undefined, projectId?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' cannot be null."); - else if (notificationSchemeId !== undefined) - notificationSchemeId && notificationSchemeId.forEach(item => { url_ += "notificationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(notificationSchemeId, 'notificationSchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("notificationSchemeId", notificationSchemeId) + .paramArray("projectId", projectId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -20944,15 +20201,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationScheme(id: number, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -21008,11 +20263,11 @@ export class Client { * @return Returned if the request is successful. */ updateNotificationScheme(id: string, body: UpdateNotificationSchemeDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -21089,11 +20344,11 @@ export class Client { * @return Returned if the request is successful. */ addNotifications(id: string, body: AddNotificationsDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -21170,11 +20425,11 @@ export class Client { * @return Returned if the request is successful. */ deleteNotificationScheme(notificationSchemeId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}") + .path("notificationSchemeId", notificationSchemeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -21248,14 +20503,13 @@ export class Client { * @return Returned if the request is successful. */ removeNotificationFromNotificationScheme(notificationSchemeId: string, notificationId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - if (notificationId === undefined || notificationId === null) - throw new globalThis.Error("The parameter 'notificationId' must be defined."); - url_ = url_.replace("{notificationId}", encodeURIComponent("" + notificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + Guard.required(notificationId, 'notificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}") + .path("notificationSchemeId", notificationSchemeId) + .path("notificationId", notificationId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -21327,8 +20581,8 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissions(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissions"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -21380,8 +20634,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkPermissions(body: BulkPermissionsRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissions/check"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/check") + .toString(); const content_ = JSON.stringify(body); @@ -21442,8 +20696,8 @@ export class Client { * @return Returned if the request is successful. */ getPermittedProjects(body: PermissionsKeysBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissions/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/project") + .toString(); const content_ = JSON.stringify(body); @@ -21506,12 +20760,11 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissionSchemes(expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -21567,12 +20820,11 @@ export class Client { * @return Returned if the permission scheme is created. */ createPermissionScheme(body: PermissionScheme, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -21632,11 +20884,11 @@ export class Client { * @return Returned if the permission scheme is deleted. */ deletePermissionScheme(schemeId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -21696,15 +20948,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionScheme(schemeId: number, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -21764,15 +21014,13 @@ export class Client { * @return Returned if the scheme is updated. */ updatePermissionScheme(schemeId: number, body: PermissionScheme, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -21840,15 +21088,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrants(schemeId: number, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -21909,15 +21155,13 @@ export class Client { * @return Returned if the scheme permission is created. */ createPermissionGrant(schemeId: number, body: PermissionGrant, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -21978,14 +21222,13 @@ export class Client { * @return Returned if the permission grant is deleted. */ deletePermissionSchemeEntity(schemeId: number, permissionId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -22046,18 +21289,15 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrant(schemeId: number, permissionId: number, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -22112,24 +21352,17 @@ export class Client { * @return Returned if the request is successful. */ getPlans(includeTrashed?: boolean | undefined, includeArchived?: boolean | undefined, cursor?: string | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (includeTrashed === null) - throw new globalThis.Error("The parameter 'includeTrashed' cannot be null."); - else if (includeTrashed !== undefined) - url_ += "includeTrashed=" + encodeURIComponent("" + includeTrashed) + "&"; - if (includeArchived === null) - throw new globalThis.Error("The parameter 'includeArchived' cannot be null."); - else if (includeArchived !== undefined) - url_ += "includeArchived=" + encodeURIComponent("" + includeArchived) + "&"; - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(includeTrashed, 'includeTrashed'); + Guard.notNull(includeArchived, 'includeArchived'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("includeTrashed", includeTrashed) + .param("includeArchived", includeArchived) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -22187,12 +21420,11 @@ export class Client { * @return Returned if the request is successful. */ createPlan(body: CreatePlanRequest, useGroupId?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -22263,15 +21495,13 @@ export class Client { * @return Returned if the request is successful. */ getPlan(planId: number, useGroupId?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -22337,15 +21567,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlan(planId: number, body: any, useGroupId?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -22429,11 +21657,11 @@ export class Client { * @return Returned if the request is successful. */ archivePlan(planId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive") + .path("planId", planId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -22506,11 +21734,11 @@ export class Client { * @return Returned if the request is successful. */ duplicatePlan(planId: number, body: DuplicatePlanRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -22596,19 +21824,15 @@ export class Client { * @return Returned if the request is successful. */ getTeams(planId: number, cursor?: string | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team") + .path("planId", planId) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -22673,11 +21897,11 @@ export class Client { * @return Returned if the request is successful. */ addAtlassianTeam(planId: number, body: AddAtlassianTeamRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -22762,14 +21986,13 @@ export class Client { * @return Returned if the request is successful. */ removeAtlassianTeam(planId: number, atlassianTeamId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -22843,14 +22066,13 @@ export class Client { * @return Returned if the request is successful. */ getAtlassianTeam(planId: number, atlassianTeamId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -22923,14 +22145,13 @@ export class Client { * @return Returned if the request is successful. */ updateAtlassianTeam(planId: number, atlassianTeamId: string, body: any): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -23014,11 +22235,11 @@ export class Client { * @return Returned if the request is successful. */ createPlanOnlyTeam(planId: number, body: CreatePlanOnlyTeamRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -23103,14 +22324,13 @@ export class Client { * @return Returned if the request is successful. */ deletePlanOnlyTeam(planId: number, planOnlyTeamId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -23184,14 +22404,13 @@ export class Client { * @return Returned if the request is successful. */ getPlanOnlyTeam(planId: number, planOnlyTeamId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -23264,14 +22483,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlanOnlyTeam(planId: number, planOnlyTeamId: number, body: any): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -23355,11 +22573,11 @@ export class Client { * @return Returned if the request is successful. */ trashPlan(planId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash") + .path("planId", planId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -23432,8 +22650,8 @@ export class Client { * @deprecated */ getPriorities(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -23488,8 +22706,8 @@ export class Client { * @deprecated */ createPriority(body: CreatePriorityDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); const content_ = JSON.stringify(body); @@ -23557,8 +22775,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultPriority(body: SetDefaultPriorityRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priority/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/default") + .toString(); const content_ = JSON.stringify(body); @@ -23634,8 +22852,8 @@ export class Client { * @return Returned if the request is successful. */ movePriorities(body: ReorderIssuePriorities): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priority/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/move") + .toString(); const content_ = JSON.stringify(body); @@ -23719,36 +22937,23 @@ export class Client { * @deprecated */ searchPriorities(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, priorityName?: string | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priority/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (priorityName === null) - throw new globalThis.Error("The parameter 'priorityName' cannot be null."); - else if (priorityName !== undefined) - url_ += "priorityName=" + encodeURIComponent("" + priorityName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(priorityName, 'priorityName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("priorityName", priorityName) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -23798,11 +23003,11 @@ export class Client { * @param id The ID of the issue priority. */ deletePriority(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -23880,11 +23085,11 @@ export class Client { * @return Returned if the request is successful. */ getPriority(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -23937,11 +23142,11 @@ export class Client { * @deprecated */ updatePriority(id: string, body: UpdatePriorityDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -24025,40 +23230,25 @@ export class Client { * @return Returned if the request is successful. */ getPrioritySchemes(startAt?: string | undefined, maxResults?: string | undefined, priorityId?: number[] | undefined, schemeId?: number[] | undefined, schemeName?: string | undefined, onlyDefault?: boolean | undefined, orderBy?: OrderBy9 | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (priorityId === null) - throw new globalThis.Error("The parameter 'priorityId' cannot be null."); - else if (priorityId !== undefined) - priorityId && priorityId.forEach(item => { url_ += "priorityId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeName === null) - throw new globalThis.Error("The parameter 'schemeName' cannot be null."); - else if (schemeName !== undefined) - url_ += "schemeName=" + encodeURIComponent("" + schemeName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(priorityId, 'priorityId'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(schemeName, 'schemeName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("priorityId", priorityId) + .paramArray("schemeId", schemeId) + .param("schemeName", schemeName) + .param("onlyDefault", onlyDefault) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -24109,8 +23299,8 @@ export class Client { * @return Returned if the request is completed. */ createPriorityScheme(body: CreatePrioritySchemeDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .toString(); const content_ = JSON.stringify(body); @@ -24180,8 +23370,8 @@ export class Client { * @return Returned if the request is successful. */ suggestedPrioritiesForMappings(body: SuggestedMappingsRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -24241,28 +23431,19 @@ export class Client { * @return Returned if the request is successful. */ getAvailablePrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, query?: string | undefined, exclude?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/priorities/available?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined and cannot be null."); - else - url_ += "schemeId=" + encodeURIComponent("" + schemeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/priorities/available") + .param("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .paramArray("exclude", exclude) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -24314,11 +23495,11 @@ export class Client { * @return Returned if the request is successful. */ deletePriorityScheme(schemeId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -24375,11 +23556,11 @@ export class Client { * @return Returned if the request is accepted. */ updatePriorityScheme(schemeId: number, body: UpdatePrioritySchemeRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -24445,19 +23626,15 @@ export class Client { * @return Returned if the request is successful. */ getPrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -24513,27 +23690,19 @@ export class Client { * @return Returned if the request is successful. */ getProjectsByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, projectId?: number[] | undefined, query?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("projectId", projectId) + .param("query", query) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -24593,20 +23762,15 @@ export class Client { * @deprecated */ getAllProjects(expand?: string | undefined, recent?: number | undefined, properties?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (recent === null) - throw new globalThis.Error("The parameter 'recent' cannot be null."); - else if (recent !== undefined) - url_ += "recent=" + encodeURIComponent("" + recent) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(recent, 'recent'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .param("expand", expand) + .param("recent", recent) + .paramArray("properties", properties) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -24661,8 +23825,8 @@ export class Client { * @return Returned if the project is created. */ createProject(body: CreateProjectDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .toString(); const content_ = JSON.stringify(body); @@ -24721,8 +23885,8 @@ export class Client { * @param body The JSON payload containing the project details and capabilities */ createProjectWithCustomTemplate(body: ProjectCustomTemplateCreateRequestDTO): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project-template"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project-template") + .toString(); const content_ = JSON.stringify(body); @@ -24780,21 +23944,13 @@ export class Client { * @return Returned if the request is successful. */ getRecent(expand?: string | undefined, properties?: StringList[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/recent?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/recent") + .param("expand", expand) + .paramArray("properties", properties) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -24897,65 +24053,35 @@ export class Client { * @return Returned if the request is successful. */ searchProjects(startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy10 | undefined, id?: number[] | undefined, keys?: string[] | undefined, query?: string | undefined, typeKey?: string | undefined, categoryId?: number | undefined, action?: Action | undefined, expand?: string | undefined, status?: Status4[] | undefined, properties?: StringList[] | undefined, propertyQuery?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (typeKey === null) - throw new globalThis.Error("The parameter 'typeKey' cannot be null."); - else if (typeKey !== undefined) - url_ += "typeKey=" + encodeURIComponent("" + typeKey) + "&"; - if (categoryId === null) - throw new globalThis.Error("The parameter 'categoryId' cannot be null."); - else if (categoryId !== undefined) - url_ += "categoryId=" + encodeURIComponent("" + categoryId) + "&"; - if (action === null) - throw new globalThis.Error("The parameter 'action' cannot be null."); - else if (action !== undefined) - url_ += "action=" + encodeURIComponent("" + action) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - if (propertyQuery === null) - throw new globalThis.Error("The parameter 'propertyQuery' cannot be null."); - else if (propertyQuery !== undefined) - url_ += "propertyQuery=" + encodeURIComponent("" + propertyQuery) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(id, 'id'); + Guard.notNull(keys, 'keys'); + Guard.notNull(query, 'query'); + Guard.notNull(typeKey, 'typeKey'); + Guard.notNull(categoryId, 'categoryId'); + Guard.notNull(action, 'action'); + Guard.notNull(expand, 'expand'); + Guard.notNull(status, 'status'); + Guard.notNull(properties, 'properties'); + Guard.notNull(propertyQuery, 'propertyQuery'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .paramArray("id", id) + .paramArray("keys", keys) + .param("query", query) + .param("typeKey", typeKey) + .param("categoryId", categoryId) + .param("action", action) + .param("expand", expand) + .paramArray("status", status) + .paramArray("properties", properties) + .param("propertyQuery", propertyQuery) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25010,8 +24136,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectTypes(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/type"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25065,8 +24191,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAccessibleProjectTypes(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/type/accessible"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/accessible") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25117,11 +24243,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectTypeByKey(projectTypeKey: ProjectTypeKey): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}") + .path("projectTypeKey", projectTypeKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25173,11 +24299,11 @@ export class Client { * @return Returned if the request is successful. */ getAccessibleProjectTypeByKey(projectTypeKey: ProjectTypeKey2): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible") + .path("projectTypeKey", projectTypeKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25230,15 +24356,13 @@ export class Client { * @return Returned if the project is deleted. */ deleteProject(projectIdOrKey: string, enableUndo?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (enableUndo === null) - throw new globalThis.Error("The parameter 'enableUndo' cannot be null."); - else if (enableUndo !== undefined) - url_ += "enableUndo=" + encodeURIComponent("" + enableUndo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(enableUndo, 'enableUndo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("enableUndo", enableUndo) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25294,19 +24418,15 @@ export class Client { * @return Returned if successful. */ getProject(projectIdOrKey: string, expand?: string | undefined, properties?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .paramArray("properties", properties) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25365,15 +24485,13 @@ export class Client { * @return Returned if the project is updated. */ updateProject(projectIdOrKey: string, body: UpdateProjectDetails, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -25437,11 +24555,11 @@ export class Client { * @return Returned if the request is successful. */ archiveProject(projectIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive") + .path("projectIdOrKey", projectIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25502,11 +24620,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectAvatar(projectIdOrKey: string, body: Avatar): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -25568,14 +24686,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectAvatar(projectIdOrKey: string, id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25630,23 +24747,17 @@ export class Client { * @return Returned if the request is successful. */ createProjectAvatar(projectIdOrKey: string, body: any, x?: number | undefined, y?: number | undefined, size?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + Guard.notNull(size, 'size'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2") + .path("projectIdOrKey", projectIdOrKey) + .param("x", x) + .param("y", y) + .param("size", size) + .toString(); const content_ = JSON.stringify(body); @@ -25710,11 +24821,11 @@ export class Client { * @return Returned if request is successful. */ getAllProjectAvatars(projectIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars") + .path("projectIdOrKey", projectIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25766,11 +24877,11 @@ export class Client { * @return Returned if the request is successful. */ removeDefaultProjectClassification(projectIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25827,11 +24938,11 @@ export class Client { * @return Returned if the request is successful. */ getDefaultProjectClassification(projectIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -25884,11 +24995,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultProjectClassification(projectIdOrKey: string, body: UpdateDefaultProjectClassificationBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -25959,31 +25070,21 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponentsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy11 | undefined, componentSource?: ComponentSource | undefined, query?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(componentSource, 'componentSource'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("componentSource", componentSource) + .param("query", query) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -26036,15 +25137,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponents(projectIdOrKey: string, componentSource?: ComponentSource2 | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(componentSource, 'componentSource'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components") + .path("projectIdOrKey", projectIdOrKey) + .param("componentSource", componentSource) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -26102,11 +25201,11 @@ export class Client { * @param projectIdOrKey The project ID or project key (case sensitive). */ deleteProjectAsynchronously(projectIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete") + .path("projectIdOrKey", projectIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -26161,11 +25260,11 @@ export class Client { * @return Returned if the request is successful. */ getFeaturesForProject(projectIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features") + .path("projectIdOrKey", projectIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -26227,14 +25326,13 @@ export class Client { * @return Returned if the request is successful. */ toggleFeatureForProject(projectIdOrKey: string, featureKey: string, body: ProjectFeatureState): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (featureKey === undefined || featureKey === null) - throw new globalThis.Error("The parameter 'featureKey' must be defined."); - url_ = url_.replace("{featureKey}", encodeURIComponent("" + featureKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(featureKey, 'featureKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("featureKey", featureKey) + .toString(); const content_ = JSON.stringify(body); @@ -26298,11 +25396,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectPropertyKeys(projectIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties") + .path("projectIdOrKey", projectIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -26363,14 +25461,13 @@ export class Client { * @return Returned if the project property is deleted. */ deleteProjectProperty(projectIdOrKey: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -26427,14 +25524,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectProperty(projectIdOrKey: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -26496,14 +25592,13 @@ export class Client { * @return Returned if the project property is updated. */ setProjectProperty(projectIdOrKey: string, propertyKey: string, body: any): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -26576,11 +25671,11 @@ export class Client { * @return Returned if the request is successful. */ restore(projectIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore") + .path("projectIdOrKey", projectIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -26636,11 +25731,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoles(projectIdOrKey: string): ng.IPromise<{ [key: string]: string; }> { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role") + .path("projectIdOrKey", projectIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -26705,26 +25800,19 @@ export class Client { * @return Returned if the request is successful. */ deleteActor(projectIdOrKey: string, id: number, user?: string | undefined, group?: string | undefined, groupId?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(group, 'group'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("user", user) + .param("group", group) + .param("groupId", groupId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -26774,18 +25862,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRole(projectIdOrKey: string, id: number, excludeInactiveUsers?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (excludeInactiveUsers === null) - throw new globalThis.Error("The parameter 'excludeInactiveUsers' cannot be null."); - else if (excludeInactiveUsers !== undefined) - url_ += "excludeInactiveUsers=" + encodeURIComponent("" + excludeInactiveUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(excludeInactiveUsers, 'excludeInactiveUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("excludeInactiveUsers", excludeInactiveUsers) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -26845,14 +25930,13 @@ export class Client { For example, the cURL request above adds a group, *jira-developers*. For the response below to be returned as a result of that request, the user *Mia Krystof* would have previously been added as a `user` actor for this project. */ addActorUsers(projectIdOrKey: string, id: number, body: ActorsMap): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26914,14 +25998,13 @@ export class Client { * @return Returned if the request is successful. The complete list of actors for the project is returned. */ setActors(projectIdOrKey: string, id: number, body: ProjectRoleActorsUpdateBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26983,19 +26066,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleDetails(projectIdOrKey: string, currentMember?: boolean | undefined, excludeConnectAddons?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (currentMember === null) - throw new globalThis.Error("The parameter 'currentMember' cannot be null."); - else if (currentMember !== undefined) - url_ += "currentMember=" + encodeURIComponent("" + currentMember) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(currentMember, 'currentMember'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails") + .path("projectIdOrKey", projectIdOrKey) + .param("currentMember", currentMember) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27054,11 +26133,11 @@ export class Client { * @return Returned if the request is successful. */ getAllStatuses(projectIdOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses") + .path("projectIdOrKey", projectIdOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27134,35 +26213,23 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersionsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy12 | undefined, query?: string | undefined, status?: string | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .param("status", status) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27211,15 +26278,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersions(projectIdOrKey: string, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27274,11 +26339,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectEmail(projectId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27335,11 +26400,11 @@ export class Client { * @return Returned if the project's sender email address is successfully set. */ updateProjectEmail(projectId: number, body: ProjectEmailAddress): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); const content_ = JSON.stringify(body); @@ -27404,11 +26469,11 @@ export class Client { * @return Returned if the request is successful. */ getHierarchy(projectId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy") + .path("projectId", projectId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27464,11 +26529,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueSecurityScheme(projectKeyOrId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme") + .path("projectKeyOrId", projectKeyOrId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27536,15 +26601,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeForProject(projectKeyOrId: string, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27608,15 +26671,13 @@ export class Client { * @return Returned if the request is successful. */ getAssignedPermissionScheme(projectKeyOrId: string, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27680,15 +26741,13 @@ export class Client { * @return Returned if the request is successful. */ assignPermissionScheme(projectKeyOrId: string, body: IdBean, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -27748,11 +26807,11 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelsForProject(projectKeyOrId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel") + .path("projectKeyOrId", projectKeyOrId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27799,8 +26858,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectCategories(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27854,8 +26913,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectCategory(body: ProjectCategory): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); const content_ = JSON.stringify(body); @@ -27919,11 +26978,11 @@ export class Client { * @return Returned if the request is successful. */ removeProjectCategory(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -27975,11 +27034,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectCategoryById(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -28030,11 +27089,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectCategory(id: number, body: ProjectCategory): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -28098,12 +27157,11 @@ export class Client { * @return Returned if the request is successful. */ validateProjectKey(key?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/key?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/key") + .param("key", key) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -28151,12 +27209,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectKey(key?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey") + .param("key", key) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -28205,12 +27262,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectName(name: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectName?"; - if (name === undefined || name === null) - throw new globalThis.Error("The parameter 'name' must be defined and cannot be null."); - else - url_ += "name=" + encodeURIComponent("" + name) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(name, 'name'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectName") + .param("name", name) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -28267,8 +27323,8 @@ export class Client { * @deprecated */ getResolutions(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -28322,8 +27378,8 @@ export class Client { * @return Returned if the request is successful. */ createResolution(body: CreateResolutionDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); const content_ = JSON.stringify(body); @@ -28391,8 +27447,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultResolution(body: SetDefaultResolutionRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/resolution/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/default") + .toString(); const content_ = JSON.stringify(body); @@ -28468,8 +27524,8 @@ export class Client { * @return Returned if the request is successful. */ moveResolutions(body: ReorderIssueResolutionsRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/resolution/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/move") + .toString(); const content_ = JSON.stringify(body); @@ -28549,24 +27605,17 @@ export class Client { * @return Returned if the request is successful. */ searchResolutions(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, onlyDefault?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/resolution/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("onlyDefault", onlyDefault) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -28617,15 +27666,13 @@ export class Client { * @param replaceWith The ID of the issue resolution that will replace the currently selected resolution. */ deleteResolution(id: string, replaceWith: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (replaceWith === undefined || replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' must be defined and cannot be null."); - else - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .param("replaceWith", replaceWith) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -28703,11 +27750,11 @@ export class Client { * @return Returned if the request is successful. */ getResolution(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -28759,11 +27806,11 @@ export class Client { * @return Returned if the request is successful. */ updateResolution(id: string, body: UpdateResolutionDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -28839,8 +27886,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectRoles(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -28898,8 +27945,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectRole(body: CreateUpdateRoleRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); const content_ = JSON.stringify(body); @@ -28964,15 +28011,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRole(id: number, swap?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (swap === null) - throw new globalThis.Error("The parameter 'swap' cannot be null."); - else if (swap !== undefined) - url_ += "swap=" + encodeURIComponent("" + swap) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(swap, 'swap'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .param("swap", swap) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -29032,11 +28077,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleById(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -29092,11 +28137,11 @@ export class Client { * @return Returned if the request is successful. */ partialUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -29160,11 +28205,11 @@ export class Client { * @return Returned if the request is successful. */ fullyUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -29231,23 +28276,17 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRoleActorsFromRole(id: number, user?: string | undefined, groupId?: string | undefined, group?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(group, 'group'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .param("user", user) + .param("groupId", groupId) + .param("group", group) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -29307,11 +28346,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleActorsForRole(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -29371,11 +28410,11 @@ export class Client { * @return Returned if the request is successful. */ addProjectRoleActorsToRole(id: number, body: ActorInputBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -29447,32 +28486,21 @@ export class Client { * @return Returned if the request is successful. */ getScreens(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, scope?: Scope2[] | undefined, orderBy?: OrderBy13 | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - scope && scope.forEach(item => { url_ += "scope=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(scope, 'scope'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .paramArray("scope", scope) + .param("orderBy", orderBy) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -29523,8 +28551,8 @@ export class Client { * @return Returned if the request is successful. */ createScreen(body: ScreenDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .toString(); const content_ = JSON.stringify(body); @@ -29584,11 +28612,11 @@ export class Client { * @return Returned if the request is successful. */ addFieldToDefaultScreen(fieldId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}") + .path("fieldId", fieldId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -29652,24 +28680,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkScreenTabs(screenId?: number[] | undefined, tabId?: number[] | undefined, startAt?: number | undefined, maxResult?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/tabs?"; - if (screenId === null) - throw new globalThis.Error("The parameter 'screenId' cannot be null."); - else if (screenId !== undefined) - screenId && screenId.forEach(item => { url_ += "screenId=" + encodeURIComponent("" + item) + "&"; }); - if (tabId === null) - throw new globalThis.Error("The parameter 'tabId' cannot be null."); - else if (tabId !== undefined) - tabId && tabId.forEach(item => { url_ += "tabId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(screenId, 'screenId'); + Guard.notNull(tabId, 'tabId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/tabs") + .paramArray("screenId", screenId) + .paramArray("tabId", tabId) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -29722,11 +28743,11 @@ export class Client { * @return Returned if the request is successful. */ deleteScreen(screenId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -29782,11 +28803,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreen(screenId: number, body: UpdateScreenDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -29850,11 +28871,11 @@ export class Client { * @return Returned if the request is successful. */ getAvailableScreenFields(screenId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields") + .path("screenId", screenId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -29918,15 +28939,13 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabs(screenId: number, projectKey?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .param("projectKey", projectKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -29993,11 +29012,11 @@ export class Client { * @return Returned if the request is successful. */ addScreenTab(screenId: number, body: ScreenableTab): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -30062,14 +29081,13 @@ export class Client { * @return Returned if the request is successful. */ deleteScreenTab(screenId: number, tabId: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -30122,14 +29140,13 @@ export class Client { * @return Returned if the request is successful. */ renameScreenTab(screenId: number, tabId: number, body: ScreenableTab): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -30195,18 +29212,15 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabFields(screenId: number, tabId: number, projectKey?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .param("projectKey", projectKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -30270,14 +29284,13 @@ export class Client { * @return Returned if the request is successful. */ addScreenTabField(screenId: number, tabId: number, body: AddFieldBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -30343,17 +29356,15 @@ export class Client { * @return Returned if the request is successful. */ removeScreenTabField(screenId: number, tabId: number, id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -30411,17 +29422,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTabField(screenId: number, tabId: number, id: string, body: MoveFieldBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -30488,17 +29497,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTab(screenId: number, tabId: number, pos: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (pos === undefined || pos === null) - throw new globalThis.Error("The parameter 'pos' must be defined."); - url_ = url_.replace("{pos}", encodeURIComponent("" + pos)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(pos, 'pos'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("pos", pos) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -30567,32 +29574,21 @@ export class Client { * @return Returned if the request is successful. */ getScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy14 | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -30643,8 +29639,8 @@ export class Client { * @return Returned if the request is successful. */ createScreenScheme(body: ScreenSchemeDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -30708,11 +29704,11 @@ export class Client { * @return Returned if the screen scheme is deleted. */ deleteScreenScheme(screenSchemeId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -30769,11 +29765,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreenScheme(screenSchemeId: string, body: UpdateScreenSchemeDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -30882,44 +29878,27 @@ export class Client { * @deprecated */ searchForIssuesUsingJql(jql?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, validateQuery?: ValidateQuery | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/search?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (validateQuery === null) - throw new globalThis.Error("The parameter 'validateQuery' cannot be null."); - else if (validateQuery !== undefined) - url_ += "validateQuery=" + encodeURIComponent("" + validateQuery) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(validateQuery, 'validateQuery'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .param("jql", jql) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("validateQuery", validateQuery) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -30972,8 +29951,8 @@ export class Client { * @deprecated */ searchForIssuesUsingJqlPost(body: SearchRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .toString(); const content_ = JSON.stringify(body); @@ -31029,8 +30008,8 @@ export class Client { * @return Returned if the request is successful. */ countIssues(body: JQLCountRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/search/approximate-count"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/approximate-count") + .toString(); const content_ = JSON.stringify(body); @@ -31087,8 +30066,8 @@ export class Client { * @deprecated */ searchForIssuesIds(body: IdSearchRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/search/id"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/id") + .toString(); const content_ = JSON.stringify(body); @@ -31187,44 +30166,27 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJql(jql?: string | undefined, nextPageToken?: string | undefined, maxResults?: number | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined, reconcileIssues?: number[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/search/jql?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - if (reconcileIssues === null) - throw new globalThis.Error("The parameter 'reconcileIssues' cannot be null."); - else if (reconcileIssues !== undefined) - reconcileIssues && reconcileIssues.forEach(item => { url_ += "reconcileIssues=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + Guard.notNull(reconcileIssues, 'reconcileIssues'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .param("jql", jql) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .paramArray("reconcileIssues", reconcileIssues) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -31275,8 +30237,8 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJqlPost(body: SearchAndReconcileRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/search/jql"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .toString(); const content_ = JSON.stringify(body); @@ -31332,11 +30294,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevel(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/securitylevel/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/securitylevel/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -31387,8 +30349,8 @@ export class Client { * @return Returned if the request is successful. */ getServerInfo(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/serverInfo"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/serverInfo") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -31435,8 +30397,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueNavigatorDefaultColumns(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -31502,14 +30464,12 @@ export class Client { * @return Returned if the request is successful. */ setIssueNavigatorDefaultColumns(body: ColumnRequestBody, columns?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); var options_: ng.IRequestConfig = { url: url_, @@ -31566,8 +30526,8 @@ export class Client { * @return Returned if the request is successful. */ getStatuses(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/status"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -31622,11 +30582,11 @@ export class Client { * @return Returned if the request is successful. */ getStatus(idOrName: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/status/{idOrName}"; - if (idOrName === undefined || idOrName === null) - throw new globalThis.Error("The parameter 'idOrName' must be defined."); - url_ = url_.replace("{idOrName}", encodeURIComponent("" + idOrName)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrName, 'idOrName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status/{idOrName}") + .path("idOrName", idOrName) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -31677,8 +30637,8 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategories(): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/statuscategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -31733,11 +30693,11 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategory(idOrKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}"; - if (idOrKey === undefined || idOrKey === null) - throw new globalThis.Error("The parameter 'idOrKey' must be defined."); - url_ = url_.replace("{idOrKey}", encodeURIComponent("" + idOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrKey, 'idOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}") + .path("idOrKey", idOrKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -31791,12 +30751,11 @@ export class Client { * @return Returned if the request is successful. */ deleteStatusesById(id: string[]): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -31857,16 +30816,13 @@ export class Client { * @return Returned if the request is successful. */ getStatusesById(id: string[], expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -31925,8 +30881,8 @@ export class Client { * @return Returned if the request is successful. */ createStatuses(body: StatusCreateRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -31993,8 +30949,8 @@ export class Client { * @return Returned if the request is successful. */ updateStatuses(body: StatusUpdateRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -32065,32 +31021,21 @@ export class Client { * @return Returned if the request is successful. */ search(expand?: string | undefined, projectId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, searchString?: string | undefined, statusCategory?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/statuses/search?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (searchString === null) - throw new globalThis.Error("The parameter 'searchString' cannot be null."); - else if (searchString !== undefined) - url_ += "searchString=" + encodeURIComponent("" + searchString) + "&"; - if (statusCategory === null) - throw new globalThis.Error("The parameter 'statusCategory' cannot be null."); - else if (statusCategory !== undefined) - url_ += "statusCategory=" + encodeURIComponent("" + statusCategory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(searchString, 'searchString'); + Guard.notNull(statusCategory, 'statusCategory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/search") + .param("expand", expand) + .param("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("searchString", searchString) + .param("statusCategory", statusCategory) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -32145,22 +31090,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueTypeUsagesForStatus(statusId: string, projectId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages") + .path("statusId", statusId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -32218,19 +31158,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -32288,19 +31224,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -32356,11 +31288,11 @@ export class Client { * @return Returned if the request is successful. */ getTask(taskId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}") + .path("taskId", taskId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -32416,11 +31348,11 @@ export class Client { * @return Returned if the request is successful. */ cancelTask(taskId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}/cancel"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}/cancel") + .path("taskId", taskId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -32526,20 +31458,15 @@ export class Client { * @return Returned if the request is successful. */ getUiModifications(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -32595,8 +31522,8 @@ export class Client { * @return Returned if the UI modification is created. */ createUiModification(body: CreateUiModificationDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .toString(); const content_ = JSON.stringify(body); @@ -32663,11 +31590,11 @@ export class Client { * @return Returned if the UI modification is deleted. */ deleteUiModification(uiModificationId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -32725,11 +31652,11 @@ export class Client { * @return Returned if the UI modification is updated. */ updateUiModification(uiModificationId: string, body: UpdateUiModificationDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); const content_ = JSON.stringify(body); @@ -32798,14 +31725,13 @@ export class Client { * @return Returned if the request is successful. */ getAvatars(type: Type3, entityId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -32861,26 +31787,19 @@ export class Client { * @return Returned if the request is successful. */ storeAvatar(type: Type4, entityId: string, size: number, body: any, x?: number | undefined, y?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -32946,17 +31865,15 @@ export class Client { * @return Returned if the request is successful. */ deleteAvatar(type: Type5, owningObjectId: string, id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (owningObjectId === undefined || owningObjectId === null) - throw new globalThis.Error("The parameter 'owningObjectId' must be defined."); - url_ = url_.replace("{owningObjectId}", encodeURIComponent("" + owningObjectId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(owningObjectId, 'owningObjectId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}") + .path("type", type) + .path("owningObjectId", owningObjectId) + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33010,19 +31927,15 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByType(type: Type6, size?: Size | undefined, format?: Format | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}") + .path("type", type) + .param("size", size) + .param("format", format) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33090,22 +32003,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByID(type: Type7, id: number, size?: Size2 | undefined, format?: Format2 | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(id, 'id'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}") + .path("type", type) + .path("id", id) + .param("size", size) + .param("format", format) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33180,22 +32088,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByOwner(type: Type8, entityId: string, size?: Size3 | undefined, format?: Format3 | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("format", format) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33269,20 +32172,15 @@ export class Client { * @return Returned if the request is successful. */ removeUser(accountId: string, username?: string | undefined, key?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33344,24 +32242,17 @@ export class Client { * @return Returned if the request is successful. */ getUser(accountId?: string | undefined, username?: string | undefined, key?: string | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33417,8 +32308,8 @@ export class Client { * @return Returned if the request is successful. */ createUser(body: NewUserDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .toString(); const content_ = JSON.stringify(body); @@ -33483,32 +32374,21 @@ export class Client { * @return Returned if the request is successful. */ findBulkAssignableUsers(projectKeys: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch?"; - if (projectKeys === undefined || projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' must be defined and cannot be null."); - else - url_ += "projectKeys=" + encodeURIComponent("" + projectKeys) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeys, 'projectKeys'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch") + .param("projectKeys", projectKeys) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33585,52 +32465,31 @@ export class Client { * @return Returned if the request is successful. */ findAssignableUsers(query?: string | undefined, sessionId?: string | undefined, username?: string | undefined, accountId?: string | undefined, project?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, actionDescriptorId?: number | undefined, recommend?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (sessionId === null) - throw new globalThis.Error("The parameter 'sessionId' cannot be null."); - else if (sessionId !== undefined) - url_ += "sessionId=" + encodeURIComponent("" + sessionId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (project === null) - throw new globalThis.Error("The parameter 'project' cannot be null."); - else if (project !== undefined) - url_ += "project=" + encodeURIComponent("" + project) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (actionDescriptorId === null) - throw new globalThis.Error("The parameter 'actionDescriptorId' cannot be null."); - else if (actionDescriptorId !== undefined) - url_ += "actionDescriptorId=" + encodeURIComponent("" + actionDescriptorId) + "&"; - if (recommend === null) - throw new globalThis.Error("The parameter 'recommend' cannot be null."); - else if (recommend !== undefined) - url_ += "recommend=" + encodeURIComponent("" + recommend) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(sessionId, 'sessionId'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(project, 'project'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(actionDescriptorId, 'actionDescriptorId'); + Guard.notNull(recommend, 'recommend'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/search") + .param("query", query) + .param("sessionId", sessionId) + .param("username", username) + .param("accountId", accountId) + .param("project", project) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("actionDescriptorId", actionDescriptorId) + .param("recommend", recommend) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33701,28 +32560,19 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsers(accountId: string[], startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk") + .paramArray("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33777,24 +32627,17 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsersMigration(startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/bulk/migration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk/migration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33854,16 +32697,13 @@ export class Client { * @return Returned if the request is successful. */ resetUserColumns(accountId?: string | undefined, username?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33912,16 +32752,13 @@ export class Client { * @return Returned if the request is successful. */ getUserDefaultColumns(accountId?: string | undefined, username?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -33986,18 +32823,15 @@ export class Client { * @return Returned if the request is successful. */ setUserColumns(body: UserColumnRequestBody, accountId?: string | undefined, columns?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .toString(); + + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); var options_: ng.IRequestConfig = { url: url_, @@ -34064,12 +32898,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmail(accountId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/email?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email") + .param("accountId", accountId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -34129,12 +32962,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmailBulk(accountId: string[]): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/email/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email/bulk") + .paramArray("accountId", accountId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -34192,20 +33024,15 @@ export class Client { * @return Returned if the request is successful. */ getUserGroups(accountId: string, username?: string | undefined, key?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/groups?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/groups") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -34269,15 +33096,13 @@ export class Client { * @return Returned if the request is successful. */ getUserNavProperty(propertyKey: string, accountId?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -34339,15 +33164,13 @@ export class Client { * @return Returned if the user property is updated/created. */ setUserNavProperty(propertyKey: string, body: any, accountId?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); const content_ = JSON.stringify(body); @@ -34460,40 +33283,25 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithAllPermissions(permissions: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/permission/search?"; - if (permissions === undefined || permissions === null) - throw new globalThis.Error("The parameter 'permissions' must be defined and cannot be null."); - else - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(permissions, 'permissions'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/permission/search") + .param("permissions", permissions) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -34570,36 +33378,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersForPicker(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, exclude?: string[] | undefined, excludeAccountIds?: string[] | undefined, avatarSize?: string | undefined, excludeConnectUsers?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/picker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeAccountIds === null) - throw new globalThis.Error("The parameter 'excludeAccountIds' cannot be null."); - else if (excludeAccountIds !== undefined) - excludeAccountIds && excludeAccountIds.forEach(item => { url_ += "excludeAccountIds=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (excludeConnectUsers === null) - throw new globalThis.Error("The parameter 'excludeConnectUsers' cannot be null."); - else if (excludeConnectUsers !== undefined) - url_ += "excludeConnectUsers=" + encodeURIComponent("" + excludeConnectUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeAccountIds, 'excludeAccountIds'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(excludeConnectUsers, 'excludeConnectUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/picker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .paramArray("exclude", exclude) + .paramArray("excludeAccountIds", excludeAccountIds) + .param("avatarSize", avatarSize) + .param("excludeConnectUsers", excludeConnectUsers) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -34657,20 +33452,15 @@ export class Client { * @return Returned if the request is successful. */ getUserPropertyKeys(accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/properties?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties") + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -34733,23 +33523,17 @@ export class Client { * @return Returned if the user property is deleted. */ deleteUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -34808,23 +33592,17 @@ export class Client { * @return Returned if the request is successful. */ getUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -34888,23 +33666,17 @@ export class Client { * @return Returned if the user property is updated. */ setUserProperty(propertyKey: string, body: any, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); const content_ = JSON.stringify(body); @@ -34986,32 +33758,21 @@ export class Client { * @return Returned if the request is successful. */ findUsers(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, property?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (property === null) - throw new globalThis.Error("The parameter 'property' cannot be null."); - else if (property !== undefined) - url_ += "property=" + encodeURIComponent("" + property) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(property, 'property'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("property", property) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -35076,20 +33837,15 @@ export class Client { * @return Returned if the request is successful. */ findUsersByQuery(query: string, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/search/query?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query") + .param("query", query) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -35163,20 +33919,15 @@ export class Client { * @return Returned if the request is successful. */ findUserKeysByQuery(query: string, startAt?: number | undefined, maxResult?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/search/query/key?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query/key") + .param("query", query) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -35254,36 +34005,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithBrowsePermission(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/user/viewissue/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/viewissue/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -35351,16 +34089,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsersDefault(startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/users?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -35424,16 +34159,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsers(startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/users/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -35495,8 +34227,8 @@ export class Client { * @return Returned if the request is successful. */ createVersion(body: Version): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version") + .toString(); const content_ = JSON.stringify(body); @@ -35559,19 +34291,15 @@ export class Client { * @deprecated */ deleteVersion(id: string, moveFixIssuesTo?: string | undefined, moveAffectedIssuesTo?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveFixIssuesTo === null) - throw new globalThis.Error("The parameter 'moveFixIssuesTo' cannot be null."); - else if (moveFixIssuesTo !== undefined) - url_ += "moveFixIssuesTo=" + encodeURIComponent("" + moveFixIssuesTo) + "&"; - if (moveAffectedIssuesTo === null) - throw new globalThis.Error("The parameter 'moveAffectedIssuesTo' cannot be null."); - else if (moveAffectedIssuesTo !== undefined) - url_ += "moveAffectedIssuesTo=" + encodeURIComponent("" + moveAffectedIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveFixIssuesTo, 'moveFixIssuesTo'); + Guard.notNull(moveAffectedIssuesTo, 'moveAffectedIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("moveFixIssuesTo", moveFixIssuesTo) + .param("moveAffectedIssuesTo", moveAffectedIssuesTo) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -35629,15 +34357,13 @@ export class Client { * @return Returned if the request is successful. */ getVersion(id: string, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -35689,11 +34415,11 @@ export class Client { * @return Returned if the request is successful. */ updateVersion(id: string, body: Version): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -35754,14 +34480,13 @@ export class Client { * @return Returned if the version is deleted. */ mergeVersions(id: string, moveIssuesTo: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === undefined || moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' must be defined."); - url_ = url_.replace("{moveIssuesTo}", encodeURIComponent("" + moveIssuesTo)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}") + .path("id", id) + .path("moveIssuesTo", moveIssuesTo) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -35818,11 +34543,11 @@ export class Client { * @return Returned if the request is successful. */ moveVersion(id: string, body: VersionMoveBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/move"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/move") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -35882,11 +34607,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionRelatedIssues(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -35938,11 +34663,11 @@ export class Client { * @return Returned if the request is successful. */ getRelatedWork(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -36004,11 +34729,11 @@ export class Client { * @return Returned if the request is successful. */ createRelatedWork(id: string, body: VersionRelatedWork): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -36072,11 +34797,11 @@ export class Client { * @return Returned if the request is successful together with updated related work. */ updateRelatedWork(id: string, body: VersionRelatedWork): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -36140,11 +34865,11 @@ export class Client { * @return Returned if the version is deleted. */ deleteAndReplaceVersion(id: string, body: DeleteAndReplaceVersionBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -36205,11 +34930,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionUnresolvedIssues(id: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -36262,14 +34987,13 @@ export class Client { * @return Returned if the related work is deleted. */ deleteRelatedWork(versionId: string, relatedWorkId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}"; - if (versionId === undefined || versionId === null) - throw new globalThis.Error("The parameter 'versionId' must be defined."); - url_ = url_.replace("{versionId}", encodeURIComponent("" + versionId)); - if (relatedWorkId === undefined || relatedWorkId === null) - throw new globalThis.Error("The parameter 'relatedWorkId' must be defined."); - url_ = url_.replace("{relatedWorkId}", encodeURIComponent("" + relatedWorkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(versionId, 'versionId'); + Guard.required(relatedWorkId, 'relatedWorkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}") + .path("versionId", versionId) + .path("relatedWorkId", relatedWorkId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -36324,8 +35048,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWebhookById(body: ContainerForWebhookIDs): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -36384,16 +35108,13 @@ export class Client { * @return Returned if the request is successful. */ getDynamicWebhooksForApp(startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/webhook?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -36450,8 +35171,8 @@ export class Client { * @return Returned if the request is successful. */ registerDynamicWebhooks(body: WebhookRegistrationDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -36514,16 +35235,13 @@ export class Client { * @return Returned if the request is successful. */ getFailedWebhooks(maxResults?: number | undefined, after?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/webhook/failed?"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (after === null) - throw new globalThis.Error("The parameter 'after' cannot be null."); - else if (after !== undefined) - url_ += "after=" + encodeURIComponent("" + after) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(after, 'after'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/failed") + .param("maxResults", maxResults) + .param("after", after) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -36580,8 +35298,8 @@ export class Client { * @return Returned if the request is successful. */ refreshWebhooks(body: ContainerForWebhookIDs): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/webhook/refresh"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/refresh") + .toString(); const content_ = JSON.stringify(body); @@ -36644,12 +35362,11 @@ export class Client { * @deprecated */ getAllWorkflows(workflowName?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow?"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .param("workflowName", workflowName) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -36705,8 +35422,8 @@ export class Client { * @deprecated */ createWorkflow(body: CreateWorkflowDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .toString(); const content_ = JSON.stringify(body); @@ -36777,40 +35494,25 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowTransitionRuleConfigurations(types: Types[], startAt?: number | undefined, maxResults?: number | undefined, keys?: string[] | undefined, workflowNames?: string[] | undefined, withTags?: string[] | undefined, draft?: boolean | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config?"; - if (types === undefined || types === null) - throw new globalThis.Error("The parameter 'types' must be defined and cannot be null."); - else - types && types.forEach(item => { url_ += "types=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (workflowNames === null) - throw new globalThis.Error("The parameter 'workflowNames' cannot be null."); - else if (workflowNames !== undefined) - workflowNames && workflowNames.forEach(item => { url_ += "workflowNames=" + encodeURIComponent("" + item) + "&"; }); - if (withTags === null) - throw new globalThis.Error("The parameter 'withTags' cannot be null."); - else if (withTags !== undefined) - withTags && withTags.forEach(item => { url_ += "withTags=" + encodeURIComponent("" + item) + "&"; }); - if (draft === null) - throw new globalThis.Error("The parameter 'draft' cannot be null."); - else if (draft !== undefined) - url_ += "draft=" + encodeURIComponent("" + draft) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(types, 'types'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(keys, 'keys'); + Guard.notNull(workflowNames, 'workflowNames'); + Guard.notNull(withTags, 'withTags'); + Guard.notNull(draft, 'draft'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .paramArray("types", types) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("keys", keys) + .paramArray("workflowNames", workflowNames) + .paramArray("withTags", withTags) + .param("draft", draft) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -36875,8 +35577,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowTransitionRuleConfigurations(body: WorkflowTransitionRulesUpdate): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .toString(); const content_ = JSON.stringify(body); @@ -36941,8 +35643,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowTransitionRuleConfigurations(body: WorkflowsWithTransitionRulesDetails): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config/delete") + .toString(); const content_ = JSON.stringify(body); @@ -37025,36 +35727,23 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowsPaginated(startAt?: number | undefined, maxResults?: number | undefined, workflowName?: string[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy15 | undefined, isActive?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - workflowName && workflowName.forEach(item => { url_ += "workflowName=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("workflowName", workflowName) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("isActive", isActive) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -37112,23 +35801,17 @@ export class Client { * @return 200 response */ deleteWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, workflowMode?: WorkflowMode | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -37192,27 +35875,19 @@ export class Client { * @return 200 response */ getWorkflowTransitionProperties(transitionId: number, workflowName: string, includeReservedKeys?: boolean | undefined, key?: string | undefined, workflowMode?: WorkflowMode2 | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (includeReservedKeys === null) - throw new globalThis.Error("The parameter 'includeReservedKeys' cannot be null."); - else if (includeReservedKeys !== undefined) - url_ += "includeReservedKeys=" + encodeURIComponent("" + includeReservedKeys) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(includeReservedKeys, 'includeReservedKeys'); + Guard.notNull(key, 'key'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("workflowName", workflowName) + .param("includeReservedKeys", includeReservedKeys) + .param("key", key) + .param("workflowMode", workflowMode) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -37275,23 +35950,17 @@ export class Client { * @return 200 response */ createWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode3 | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -37358,23 +36027,17 @@ export class Client { * @return 200 response */ updateWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode4 | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -37442,11 +36105,11 @@ export class Client { * @return Returned if the workflow is deleted. */ deleteInactiveWorkflow(entityId: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{entityId}"; - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{entityId}") + .path("entityId", entityId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -37505,22 +36168,17 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowProjectIssueTypeUsages(workflowId: string, projectId: number, nextPageToken?: string | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages") + .path("workflowId", workflowId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -37578,19 +36236,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -37648,19 +36302,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -37722,16 +36372,13 @@ export class Client { * @return Returned if the request is successful. */ readWorkflows(body: WorkflowReadRequest, expand?: string | undefined, useApprovalConfiguration?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflows?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (useApprovalConfiguration === null) - throw new globalThis.Error("The parameter 'useApprovalConfiguration' cannot be null."); - else if (useApprovalConfiguration !== undefined) - url_ += "useApprovalConfiguration=" + encodeURIComponent("" + useApprovalConfiguration) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(useApprovalConfiguration, 'useApprovalConfiguration'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows") + .param("expand", expand) + .param("useApprovalConfiguration", useApprovalConfiguration) + .toString(); const content_ = JSON.stringify(body); @@ -37789,20 +36436,15 @@ export class Client { * @return Returned if the request is successful. */ workflowCapabilities(workflowId?: string | undefined, projectId?: string | undefined, issueTypeId?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflows/capabilities?"; - if (workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' cannot be null."); - else if (workflowId !== undefined) - url_ += "workflowId=" + encodeURIComponent("" + workflowId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowId, 'workflowId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/capabilities") + .param("workflowId", workflowId) + .param("projectId", projectId) + .param("issueTypeId", issueTypeId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -37853,8 +36495,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflows(body: WorkflowCreateRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflows/create"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create") + .toString(); const content_ = JSON.stringify(body); @@ -37913,8 +36555,8 @@ export class Client { * @return Returned if the request is successful. */ validateCreateWorkflows(body: WorkflowCreateValidateRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflows/create/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create/validation") + .toString(); const content_ = JSON.stringify(body); @@ -37982,36 +36624,23 @@ export class Client { * @return Returned if the request is successful. */ searchWorkflows(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: string | undefined, scope?: string | undefined, isActive?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflows/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - url_ += "scope=" + encodeURIComponent("" + scope) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(scope, 'scope'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("scope", scope) + .param("isActive", isActive) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -38066,12 +36695,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflows(body: WorkflowUpdateRequest, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflows/update?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -38130,8 +36758,8 @@ export class Client { * @return Returned if the request is successful. */ validateUpdateWorkflows(body: WorkflowUpdateValidateRequestBean): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflows/update/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update/validation") + .toString(); const content_ = JSON.stringify(body); @@ -38188,16 +36816,13 @@ export class Client { * @return Returned if the request is successful. */ getAllWorkflowSchemes(startAt?: number | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -38248,8 +36873,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowScheme(body: WorkflowScheme): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .toString(); const content_ = JSON.stringify(body); @@ -38309,12 +36934,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeProjectAssociations(projectId: number[]): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .paramArray("projectId", projectId) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -38369,8 +36993,8 @@ export class Client { * @return Returned if the request is successful. */ assignSchemeToProject(body: WorkflowSchemeProjectAssociation): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -38439,12 +37063,11 @@ export class Client { * @return Returned if the request is successful. */ readWorkflowSchemes(body: WorkflowSchemeReadRequest, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/read?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/read") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -38506,8 +37129,8 @@ export class Client { * @return Returned if the request is successful and there is no asynchronous task. */ updateSchemes(body: WorkflowSchemeUpdateRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update") + .toString(); const content_ = JSON.stringify(body); @@ -38574,8 +37197,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeMappings(body: WorkflowSchemeUpdateRequiredMappingsRequest): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -38631,11 +37254,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowScheme(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -38697,15 +37320,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowScheme(id: number, returnDraftIfExists?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -38761,11 +37382,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowScheme(id: number, body: WorkflowScheme): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -38829,11 +37450,11 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowSchemeDraftFromParent(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -38890,15 +37511,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDefaultWorkflow(id: number, updateDraftIfNeeded?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -38959,15 +37578,13 @@ export class Client { * @return Returned if the request is successful. */ getDefaultWorkflow(id: number, returnDraftIfExists?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -39024,11 +37641,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultWorkflow(id: number, body: DefaultWorkflow): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -39092,11 +37709,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraft(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -39148,11 +37765,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraft(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -39208,11 +37825,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeDraft(id: number, body: WorkflowScheme): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -39276,11 +37893,11 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftDefaultWorkflow(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -39336,11 +37953,11 @@ export class Client { * @return Returned if the request is successful. */ getDraftDefaultWorkflow(id: number): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -39397,11 +38014,11 @@ export class Client { * @return Returned if the request is successful. */ updateDraftDefaultWorkflow(id: number, body: DefaultWorkflow): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -39466,14 +38083,13 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraftIssueType(id: number, issueType: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -39530,14 +38146,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraftIssueType(id: number, issueType: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -39595,14 +38210,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeDraftIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -39668,15 +38282,13 @@ export class Client { * @return Returned if the request is only for validation and is successful. */ publishDraftWorkflowScheme(id: number, body: PublishDraftWorkflowScheme, validateOnly?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (validateOnly === null) - throw new globalThis.Error("The parameter 'validateOnly' cannot be null."); - else if (validateOnly !== undefined) - url_ += "validateOnly=" + encodeURIComponent("" + validateOnly) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(validateOnly, 'validateOnly'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish") + .path("id", id) + .param("validateOnly", validateOnly) + .toString(); const content_ = JSON.stringify(body); @@ -39744,15 +38356,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftWorkflowMapping(id: number, workflowName: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -39805,15 +38415,13 @@ export class Client { * @return Returned if the request is successful. */ getDraftWorkflow(id: number, workflowName?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -39870,15 +38478,13 @@ export class Client { * @return Returned if the request is successful. */ updateDraftWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -39944,18 +38550,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeIssueType(id: number, issueType: string, updateDraftIfNeeded?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -40017,18 +38620,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeIssueType(id: number, issueType: string, returnDraftIfExists?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -40086,14 +38686,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -40159,19 +38758,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowMapping(id: number, workflowName: string, updateDraftIfNeeded?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -40229,19 +38824,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflow(id: number, workflowName?: string | undefined, returnDraftIfExists?: boolean | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -40298,15 +38889,13 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -40372,19 +38961,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflowScheme(workflowSchemeId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages?"; - if (workflowSchemeId === undefined || workflowSchemeId === null) - throw new globalThis.Error("The parameter 'workflowSchemeId' must be defined."); - url_ = url_.replace("{workflowSchemeId}", encodeURIComponent("" + workflowSchemeId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowSchemeId, 'workflowSchemeId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages") + .path("workflowSchemeId", workflowSchemeId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -40440,12 +39025,11 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsDeletedSince(since?: number | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/worklog/deleted?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/deleted") + .param("since", since) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -40494,12 +39078,11 @@ export class Client { * @return Returned if the request is successful. */ getWorklogsForIds(body: WorklogIdsRequestBean, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/worklog/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -40563,16 +39146,13 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsModifiedSince(since?: number | undefined, expand?: string | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/api/3/worklog/updated?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/updated") + .param("since", since) + .param("expand", expand) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -40620,11 +39200,11 @@ export class Client { * @return Returned if the request is successful. */ deleteForgeAppProperty(propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -40686,11 +39266,11 @@ export class Client { * @return Returned if the property is updated. */ putForgeAppProperty(propertyKey: string, body: any): ng.IPromise { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -40773,11 +39353,11 @@ export class AddonPropertiesResource_getAddonPropertiesClient { * @return Returned if the request is successful. */ get(addonKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties") + .path("addonKey", addonKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -40842,14 +39422,13 @@ export class AddonPropertiesResource_deleteAddonPropertyClient { * @return Returned if the request is successful. */ delete(addonKey: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -40924,14 +39503,13 @@ export class AddonPropertiesResource_getAddonPropertyClient { * @return Returned if the request is successful. */ get(addonKey: string, propertyKey: string): ng.IPromise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -41010,14 +39588,13 @@ export class AddonPropertiesResource_putAddonPropertyClient { * @return Returned if the property is updated. */ put(addonKey: string, propertyKey: string, body: any): ng.IPromise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -41101,12 +39678,11 @@ export class DynamicModulesResource_removeModulesClient { * @return Returned if the request is successful. */ delete(moduleKey?: string[] | undefined): ng.IPromise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic?"; - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(moduleKey, 'moduleKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .paramArray("moduleKey", moduleKey) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -41165,8 +39741,8 @@ export class DynamicModulesResource_getModulesClient { * @return Returned if the request is successful. */ get(): ng.IPromise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -41229,8 +39805,8 @@ export class DynamicModulesResource_registerModulesClient { * @return Returned if the request is successful. */ post(body: ConnectModules): ng.IPromise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); const content_ = JSON.stringify(body); @@ -41301,8 +39877,8 @@ export class AppIssueFieldValueUpdateResource_updateIssueFieldsClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, body: ConnectCustomFieldValues): ng.IPromise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/field") + .toString(); const content_ = JSON.stringify(body); @@ -41374,11 +39950,11 @@ export class MigrationResource_updateEntityPropertiesValueClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, entityType: EntityType, body: EntityPropertyDetails[]): ng.IPromise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}"; - if (entityType === undefined || entityType === null) - throw new globalThis.Error("The parameter 'entityType' must be defined."); - url_ = url_.replace("{entityType}", encodeURIComponent("" + entityType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityType, 'entityType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}") + .path("entityType", entityType) + .toString(); const content_ = JSON.stringify(body); @@ -41444,8 +40020,8 @@ export class MigrationResource_workflowRuleSearchClient { * @return Returned if the request is successful. */ post(atlassian_Transfer_Id: string, body: WorkflowRulesSearch): ng.IPromise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search") + .toString(); const content_ = JSON.stringify(body); @@ -41515,12 +40091,11 @@ export class ServiceRegistryResource_servicesClient { * @return Returned if the request is successful. */ get(serviceIds: string[]): ng.IPromise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/service-registry?"; - if (serviceIds === undefined || serviceIds === null) - throw new globalThis.Error("The parameter 'serviceIds' must be defined and cannot be null."); - else - serviceIds && serviceIds.forEach(item => { url_ += "serviceIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(serviceIds, 'serviceIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/service-registry") + .paramArray("serviceIds", serviceIds) + .toString(); var options_: ng.IRequestConfig = { url: url_, @@ -100275,4 +98850,68 @@ function blobToText(blob: Blob, q: ng.IQService): ng.IPromise { reader.onload = event => resolve((event.target as any).result); reader.readAsText(blob); }); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..97d08b6d7 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 @@ -21,8 +21,8 @@ export class Client { * @return Returned if the request is successful. */ getBanner(): Promise { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); let options_: RequestInit = { method: "GET", @@ -73,8 +73,8 @@ export class Client { * @return Returned if the request is successful. */ setBanner(body: AnnouncementBannerConfigurationUpdate): Promise { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); const content_ = JSON.stringify(body); @@ -144,36 +144,23 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldsConfigurations(body: ConfigurationsListParameters, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/context/configuration/list?"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/context/configuration/list") + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -231,12 +218,11 @@ export class Client { * @return Returned if the request is successful. */ updateMultipleCustomFieldValues(body: MultipleCustomFieldValuesUpdateDetails, generateChangelog?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/value?"; - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/value") + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -298,39 +284,25 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldConfiguration(fieldIdOrKey: string, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -384,11 +356,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldConfiguration(fieldIdOrKey: string, body: CustomFieldConfigurations): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -448,15 +420,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldValue(fieldIdOrKey: string, body: CustomFieldValueUpdateDetails, generateChangelog?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value") + .path("fieldIdOrKey", fieldIdOrKey) + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -513,20 +483,15 @@ export class Client { * @return Returned if the request is successful. */ getApplicationProperty(key?: string | undefined, permissionLevel?: string | undefined, keyFilter?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/application-properties?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (permissionLevel === null) - throw new globalThis.Error("The parameter 'permissionLevel' cannot be null."); - else if (permissionLevel !== undefined) - url_ += "permissionLevel=" + encodeURIComponent("" + permissionLevel) + "&"; - if (keyFilter === null) - throw new globalThis.Error("The parameter 'keyFilter' cannot be null."); - else if (keyFilter !== undefined) - url_ += "keyFilter=" + encodeURIComponent("" + keyFilter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + Guard.notNull(permissionLevel, 'permissionLevel'); + Guard.notNull(keyFilter, 'keyFilter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties") + .param("key", key) + .param("permissionLevel", permissionLevel) + .param("keyFilter", keyFilter) + .toString(); let options_: RequestInit = { method: "GET", @@ -584,8 +549,8 @@ export class Client { * @return Returned if the request is successful. */ getAdvancedSettings(): Promise { - let url_ = this.baseUrl + "/rest/api/3/application-properties/advanced-settings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/advanced-settings") + .toString(); let options_: RequestInit = { method: "GET", @@ -638,11 +603,11 @@ export class Client { * @return Returned if the request is successful. */ setApplicationProperty(id: string, body: SimpleApplicationPropertyBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/application-properties/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -711,8 +676,8 @@ export class Client { * @return Returned if the request is successful. */ getAllApplicationRoles(): Promise { - let url_ = this.baseUrl + "/rest/api/3/applicationrole"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole") + .toString(); let options_: RequestInit = { method: "GET", @@ -765,11 +730,11 @@ export class Client { * @return Returned if the request is successful. */ getApplicationRole(key: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/applicationrole/{key}"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined."); - url_ = url_.replace("{key}", encodeURIComponent("" + key)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole/{key}") + .path("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -820,15 +785,13 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentContent(id: string, redirect?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/content/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/content/{id}") + .path("id", id) + .param("redirect", redirect) + .toString(); let options_: RequestInit = { method: "GET", @@ -900,8 +863,8 @@ export class Client { * @return Returned if the request is successful. */ getAttachmentMeta(): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/meta"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/meta") + .toString(); let options_: RequestInit = { method: "GET", @@ -947,27 +910,19 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentThumbnail(id: string, redirect?: boolean | undefined, fallbackToDefault?: boolean | undefined, width?: number | undefined, height?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - if (fallbackToDefault === null) - throw new globalThis.Error("The parameter 'fallbackToDefault' cannot be null."); - else if (fallbackToDefault !== undefined) - url_ += "fallbackToDefault=" + encodeURIComponent("" + fallbackToDefault) + "&"; - if (width === null) - throw new globalThis.Error("The parameter 'width' cannot be null."); - else if (width !== undefined) - url_ += "width=" + encodeURIComponent("" + width) + "&"; - if (height === null) - throw new globalThis.Error("The parameter 'height' cannot be null."); - else if (height !== undefined) - url_ += "height=" + encodeURIComponent("" + height) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + Guard.notNull(fallbackToDefault, 'fallbackToDefault'); + Guard.notNull(width, 'width'); + Guard.notNull(height, 'height'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}") + .path("id", id) + .param("redirect", redirect) + .param("fallbackToDefault", fallbackToDefault) + .param("width", width) + .param("height", height) + .toString(); let options_: RequestInit = { method: "GET", @@ -1032,11 +987,11 @@ export class Client { * @return Returned if the request is successful. */ removeAttachment(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -1078,11 +1033,11 @@ export class Client { * @return Returned if the request is successful. */ getAttachment(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -1132,11 +1087,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForHumans(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/human"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/human") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -1190,11 +1145,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForMachines(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -1252,28 +1207,19 @@ export class Client { * @return Returned if the request is successful. */ getAuditRecords(offset?: number | undefined, limit?: number | undefined, filter?: string | undefined, from?: string | undefined, to?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/auditing/record?"; - if (offset === null) - throw new globalThis.Error("The parameter 'offset' cannot be null."); - else if (offset !== undefined) - url_ += "offset=" + encodeURIComponent("" + offset) + "&"; - if (limit === null) - throw new globalThis.Error("The parameter 'limit' cannot be null."); - else if (limit !== undefined) - url_ += "limit=" + encodeURIComponent("" + limit) + "&"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (from === null) - throw new globalThis.Error("The parameter 'from' cannot be null."); - else if (from !== undefined) - url_ += "from=" + encodeURIComponent("" + from) + "&"; - if (to === null) - throw new globalThis.Error("The parameter 'to' cannot be null."); - else if (to !== undefined) - url_ += "to=" + encodeURIComponent("" + to) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(offset, 'offset'); + Guard.notNull(limit, 'limit'); + Guard.notNull(filter, 'filter'); + Guard.notNull(from, 'from'); + Guard.notNull(to, 'to'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/auditing/record") + .param("offset", offset) + .param("limit", limit) + .param("filter", filter) + .param("from", from) + .param("to", to) + .toString(); let options_: RequestInit = { method: "GET", @@ -1325,11 +1271,11 @@ export class Client { * @return Returned if the request is successful. */ getAllSystemAvatars(type: Type): Promise { - let url_ = this.baseUrl + "/rest/api/3/avatar/{type}/system"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/avatar/{type}/system") + .path("type", type) + .toString(); let options_: RequestInit = { method: "GET", @@ -1375,8 +1321,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkDelete(body: IssueBulkDeletePayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/delete") + .toString(); const content_ = JSON.stringify(body); @@ -1442,24 +1388,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkEditableFields(issueIdsOrKeys: string, searchText?: string | undefined, endingBefore?: string | undefined, startingAfter?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (searchText === null) - throw new globalThis.Error("The parameter 'searchText' cannot be null."); - else if (searchText !== undefined) - url_ += "searchText=" + encodeURIComponent("" + searchText) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(searchText, 'searchText'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("searchText", searchText) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); let options_: RequestInit = { method: "GET", @@ -1525,8 +1464,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkEdit(body: IssueBulkEditPayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .toString(); const content_ = JSON.stringify(body); @@ -1581,8 +1520,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkMove(body: IssueBulkMovePayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/move") + .toString(); const content_ = JSON.stringify(body); @@ -1640,20 +1579,15 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTransitions(issueIdsOrKeys: string, endingBefore?: string | undefined, startingAfter?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); let options_: RequestInit = { method: "GET", @@ -1712,8 +1646,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkTransition(body: IssueBulkTransitionPayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .toString(); const content_ = JSON.stringify(body); @@ -1776,8 +1710,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkUnwatch(body: IssueBulkWatchOrUnwatchPayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/unwatch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/unwatch") + .toString(); const content_ = JSON.stringify(body); @@ -1840,8 +1774,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkWatch(body: IssueBulkWatchOrUnwatchPayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/watch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/watch") + .toString(); const content_ = JSON.stringify(body); @@ -1904,11 +1838,11 @@ export class Client { * @return Returned if the request is successful. */ getBulkOperationProgress(taskId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/queue/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/queue/{taskId}") + .path("taskId", taskId) + .toString(); let options_: RequestInit = { method: "GET", @@ -1960,8 +1894,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkChangelogs(body: BulkChangelogRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/changelog/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/changelog/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -2008,16 +1942,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUserDataClassificationLevels(status?: Status2[] | undefined, orderBy?: OrderBy | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/classification-levels?"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(status, 'status'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/classification-levels") + .paramArray("status", status) + .param("orderBy", orderBy) + .toString(); let options_: RequestInit = { method: "GET", @@ -2063,12 +1994,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentsByIds(body: IssueCommentListRequestBean, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -2114,11 +2044,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentPropertyKeys(commentId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties") + .path("commentId", commentId) + .toString(); let options_: RequestInit = { method: "GET", @@ -2173,14 +2103,13 @@ export class Client { * @return Returned if the request is successful. */ deleteCommentProperty(commentId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -2231,14 +2160,13 @@ export class Client { * @return Returned if the request is successful. */ getCommentProperty(commentId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -2294,14 +2222,13 @@ export class Client { * @return Returned if the comment property is updated. */ setCommentProperty(commentId: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -2375,28 +2302,19 @@ export class Client { * @return Returned if the request is successful. */ findComponentsForProjects(projectIdsOrKeys?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy2 | undefined, query?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/component?"; - if (projectIdsOrKeys === null) - throw new globalThis.Error("The parameter 'projectIdsOrKeys' cannot be null."); - else if (projectIdsOrKeys !== undefined) - projectIdsOrKeys && projectIdsOrKeys.forEach(item => { url_ += "projectIdsOrKeys=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIdsOrKeys, 'projectIdsOrKeys'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .paramArray("projectIdsOrKeys", projectIdsOrKeys) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .toString(); let options_: RequestInit = { method: "GET", @@ -2441,8 +2359,8 @@ export class Client { * @return Returned if the request is successful. */ createComponent(body: ProjectComponent): Promise { - let url_ = this.baseUrl + "/rest/api/3/component"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .toString(); const content_ = JSON.stringify(body); @@ -2501,15 +2419,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComponent(id: string, moveIssuesTo?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' cannot be null."); - else if (moveIssuesTo !== undefined) - url_ += "moveIssuesTo=" + encodeURIComponent("" + moveIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .param("moveIssuesTo", moveIssuesTo) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -2555,11 +2471,11 @@ export class Client { * @return Returned if the request is successful. */ getComponent(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -2605,11 +2521,11 @@ export class Client { * @return Returned if the request is successful. */ updateComponent(id: string, body: ProjectComponent): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -2667,11 +2583,11 @@ export class Client { * @return Returned if the request is successful. */ getComponentRelatedIssues(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -2716,8 +2632,8 @@ export class Client { * @return Returned if the request is successful. */ getConfiguration(): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration") + .toString(); let options_: RequestInit = { method: "GET", @@ -2758,8 +2674,8 @@ export class Client { * @return Returned if the request is successful and time tracking is enabled. */ getSelectedTimeTrackingImplementation(): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); let options_: RequestInit = { method: "GET", @@ -2812,8 +2728,8 @@ export class Client { * @return Returned if the request is successful. */ selectTimeTrackingImplementation(body: TimeTrackingProvider): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); const content_ = JSON.stringify(body); @@ -2867,8 +2783,8 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTimeTrackingImplementations(): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/list"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/list") + .toString(); let options_: RequestInit = { method: "GET", @@ -2920,8 +2836,8 @@ export class Client { * @return Returned if the request is successful. */ getSharedTimeTrackingConfiguration(): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); let options_: RequestInit = { method: "GET", @@ -2966,8 +2882,8 @@ export class Client { * @return Returned if the request is successful. */ setSharedTimeTrackingConfiguration(body: TimeTrackingConfiguration): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); const content_ = JSON.stringify(body); @@ -3021,11 +2937,11 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldOption(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/customFieldOption/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/customFieldOption/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -3076,20 +2992,15 @@ export class Client { * @return Returned if the request is successful. */ getAllDashboards(filter?: Filter2 | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filter, 'filter'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("filter", filter) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -3142,12 +3053,11 @@ export class Client { * @return Returned if the request is successful. */ createDashboard(body: DashboardDetails, extendAdminPermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -3203,8 +3113,8 @@ export class Client { * @return Returned if the request is successful. */ bulkEditDashboards(body: BulkEditShareableEntityRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/bulk/edit"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/bulk/edit") + .toString(); const content_ = JSON.stringify(body); @@ -3259,8 +3169,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAvailableDashboardGadgets(): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/gadgets"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/gadgets") + .toString(); let options_: RequestInit = { method: "GET", @@ -3338,52 +3248,31 @@ export class Client { * @return Returned if the request is successful. */ getDashboardsPaginated(dashboardName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, orderBy?: OrderBy3 | undefined, startAt?: number | undefined, maxResults?: number | undefined, status?: Status3 | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/search?"; - if (dashboardName === null) - throw new globalThis.Error("The parameter 'dashboardName' cannot be null."); - else if (dashboardName !== undefined) - url_ += "dashboardName=" + encodeURIComponent("" + dashboardName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(dashboardName, 'dashboardName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/search") + .param("dashboardName", dashboardName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("status", status) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -3438,23 +3327,17 @@ export class Client { * @return Returned if the request is successful. */ getAllGadgets(dashboardId: number, moduleKey?: string[] | undefined, uri?: string[] | undefined, gadgetId?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget?"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - if (uri === null) - throw new globalThis.Error("The parameter 'uri' cannot be null."); - else if (uri !== undefined) - uri && uri.forEach(item => { url_ += "uri=" + encodeURIComponent("" + item) + "&"; }); - if (gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' cannot be null."); - else if (gadgetId !== undefined) - gadgetId && gadgetId.forEach(item => { url_ += "gadgetId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.notNull(moduleKey, 'moduleKey'); + Guard.notNull(uri, 'uri'); + Guard.notNull(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .paramArray("moduleKey", moduleKey) + .paramArray("uri", uri) + .paramArray("gadgetId", gadgetId) + .toString(); let options_: RequestInit = { method: "GET", @@ -3503,11 +3386,11 @@ export class Client { * @return Returned if the request is successful. */ addGadget(dashboardId: number, body: DashboardGadgetSettings): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .toString(); const content_ = JSON.stringify(body); @@ -3568,14 +3451,13 @@ export class Client { * @return Returned if the request is successful. */ removeGadget(dashboardId: number, gadgetId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -3626,14 +3508,13 @@ export class Client { * @return Returned if the request is successful. */ updateGadget(dashboardId: number, gadgetId: number, body: DashboardGadgetUpdateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); const content_ = JSON.stringify(body); @@ -3695,14 +3576,13 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemPropertyKeys(dashboardId: string, itemId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .toString(); let options_: RequestInit = { method: "GET", @@ -3756,17 +3636,15 @@ export class Client { * @return Returned if the dashboard item property is deleted. */ deleteDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -3835,17 +3713,15 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -3900,17 +3776,15 @@ export class Client { * @return Returned if the dashboard item property is updated. */ setDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -3989,11 +3863,11 @@ export class Client { * @return Returned if the dashboard is deleted. */ deleteDashboard(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -4041,11 +3915,11 @@ export class Client { * @return Returned if the request is successful. */ getDashboard(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -4103,15 +3977,13 @@ export class Client { * @return Returned if the request is successful. */ updateDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -4175,15 +4047,13 @@ export class Client { * @return Returned if the request is successful. */ copyDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}/copy?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}/copy") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -4245,8 +4115,8 @@ export class Client { * @return Returned if the request is successful */ getPolicy(): Promise { - let url_ = this.baseUrl + "/rest/api/3/data-policy"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy") + .toString(); let options_: RequestInit = { method: "GET", @@ -4298,12 +4168,11 @@ export class Client { * @return Returned if the request is successful. */ getPolicies(ids?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/data-policy/project?"; - if (ids === null) - throw new globalThis.Error("The parameter 'ids' cannot be null."); - else if (ids !== undefined) - url_ += "ids=" + encodeURIComponent("" + ids) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(ids, 'ids'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy/project") + .param("ids", ids) + .toString(); let options_: RequestInit = { method: "GET", @@ -4361,8 +4230,8 @@ export class Client { * @return Returned if the request is successful. */ getEvents(): Promise { - let url_ = this.baseUrl + "/rest/api/3/events"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/events") + .toString(); let options_: RequestInit = { method: "GET", @@ -4420,12 +4289,11 @@ export class Client { * @return Returned if the request is successful. */ analyseExpression(body: JiraExpressionForAnalysis, check?: Check | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/expression/analyse?"; - if (check === null) - throw new globalThis.Error("The parameter 'check' cannot be null."); - else if (check !== undefined) - url_ += "check=" + encodeURIComponent("" + check) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(check, 'check'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/analyse") + .param("check", check) + .toString(); const content_ = JSON.stringify(body); @@ -4487,12 +4355,11 @@ export class Client { * @deprecated */ evaluateJiraExpression(body: JiraExpressionEvalRequestBean, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/expression/eval?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/eval") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -4553,12 +4420,11 @@ export class Client { * @return Returned if the evaluation results in a value. The result is a JSON primitive value, list, or object. */ evaluateJSISJiraExpression(body: JiraExpressionEvaluateRequestBean, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/expression/evaluate?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/evaluate") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -4617,8 +4483,8 @@ export class Client { * @return Returned if the request is successful. */ getFields(): Promise { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); let options_: RequestInit = { method: "GET", @@ -4667,8 +4533,8 @@ export class Client { * @return Returned if the custom field is created. */ createCustomField(body: CustomFieldDefinitionJsonBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); const content_ = JSON.stringify(body); @@ -4714,8 +4580,8 @@ export class Client { * @return Returned if the field association validation passes. */ removeAssociations(body: FieldAssociationsRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -4770,8 +4636,8 @@ export class Client { * @return Returned if the field association validation passes. */ createAssociations(body: FieldAssociationsRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -4846,40 +4712,25 @@ export class Client { * @return Returned if the request is successful. */ getFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, type?: Type2[] | undefined, id?: string[] | undefined, query?: string | undefined, orderBy?: OrderBy4 | undefined, expand?: string | undefined, projectIds?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (type === null) - throw new globalThis.Error("The parameter 'type' cannot be null."); - else if (type !== undefined) - type && type.forEach(item => { url_ += "type=" + encodeURIComponent("" + item) + "&"; }); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(type, 'type'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectIds, 'projectIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("type", type) + .paramArray("id", id) + .param("query", query) + .param("orderBy", orderBy) + .param("expand", expand) + .paramArray("projectIds", projectIds) + .toString(); let options_: RequestInit = { method: "GET", @@ -4944,32 +4795,21 @@ export class Client { * @return Returned if the request is successful. */ getTrashedFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, id?: string[] | undefined, query?: string | undefined, expand?: Expand | undefined, orderBy?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/search/trashed?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(expand, 'expand'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search/trashed") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("query", query) + .param("expand", expand) + .param("orderBy", orderBy) + .toString(); let options_: RequestInit = { method: "GET", @@ -5026,11 +4866,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomField(fieldId: string, body: UpdateCustomFieldDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -5094,31 +4934,21 @@ export class Client { * @return Returned if the request is successful. */ getContextsForField(fieldId: string, isAnyIssueType?: boolean | undefined, isGlobalContext?: boolean | undefined, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (isAnyIssueType === null) - throw new globalThis.Error("The parameter 'isAnyIssueType' cannot be null."); - else if (isAnyIssueType !== undefined) - url_ += "isAnyIssueType=" + encodeURIComponent("" + isAnyIssueType) + "&"; - if (isGlobalContext === null) - throw new globalThis.Error("The parameter 'isGlobalContext' cannot be null."); - else if (isGlobalContext !== undefined) - url_ += "isGlobalContext=" + encodeURIComponent("" + isGlobalContext) + "&"; - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(isAnyIssueType, 'isAnyIssueType'); + Guard.notNull(isGlobalContext, 'isGlobalContext'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .param("isAnyIssueType", isAnyIssueType) + .param("isGlobalContext", isGlobalContext) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -5168,11 +4998,11 @@ export class Client { * @return Returned if the custom field context is created. */ createCustomFieldContext(fieldId: string, body: CreateCustomFieldContext): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -5233,23 +5063,17 @@ export class Client { * @return Returned if the request is successful. */ getDefaultValues(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -5299,11 +5123,11 @@ export class Client { * @return Returned if operation is successful. */ setDefaultValues(fieldId: string, body: CustomFieldContextDefaultValueUpdate): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -5365,23 +5189,17 @@ export class Client { * @return Returned if operation is successful. */ getIssueTypeMappingsForContexts(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -5430,19 +5248,15 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldContextsForProjectsAndIssueTypes(fieldId: string, body: ProjectIssueTypeMappings, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -5503,23 +5317,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectContextMapping(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -5570,14 +5378,13 @@ export class Client { * @return Returned if the context is deleted. */ deleteCustomFieldContext(fieldId: string, contextId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -5633,14 +5440,13 @@ export class Client { * @return Returned if the context is updated. */ updateCustomFieldContext(fieldId: string, contextId: number, body: CustomFieldContextUpdateDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -5700,14 +5506,13 @@ export class Client { * @return Returned if operation is successful. */ addIssueTypesToContext(fieldId: string, contextId: number, body: IssueTypeIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -5771,14 +5576,13 @@ export class Client { * @return Returned if operation is successful. */ removeIssueTypesFromContext(fieldId: string, contextId: number, body: IssueTypeIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -5842,30 +5646,21 @@ export class Client { * @return Returned if the request is successful. */ getOptionsForContext(fieldId: string, contextId: number, optionId?: number | undefined, onlyOptions?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === null) - throw new globalThis.Error("The parameter 'optionId' cannot be null."); - else if (optionId !== undefined) - url_ += "optionId=" + encodeURIComponent("" + optionId) + "&"; - if (onlyOptions === null) - throw new globalThis.Error("The parameter 'onlyOptions' cannot be null."); - else if (onlyOptions !== undefined) - url_ += "onlyOptions=" + encodeURIComponent("" + onlyOptions) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(optionId, 'optionId'); + Guard.notNull(onlyOptions, 'onlyOptions'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .param("optionId", optionId) + .param("onlyOptions", onlyOptions) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -5920,14 +5715,13 @@ export class Client { * @return Returned if the request is successful. */ createCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionCreateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -5986,14 +5780,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionUpdateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6052,14 +5845,13 @@ export class Client { * @return Returned if options are reordered. */ reorderCustomFieldOptions(fieldId: string, contextId: number, body: OrderOfCustomFieldOptions): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6120,17 +5912,15 @@ export class Client { * @return Returned if the option is deleted. */ deleteCustomFieldOption(fieldId: string, contextId: number, optionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .path("optionId", optionId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -6183,25 +5973,19 @@ export class Client { * @param jql (optional) A JQL query that specifies the issues to be updated. For example, *project=10000*. */ replaceCustomFieldOption(fieldId: string, optionId: number, contextId: number, replaceWith?: number | undefined, jql?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(optionId, 'optionId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue") + .path("fieldId", fieldId) + .path("optionId", optionId) + .path("contextId", contextId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -6251,14 +6035,13 @@ export class Client { * @return Returned if operation is successful. */ assignProjectsToCustomFieldContext(fieldId: string, contextId: number, body: ProjectIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6318,14 +6101,13 @@ export class Client { * @return Returned if the custom field context is removed from the projects. */ removeCustomFieldContextFromProjects(fieldId: string, contextId: number, body: ProjectIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6387,19 +6169,15 @@ export class Client { * @deprecated */ getContextsForFieldDeprecated(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/contexts?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/contexts") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -6448,23 +6226,17 @@ export class Client { * @return Returned if the request is successful. */ getScreensForField(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/screens?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/screens") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -6515,19 +6287,15 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -6576,11 +6344,11 @@ export class Client { * @return Returned if the request is successful. */ createIssueFieldOption(fieldKey: string, body: IssueFieldOptionCreateBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .toString(); const content_ = JSON.stringify(body); @@ -6640,23 +6408,17 @@ export class Client { * @return Returned if the request is successful. */ getSelectableIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -6708,23 +6470,17 @@ export class Client { * @return Returned if the request is successful. */ getVisibleIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -6774,14 +6530,13 @@ export class Client { * @return Returned if the field option is deleted. */ deleteIssueFieldOption(fieldKey: string, optionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -6836,14 +6591,13 @@ export class Client { * @return Returned if the requested option is returned. */ getIssueFieldOption(fieldKey: string, optionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); let options_: RequestInit = { method: "GET", @@ -6897,14 +6651,13 @@ export class Client { * @return Returned if the option is updated or created. */ updateIssueFieldOption(fieldKey: string, optionId: number, body: IssueFieldOption): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); const content_ = JSON.stringify(body); @@ -6965,30 +6718,21 @@ export class Client { * @param overrideEditableFlag (optional) Whether screen security is overridden to enable uneditable fields to be edited. Available to Connect and Forge app users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ replaceIssueFieldOption(fieldKey: string, optionId: number, replaceWith?: number | undefined, jql?: string | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -7036,11 +6780,11 @@ export class Client { * @param id The ID of a custom field. */ deleteCustomField(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -7112,11 +6856,11 @@ export class Client { * @return Returned if the request is successful. */ restoreCustomField(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/restore"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/restore") + .path("id", id) + .toString(); let options_: RequestInit = { method: "POST", @@ -7183,11 +6927,11 @@ export class Client { * @return Returned if the request is successful. */ trashCustomField(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/trash"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/trash") + .path("id", id) + .toString(); let options_: RequestInit = { method: "POST", @@ -7258,28 +7002,19 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurations(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, isDefault?: boolean | undefined, query?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (isDefault === null) - throw new globalThis.Error("The parameter 'isDefault' cannot be null."); - else if (isDefault !== undefined) - url_ += "isDefault=" + encodeURIComponent("" + isDefault) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(isDefault, 'isDefault'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("isDefault", isDefault) + .param("query", query) + .toString(); let options_: RequestInit = { method: "GET", @@ -7324,8 +7059,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfiguration(body: FieldConfigurationDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .toString(); const content_ = JSON.stringify(body); @@ -7379,11 +7114,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfiguration(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -7438,11 +7173,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfiguration(id: number, body: FieldConfigurationDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -7503,19 +7238,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationItems(id: number, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -7565,11 +7296,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationItems(id: number, body: FieldConfigurationItemsDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -7630,20 +7361,15 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurationSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -7693,8 +7419,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfigurationScheme(body: UpdateFieldConfigurationSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -7750,20 +7476,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, fieldConfigurationSchemeId?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fieldConfigurationSchemeId === null) - throw new globalThis.Error("The parameter 'fieldConfigurationSchemeId' cannot be null."); - else if (fieldConfigurationSchemeId !== undefined) - fieldConfigurationSchemeId && fieldConfigurationSchemeId.forEach(item => { url_ += "fieldConfigurationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fieldConfigurationSchemeId, 'fieldConfigurationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("fieldConfigurationSchemeId", fieldConfigurationSchemeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -7819,20 +7540,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeProjectMapping(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -7881,8 +7597,8 @@ export class Client { * @return Returned if the request is successful. */ assignFieldConfigurationSchemeToProject(body: FieldConfigurationSchemeProjectAssociation): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -7941,11 +7657,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfigurationScheme(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -8001,11 +7717,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationScheme(id: number, body: UpdateFieldConfigurationSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -8064,11 +7780,11 @@ export class Client { * @return Returned if the request is successful. */ setFieldConfigurationSchemeMapping(id: number, body: AssociateFieldConfigurationsWithIssueTypesRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -8128,11 +7844,11 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypesFromGlobalFieldConfigurationScheme(id: number, body: IssueTypeIdsToRemove): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -8208,16 +7924,13 @@ export class Client { * @return Returned if the request is successful. */ createFilter(body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter") + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -8266,8 +7979,8 @@ export class Client { * @return Returned if the request is successful. */ getDefaultShareScope(): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); let options_: RequestInit = { method: "GET", @@ -8308,8 +8021,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultShareScope(body: DefaultShareScope): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); const content_ = JSON.stringify(body); @@ -8362,12 +8075,11 @@ export class Client { * @return Returned if the request is successful. */ getFavouriteFilters(expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/favourite?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/favourite") + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -8420,16 +8132,13 @@ export class Client { * @return Returned if the request is successful. */ getMyFilters(expand?: string | undefined, includeFavourites?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/my?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (includeFavourites === null) - throw new globalThis.Error("The parameter 'includeFavourites' cannot be null."); - else if (includeFavourites !== undefined) - url_ += "includeFavourites=" + encodeURIComponent("" + includeFavourites) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(includeFavourites, 'includeFavourites'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/my") + .param("expand", expand) + .param("includeFavourites", includeFavourites) + .toString(); let options_: RequestInit = { method: "GET", @@ -8511,60 +8220,35 @@ export class Client { * @return Returned if the request is successful. */ getFiltersPaginated(filterName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy5 | undefined, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, isSubstringMatch?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/search?"; - if (filterName === null) - throw new globalThis.Error("The parameter 'filterName' cannot be null."); - else if (filterName !== undefined) - url_ += "filterName=" + encodeURIComponent("" + filterName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - if (isSubstringMatch === null) - throw new globalThis.Error("The parameter 'isSubstringMatch' cannot be null."); - else if (isSubstringMatch !== undefined) - url_ += "isSubstringMatch=" + encodeURIComponent("" + isSubstringMatch) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filterName, 'filterName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + Guard.notNull(isSubstringMatch, 'isSubstringMatch'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/search") + .param("filterName", filterName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .param("isSubstringMatch", isSubstringMatch) + .toString(); let options_: RequestInit = { method: "GET", @@ -8613,11 +8297,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFilter(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -8664,19 +8348,15 @@ export class Client { * @return Returned if the request is successful. */ getFilter(id: number, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); let options_: RequestInit = { method: "GET", @@ -8728,19 +8408,15 @@ export class Client { * @return Returned if the request is successful. */ updateFilter(id: number, body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -8790,11 +8466,11 @@ export class Client { * @return Returned if the request is successful. */ resetColumns(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -8836,11 +8512,11 @@ export class Client { * @return Returned if the request is successful. */ getColumns(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -8899,17 +8575,15 @@ export class Client { * @return Returned if the request is successful. */ setColumns(id: number, body: ColumnRequestBody, columns?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_: RequestInit = { body: content_, @@ -8962,15 +8636,13 @@ export class Client { * @return Returned if the request is successful. */ deleteFavouriteForFilter(id: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -9016,15 +8688,13 @@ export class Client { * @return Returned if the request is successful. */ setFavouriteForFilter(id: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "PUT", @@ -9067,11 +8737,11 @@ export class Client { * @return Returned if the request is successful. */ changeFilterOwner(id: number, body: ChangeFilterOwner): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/owner"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/owner") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9126,11 +8796,11 @@ export class Client { * @return Returned if the request is successful. */ getSharePermissions(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -9183,11 +8853,11 @@ export class Client { * @return Returned if the request is successful. */ addSharePermission(id: number, body: SharePermissionInputBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9249,14 +8919,13 @@ export class Client { * @return Returned if the request is successful. */ deleteSharePermission(id: number, permissionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -9299,14 +8968,13 @@ export class Client { * @return Returned if the request is successful. */ getSharePermission(id: number, permissionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); let options_: RequestInit = { method: "GET", @@ -9356,24 +9024,17 @@ export class Client { * @return Returned if the request is successful. */ removeGroup(groupname?: string | undefined, groupId?: string | undefined, swapGroup?: string | undefined, swapGroupId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (swapGroup === null) - throw new globalThis.Error("The parameter 'swapGroup' cannot be null."); - else if (swapGroup !== undefined) - url_ += "swapGroup=" + encodeURIComponent("" + swapGroup) + "&"; - if (swapGroupId === null) - throw new globalThis.Error("The parameter 'swapGroupId' cannot be null."); - else if (swapGroupId !== undefined) - url_ += "swapGroupId=" + encodeURIComponent("" + swapGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(swapGroup, 'swapGroup'); + Guard.notNull(swapGroupId, 'swapGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("swapGroup", swapGroup) + .param("swapGroupId", swapGroupId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -9427,20 +9088,15 @@ export class Client { * @deprecated */ getGroup(groupname?: string | undefined, groupId?: string | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -9494,8 +9150,8 @@ export class Client { * @return Returned if the request is successful. */ createGroup(body: AddGroupBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/group"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .toString(); const content_ = JSON.stringify(body); @@ -9554,32 +9210,21 @@ export class Client { * @return Returned if the request is successful. */ bulkGetGroups(startAt?: number | undefined, maxResults?: number | undefined, groupId?: string[] | undefined, groupName?: string[] | undefined, accessType?: string | undefined, applicationKey?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/bulk?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - groupId && groupId.forEach(item => { url_ += "groupId=" + encodeURIComponent("" + item) + "&"; }); - if (groupName === null) - throw new globalThis.Error("The parameter 'groupName' cannot be null."); - else if (groupName !== undefined) - groupName && groupName.forEach(item => { url_ += "groupName=" + encodeURIComponent("" + item) + "&"; }); - if (accessType === null) - throw new globalThis.Error("The parameter 'accessType' cannot be null."); - else if (accessType !== undefined) - url_ += "accessType=" + encodeURIComponent("" + accessType) + "&"; - if (applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' cannot be null."); - else if (applicationKey !== undefined) - url_ += "applicationKey=" + encodeURIComponent("" + applicationKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(groupName, 'groupName'); + Guard.notNull(accessType, 'accessType'); + Guard.notNull(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/bulk") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("groupId", groupId) + .paramArray("groupName", groupName) + .param("accessType", accessType) + .param("applicationKey", applicationKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -9638,28 +9283,19 @@ export class Client { * @return Returned if the request is successful. */ getUsersFromGroup(groupname?: string | undefined, groupId?: string | undefined, includeInactiveUsers?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/member?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (includeInactiveUsers === null) - throw new globalThis.Error("The parameter 'includeInactiveUsers' cannot be null."); - else if (includeInactiveUsers !== undefined) - url_ += "includeInactiveUsers=" + encodeURIComponent("" + includeInactiveUsers) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(includeInactiveUsers, 'includeInactiveUsers'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/member") + .param("groupname", groupname) + .param("groupId", groupId) + .param("includeInactiveUsers", includeInactiveUsers) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -9717,24 +9353,17 @@ export class Client { * @return Returned if the request is successful. */ removeUserFromGroup(accountId: string, groupname?: string | undefined, groupId?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("accountId", accountId) + .param("groupname", groupname) + .param("groupId", groupId) + .param("username", username) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -9787,16 +9416,13 @@ export class Client { * @return Returned if the request is successful. */ addUserToGroup(body: UpdateUserToGroupBean, groupname?: string | undefined, groupId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("groupname", groupname) + .param("groupId", groupId) + .toString(); const content_ = JSON.stringify(body); @@ -9865,36 +9491,23 @@ export class Client { * @return Returned if the request is successful. */ findGroups(accountId?: string | undefined, query?: string | undefined, exclude?: string[] | undefined, excludeId?: string[] | undefined, maxResults?: number | undefined, caseInsensitive?: boolean | undefined, userName?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/groups/picker?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeId === null) - throw new globalThis.Error("The parameter 'excludeId' cannot be null."); - else if (excludeId !== undefined) - excludeId && excludeId.forEach(item => { url_ += "excludeId=" + encodeURIComponent("" + item) + "&"; }); - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (userName === null) - throw new globalThis.Error("The parameter 'userName' cannot be null."); - else if (userName !== undefined) - url_ += "userName=" + encodeURIComponent("" + userName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeId, 'excludeId'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(userName, 'userName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groups/picker") + .param("accountId", accountId) + .param("query", query) + .paramArray("exclude", exclude) + .paramArray("excludeId", excludeId) + .param("maxResults", maxResults) + .param("caseInsensitive", caseInsensitive) + .param("userName", userName) + .toString(); let options_: RequestInit = { method: "GET", @@ -9940,44 +9553,27 @@ export class Client { * @return Returned if the request is successful. */ findUsersAndGroups(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, fieldId?: string | undefined, projectId?: string[] | undefined, issueTypeId?: string[] | undefined, avatarSize?: AvatarSize | undefined, caseInsensitive?: boolean | undefined, excludeConnectAddons?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/groupuserpicker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' cannot be null."); - else if (fieldId !== undefined) - url_ += "fieldId=" + encodeURIComponent("" + fieldId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - issueTypeId && issueTypeId.forEach(item => { url_ += "issueTypeId=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(fieldId, 'fieldId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groupuserpicker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .param("fieldId", fieldId) + .paramArray("projectId", projectId) + .paramArray("issueTypeId", issueTypeId) + .param("avatarSize", avatarSize) + .param("caseInsensitive", caseInsensitive) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); let options_: RequestInit = { method: "GET", @@ -10030,8 +9626,8 @@ export class Client { * @return Returned if the request is successful. */ getLicense(): Promise { - let url_ = this.baseUrl + "/rest/api/3/instance/license"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/instance/license") + .toString(); let options_: RequestInit = { method: "GET", @@ -10073,12 +9669,11 @@ export class Client { * @return Returned if the request is successful. */ createIssue(body: IssueUpdateDetails, updateHistory?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue?"; - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(updateHistory, 'updateHistory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue") + .param("updateHistory", updateHistory) + .toString(); const content_ = JSON.stringify(body); @@ -10148,8 +9743,8 @@ export class Client { * @return Returns the URL to check the status of the submitted request. */ archiveIssues(body: ArchiveIssueAsyncRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -10208,8 +9803,8 @@ export class Client { * @return Returned if there is at least one valid issue to archive in the request. The return message will include the count of archived issues and subtasks, as well as error details for issues which failed to get archived. */ archiveIssues(body: IssueArchivalSyncRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -10274,8 +9869,8 @@ export class Client { * is invalid for any other reason. */ createIssues(body: IssuesUpdateBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/bulk"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulk") + .toString(); const content_ = JSON.stringify(body); @@ -10328,8 +9923,8 @@ export class Client { * @return Returned if the request is successful. A response may contain both successful issues and issue errors. */ bulkFetchIssues(body: BulkFetchIssueRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -10384,28 +9979,19 @@ export class Client { * @deprecated */ getCreateIssueMeta(projectIds?: string[] | undefined, projectKeys?: string[] | undefined, issuetypeIds?: string[] | undefined, issuetypeNames?: string[] | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta?"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - if (projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' cannot be null."); - else if (projectKeys !== undefined) - projectKeys && projectKeys.forEach(item => { url_ += "projectKeys=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeIds === null) - throw new globalThis.Error("The parameter 'issuetypeIds' cannot be null."); - else if (issuetypeIds !== undefined) - issuetypeIds && issuetypeIds.forEach(item => { url_ += "issuetypeIds=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeNames === null) - throw new globalThis.Error("The parameter 'issuetypeNames' cannot be null."); - else if (issuetypeNames !== undefined) - issuetypeNames && issuetypeNames.forEach(item => { url_ += "issuetypeNames=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIds, 'projectIds'); + Guard.notNull(projectKeys, 'projectKeys'); + Guard.notNull(issuetypeIds, 'issuetypeIds'); + Guard.notNull(issuetypeNames, 'issuetypeNames'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta") + .paramArray("projectIds", projectIds) + .paramArray("projectKeys", projectKeys) + .paramArray("issuetypeIds", issuetypeIds) + .paramArray("issuetypeNames", issuetypeNames) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -10449,19 +10035,15 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypes(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -10510,22 +10092,17 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypeId(projectIdOrKey: string, issueTypeId: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}") + .path("projectIdOrKey", projectIdOrKey) + .path("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -10573,12 +10150,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLimitReport(isReturningKeys?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/limit/report?"; - if (isReturningKeys === null) - throw new globalThis.Error("The parameter 'isReturningKeys' cannot be null."); - else if (isReturningKeys !== undefined) - url_ += "isReturningKeys=" + encodeURIComponent("" + isReturningKeys) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(isReturningKeys, 'isReturningKeys'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/limit/report") + .param("isReturningKeys", isReturningKeys) + .toString(); let options_: RequestInit = { method: "GET", @@ -10629,32 +10205,21 @@ export class Client { * @return Returned if the request is successful. */ getIssuePickerResource(query?: string | undefined, currentJQL?: string | undefined, currentIssueKey?: string | undefined, currentProjectId?: string | undefined, showSubTasks?: boolean | undefined, showSubTaskParent?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/picker?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (currentJQL === null) - throw new globalThis.Error("The parameter 'currentJQL' cannot be null."); - else if (currentJQL !== undefined) - url_ += "currentJQL=" + encodeURIComponent("" + currentJQL) + "&"; - if (currentIssueKey === null) - throw new globalThis.Error("The parameter 'currentIssueKey' cannot be null."); - else if (currentIssueKey !== undefined) - url_ += "currentIssueKey=" + encodeURIComponent("" + currentIssueKey) + "&"; - if (currentProjectId === null) - throw new globalThis.Error("The parameter 'currentProjectId' cannot be null."); - else if (currentProjectId !== undefined) - url_ += "currentProjectId=" + encodeURIComponent("" + currentProjectId) + "&"; - if (showSubTasks === null) - throw new globalThis.Error("The parameter 'showSubTasks' cannot be null."); - else if (showSubTasks !== undefined) - url_ += "showSubTasks=" + encodeURIComponent("" + showSubTasks) + "&"; - if (showSubTaskParent === null) - throw new globalThis.Error("The parameter 'showSubTaskParent' cannot be null."); - else if (showSubTaskParent !== undefined) - url_ += "showSubTaskParent=" + encodeURIComponent("" + showSubTaskParent) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(currentJQL, 'currentJQL'); + Guard.notNull(currentIssueKey, 'currentIssueKey'); + Guard.notNull(currentProjectId, 'currentProjectId'); + Guard.notNull(showSubTasks, 'showSubTasks'); + Guard.notNull(showSubTaskParent, 'showSubTaskParent'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/picker") + .param("query", query) + .param("currentJQL", currentJQL) + .param("currentIssueKey", currentIssueKey) + .param("currentProjectId", currentProjectId) + .param("showSubTasks", showSubTasks) + .param("showSubTaskParent", showSubTaskParent) + .toString(); let options_: RequestInit = { method: "GET", @@ -10695,8 +10260,8 @@ export class Client { * @param body Issue properties to be set or updated with values. */ bulkSetIssuesPropertiesList(body: IssueEntityProperties): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties") + .toString(); const content_ = JSON.stringify(body); @@ -10747,8 +10312,8 @@ export class Client { * @param body Details of the issue properties to be set or updated. Note that if an issue is not found, it is ignored. */ bulkSetIssuePropertiesByIssue(body: MultiIssueEntityProperties): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/multi"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/multi") + .toString(); const content_ = JSON.stringify(body); @@ -10806,11 +10371,11 @@ export class Client { * @param propertyKey The key of the property. */ bulkDeleteIssueProperty(propertyKey: string, body: IssueFilterForBulkPropertyDelete): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -10861,11 +10426,11 @@ export class Client { * @param propertyKey The key of the property. The maximum length is 255 characters. */ bulkSetIssueProperty(propertyKey: string, body: BulkIssuePropertyUpdateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -10917,8 +10482,8 @@ export class Client { * @return Returned if there is at least one valid issue to unarchive in the request. It will return the count of unarchived issues, which also includes the count of the subtasks unarchived, and it will show the detailed errors for those issues which are not unarchived. */ unarchiveIssues(body: IssueArchivalSyncRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/unarchive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/unarchive") + .toString(); const content_ = JSON.stringify(body); @@ -10976,8 +10541,8 @@ export class Client { * @return Returned if the request is successful */ getIsWatchingIssueBulk(body: IssueList): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/watching"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/watching") + .toString(); const content_ = JSON.stringify(body); @@ -11024,15 +10589,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssue(issueIdOrKey: string, deleteSubtasks?: DeleteSubtasks | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (deleteSubtasks === null) - throw new globalThis.Error("The parameter 'deleteSubtasks' cannot be null."); - else if (deleteSubtasks !== undefined) - url_ += "deleteSubtasks=" + encodeURIComponent("" + deleteSubtasks) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(deleteSubtasks, 'deleteSubtasks'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("deleteSubtasks", deleteSubtasks) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -11121,35 +10684,23 @@ export class Client { * @return Returned if the request is successful. */ getIssue(issueIdOrKey: string, fields?: string[] | undefined, fieldsByKeys?: boolean | undefined, expand?: string | undefined, properties?: string[] | undefined, updateHistory?: boolean | undefined, failFast?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(fields, 'fields'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(updateHistory, 'updateHistory'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .paramArray("fields", fields) + .param("fieldsByKeys", fieldsByKeys) + .param("expand", expand) + .paramArray("properties", properties) + .param("updateHistory", updateHistory) + .param("failFast", failFast) + .toString(); let options_: RequestInit = { method: "GET", @@ -11200,31 +10751,21 @@ export class Client { * @return Returned if the request is successful and the `returnIssue` parameter is `true` */ editIssue(issueIdOrKey: string, body: IssueUpdateDetails, notifyUsers?: boolean | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined, returnIssue?: boolean | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (returnIssue === null) - throw new globalThis.Error("The parameter 'returnIssue' cannot be null."); - else if (returnIssue !== undefined) - url_ += "returnIssue=" + encodeURIComponent("" + returnIssue) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(returnIssue, 'returnIssue'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .param("returnIssue", returnIssue) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -11300,11 +10841,11 @@ export class Client { * @return Returned if the request is successful. */ assignIssue(issueIdOrKey: string, body: User): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -11359,11 +10900,11 @@ export class Client { * @return Returned if the request is successful. */ addAttachment(issueIdOrKey: string, body: Blob): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = body; @@ -11426,19 +10967,15 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogs(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -11480,11 +11017,11 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogsByIds(issueIdOrKey: string, body: IssueChangelogIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -11538,27 +11075,19 @@ export class Client { * @return Returned if the request is successful. */ getComments(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy6 | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -11609,15 +11138,13 @@ export class Client { * @return Returned if the request is successful. */ addComment(issueIdOrKey: string, body: Comment, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -11676,14 +11203,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComment(issueIdOrKey: string, id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -11735,18 +11261,15 @@ export class Client { * @return Returned if the request is successful. */ getComment(issueIdOrKey: string, id: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -11796,26 +11319,19 @@ export class Client { * @return Returned if the request is successful. */ updateComment(issueIdOrKey: string, id: string, body: Comment, notifyUsers?: boolean | undefined, overrideEditableFlag?: boolean | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("overrideEditableFlag", overrideEditableFlag) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -11871,19 +11387,15 @@ export class Client { * @return Returned if the request is successful. */ getEditIssueMeta(issueIdOrKey: string, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta") + .path("issueIdOrKey", issueIdOrKey) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_: RequestInit = { method: "GET", @@ -11934,11 +11446,11 @@ export class Client { * @return Returned if the email is queued for sending. */ notify(issueIdOrKey: string, body: Notification): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -11993,11 +11505,11 @@ export class Client { * @return Returned if the request is successful. */ getIssuePropertyKeys(issueIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -12040,14 +11552,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueProperty(issueIdOrKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -12090,14 +11601,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueProperty(issueIdOrKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -12145,14 +11655,13 @@ export class Client { * @return Returned if the issue property is updated. */ setIssueProperty(issueIdOrKey: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -12220,15 +11729,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkByGlobalId(issueIdOrKey: string, globalId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === undefined || globalId === null) - throw new globalThis.Error("The parameter 'globalId' must be defined and cannot be null."); - else - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -12279,15 +11786,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinks(issueIdOrKey: string, globalId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === null) - throw new globalThis.Error("The parameter 'globalId' cannot be null."); - else if (globalId !== undefined) - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); let options_: RequestInit = { method: "GET", @@ -12345,11 +11850,11 @@ export class Client { * @return Returned if the remote issue link is updated. */ createOrUpdateRemoteIssueLink(issueIdOrKey: string, body: RemoteIssueLinkRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -12415,14 +11920,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkById(issueIdOrKey: string, linkId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -12473,14 +11977,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinkById(issueIdOrKey: string, linkId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); let options_: RequestInit = { method: "GET", @@ -12535,14 +12038,13 @@ export class Client { * @return Returned if the request is successful. */ updateRemoteIssueLink(issueIdOrKey: string, linkId: string, body: RemoteIssueLinkRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); const content_ = JSON.stringify(body); @@ -12606,31 +12108,21 @@ export class Client { * @return Returned if the request is successful. */ getTransitions(issueIdOrKey: string, expand?: string | undefined, transitionId?: string | undefined, skipRemoteOnlyCondition?: boolean | undefined, includeUnavailableTransitions?: boolean | undefined, sortByOpsBarAndStatus?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' cannot be null."); - else if (transitionId !== undefined) - url_ += "transitionId=" + encodeURIComponent("" + transitionId) + "&"; - if (skipRemoteOnlyCondition === null) - throw new globalThis.Error("The parameter 'skipRemoteOnlyCondition' cannot be null."); - else if (skipRemoteOnlyCondition !== undefined) - url_ += "skipRemoteOnlyCondition=" + encodeURIComponent("" + skipRemoteOnlyCondition) + "&"; - if (includeUnavailableTransitions === null) - throw new globalThis.Error("The parameter 'includeUnavailableTransitions' cannot be null."); - else if (includeUnavailableTransitions !== undefined) - url_ += "includeUnavailableTransitions=" + encodeURIComponent("" + includeUnavailableTransitions) + "&"; - if (sortByOpsBarAndStatus === null) - throw new globalThis.Error("The parameter 'sortByOpsBarAndStatus' cannot be null."); - else if (sortByOpsBarAndStatus !== undefined) - url_ += "sortByOpsBarAndStatus=" + encodeURIComponent("" + sortByOpsBarAndStatus) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(transitionId, 'transitionId'); + Guard.notNull(skipRemoteOnlyCondition, 'skipRemoteOnlyCondition'); + Guard.notNull(includeUnavailableTransitions, 'includeUnavailableTransitions'); + Guard.notNull(sortByOpsBarAndStatus, 'sortByOpsBarAndStatus'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .param("transitionId", transitionId) + .param("skipRemoteOnlyCondition", skipRemoteOnlyCondition) + .param("includeUnavailableTransitions", includeUnavailableTransitions) + .param("sortByOpsBarAndStatus", sortByOpsBarAndStatus) + .toString(); let options_: RequestInit = { method: "GET", @@ -12676,11 +12168,11 @@ export class Client { * @return Returned if the request is successful. */ doTransition(issueIdOrKey: string, body: IssueUpdateDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -12747,11 +12239,11 @@ export class Client { * @return Returned if the request is successful. */ removeVote(issueIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -12793,11 +12285,11 @@ export class Client { * @return Returned if the request is successful. */ getVotes(issueIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -12843,11 +12335,11 @@ export class Client { * @return Returned if the request is successful. */ addVote(issueIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: RequestInit = { method: "POST", @@ -12900,19 +12392,15 @@ export class Client { * @return Returned if the request is successful. */ removeWatcher(issueIdOrKey: string, username?: string | undefined, accountId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .param("username", username) + .param("accountId", accountId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -12962,11 +12450,11 @@ export class Client { * @return Returned if the request is successful */ getIssueWatchers(issueIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -13013,11 +12501,11 @@ export class Client { * @return Returned if the request is successful. */ addWatcher(issueIdOrKey: string, body: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -13082,19 +12570,15 @@ export class Client { * @return Returned if the bulk deletion request was partially successful, with a message indicating partial success. */ bulkDeleteWorklogs(issueIdOrKey: string, body: WorklogIdsRequestBean, adjustEstimate?: AdjustEstimate | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -13153,31 +12637,21 @@ export class Client { * @return Returned if the request is successful */ getIssueWorklog(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, startedAfter?: number | undefined, startedBefore?: number | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (startedAfter === null) - throw new globalThis.Error("The parameter 'startedAfter' cannot be null."); - else if (startedAfter !== undefined) - url_ += "startedAfter=" + encodeURIComponent("" + startedAfter) + "&"; - if (startedBefore === null) - throw new globalThis.Error("The parameter 'startedBefore' cannot be null."); - else if (startedBefore !== undefined) - url_ += "startedBefore=" + encodeURIComponent("" + startedBefore) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(startedAfter, 'startedAfter'); + Guard.notNull(startedBefore, 'startedBefore'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("startedAfter", startedAfter) + .param("startedBefore", startedBefore) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -13234,35 +12708,23 @@ export class Client { * @return Returned if the request is successful. */ addWorklog(issueIdOrKey: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate2 | undefined, newEstimate?: string | undefined, reduceBy?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (reduceBy === null) - throw new globalThis.Error("The parameter 'reduceBy' cannot be null."); - else if (reduceBy !== undefined) - url_ += "reduceBy=" + encodeURIComponent("" + reduceBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(reduceBy, 'reduceBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("reduceBy", reduceBy) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -13325,19 +12787,15 @@ export class Client { * @return Returned if the request is partially successful. */ bulkMoveWorklogs(issueIdOrKey: string, body: WorklogsMoveRequestBean, adjustEstimate?: AdjustEstimate3 | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -13402,34 +12860,23 @@ export class Client { * @return Returned if the request is successful. */ deleteWorklog(issueIdOrKey: string, id: string, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate4 | undefined, newEstimate?: string | undefined, increaseBy?: string | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (increaseBy === null) - throw new globalThis.Error("The parameter 'increaseBy' cannot be null."); - else if (increaseBy !== undefined) - url_ += "increaseBy=" + encodeURIComponent("" + increaseBy) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(increaseBy, 'increaseBy'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("increaseBy", increaseBy) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -13479,18 +12926,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklog(issueIdOrKey: string, id: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -13546,34 +12990,23 @@ export class Client { * @return Returned if the request is successful */ updateWorklog(issueIdOrKey: string, id: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate5 | undefined, newEstimate?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -13628,14 +13061,13 @@ export class Client { * @return Returned if the request is successful. */ getWorklogPropertyKeys(issueIdOrKey: string, worklogId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .toString(); let options_: RequestInit = { method: "GET", @@ -13687,17 +13119,15 @@ export class Client { * @return Returned if the worklog property is removed. */ deleteWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -13749,17 +13179,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -13812,17 +13240,15 @@ export class Client { * @return Returned if the worklog property is updated. */ setWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -13889,8 +13315,8 @@ export class Client { * @return Returned if the request is successful. */ linkIssues(body: LinkIssueRequestJsonBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLink"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink") + .toString(); const content_ = JSON.stringify(body); @@ -13949,11 +13375,11 @@ export class Client { * @return 200 response */ deleteIssueLink(linkId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -14003,11 +13429,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLink(linkId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); let options_: RequestInit = { method: "GET", @@ -14056,8 +13482,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkTypes(): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); let options_: RequestInit = { method: "GET", @@ -14102,8 +13528,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueLinkType(body: IssueLinkType): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); const content_ = JSON.stringify(body); @@ -14157,11 +13583,11 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueLinkType(issueLinkTypeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -14207,11 +13633,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkType(issueLinkTypeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -14261,11 +13687,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueLinkType(issueLinkTypeId: string, body: IssueLinkType): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); const content_ = JSON.stringify(body); @@ -14319,8 +13745,8 @@ export class Client { * @return Returns the details of your export task. You can use the [get task](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/#api-rest-api-3-task-taskid-get) API to view the progress of your request. */ exportArchivedIssues(body: ArchivedIssuesFilterRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issues/archive/export"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issues/archive/export") + .toString(); const content_ = JSON.stringify(body); @@ -14377,8 +13803,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecuritySchemes(): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); let options_: RequestInit = { method: "GET", @@ -14423,8 +13849,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueSecurityScheme(body: CreateIssueSecuritySchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); const content_ = JSON.stringify(body); @@ -14491,28 +13917,19 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevels(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, onlyDefault?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .param("onlyDefault", onlyDefault) + .toString(); let options_: RequestInit = { method: "GET", @@ -14570,8 +13987,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultLevels(body: SetDefaultLevelsRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default") + .toString(); const content_ = JSON.stringify(body); @@ -14653,32 +14070,21 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelMembers(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, levelId?: string[] | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (levelId === null) - throw new globalThis.Error("The parameter 'levelId' cannot be null."); - else if (levelId !== undefined) - levelId && levelId.forEach(item => { url_ += "levelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(levelId, 'levelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .paramArray("levelId", levelId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -14731,24 +14137,17 @@ export class Client { * @return Returned if the request is successful. */ searchProjectsUsingSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, issueSecuritySchemeId?: string[] | undefined, projectId?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' cannot be null."); - else if (issueSecuritySchemeId !== undefined) - issueSecuritySchemeId && issueSecuritySchemeId.forEach(item => { url_ += "issueSecuritySchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecuritySchemeId", issueSecuritySchemeId) + .paramArray("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -14805,8 +14204,8 @@ export class Client { * Associate security scheme to project */ associateSchemesToProjects(body: AssociateSecuritySchemeWithProjectDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .toString(); const content_ = JSON.stringify(body); @@ -14885,24 +14284,17 @@ export class Client { * @return Returned if the request is successful. */ searchSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -14952,11 +14344,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityScheme(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -15002,11 +14394,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueSecurityScheme(id: string, body: UpdateIssueSecuritySchemeRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -15087,27 +14479,19 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevelMembers(issueSecuritySchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, issueSecurityLevelId?: string[] | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members?"; - if (issueSecuritySchemeId === undefined || issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' must be defined."); - url_ = url_.replace("{issueSecuritySchemeId}", encodeURIComponent("" + issueSecuritySchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecurityLevelId === null) - throw new globalThis.Error("The parameter 'issueSecurityLevelId' cannot be null."); - else if (issueSecurityLevelId !== undefined) - issueSecurityLevelId && issueSecurityLevelId.forEach(item => { url_ += "issueSecurityLevelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecurityLevelId, 'issueSecurityLevelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members") + .path("issueSecuritySchemeId", issueSecuritySchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecurityLevelId", issueSecurityLevelId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -15161,11 +14545,11 @@ export class Client { * @return Returned if the request is successful. */ deleteSecurityScheme(schemeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -15232,11 +14616,11 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevel(schemeId: string, body: AddSecuritySchemeLevelsRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -15308,18 +14692,15 @@ export class Client { * @param replaceWith (optional) The ID of the issue security level that will replace the currently selected level. */ removeLevel(schemeId: string, levelId: string, replaceWith?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.notNull(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .param("replaceWith", replaceWith) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -15392,14 +14773,13 @@ export class Client { * @return Returned if the request is successful. */ updateSecurityLevel(schemeId: string, levelId: string, body: UpdateIssueSecurityLevelDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -15471,14 +14851,13 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevelMembers(schemeId: string, levelId: string, body: SecuritySchemeMembersRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -15551,17 +14930,15 @@ export class Client { * @return Returned if the request is successful. */ removeMemberFromSecurityLevel(schemeId: string, levelId: string, memberId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (memberId === undefined || memberId === null) - throw new globalThis.Error("The parameter 'memberId' must be defined."); - url_ = url_.replace("{memberId}", encodeURIComponent("" + memberId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.required(memberId, 'memberId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .path("memberId", memberId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -15627,8 +15004,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueAllTypes(): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); let options_: RequestInit = { method: "GET", @@ -15672,8 +15049,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueType(body: IssueTypeCreateBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); const content_ = JSON.stringify(body); @@ -15736,16 +15113,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypesForProject(projectId: number, level?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (level === null) - throw new globalThis.Error("The parameter 'level' cannot be null."); - else if (level !== undefined) - url_ += "level=" + encodeURIComponent("" + level) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(level, 'level'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/project") + .param("projectId", projectId) + .param("level", level) + .toString(); let options_: RequestInit = { method: "GET", @@ -15799,15 +15173,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueType(id: string, alternativeIssueTypeId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (alternativeIssueTypeId === null) - throw new globalThis.Error("The parameter 'alternativeIssueTypeId' cannot be null."); - else if (alternativeIssueTypeId !== undefined) - url_ += "alternativeIssueTypeId=" + encodeURIComponent("" + alternativeIssueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(alternativeIssueTypeId, 'alternativeIssueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .param("alternativeIssueTypeId", alternativeIssueTypeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -15865,11 +15237,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueType(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -15915,11 +15287,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueType(id: string, body: IssueTypeUpdateBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -15981,11 +15353,11 @@ export class Client { * @return Returned if the request is successful. */ getAlternativeIssueTypes(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -16037,23 +15409,17 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeAvatar(id: string, size: number, body: any, x?: number | undefined, y?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2") + .path("id", id) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -16111,11 +15477,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypePropertyKeys(issueTypeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties") + .path("issueTypeId", issueTypeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -16162,14 +15528,13 @@ export class Client { * @return Returned if the issue type property is deleted. */ deleteIssueTypeProperty(issueTypeId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -16220,14 +15585,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeProperty(issueTypeId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -16279,14 +15643,13 @@ export class Client { * @return Returned if the issue type property is updated. */ setIssueTypeProperty(issueTypeId: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -16364,32 +15727,21 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueTypeSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy7 | undefined, expand?: string | undefined, queryString?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("expand", expand) + .param("queryString", queryString) + .toString(); let options_: RequestInit = { method: "GET", @@ -16438,8 +15790,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScheme(body: IssueTypeSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .toString(); const content_ = JSON.stringify(body); @@ -16499,20 +15851,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemesMapping(startAt?: number | undefined, maxResults?: number | undefined, issueTypeSchemeId?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' cannot be null."); - else if (issueTypeSchemeId !== undefined) - issueTypeSchemeId && issueTypeSchemeId.forEach(item => { url_ += "issueTypeSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeSchemeId", issueTypeSchemeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -16564,20 +15911,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemeForProjects(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -16626,8 +15968,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeSchemeToProject(body: IssueTypeSchemeProjectAssociation): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -16686,11 +16028,11 @@ export class Client { * @return Returned if the issue type scheme is deleted. */ deleteIssueTypeScheme(issueTypeSchemeId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -16745,11 +16087,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeSchemeUpdateDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -16808,11 +16150,11 @@ export class Client { * @return Returned if the request is successful. */ addIssueTypesToIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -16871,11 +16213,11 @@ export class Client { * @return Returned if the request is successful. */ reorderIssueTypesInIssueTypeScheme(issueTypeSchemeId: number, body: OrderOfIssueTypes): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -16935,14 +16277,13 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypeFromIssueTypeScheme(issueTypeSchemeId: number, issueTypeId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .path("issueTypeId", issueTypeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -17005,32 +16346,21 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, orderBy?: OrderBy8 | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -17080,8 +16410,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScreenScheme(body: IssueTypeScreenSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -17145,20 +16475,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, issueTypeScreenSchemeId?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' cannot be null."); - else if (issueTypeScreenSchemeId !== undefined) - issueTypeScreenSchemeId && issueTypeScreenSchemeId.forEach(item => { url_ += "issueTypeScreenSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -17210,20 +16535,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeProjectAssociations(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -17272,8 +16592,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeScreenSchemeToProject(body: IssueTypeScreenSchemeProjectAssociation): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -17332,11 +16652,11 @@ export class Client { * @return Returned if the issue type screen scheme is deleted. */ deleteIssueTypeScreenScheme(issueTypeScreenSchemeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -17392,11 +16712,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeUpdateDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -17455,11 +16775,11 @@ export class Client { * @return Returned if the request is successful. */ appendMappingsForIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeMappingDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -17522,11 +16842,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultScreenScheme(issueTypeScreenSchemeId: string, body: UpdateDefaultScreenScheme): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -17585,11 +16905,11 @@ export class Client { * @return Returned if the screen scheme mappings are removed from the issue type screen scheme. */ removeMappingsFromIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -17651,23 +16971,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectsForIssueTypeScreenScheme(issueTypeScreenSchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, query?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project?"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .toString(); let options_: RequestInit = { method: "GET", @@ -17716,8 +17030,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoComplete(): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); let options_: RequestInit = { method: "GET", @@ -17758,8 +17072,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoCompletePost(body: SearchAutoCompleteFilter): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); const content_ = JSON.stringify(body); @@ -17812,24 +17126,17 @@ export class Client { * @return Returned if the request is successful. */ getFieldAutoCompleteForQueryString(fieldName?: string | undefined, fieldValue?: string | undefined, predicateName?: string | undefined, predicateValue?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions?"; - if (fieldName === null) - throw new globalThis.Error("The parameter 'fieldName' cannot be null."); - else if (fieldName !== undefined) - url_ += "fieldName=" + encodeURIComponent("" + fieldName) + "&"; - if (fieldValue === null) - throw new globalThis.Error("The parameter 'fieldValue' cannot be null."); - else if (fieldValue !== undefined) - url_ += "fieldValue=" + encodeURIComponent("" + fieldValue) + "&"; - if (predicateName === null) - throw new globalThis.Error("The parameter 'predicateName' cannot be null."); - else if (predicateName !== undefined) - url_ += "predicateName=" + encodeURIComponent("" + predicateName) + "&"; - if (predicateValue === null) - throw new globalThis.Error("The parameter 'predicateValue' cannot be null."); - else if (predicateValue !== undefined) - url_ += "predicateValue=" + encodeURIComponent("" + predicateValue) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(fieldName, 'fieldName'); + Guard.notNull(fieldValue, 'fieldValue'); + Guard.notNull(predicateName, 'predicateName'); + Guard.notNull(predicateValue, 'predicateValue'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions") + .param("fieldName", fieldName) + .param("fieldValue", fieldValue) + .param("predicateName", predicateName) + .param("predicateValue", predicateValue) + .toString(); let options_: RequestInit = { method: "GET", @@ -17886,24 +17193,17 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputations(functionKey?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (functionKey === null) - throw new globalThis.Error("The parameter 'functionKey' cannot be null."); - else if (functionKey !== undefined) - functionKey && functionKey.forEach(item => { url_ += "functionKey=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(functionKey, 'functionKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .paramArray("functionKey", functionKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .toString(); let options_: RequestInit = { method: "GET", @@ -17957,12 +17257,11 @@ export class Client { * @return 200 response */ updatePrecomputations(body: JqlFunctionPrecomputationUpdateRequestBean, skipNotFoundPrecomputations?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (skipNotFoundPrecomputations === null) - throw new globalThis.Error("The parameter 'skipNotFoundPrecomputations' cannot be null."); - else if (skipNotFoundPrecomputations !== undefined) - url_ += "skipNotFoundPrecomputations=" + encodeURIComponent("" + skipNotFoundPrecomputations) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(skipNotFoundPrecomputations, 'skipNotFoundPrecomputations'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .param("skipNotFoundPrecomputations", skipNotFoundPrecomputations) + .toString(); const content_ = JSON.stringify(body); @@ -18038,12 +17337,11 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputationsByID(body: JqlFunctionPrecomputationGetByIdRequest, orderBy?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation/search?"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation/search") + .param("orderBy", orderBy) + .toString(); const content_ = JSON.stringify(body); @@ -18100,8 +17398,8 @@ export class Client { * @return Returned if the request is successful. */ matchIssues(body: IssuesAndJQLQueries): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/match"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/match") + .toString(); const content_ = JSON.stringify(body); @@ -18151,12 +17449,11 @@ export class Client { * @return Returned if the request is successful. */ parseJqlQueries(validation: Validation, body: JqlQueriesToParse): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/parse?"; - if (validation === undefined || validation === null) - throw new globalThis.Error("The parameter 'validation' must be defined and cannot be null."); - else - url_ += "validation=" + encodeURIComponent("" + validation) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(validation, 'validation'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/parse") + .param("validation", validation) + .toString(); const content_ = JSON.stringify(body); @@ -18208,8 +17505,8 @@ export class Client { * @return Returned if the request is successful. Note that the JQL queries are returned in the same order that they were passed. */ migrateQueries(body: JQLPersonalDataMigrationRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/pdcleaner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/pdcleaner") + .toString(); const content_ = JSON.stringify(body); @@ -18266,8 +17563,8 @@ export class Client { * @return Returned if the request is successful. */ sanitiseJqlQueries(body: JqlQueriesToSanitize): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/sanitize"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/sanitize") + .toString(); const content_ = JSON.stringify(body); @@ -18331,16 +17628,13 @@ export class Client { * @return Returned if the request is successful. */ getAllLabels(startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/label?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/label") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -18377,8 +17671,8 @@ export class Client { * @return Returned if the request is successful. */ getApproximateLicenseCount(): Promise { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount") + .toString(); let options_: RequestInit = { method: "GET", @@ -18430,11 +17724,11 @@ export class Client { * @return Returned if the request is successful. */ getApproximateApplicationLicenseCount(applicationKey: ApplicationKey): Promise { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}"; - if (applicationKey === undefined || applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' must be defined."); - url_ = url_.replace("{applicationKey}", encodeURIComponent("" + applicationKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}") + .path("applicationKey", applicationKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -18493,40 +17787,25 @@ export class Client { * @return Returned if the request is successful. */ getMyPermissions(projectKey?: string | undefined, projectId?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, permissions?: string | undefined, projectUuid?: string | undefined, projectConfigurationUuid?: string | undefined, commentId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypermissions?"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (permissions === null) - throw new globalThis.Error("The parameter 'permissions' cannot be null."); - else if (permissions !== undefined) - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (projectUuid === null) - throw new globalThis.Error("The parameter 'projectUuid' cannot be null."); - else if (projectUuid !== undefined) - url_ += "projectUuid=" + encodeURIComponent("" + projectUuid) + "&"; - if (projectConfigurationUuid === null) - throw new globalThis.Error("The parameter 'projectConfigurationUuid' cannot be null."); - else if (projectConfigurationUuid !== undefined) - url_ += "projectConfigurationUuid=" + encodeURIComponent("" + projectConfigurationUuid) + "&"; - if (commentId === null) - throw new globalThis.Error("The parameter 'commentId' cannot be null."); - else if (commentId !== undefined) - url_ += "commentId=" + encodeURIComponent("" + commentId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(permissions, 'permissions'); + Guard.notNull(projectUuid, 'projectUuid'); + Guard.notNull(projectConfigurationUuid, 'projectConfigurationUuid'); + Guard.notNull(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypermissions") + .param("projectKey", projectKey) + .param("projectId", projectId) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("permissions", permissions) + .param("projectUuid", projectUuid) + .param("projectConfigurationUuid", projectConfigurationUuid) + .param("commentId", commentId) + .toString(); let options_: RequestInit = { method: "GET", @@ -18585,12 +17864,11 @@ export class Client { * @return Returned if the request is successful. */ removePreference(key: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -18632,12 +17910,11 @@ export class Client { * @return Returned if the request is successful. */ getPreference(key: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -18685,12 +17962,11 @@ export class Client { * @return Returned if the request is successful. */ setPreference(key: string, body: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); const content_ = JSON.stringify(body); @@ -18741,8 +18017,8 @@ export class Client { * @deprecated */ deleteLocale(): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); let options_: RequestInit = { method: "DELETE", @@ -18784,8 +18060,8 @@ export class Client { * @return Returned if the request is successful. */ getLocale(): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); let options_: RequestInit = { method: "GET", @@ -18828,8 +18104,8 @@ export class Client { * @deprecated */ setLocale(body: Locale): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); const content_ = JSON.stringify(body); @@ -18883,12 +18159,11 @@ export class Client { * @return Returned if the request is successful. */ getCurrentUser(expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/myself?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/myself") + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -18942,32 +18217,21 @@ export class Client { * @return Returned if the request is successful. Only returns notification schemes that the user has permission to access. An empty list is returned if the user lacks permission to access all notification schemes. */ getNotificationSchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -19012,8 +18276,8 @@ export class Client { * @return Returned if the request is successful. */ createNotificationScheme(body: CreateNotificationSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -19079,24 +18343,17 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeToProjectMappings(startAt?: string | undefined, maxResults?: string | undefined, notificationSchemeId?: string[] | undefined, projectId?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' cannot be null."); - else if (notificationSchemeId !== undefined) - notificationSchemeId && notificationSchemeId.forEach(item => { url_ += "notificationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(notificationSchemeId, 'notificationSchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("notificationSchemeId", notificationSchemeId) + .paramArray("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -19156,15 +18413,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationScheme(id: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -19214,11 +18469,11 @@ export class Client { * @return Returned if the request is successful. */ updateNotificationScheme(id: string, body: UpdateNotificationSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -19289,11 +18544,11 @@ export class Client { * @return Returned if the request is successful. */ addNotifications(id: string, body: AddNotificationsDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -19364,11 +18619,11 @@ export class Client { * @return Returned if the request is successful. */ deleteNotificationScheme(notificationSchemeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}") + .path("notificationSchemeId", notificationSchemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -19436,14 +18691,13 @@ export class Client { * @return Returned if the request is successful. */ removeNotificationFromNotificationScheme(notificationSchemeId: string, notificationId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - if (notificationId === undefined || notificationId === null) - throw new globalThis.Error("The parameter 'notificationId' must be defined."); - url_ = url_.replace("{notificationId}", encodeURIComponent("" + notificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + Guard.required(notificationId, 'notificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}") + .path("notificationSchemeId", notificationSchemeId) + .path("notificationId", notificationId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -19509,8 +18763,8 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissions(): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissions"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions") + .toString(); let options_: RequestInit = { method: "GET", @@ -19556,8 +18810,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkPermissions(body: BulkPermissionsRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissions/check"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/check") + .toString(); const content_ = JSON.stringify(body); @@ -19612,8 +18866,8 @@ export class Client { * @return Returned if the request is successful. */ getPermittedProjects(body: PermissionsKeysBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissions/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/project") + .toString(); const content_ = JSON.stringify(body); @@ -19670,12 +18924,11 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissionSchemes(expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -19725,12 +18978,11 @@ export class Client { * @return Returned if the permission scheme is created. */ createPermissionScheme(body: PermissionScheme, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -19784,11 +19036,11 @@ export class Client { * @return Returned if the permission scheme is deleted. */ deletePermissionScheme(schemeId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -19842,15 +19094,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionScheme(schemeId: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -19904,15 +19154,13 @@ export class Client { * @return Returned if the scheme is updated. */ updatePermissionScheme(schemeId: number, body: PermissionScheme, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -19974,15 +19222,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrants(schemeId: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -20037,15 +19283,13 @@ export class Client { * @return Returned if the scheme permission is created. */ createPermissionGrant(schemeId: number, body: PermissionGrant, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -20100,14 +19344,13 @@ export class Client { * @return Returned if the permission grant is deleted. */ deletePermissionSchemeEntity(schemeId: number, permissionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -20162,18 +19405,15 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrant(schemeId: number, permissionId: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -20222,24 +19462,17 @@ export class Client { * @return Returned if the request is successful. */ getPlans(includeTrashed?: boolean | undefined, includeArchived?: boolean | undefined, cursor?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (includeTrashed === null) - throw new globalThis.Error("The parameter 'includeTrashed' cannot be null."); - else if (includeTrashed !== undefined) - url_ += "includeTrashed=" + encodeURIComponent("" + includeTrashed) + "&"; - if (includeArchived === null) - throw new globalThis.Error("The parameter 'includeArchived' cannot be null."); - else if (includeArchived !== undefined) - url_ += "includeArchived=" + encodeURIComponent("" + includeArchived) + "&"; - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(includeTrashed, 'includeTrashed'); + Guard.notNull(includeArchived, 'includeArchived'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("includeTrashed", includeTrashed) + .param("includeArchived", includeArchived) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -20291,12 +19524,11 @@ export class Client { * @return Returned if the request is successful. */ createPlan(body: CreatePlanRequest, useGroupId?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -20361,15 +19593,13 @@ export class Client { * @return Returned if the request is successful. */ getPlan(planId: number, useGroupId?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); let options_: RequestInit = { method: "GET", @@ -20429,15 +19659,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlan(planId: number, body: any, useGroupId?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -20515,11 +19743,11 @@ export class Client { * @return Returned if the request is successful. */ archivePlan(planId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive") + .path("planId", planId) + .toString(); let options_: RequestInit = { method: "PUT", @@ -20586,11 +19814,11 @@ export class Client { * @return Returned if the request is successful. */ duplicatePlan(planId: number, body: DuplicatePlanRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -20670,19 +19898,15 @@ export class Client { * @return Returned if the request is successful. */ getTeams(planId: number, cursor?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team") + .path("planId", planId) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -20741,11 +19965,11 @@ export class Client { * @return Returned if the request is successful. */ addAtlassianTeam(planId: number, body: AddAtlassianTeamRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -20824,14 +20048,13 @@ export class Client { * @return Returned if the request is successful. */ removeAtlassianTeam(planId: number, atlassianTeamId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -20899,14 +20122,13 @@ export class Client { * @return Returned if the request is successful. */ getAtlassianTeam(planId: number, atlassianTeamId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); let options_: RequestInit = { method: "GET", @@ -20973,14 +20195,13 @@ export class Client { * @return Returned if the request is successful. */ updateAtlassianTeam(planId: number, atlassianTeamId: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -21058,11 +20279,11 @@ export class Client { * @return Returned if the request is successful. */ createPlanOnlyTeam(planId: number, body: CreatePlanOnlyTeamRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -21141,14 +20362,13 @@ export class Client { * @return Returned if the request is successful. */ deletePlanOnlyTeam(planId: number, planOnlyTeamId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -21216,14 +20436,13 @@ export class Client { * @return Returned if the request is successful. */ getPlanOnlyTeam(planId: number, planOnlyTeamId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); let options_: RequestInit = { method: "GET", @@ -21290,14 +20509,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlanOnlyTeam(planId: number, planOnlyTeamId: number, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -21375,11 +20593,11 @@ export class Client { * @return Returned if the request is successful. */ trashPlan(planId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash") + .path("planId", planId) + .toString(); let options_: RequestInit = { method: "PUT", @@ -21446,8 +20664,8 @@ export class Client { * @deprecated */ getPriorities(): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); let options_: RequestInit = { method: "GET", @@ -21496,8 +20714,8 @@ export class Client { * @deprecated */ createPriority(body: CreatePriorityDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); const content_ = JSON.stringify(body); @@ -21559,8 +20777,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultPriority(body: SetDefaultPriorityRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/default") + .toString(); const content_ = JSON.stringify(body); @@ -21630,8 +20848,8 @@ export class Client { * @return Returned if the request is successful. */ movePriorities(body: ReorderIssuePriorities): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/move") + .toString(); const content_ = JSON.stringify(body); @@ -21709,36 +20927,23 @@ export class Client { * @deprecated */ searchPriorities(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, priorityName?: string | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (priorityName === null) - throw new globalThis.Error("The parameter 'priorityName' cannot be null."); - else if (priorityName !== undefined) - url_ += "priorityName=" + encodeURIComponent("" + priorityName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(priorityName, 'priorityName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("priorityName", priorityName) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -21782,11 +20987,11 @@ export class Client { * @param id The ID of the issue priority. */ deletePriority(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -21858,11 +21063,11 @@ export class Client { * @return Returned if the request is successful. */ getPriority(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -21909,11 +21114,11 @@ export class Client { * @deprecated */ updatePriority(id: string, body: UpdatePriorityDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -21991,40 +21196,25 @@ export class Client { * @return Returned if the request is successful. */ getPrioritySchemes(startAt?: string | undefined, maxResults?: string | undefined, priorityId?: number[] | undefined, schemeId?: number[] | undefined, schemeName?: string | undefined, onlyDefault?: boolean | undefined, orderBy?: OrderBy9 | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (priorityId === null) - throw new globalThis.Error("The parameter 'priorityId' cannot be null."); - else if (priorityId !== undefined) - priorityId && priorityId.forEach(item => { url_ += "priorityId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeName === null) - throw new globalThis.Error("The parameter 'schemeName' cannot be null."); - else if (schemeName !== undefined) - url_ += "schemeName=" + encodeURIComponent("" + schemeName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(priorityId, 'priorityId'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(schemeName, 'schemeName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("priorityId", priorityId) + .paramArray("schemeId", schemeId) + .param("schemeName", schemeName) + .param("onlyDefault", onlyDefault) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -22069,8 +21259,8 @@ export class Client { * @return Returned if the request is completed. */ createPriorityScheme(body: CreatePrioritySchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .toString(); const content_ = JSON.stringify(body); @@ -22134,8 +21324,8 @@ export class Client { * @return Returned if the request is successful. */ suggestedPrioritiesForMappings(body: SuggestedMappingsRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -22189,28 +21379,19 @@ export class Client { * @return Returned if the request is successful. */ getAvailablePrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, query?: string | undefined, exclude?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/priorities/available?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined and cannot be null."); - else - url_ += "schemeId=" + encodeURIComponent("" + schemeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/priorities/available") + .param("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .paramArray("exclude", exclude) + .toString(); let options_: RequestInit = { method: "GET", @@ -22256,11 +21437,11 @@ export class Client { * @return Returned if the request is successful. */ deletePriorityScheme(schemeId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -22311,11 +21492,11 @@ export class Client { * @return Returned if the request is accepted. */ updatePriorityScheme(schemeId: number, body: UpdatePrioritySchemeRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -22375,19 +21556,15 @@ export class Client { * @return Returned if the request is successful. */ getPrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -22437,27 +21614,19 @@ export class Client { * @return Returned if the request is successful. */ getProjectsByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, projectId?: number[] | undefined, query?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("projectId", projectId) + .param("query", query) + .toString(); let options_: RequestInit = { method: "GET", @@ -22511,20 +21680,15 @@ export class Client { * @deprecated */ getAllProjects(expand?: string | undefined, recent?: number | undefined, properties?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (recent === null) - throw new globalThis.Error("The parameter 'recent' cannot be null."); - else if (recent !== undefined) - url_ += "recent=" + encodeURIComponent("" + recent) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(recent, 'recent'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .param("expand", expand) + .param("recent", recent) + .paramArray("properties", properties) + .toString(); let options_: RequestInit = { method: "GET", @@ -22573,8 +21737,8 @@ export class Client { * @return Returned if the project is created. */ createProject(body: CreateProjectDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .toString(); const content_ = JSON.stringify(body); @@ -22627,8 +21791,8 @@ export class Client { * @param body The JSON payload containing the project details and capabilities */ createProjectWithCustomTemplate(body: ProjectCustomTemplateCreateRequestDTO): Promise { - let url_ = this.baseUrl + "/rest/api/3/project-template"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project-template") + .toString(); const content_ = JSON.stringify(body); @@ -22680,21 +21844,13 @@ export class Client { * @return Returned if the request is successful. */ getRecent(expand?: string | undefined, properties?: StringList[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/recent?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/recent") + .param("expand", expand) + .paramArray("properties", properties) + .toString(); let options_: RequestInit = { method: "GET", @@ -22791,65 +21947,35 @@ export class Client { * @return Returned if the request is successful. */ searchProjects(startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy10 | undefined, id?: number[] | undefined, keys?: string[] | undefined, query?: string | undefined, typeKey?: string | undefined, categoryId?: number | undefined, action?: Action | undefined, expand?: string | undefined, status?: Status4[] | undefined, properties?: StringList[] | undefined, propertyQuery?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (typeKey === null) - throw new globalThis.Error("The parameter 'typeKey' cannot be null."); - else if (typeKey !== undefined) - url_ += "typeKey=" + encodeURIComponent("" + typeKey) + "&"; - if (categoryId === null) - throw new globalThis.Error("The parameter 'categoryId' cannot be null."); - else if (categoryId !== undefined) - url_ += "categoryId=" + encodeURIComponent("" + categoryId) + "&"; - if (action === null) - throw new globalThis.Error("The parameter 'action' cannot be null."); - else if (action !== undefined) - url_ += "action=" + encodeURIComponent("" + action) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - if (propertyQuery === null) - throw new globalThis.Error("The parameter 'propertyQuery' cannot be null."); - else if (propertyQuery !== undefined) - url_ += "propertyQuery=" + encodeURIComponent("" + propertyQuery) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(id, 'id'); + Guard.notNull(keys, 'keys'); + Guard.notNull(query, 'query'); + Guard.notNull(typeKey, 'typeKey'); + Guard.notNull(categoryId, 'categoryId'); + Guard.notNull(action, 'action'); + Guard.notNull(expand, 'expand'); + Guard.notNull(status, 'status'); + Guard.notNull(properties, 'properties'); + Guard.notNull(propertyQuery, 'propertyQuery'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .paramArray("id", id) + .paramArray("keys", keys) + .param("query", query) + .param("typeKey", typeKey) + .param("categoryId", categoryId) + .param("action", action) + .param("expand", expand) + .paramArray("status", status) + .paramArray("properties", properties) + .param("propertyQuery", propertyQuery) + .toString(); let options_: RequestInit = { method: "GET", @@ -22898,8 +22024,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectTypes(): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type") + .toString(); let options_: RequestInit = { method: "GET", @@ -22947,8 +22073,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAccessibleProjectTypes(): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type/accessible"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/accessible") + .toString(); let options_: RequestInit = { method: "GET", @@ -22993,11 +22119,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectTypeByKey(projectTypeKey: ProjectTypeKey): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}") + .path("projectTypeKey", projectTypeKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -23043,11 +22169,11 @@ export class Client { * @return Returned if the request is successful. */ getAccessibleProjectTypeByKey(projectTypeKey: ProjectTypeKey2): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible") + .path("projectTypeKey", projectTypeKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -23094,15 +22220,13 @@ export class Client { * @return Returned if the project is deleted. */ deleteProject(projectIdOrKey: string, enableUndo?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (enableUndo === null) - throw new globalThis.Error("The parameter 'enableUndo' cannot be null."); - else if (enableUndo !== undefined) - url_ += "enableUndo=" + encodeURIComponent("" + enableUndo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(enableUndo, 'enableUndo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("enableUndo", enableUndo) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -23152,19 +22276,15 @@ export class Client { * @return Returned if successful. */ getProject(projectIdOrKey: string, expand?: string | undefined, properties?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .paramArray("properties", properties) + .toString(); let options_: RequestInit = { method: "GET", @@ -23217,15 +22337,13 @@ export class Client { * @return Returned if the project is updated. */ updateProject(projectIdOrKey: string, body: UpdateProjectDetails, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -23283,11 +22401,11 @@ export class Client { * @return Returned if the request is successful. */ archiveProject(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "POST", @@ -23342,11 +22460,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectAvatar(projectIdOrKey: string, body: Avatar): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -23402,14 +22520,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectAvatar(projectIdOrKey: string, id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -23458,23 +22575,17 @@ export class Client { * @return Returned if the request is successful. */ createProjectAvatar(projectIdOrKey: string, body: any, x?: number | undefined, y?: number | undefined, size?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + Guard.notNull(size, 'size'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2") + .path("projectIdOrKey", projectIdOrKey) + .param("x", x) + .param("y", y) + .param("size", size) + .toString(); const content_ = JSON.stringify(body); @@ -23532,11 +22643,11 @@ export class Client { * @return Returned if request is successful. */ getAllProjectAvatars(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -23582,11 +22693,11 @@ export class Client { * @return Returned if the request is successful. */ removeDefaultProjectClassification(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -23637,11 +22748,11 @@ export class Client { * @return Returned if the request is successful. */ getDefaultProjectClassification(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -23688,11 +22799,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultProjectClassification(projectIdOrKey: string, body: UpdateDefaultProjectClassificationBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -23757,31 +22868,21 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponentsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy11 | undefined, componentSource?: ComponentSource | undefined, query?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(componentSource, 'componentSource'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("componentSource", componentSource) + .param("query", query) + .toString(); let options_: RequestInit = { method: "GET", @@ -23828,15 +22929,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponents(projectIdOrKey: string, componentSource?: ComponentSource2 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(componentSource, 'componentSource'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components") + .path("projectIdOrKey", projectIdOrKey) + .param("componentSource", componentSource) + .toString(); let options_: RequestInit = { method: "GET", @@ -23888,11 +22987,11 @@ export class Client { * @param projectIdOrKey The project ID or project key (case sensitive). */ deleteProjectAsynchronously(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "POST", @@ -23941,11 +23040,11 @@ export class Client { * @return Returned if the request is successful. */ getFeaturesForProject(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -24001,14 +23100,13 @@ export class Client { * @return Returned if the request is successful. */ toggleFeatureForProject(projectIdOrKey: string, featureKey: string, body: ProjectFeatureState): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (featureKey === undefined || featureKey === null) - throw new globalThis.Error("The parameter 'featureKey' must be defined."); - url_ = url_.replace("{featureKey}", encodeURIComponent("" + featureKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(featureKey, 'featureKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("featureKey", featureKey) + .toString(); const content_ = JSON.stringify(body); @@ -24066,11 +23164,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectPropertyKeys(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -24125,14 +23223,13 @@ export class Client { * @return Returned if the project property is deleted. */ deleteProjectProperty(projectIdOrKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -24183,14 +23280,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectProperty(projectIdOrKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -24246,14 +23342,13 @@ export class Client { * @return Returned if the project property is updated. */ setProjectProperty(projectIdOrKey: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -24320,11 +23415,11 @@ export class Client { * @return Returned if the request is successful. */ restore(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "POST", @@ -24374,11 +23469,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoles(projectIdOrKey: string): Promise<{ [key: string]: string; }> { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -24437,26 +23532,19 @@ export class Client { * @return Returned if the request is successful. */ deleteActor(projectIdOrKey: string, id: number, user?: string | undefined, group?: string | undefined, groupId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(group, 'group'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("user", user) + .param("group", group) + .param("groupId", groupId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -24500,18 +23588,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRole(projectIdOrKey: string, id: number, excludeInactiveUsers?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (excludeInactiveUsers === null) - throw new globalThis.Error("The parameter 'excludeInactiveUsers' cannot be null."); - else if (excludeInactiveUsers !== undefined) - url_ += "excludeInactiveUsers=" + encodeURIComponent("" + excludeInactiveUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(excludeInactiveUsers, 'excludeInactiveUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("excludeInactiveUsers", excludeInactiveUsers) + .toString(); let options_: RequestInit = { method: "GET", @@ -24565,14 +23650,13 @@ export class Client { For example, the cURL request above adds a group, *jira-developers*. For the response below to be returned as a result of that request, the user *Mia Krystof* would have previously been added as a `user` actor for this project. */ addActorUsers(projectIdOrKey: string, id: number, body: ActorsMap): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -24628,14 +23712,13 @@ export class Client { * @return Returned if the request is successful. The complete list of actors for the project is returned. */ setActors(projectIdOrKey: string, id: number, body: ProjectRoleActorsUpdateBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -24691,19 +23774,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleDetails(projectIdOrKey: string, currentMember?: boolean | undefined, excludeConnectAddons?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (currentMember === null) - throw new globalThis.Error("The parameter 'currentMember' cannot be null."); - else if (currentMember !== undefined) - url_ += "currentMember=" + encodeURIComponent("" + currentMember) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(currentMember, 'currentMember'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails") + .path("projectIdOrKey", projectIdOrKey) + .param("currentMember", currentMember) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); let options_: RequestInit = { method: "GET", @@ -24756,11 +23835,11 @@ export class Client { * @return Returned if the request is successful. */ getAllStatuses(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -24830,35 +23909,23 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersionsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy12 | undefined, query?: string | undefined, status?: string | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .param("status", status) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -24901,15 +23968,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersions(projectIdOrKey: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -24958,11 +24023,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectEmail(projectId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -25013,11 +24078,11 @@ export class Client { * @return Returned if the project's sender email address is successfully set. */ updateProjectEmail(projectId: number, body: ProjectEmailAddress): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); const content_ = JSON.stringify(body); @@ -25076,11 +24141,11 @@ export class Client { * @return Returned if the request is successful. */ getHierarchy(projectId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy") + .path("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -25130,11 +24195,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueSecurityScheme(projectKeyOrId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme") + .path("projectKeyOrId", projectKeyOrId) + .toString(); let options_: RequestInit = { method: "GET", @@ -25196,15 +24261,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeForProject(projectKeyOrId: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -25262,15 +24325,13 @@ export class Client { * @return Returned if the request is successful. */ getAssignedPermissionScheme(projectKeyOrId: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -25328,15 +24389,13 @@ export class Client { * @return Returned if the request is successful. */ assignPermissionScheme(projectKeyOrId: string, body: IdBean, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -25390,11 +24449,11 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelsForProject(projectKeyOrId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel") + .path("projectKeyOrId", projectKeyOrId) + .toString(); let options_: RequestInit = { method: "GET", @@ -25435,8 +24494,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectCategories(): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); let options_: RequestInit = { method: "GET", @@ -25484,8 +24543,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectCategory(body: ProjectCategory): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); const content_ = JSON.stringify(body); @@ -25543,11 +24602,11 @@ export class Client { * @return Returned if the request is successful. */ removeProjectCategory(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -25593,11 +24652,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectCategoryById(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -25642,11 +24701,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectCategory(id: number, body: ProjectCategory): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -25704,12 +24763,11 @@ export class Client { * @return Returned if the request is successful. */ validateProjectKey(key?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/key?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/key") + .param("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -25751,12 +24809,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectKey(key?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey") + .param("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -25799,12 +24856,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectName(name: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectName?"; - if (name === undefined || name === null) - throw new globalThis.Error("The parameter 'name' must be defined and cannot be null."); - else - url_ += "name=" + encodeURIComponent("" + name) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(name, 'name'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectName") + .param("name", name) + .toString(); let options_: RequestInit = { method: "GET", @@ -25855,8 +24911,8 @@ export class Client { * @deprecated */ getResolutions(): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); let options_: RequestInit = { method: "GET", @@ -25904,8 +24960,8 @@ export class Client { * @return Returned if the request is successful. */ createResolution(body: CreateResolutionDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); const content_ = JSON.stringify(body); @@ -25967,8 +25023,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultResolution(body: SetDefaultResolutionRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/default") + .toString(); const content_ = JSON.stringify(body); @@ -26038,8 +25094,8 @@ export class Client { * @return Returned if the request is successful. */ moveResolutions(body: ReorderIssueResolutionsRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/move") + .toString(); const content_ = JSON.stringify(body); @@ -26113,24 +25169,17 @@ export class Client { * @return Returned if the request is successful. */ searchResolutions(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, onlyDefault?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("onlyDefault", onlyDefault) + .toString(); let options_: RequestInit = { method: "GET", @@ -26175,15 +25224,13 @@ export class Client { * @param replaceWith The ID of the issue resolution that will replace the currently selected resolution. */ deleteResolution(id: string, replaceWith: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (replaceWith === undefined || replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' must be defined and cannot be null."); - else - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .param("replaceWith", replaceWith) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -26255,11 +25302,11 @@ export class Client { * @return Returned if the request is successful. */ getResolution(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -26305,11 +25352,11 @@ export class Client { * @return Returned if the request is successful. */ updateResolution(id: string, body: UpdateResolutionDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26379,8 +25426,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectRoles(): Promise { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); let options_: RequestInit = { method: "GET", @@ -26432,8 +25479,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectRole(body: CreateUpdateRoleRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); const content_ = JSON.stringify(body); @@ -26492,15 +25539,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRole(id: number, swap?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (swap === null) - throw new globalThis.Error("The parameter 'swap' cannot be null."); - else if (swap !== undefined) - url_ += "swap=" + encodeURIComponent("" + swap) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(swap, 'swap'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .param("swap", swap) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -26554,11 +25599,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleById(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -26608,11 +25653,11 @@ export class Client { * @return Returned if the request is successful. */ partialUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26670,11 +25715,11 @@ export class Client { * @return Returned if the request is successful. */ fullyUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26735,23 +25780,17 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRoleActorsFromRole(id: number, user?: string | undefined, groupId?: string | undefined, group?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(group, 'group'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .param("user", user) + .param("groupId", groupId) + .param("group", group) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -26805,11 +25844,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleActorsForRole(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -26863,11 +25902,11 @@ export class Client { * @return Returned if the request is successful. */ addProjectRoleActorsToRole(id: number, body: ActorInputBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26933,32 +25972,21 @@ export class Client { * @return Returned if the request is successful. */ getScreens(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, scope?: Scope2[] | undefined, orderBy?: OrderBy13 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - scope && scope.forEach(item => { url_ += "scope=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(scope, 'scope'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .paramArray("scope", scope) + .param("orderBy", orderBy) + .toString(); let options_: RequestInit = { method: "GET", @@ -27003,8 +26031,8 @@ export class Client { * @return Returned if the request is successful. */ createScreen(body: ScreenDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .toString(); const content_ = JSON.stringify(body); @@ -27058,11 +26086,11 @@ export class Client { * @return Returned if the request is successful. */ addFieldToDefaultScreen(fieldId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}") + .path("fieldId", fieldId) + .toString(); let options_: RequestInit = { method: "POST", @@ -27120,24 +26148,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkScreenTabs(screenId?: number[] | undefined, tabId?: number[] | undefined, startAt?: number | undefined, maxResult?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/tabs?"; - if (screenId === null) - throw new globalThis.Error("The parameter 'screenId' cannot be null."); - else if (screenId !== undefined) - screenId && screenId.forEach(item => { url_ += "screenId=" + encodeURIComponent("" + item) + "&"; }); - if (tabId === null) - throw new globalThis.Error("The parameter 'tabId' cannot be null."); - else if (tabId !== undefined) - tabId && tabId.forEach(item => { url_ += "tabId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(screenId, 'screenId'); + Guard.notNull(tabId, 'tabId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/tabs") + .paramArray("screenId", screenId) + .paramArray("tabId", tabId) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); let options_: RequestInit = { method: "GET", @@ -27184,11 +26205,11 @@ export class Client { * @return Returned if the request is successful. */ deleteScreen(screenId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -27238,11 +26259,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreen(screenId: number, body: UpdateScreenDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -27300,11 +26321,11 @@ export class Client { * @return Returned if the request is successful. */ getAvailableScreenFields(screenId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields") + .path("screenId", screenId) + .toString(); let options_: RequestInit = { method: "GET", @@ -27362,15 +26383,13 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabs(screenId: number, projectKey?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .param("projectKey", projectKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -27431,11 +26450,11 @@ export class Client { * @return Returned if the request is successful. */ addScreenTab(screenId: number, body: ScreenableTab): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -27494,14 +26513,13 @@ export class Client { * @return Returned if the request is successful. */ deleteScreenTab(screenId: number, tabId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -27548,14 +26566,13 @@ export class Client { * @return Returned if the request is successful. */ renameScreenTab(screenId: number, tabId: number, body: ScreenableTab): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -27615,18 +26632,15 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabFields(screenId: number, tabId: number, projectKey?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .param("projectKey", projectKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -27684,14 +26698,13 @@ export class Client { * @return Returned if the request is successful. */ addScreenTabField(screenId: number, tabId: number, body: AddFieldBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -27751,17 +26764,15 @@ export class Client { * @return Returned if the request is successful. */ removeScreenTabField(screenId: number, tabId: number, id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -27813,17 +26824,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTabField(screenId: number, tabId: number, id: string, body: MoveFieldBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -27884,17 +26893,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTab(screenId: number, tabId: number, pos: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (pos === undefined || pos === null) - throw new globalThis.Error("The parameter 'pos' must be defined."); - url_ = url_.replace("{pos}", encodeURIComponent("" + pos)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(pos, 'pos'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("pos", pos) + .toString(); let options_: RequestInit = { method: "POST", @@ -27957,32 +26964,21 @@ export class Client { * @return Returned if the request is successful. */ getScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy14 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .toString(); let options_: RequestInit = { method: "GET", @@ -28027,8 +27023,8 @@ export class Client { * @return Returned if the request is successful. */ createScreenScheme(body: ScreenSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -28086,11 +27082,11 @@ export class Client { * @return Returned if the screen scheme is deleted. */ deleteScreenScheme(screenSchemeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -28141,11 +27137,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreenScheme(screenSchemeId: string, body: UpdateScreenSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -28248,44 +27244,27 @@ export class Client { * @deprecated */ searchForIssuesUsingJql(jql?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, validateQuery?: ValidateQuery | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/search?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (validateQuery === null) - throw new globalThis.Error("The parameter 'validateQuery' cannot be null."); - else if (validateQuery !== undefined) - url_ += "validateQuery=" + encodeURIComponent("" + validateQuery) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(validateQuery, 'validateQuery'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .param("jql", jql) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("validateQuery", validateQuery) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .toString(); let options_: RequestInit = { method: "GET", @@ -28332,8 +27311,8 @@ export class Client { * @deprecated */ searchForIssuesUsingJqlPost(body: SearchRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .toString(); const content_ = JSON.stringify(body); @@ -28383,8 +27362,8 @@ export class Client { * @return Returned if the request is successful. */ countIssues(body: JQLCountRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/approximate-count"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/approximate-count") + .toString(); const content_ = JSON.stringify(body); @@ -28435,8 +27414,8 @@ export class Client { * @deprecated */ searchForIssuesIds(body: IdSearchRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/id"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/id") + .toString(); const content_ = JSON.stringify(body); @@ -28529,44 +27508,27 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJql(jql?: string | undefined, nextPageToken?: string | undefined, maxResults?: number | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined, reconcileIssues?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/jql?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - if (reconcileIssues === null) - throw new globalThis.Error("The parameter 'reconcileIssues' cannot be null."); - else if (reconcileIssues !== undefined) - reconcileIssues && reconcileIssues.forEach(item => { url_ += "reconcileIssues=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + Guard.notNull(reconcileIssues, 'reconcileIssues'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .param("jql", jql) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .paramArray("reconcileIssues", reconcileIssues) + .toString(); let options_: RequestInit = { method: "GET", @@ -28611,8 +27573,8 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJqlPost(body: SearchAndReconcileRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/jql"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .toString(); const content_ = JSON.stringify(body); @@ -28662,11 +27624,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevel(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/securitylevel/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/securitylevel/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -28711,8 +27673,8 @@ export class Client { * @return Returned if the request is successful. */ getServerInfo(): Promise { - let url_ = this.baseUrl + "/rest/api/3/serverInfo"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/serverInfo") + .toString(); let options_: RequestInit = { method: "GET", @@ -28753,8 +27715,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueNavigatorDefaultColumns(): Promise { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); let options_: RequestInit = { method: "GET", @@ -28814,14 +27776,12 @@ export class Client { * @return Returned if the request is successful. */ setIssueNavigatorDefaultColumns(body: ColumnRequestBody, columns?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_: RequestInit = { body: content_, @@ -28872,8 +27832,8 @@ export class Client { * @return Returned if the request is successful. */ getStatuses(): Promise { - let url_ = this.baseUrl + "/rest/api/3/status"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status") + .toString(); let options_: RequestInit = { method: "GET", @@ -28922,11 +27882,11 @@ export class Client { * @return Returned if the request is successful. */ getStatus(idOrName: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/status/{idOrName}"; - if (idOrName === undefined || idOrName === null) - throw new globalThis.Error("The parameter 'idOrName' must be defined."); - url_ = url_.replace("{idOrName}", encodeURIComponent("" + idOrName)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrName, 'idOrName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status/{idOrName}") + .path("idOrName", idOrName) + .toString(); let options_: RequestInit = { method: "GET", @@ -28971,8 +27931,8 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategories(): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuscategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory") + .toString(); let options_: RequestInit = { method: "GET", @@ -29021,11 +27981,11 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategory(idOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}"; - if (idOrKey === undefined || idOrKey === null) - throw new globalThis.Error("The parameter 'idOrKey' must be defined."); - url_ = url_.replace("{idOrKey}", encodeURIComponent("" + idOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrKey, 'idOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}") + .path("idOrKey", idOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -29073,12 +28033,11 @@ export class Client { * @return Returned if the request is successful. */ deleteStatusesById(id: string[]): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -29133,16 +28092,13 @@ export class Client { * @return Returned if the request is successful. */ getStatusesById(id: string[], expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -29195,8 +28151,8 @@ export class Client { * @return Returned if the request is successful. */ createStatuses(body: StatusCreateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -29257,8 +28213,8 @@ export class Client { * @return Returned if the request is successful. */ updateStatuses(body: StatusUpdateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -29323,32 +28279,21 @@ export class Client { * @return Returned if the request is successful. */ search(expand?: string | undefined, projectId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, searchString?: string | undefined, statusCategory?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/search?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (searchString === null) - throw new globalThis.Error("The parameter 'searchString' cannot be null."); - else if (searchString !== undefined) - url_ += "searchString=" + encodeURIComponent("" + searchString) + "&"; - if (statusCategory === null) - throw new globalThis.Error("The parameter 'statusCategory' cannot be null."); - else if (statusCategory !== undefined) - url_ += "statusCategory=" + encodeURIComponent("" + statusCategory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(searchString, 'searchString'); + Guard.notNull(statusCategory, 'statusCategory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/search") + .param("expand", expand) + .param("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("searchString", searchString) + .param("statusCategory", statusCategory) + .toString(); let options_: RequestInit = { method: "GET", @@ -29397,22 +28342,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueTypeUsagesForStatus(statusId: string, projectId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages") + .path("statusId", statusId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -29464,19 +28404,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -29528,19 +28464,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -29590,11 +28522,11 @@ export class Client { * @return Returned if the request is successful. */ getTask(taskId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}") + .path("taskId", taskId) + .toString(); let options_: RequestInit = { method: "GET", @@ -29644,11 +28576,11 @@ export class Client { * @return Returned if the request is successful. */ cancelTask(taskId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}/cancel"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}/cancel") + .path("taskId", taskId) + .toString(); let options_: RequestInit = { method: "POST", @@ -29748,20 +28680,15 @@ export class Client { * @return Returned if the request is successful. */ getUiModifications(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -29811,8 +28738,8 @@ export class Client { * @return Returned if the UI modification is created. */ createUiModification(body: CreateUiModificationDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .toString(); const content_ = JSON.stringify(body); @@ -29873,11 +28800,11 @@ export class Client { * @return Returned if the UI modification is deleted. */ deleteUiModification(uiModificationId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -29929,11 +28856,11 @@ export class Client { * @return Returned if the UI modification is updated. */ updateUiModification(uiModificationId: string, body: UpdateUiModificationDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); const content_ = JSON.stringify(body); @@ -29996,14 +28923,13 @@ export class Client { * @return Returned if the request is successful. */ getAvatars(type: Type3, entityId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .toString(); let options_: RequestInit = { method: "GET", @@ -30053,26 +28979,19 @@ export class Client { * @return Returned if the request is successful. */ storeAvatar(type: Type4, entityId: string, size: number, body: any, x?: number | undefined, y?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -30132,17 +29051,15 @@ export class Client { * @return Returned if the request is successful. */ deleteAvatar(type: Type5, owningObjectId: string, id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (owningObjectId === undefined || owningObjectId === null) - throw new globalThis.Error("The parameter 'owningObjectId' must be defined."); - url_ = url_.replace("{owningObjectId}", encodeURIComponent("" + owningObjectId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(owningObjectId, 'owningObjectId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}") + .path("type", type) + .path("owningObjectId", owningObjectId) + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -30190,19 +29107,15 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByType(type: Type6, size?: Size | undefined, format?: Format | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}") + .path("type", type) + .param("size", size) + .param("format", format) + .toString(); let options_: RequestInit = { method: "GET", @@ -30264,22 +29177,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByID(type: Type7, id: number, size?: Size2 | undefined, format?: Format2 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(id, 'id'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}") + .path("type", type) + .path("id", id) + .param("size", size) + .param("format", format) + .toString(); let options_: RequestInit = { method: "GET", @@ -30348,22 +29256,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByOwner(type: Type8, entityId: string, size?: Size3 | undefined, format?: Format3 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("format", format) + .toString(); let options_: RequestInit = { method: "GET", @@ -30431,20 +29334,15 @@ export class Client { * @return Returned if the request is successful. */ removeUser(accountId: string, username?: string | undefined, key?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -30500,24 +29398,17 @@ export class Client { * @return Returned if the request is successful. */ getUser(accountId?: string | undefined, username?: string | undefined, key?: string | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -30567,8 +29458,8 @@ export class Client { * @return Returned if the request is successful. */ createUser(body: NewUserDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/user"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .toString(); const content_ = JSON.stringify(body); @@ -30627,32 +29518,21 @@ export class Client { * @return Returned if the request is successful. */ findBulkAssignableUsers(projectKeys: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch?"; - if (projectKeys === undefined || projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' must be defined and cannot be null."); - else - url_ += "projectKeys=" + encodeURIComponent("" + projectKeys) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeys, 'projectKeys'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch") + .param("projectKeys", projectKeys) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -30723,52 +29603,31 @@ export class Client { * @return Returned if the request is successful. */ findAssignableUsers(query?: string | undefined, sessionId?: string | undefined, username?: string | undefined, accountId?: string | undefined, project?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, actionDescriptorId?: number | undefined, recommend?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (sessionId === null) - throw new globalThis.Error("The parameter 'sessionId' cannot be null."); - else if (sessionId !== undefined) - url_ += "sessionId=" + encodeURIComponent("" + sessionId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (project === null) - throw new globalThis.Error("The parameter 'project' cannot be null."); - else if (project !== undefined) - url_ += "project=" + encodeURIComponent("" + project) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (actionDescriptorId === null) - throw new globalThis.Error("The parameter 'actionDescriptorId' cannot be null."); - else if (actionDescriptorId !== undefined) - url_ += "actionDescriptorId=" + encodeURIComponent("" + actionDescriptorId) + "&"; - if (recommend === null) - throw new globalThis.Error("The parameter 'recommend' cannot be null."); - else if (recommend !== undefined) - url_ += "recommend=" + encodeURIComponent("" + recommend) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(sessionId, 'sessionId'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(project, 'project'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(actionDescriptorId, 'actionDescriptorId'); + Guard.notNull(recommend, 'recommend'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/search") + .param("query", query) + .param("sessionId", sessionId) + .param("username", username) + .param("accountId", accountId) + .param("project", project) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("actionDescriptorId", actionDescriptorId) + .param("recommend", recommend) + .toString(); let options_: RequestInit = { method: "GET", @@ -30833,28 +29692,19 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsers(accountId: string[], startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk") + .paramArray("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -30903,24 +29753,17 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsersMigration(startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/bulk/migration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk/migration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -30974,16 +29817,13 @@ export class Client { * @return Returned if the request is successful. */ resetUserColumns(accountId?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -31026,16 +29866,13 @@ export class Client { * @return Returned if the request is successful. */ getUserDefaultColumns(accountId?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); let options_: RequestInit = { method: "GET", @@ -31094,18 +29931,15 @@ export class Client { * @return Returned if the request is successful. */ setUserColumns(body: UserColumnRequestBody, accountId?: string | undefined, columns?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_: RequestInit = { body: content_, @@ -31166,12 +30000,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmail(accountId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/email?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email") + .param("accountId", accountId) + .toString(); let options_: RequestInit = { method: "GET", @@ -31225,12 +30058,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmailBulk(accountId: string[]): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/email/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email/bulk") + .paramArray("accountId", accountId) + .toString(); let options_: RequestInit = { method: "GET", @@ -31282,20 +30114,15 @@ export class Client { * @return Returned if the request is successful. */ getUserGroups(accountId: string, username?: string | undefined, key?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/groups?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/groups") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -31353,15 +30180,13 @@ export class Client { * @return Returned if the request is successful. */ getUserNavProperty(propertyKey: string, accountId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); let options_: RequestInit = { method: "GET", @@ -31417,15 +30242,13 @@ export class Client { * @return Returned if the user property is updated/created. */ setUserNavProperty(propertyKey: string, body: any, accountId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); const content_ = JSON.stringify(body); @@ -31532,40 +30355,25 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithAllPermissions(permissions: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/permission/search?"; - if (permissions === undefined || permissions === null) - throw new globalThis.Error("The parameter 'permissions' must be defined and cannot be null."); - else - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(permissions, 'permissions'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/permission/search") + .param("permissions", permissions) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -31636,36 +30444,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersForPicker(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, exclude?: string[] | undefined, excludeAccountIds?: string[] | undefined, avatarSize?: string | undefined, excludeConnectUsers?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/picker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeAccountIds === null) - throw new globalThis.Error("The parameter 'excludeAccountIds' cannot be null."); - else if (excludeAccountIds !== undefined) - excludeAccountIds && excludeAccountIds.forEach(item => { url_ += "excludeAccountIds=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (excludeConnectUsers === null) - throw new globalThis.Error("The parameter 'excludeConnectUsers' cannot be null."); - else if (excludeConnectUsers !== undefined) - url_ += "excludeConnectUsers=" + encodeURIComponent("" + excludeConnectUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeAccountIds, 'excludeAccountIds'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(excludeConnectUsers, 'excludeConnectUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/picker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .paramArray("exclude", exclude) + .paramArray("excludeAccountIds", excludeAccountIds) + .param("avatarSize", avatarSize) + .param("excludeConnectUsers", excludeConnectUsers) + .toString(); let options_: RequestInit = { method: "GET", @@ -31717,20 +30512,15 @@ export class Client { * @return Returned if the request is successful. */ getUserPropertyKeys(accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties") + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_: RequestInit = { method: "GET", @@ -31787,23 +30577,17 @@ export class Client { * @return Returned if the user property is deleted. */ deleteUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -31856,23 +30640,17 @@ export class Client { * @return Returned if the request is successful. */ getUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_: RequestInit = { method: "GET", @@ -31930,23 +30708,17 @@ export class Client { * @return Returned if the user property is updated. */ setUserProperty(propertyKey: string, body: any, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); const content_ = JSON.stringify(body); @@ -32022,32 +30794,21 @@ export class Client { * @return Returned if the request is successful. */ findUsers(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, property?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (property === null) - throw new globalThis.Error("The parameter 'property' cannot be null."); - else if (property !== undefined) - url_ += "property=" + encodeURIComponent("" + property) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(property, 'property'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("property", property) + .toString(); let options_: RequestInit = { method: "GET", @@ -32106,20 +30867,15 @@ export class Client { * @return Returned if the request is successful. */ findUsersByQuery(query: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/search/query?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query") + .param("query", query) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -32187,20 +30943,15 @@ export class Client { * @return Returned if the request is successful. */ findUserKeysByQuery(query: string, startAt?: number | undefined, maxResult?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/search/query/key?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query/key") + .param("query", query) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); let options_: RequestInit = { method: "GET", @@ -32272,36 +31023,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithBrowsePermission(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/viewissue/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/viewissue/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -32363,16 +31101,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsersDefault(startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/users?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -32430,16 +31165,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsers(startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/users/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -32495,8 +31227,8 @@ export class Client { * @return Returned if the request is successful. */ createVersion(body: Version): Promise { - let url_ = this.baseUrl + "/rest/api/3/version"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version") + .toString(); const content_ = JSON.stringify(body); @@ -32553,19 +31285,15 @@ export class Client { * @deprecated */ deleteVersion(id: string, moveFixIssuesTo?: string | undefined, moveAffectedIssuesTo?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveFixIssuesTo === null) - throw new globalThis.Error("The parameter 'moveFixIssuesTo' cannot be null."); - else if (moveFixIssuesTo !== undefined) - url_ += "moveFixIssuesTo=" + encodeURIComponent("" + moveFixIssuesTo) + "&"; - if (moveAffectedIssuesTo === null) - throw new globalThis.Error("The parameter 'moveAffectedIssuesTo' cannot be null."); - else if (moveAffectedIssuesTo !== undefined) - url_ += "moveAffectedIssuesTo=" + encodeURIComponent("" + moveAffectedIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveFixIssuesTo, 'moveFixIssuesTo'); + Guard.notNull(moveAffectedIssuesTo, 'moveAffectedIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("moveFixIssuesTo", moveFixIssuesTo) + .param("moveAffectedIssuesTo", moveAffectedIssuesTo) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -32617,15 +31345,13 @@ export class Client { * @return Returned if the request is successful. */ getVersion(id: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -32671,11 +31397,11 @@ export class Client { * @return Returned if the request is successful. */ updateVersion(id: string, body: Version): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32730,14 +31456,13 @@ export class Client { * @return Returned if the version is deleted. */ mergeVersions(id: string, moveIssuesTo: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === undefined || moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' must be defined."); - url_ = url_.replace("{moveIssuesTo}", encodeURIComponent("" + moveIssuesTo)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}") + .path("id", id) + .path("moveIssuesTo", moveIssuesTo) + .toString(); let options_: RequestInit = { method: "PUT", @@ -32788,11 +31513,11 @@ export class Client { * @return Returned if the request is successful. */ moveVersion(id: string, body: VersionMoveBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/move"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/move") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32846,11 +31571,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionRelatedIssues(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -32896,11 +31621,11 @@ export class Client { * @return Returned if the request is successful. */ getRelatedWork(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -32956,11 +31681,11 @@ export class Client { * @return Returned if the request is successful. */ createRelatedWork(id: string, body: VersionRelatedWork): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -33018,11 +31743,11 @@ export class Client { * @return Returned if the request is successful together with updated related work. */ updateRelatedWork(id: string, body: VersionRelatedWork): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -33080,11 +31805,11 @@ export class Client { * @return Returned if the version is deleted. */ deleteAndReplaceVersion(id: string, body: DeleteAndReplaceVersionBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -33139,11 +31864,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionUnresolvedIssues(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -33190,14 +31915,13 @@ export class Client { * @return Returned if the related work is deleted. */ deleteRelatedWork(versionId: string, relatedWorkId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}"; - if (versionId === undefined || versionId === null) - throw new globalThis.Error("The parameter 'versionId' must be defined."); - url_ = url_.replace("{versionId}", encodeURIComponent("" + versionId)); - if (relatedWorkId === undefined || relatedWorkId === null) - throw new globalThis.Error("The parameter 'relatedWorkId' must be defined."); - url_ = url_.replace("{relatedWorkId}", encodeURIComponent("" + relatedWorkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(versionId, 'versionId'); + Guard.required(relatedWorkId, 'relatedWorkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}") + .path("versionId", versionId) + .path("relatedWorkId", relatedWorkId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -33246,8 +31970,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWebhookById(body: ContainerForWebhookIDs): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -33300,16 +32024,13 @@ export class Client { * @return Returned if the request is successful. */ getDynamicWebhooksForApp(startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -33360,8 +32081,8 @@ export class Client { * @return Returned if the request is successful. */ registerDynamicWebhooks(body: WebhookRegistrationDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -33418,16 +32139,13 @@ export class Client { * @return Returned if the request is successful. */ getFailedWebhooks(maxResults?: number | undefined, after?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook/failed?"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (after === null) - throw new globalThis.Error("The parameter 'after' cannot be null."); - else if (after !== undefined) - url_ += "after=" + encodeURIComponent("" + after) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(after, 'after'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/failed") + .param("maxResults", maxResults) + .param("after", after) + .toString(); let options_: RequestInit = { method: "GET", @@ -33478,8 +32196,8 @@ export class Client { * @return Returned if the request is successful. */ refreshWebhooks(body: ContainerForWebhookIDs): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook/refresh"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/refresh") + .toString(); const content_ = JSON.stringify(body); @@ -33536,12 +32254,11 @@ export class Client { * @deprecated */ getAllWorkflows(workflowName?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow?"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .param("workflowName", workflowName) + .toString(); let options_: RequestInit = { method: "GET", @@ -33591,8 +32308,8 @@ export class Client { * @deprecated */ createWorkflow(body: CreateWorkflowDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .toString(); const content_ = JSON.stringify(body); @@ -33657,40 +32374,25 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowTransitionRuleConfigurations(types: Types[], startAt?: number | undefined, maxResults?: number | undefined, keys?: string[] | undefined, workflowNames?: string[] | undefined, withTags?: string[] | undefined, draft?: boolean | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config?"; - if (types === undefined || types === null) - throw new globalThis.Error("The parameter 'types' must be defined and cannot be null."); - else - types && types.forEach(item => { url_ += "types=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (workflowNames === null) - throw new globalThis.Error("The parameter 'workflowNames' cannot be null."); - else if (workflowNames !== undefined) - workflowNames && workflowNames.forEach(item => { url_ += "workflowNames=" + encodeURIComponent("" + item) + "&"; }); - if (withTags === null) - throw new globalThis.Error("The parameter 'withTags' cannot be null."); - else if (withTags !== undefined) - withTags && withTags.forEach(item => { url_ += "withTags=" + encodeURIComponent("" + item) + "&"; }); - if (draft === null) - throw new globalThis.Error("The parameter 'draft' cannot be null."); - else if (draft !== undefined) - url_ += "draft=" + encodeURIComponent("" + draft) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(types, 'types'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(keys, 'keys'); + Guard.notNull(workflowNames, 'workflowNames'); + Guard.notNull(withTags, 'withTags'); + Guard.notNull(draft, 'draft'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .paramArray("types", types) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("keys", keys) + .paramArray("workflowNames", workflowNames) + .paramArray("withTags", withTags) + .param("draft", draft) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -33749,8 +32451,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowTransitionRuleConfigurations(body: WorkflowTransitionRulesUpdate): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .toString(); const content_ = JSON.stringify(body); @@ -33809,8 +32511,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowTransitionRuleConfigurations(body: WorkflowsWithTransitionRulesDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config/delete") + .toString(); const content_ = JSON.stringify(body); @@ -33887,36 +32589,23 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowsPaginated(startAt?: number | undefined, maxResults?: number | undefined, workflowName?: string[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy15 | undefined, isActive?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - workflowName && workflowName.forEach(item => { url_ += "workflowName=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("workflowName", workflowName) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("isActive", isActive) + .toString(); let options_: RequestInit = { method: "GET", @@ -33968,23 +32657,17 @@ export class Client { * @return 200 response */ deleteWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, workflowMode?: WorkflowMode | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -34042,27 +32725,19 @@ export class Client { * @return 200 response */ getWorkflowTransitionProperties(transitionId: number, workflowName: string, includeReservedKeys?: boolean | undefined, key?: string | undefined, workflowMode?: WorkflowMode2 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (includeReservedKeys === null) - throw new globalThis.Error("The parameter 'includeReservedKeys' cannot be null."); - else if (includeReservedKeys !== undefined) - url_ += "includeReservedKeys=" + encodeURIComponent("" + includeReservedKeys) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(includeReservedKeys, 'includeReservedKeys'); + Guard.notNull(key, 'key'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("workflowName", workflowName) + .param("includeReservedKeys", includeReservedKeys) + .param("key", key) + .param("workflowMode", workflowMode) + .toString(); let options_: RequestInit = { method: "GET", @@ -34119,23 +32794,17 @@ export class Client { * @return 200 response */ createWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode3 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -34196,23 +32865,17 @@ export class Client { * @return 200 response */ updateWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode4 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -34274,11 +32937,11 @@ export class Client { * @return Returned if the workflow is deleted. */ deleteInactiveWorkflow(entityId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{entityId}"; - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{entityId}") + .path("entityId", entityId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -34331,22 +32994,17 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowProjectIssueTypeUsages(workflowId: string, projectId: number, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages") + .path("workflowId", workflowId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -34398,19 +33056,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -34462,19 +33116,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -34530,16 +33180,13 @@ export class Client { * @return Returned if the request is successful. */ readWorkflows(body: WorkflowReadRequest, expand?: string | undefined, useApprovalConfiguration?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (useApprovalConfiguration === null) - throw new globalThis.Error("The parameter 'useApprovalConfiguration' cannot be null."); - else if (useApprovalConfiguration !== undefined) - url_ += "useApprovalConfiguration=" + encodeURIComponent("" + useApprovalConfiguration) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(useApprovalConfiguration, 'useApprovalConfiguration'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows") + .param("expand", expand) + .param("useApprovalConfiguration", useApprovalConfiguration) + .toString(); const content_ = JSON.stringify(body); @@ -34591,20 +33238,15 @@ export class Client { * @return Returned if the request is successful. */ workflowCapabilities(workflowId?: string | undefined, projectId?: string | undefined, issueTypeId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/capabilities?"; - if (workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' cannot be null."); - else if (workflowId !== undefined) - url_ += "workflowId=" + encodeURIComponent("" + workflowId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowId, 'workflowId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/capabilities") + .param("workflowId", workflowId) + .param("projectId", projectId) + .param("issueTypeId", issueTypeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -34649,8 +33291,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflows(body: WorkflowCreateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/create"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create") + .toString(); const content_ = JSON.stringify(body); @@ -34703,8 +33345,8 @@ export class Client { * @return Returned if the request is successful. */ validateCreateWorkflows(body: WorkflowCreateValidateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/create/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create/validation") + .toString(); const content_ = JSON.stringify(body); @@ -34766,36 +33408,23 @@ export class Client { * @return Returned if the request is successful. */ searchWorkflows(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: string | undefined, scope?: string | undefined, isActive?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - url_ += "scope=" + encodeURIComponent("" + scope) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(scope, 'scope'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("scope", scope) + .param("isActive", isActive) + .toString(); let options_: RequestInit = { method: "GET", @@ -34844,12 +33473,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflows(body: WorkflowUpdateRequest, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/update?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -34902,8 +33530,8 @@ export class Client { * @return Returned if the request is successful. */ validateUpdateWorkflows(body: WorkflowUpdateValidateRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/update/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update/validation") + .toString(); const content_ = JSON.stringify(body); @@ -34954,16 +33582,13 @@ export class Client { * @return Returned if the request is successful. */ getAllWorkflowSchemes(startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -35008,8 +33633,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowScheme(body: WorkflowScheme): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .toString(); const content_ = JSON.stringify(body); @@ -35063,12 +33688,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeProjectAssociations(projectId: number[]): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .paramArray("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -35117,8 +33741,8 @@ export class Client { * @return Returned if the request is successful. */ assignSchemeToProject(body: WorkflowSchemeProjectAssociation): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -35181,12 +33805,11 @@ export class Client { * @return Returned if the request is successful. */ readWorkflowSchemes(body: WorkflowSchemeReadRequest, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/read?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/read") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -35242,8 +33865,8 @@ export class Client { * @return Returned if the request is successful and there is no asynchronous task. */ updateSchemes(body: WorkflowSchemeUpdateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update") + .toString(); const content_ = JSON.stringify(body); @@ -35304,8 +33927,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeMappings(body: WorkflowSchemeUpdateRequiredMappingsRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -35355,11 +33978,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowScheme(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -35415,15 +34038,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowScheme(id: number, returnDraftIfExists?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: RequestInit = { method: "GET", @@ -35473,11 +34094,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowScheme(id: number, body: WorkflowScheme): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -35535,11 +34156,11 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowSchemeDraftFromParent(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft") + .path("id", id) + .toString(); let options_: RequestInit = { method: "POST", @@ -35590,15 +34211,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDefaultWorkflow(id: number, updateDraftIfNeeded?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -35653,15 +34272,13 @@ export class Client { * @return Returned if the request is successful. */ getDefaultWorkflow(id: number, returnDraftIfExists?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: RequestInit = { method: "GET", @@ -35712,11 +34329,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultWorkflow(id: number, body: DefaultWorkflow): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -35774,11 +34391,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraft(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -35824,11 +34441,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraft(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -35878,11 +34495,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeDraft(id: number, body: WorkflowScheme): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -35940,11 +34557,11 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftDefaultWorkflow(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -35994,11 +34611,11 @@ export class Client { * @return Returned if the request is successful. */ getDraftDefaultWorkflow(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -36049,11 +34666,11 @@ export class Client { * @return Returned if the request is successful. */ updateDraftDefaultWorkflow(id: number, body: DefaultWorkflow): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -36112,14 +34729,13 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraftIssueType(id: number, issueType: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -36170,14 +34786,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraftIssueType(id: number, issueType: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); let options_: RequestInit = { method: "GET", @@ -36229,14 +34844,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeDraftIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -36296,15 +34910,13 @@ export class Client { * @return Returned if the request is only for validation and is successful. */ publishDraftWorkflowScheme(id: number, body: PublishDraftWorkflowScheme, validateOnly?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (validateOnly === null) - throw new globalThis.Error("The parameter 'validateOnly' cannot be null."); - else if (validateOnly !== undefined) - url_ += "validateOnly=" + encodeURIComponent("" + validateOnly) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(validateOnly, 'validateOnly'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish") + .path("id", id) + .param("validateOnly", validateOnly) + .toString(); const content_ = JSON.stringify(body); @@ -36366,15 +34978,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftWorkflowMapping(id: number, workflowName: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -36421,15 +35031,13 @@ export class Client { * @return Returned if the request is successful. */ getDraftWorkflow(id: number, workflowName?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); let options_: RequestInit = { method: "GET", @@ -36480,15 +35088,13 @@ export class Client { * @return Returned if the request is successful. */ updateDraftWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -36548,18 +35154,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeIssueType(id: number, issueType: string, updateDraftIfNeeded?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -36615,18 +35218,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeIssueType(id: number, issueType: string, returnDraftIfExists?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: RequestInit = { method: "GET", @@ -36678,14 +35278,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -36745,19 +35344,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowMapping(id: number, workflowName: string, updateDraftIfNeeded?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -36809,19 +35404,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflow(id: number, workflowName?: string | undefined, returnDraftIfExists?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: RequestInit = { method: "GET", @@ -36872,15 +35463,13 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -36940,19 +35529,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflowScheme(workflowSchemeId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages?"; - if (workflowSchemeId === undefined || workflowSchemeId === null) - throw new globalThis.Error("The parameter 'workflowSchemeId' must be defined."); - url_ = url_.replace("{workflowSchemeId}", encodeURIComponent("" + workflowSchemeId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowSchemeId, 'workflowSchemeId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages") + .path("workflowSchemeId", workflowSchemeId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -37002,12 +35587,11 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsDeletedSince(since?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/worklog/deleted?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/deleted") + .param("since", since) + .toString(); let options_: RequestInit = { method: "GET", @@ -37050,12 +35634,11 @@ export class Client { * @return Returned if the request is successful. */ getWorklogsForIds(body: WorklogIdsRequestBean, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/worklog/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -37113,16 +35696,13 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsModifiedSince(since?: number | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/worklog/updated?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/updated") + .param("since", since) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -37164,11 +35744,11 @@ export class Client { * @return Returned if the request is successful. */ deleteForgeAppProperty(propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -37224,11 +35804,11 @@ export class Client { * @return Returned if the property is updated. */ putForgeAppProperty(propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -37304,11 +35884,11 @@ export class AddonPropertiesResource_getAddonPropertiesClient { * @return Returned if the request is successful. */ get(addonKey: string): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties") + .path("addonKey", addonKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -37366,14 +35946,13 @@ export class AddonPropertiesResource_deleteAddonPropertyClient { * @return Returned if the request is successful. */ delete(addonKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -37441,14 +36020,13 @@ export class AddonPropertiesResource_getAddonPropertyClient { * @return Returned if the request is successful. */ get(addonKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -37520,14 +36098,13 @@ export class AddonPropertiesResource_putAddonPropertyClient { * @return Returned if the property is updated. */ put(addonKey: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -37604,12 +36181,11 @@ export class DynamicModulesResource_removeModulesClient { * @return Returned if the request is successful. */ delete(moduleKey?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic?"; - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(moduleKey, 'moduleKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .paramArray("moduleKey", moduleKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -37661,8 +36237,8 @@ export class DynamicModulesResource_getModulesClient { * @return Returned if the request is successful. */ get(): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); let options_: RequestInit = { method: "GET", @@ -37718,8 +36294,8 @@ export class DynamicModulesResource_registerModulesClient { * @return Returned if the request is successful. */ post(body: ConnectModules): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); const content_ = JSON.stringify(body); @@ -37783,8 +36359,8 @@ export class AppIssueFieldValueUpdateResource_updateIssueFieldsClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, body: ConnectCustomFieldValues): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/field") + .toString(); const content_ = JSON.stringify(body); @@ -37849,11 +36425,11 @@ export class MigrationResource_updateEntityPropertiesValueClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, entityType: EntityType, body: EntityPropertyDetails[]): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}"; - if (entityType === undefined || entityType === null) - throw new globalThis.Error("The parameter 'entityType' must be defined."); - url_ = url_.replace("{entityType}", encodeURIComponent("" + entityType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityType, 'entityType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}") + .path("entityType", entityType) + .toString(); const content_ = JSON.stringify(body); @@ -37912,8 +36488,8 @@ export class MigrationResource_workflowRuleSearchClient { * @return Returned if the request is successful. */ post(atlassian_Transfer_Id: string, body: WorkflowRulesSearch): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search") + .toString(); const content_ = JSON.stringify(body); @@ -37976,12 +36552,11 @@ export class ServiceRegistryResource_servicesClient { * @return Returned if the request is successful. */ get(serviceIds: string[]): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/service-registry?"; - if (serviceIds === undefined || serviceIds === null) - throw new globalThis.Error("The parameter 'serviceIds' must be defined and cannot be null."); - else - serviceIds && serviceIds.forEach(item => { url_ += "serviceIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(serviceIds, 'serviceIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/service-registry") + .paramArray("serviceIds", serviceIds) + .toString(); let options_: RequestInit = { method: "GET", @@ -96722,4 +95297,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Axios.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Axios.verified.txt index 183c6b56f..029d8a997 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Axios.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_Axios.verified.txt @@ -23,8 +23,8 @@ export class Client { * @return Returned if the request is successful. */ getBanner( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -89,8 +89,8 @@ export class Client { * @return Returned if the request is successful. */ setBanner(body: AnnouncementBannerConfigurationUpdate, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); const content_ = JSON.stringify(body); @@ -174,36 +174,23 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldsConfigurations(body: ConfigurationsListParameters, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/context/configuration/list?"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/context/configuration/list") + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -275,12 +262,11 @@ export class Client { * @return Returned if the request is successful. */ updateMultipleCustomFieldValues(body: MultipleCustomFieldValuesUpdateDetails, generateChangelog?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/value?"; - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/value") + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -356,39 +342,25 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldConfiguration(fieldIdOrKey: string, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -456,11 +428,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldConfiguration(fieldIdOrKey: string, body: CustomFieldConfigurations, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -534,15 +506,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldValue(fieldIdOrKey: string, body: CustomFieldValueUpdateDetails, generateChangelog?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value") + .path("fieldIdOrKey", fieldIdOrKey) + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -613,20 +583,15 @@ export class Client { * @return Returned if the request is successful. */ getApplicationProperty(key?: string | undefined, permissionLevel?: string | undefined, keyFilter?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/application-properties?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (permissionLevel === null) - throw new globalThis.Error("The parameter 'permissionLevel' cannot be null."); - else if (permissionLevel !== undefined) - url_ += "permissionLevel=" + encodeURIComponent("" + permissionLevel) + "&"; - if (keyFilter === null) - throw new globalThis.Error("The parameter 'keyFilter' cannot be null."); - else if (keyFilter !== undefined) - url_ += "keyFilter=" + encodeURIComponent("" + keyFilter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + Guard.notNull(permissionLevel, 'permissionLevel'); + Guard.notNull(keyFilter, 'keyFilter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties") + .param("key", key) + .param("permissionLevel", permissionLevel) + .param("keyFilter", keyFilter) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -698,8 +663,8 @@ export class Client { * @return Returned if the request is successful. */ getAdvancedSettings( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/application-properties/advanced-settings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/advanced-settings") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -766,11 +731,11 @@ export class Client { * @return Returned if the request is successful. */ setApplicationProperty(id: string, body: SimpleApplicationPropertyBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/application-properties/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -853,8 +818,8 @@ export class Client { * @return Returned if the request is successful. */ getAllApplicationRoles( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/applicationrole"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -921,11 +886,11 @@ export class Client { * @return Returned if the request is successful. */ getApplicationRole(key: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/applicationrole/{key}"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined."); - url_ = url_.replace("{key}", encodeURIComponent("" + key)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole/{key}") + .path("key", key) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -990,15 +955,13 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentContent(id: string, redirect?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/content/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/content/{id}") + .path("id", id) + .param("redirect", redirect) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -1084,8 +1047,8 @@ export class Client { * @return Returned if the request is successful. */ getAttachmentMeta( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/meta"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/meta") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -1145,27 +1108,19 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentThumbnail(id: string, redirect?: boolean | undefined, fallbackToDefault?: boolean | undefined, width?: number | undefined, height?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - if (fallbackToDefault === null) - throw new globalThis.Error("The parameter 'fallbackToDefault' cannot be null."); - else if (fallbackToDefault !== undefined) - url_ += "fallbackToDefault=" + encodeURIComponent("" + fallbackToDefault) + "&"; - if (width === null) - throw new globalThis.Error("The parameter 'width' cannot be null."); - else if (width !== undefined) - url_ += "width=" + encodeURIComponent("" + width) + "&"; - if (height === null) - throw new globalThis.Error("The parameter 'height' cannot be null."); - else if (height !== undefined) - url_ += "height=" + encodeURIComponent("" + height) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + Guard.notNull(fallbackToDefault, 'fallbackToDefault'); + Guard.notNull(width, 'width'); + Guard.notNull(height, 'height'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}") + .path("id", id) + .param("redirect", redirect) + .param("fallbackToDefault", fallbackToDefault) + .param("width", width) + .param("height", height) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -1244,11 +1199,11 @@ export class Client { * @return Returned if the request is successful. */ removeAttachment(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -1304,11 +1259,11 @@ export class Client { * @return Returned if the request is successful. */ getAttachment(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -1372,11 +1327,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForHumans(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/human"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/human") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -1444,11 +1399,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForMachines(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -1520,28 +1475,19 @@ export class Client { * @return Returned if the request is successful. */ getAuditRecords(offset?: number | undefined, limit?: number | undefined, filter?: string | undefined, from?: string | undefined, to?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/auditing/record?"; - if (offset === null) - throw new globalThis.Error("The parameter 'offset' cannot be null."); - else if (offset !== undefined) - url_ += "offset=" + encodeURIComponent("" + offset) + "&"; - if (limit === null) - throw new globalThis.Error("The parameter 'limit' cannot be null."); - else if (limit !== undefined) - url_ += "limit=" + encodeURIComponent("" + limit) + "&"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (from === null) - throw new globalThis.Error("The parameter 'from' cannot be null."); - else if (from !== undefined) - url_ += "from=" + encodeURIComponent("" + from) + "&"; - if (to === null) - throw new globalThis.Error("The parameter 'to' cannot be null."); - else if (to !== undefined) - url_ += "to=" + encodeURIComponent("" + to) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(offset, 'offset'); + Guard.notNull(limit, 'limit'); + Guard.notNull(filter, 'filter'); + Guard.notNull(from, 'from'); + Guard.notNull(to, 'to'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/auditing/record") + .param("offset", offset) + .param("limit", limit) + .param("filter", filter) + .param("from", from) + .param("to", to) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -1607,11 +1553,11 @@ export class Client { * @return Returned if the request is successful. */ getAllSystemAvatars(type: Type, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/avatar/{type}/system"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/avatar/{type}/system") + .path("type", type) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -1671,8 +1617,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkDelete(body: IssueBulkDeletePayload, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/delete") + .toString(); const content_ = JSON.stringify(body); @@ -1752,24 +1698,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkEditableFields(issueIdsOrKeys: string, searchText?: string | undefined, endingBefore?: string | undefined, startingAfter?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (searchText === null) - throw new globalThis.Error("The parameter 'searchText' cannot be null."); - else if (searchText !== undefined) - url_ += "searchText=" + encodeURIComponent("" + searchText) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(searchText, 'searchText'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("searchText", searchText) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -1849,8 +1788,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkEdit(body: IssueBulkEditPayload, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .toString(); const content_ = JSON.stringify(body); @@ -1919,8 +1858,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkMove(body: IssueBulkMovePayload, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/move") + .toString(); const content_ = JSON.stringify(body); @@ -1992,20 +1931,15 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTransitions(issueIdsOrKeys: string, endingBefore?: string | undefined, startingAfter?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -2078,8 +2012,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkTransition(body: IssueBulkTransitionPayload, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .toString(); const content_ = JSON.stringify(body); @@ -2156,8 +2090,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkUnwatch(body: IssueBulkWatchOrUnwatchPayload, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/unwatch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/unwatch") + .toString(); const content_ = JSON.stringify(body); @@ -2234,8 +2168,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkWatch(body: IssueBulkWatchOrUnwatchPayload, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/watch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/watch") + .toString(); const content_ = JSON.stringify(body); @@ -2312,11 +2246,11 @@ export class Client { * @return Returned if the request is successful. */ getBulkOperationProgress(taskId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/queue/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/queue/{taskId}") + .path("taskId", taskId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -2382,8 +2316,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkChangelogs(body: BulkChangelogRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/changelog/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/changelog/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -2444,16 +2378,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUserDataClassificationLevels(status?: Status2[] | undefined, orderBy?: OrderBy | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/classification-levels?"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(status, 'status'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/classification-levels") + .paramArray("status", status) + .param("orderBy", orderBy) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -2513,12 +2444,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentsByIds(body: IssueCommentListRequestBean, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -2578,11 +2508,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentPropertyKeys(commentId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties") + .path("commentId", commentId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -2651,14 +2581,13 @@ export class Client { * @return Returned if the request is successful. */ deleteCommentProperty(commentId: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -2723,14 +2652,13 @@ export class Client { * @return Returned if the request is successful. */ getCommentProperty(commentId: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -2800,14 +2728,13 @@ export class Client { * @return Returned if the comment property is updated. */ setCommentProperty(commentId: string, propertyKey: string, body: any, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -2895,28 +2822,19 @@ export class Client { * @return Returned if the request is successful. */ findComponentsForProjects(projectIdsOrKeys?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy2 | undefined, query?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/component?"; - if (projectIdsOrKeys === null) - throw new globalThis.Error("The parameter 'projectIdsOrKeys' cannot be null."); - else if (projectIdsOrKeys !== undefined) - projectIdsOrKeys && projectIdsOrKeys.forEach(item => { url_ += "projectIdsOrKeys=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIdsOrKeys, 'projectIdsOrKeys'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .paramArray("projectIdsOrKeys", projectIdsOrKeys) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -2975,8 +2893,8 @@ export class Client { * @return Returned if the request is successful. */ createComponent(body: ProjectComponent, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/component"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .toString(); const content_ = JSON.stringify(body); @@ -3049,15 +2967,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComponent(id: string, moveIssuesTo?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' cannot be null."); - else if (moveIssuesTo !== undefined) - url_ += "moveIssuesTo=" + encodeURIComponent("" + moveIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .param("moveIssuesTo", moveIssuesTo) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -3117,11 +3033,11 @@ export class Client { * @return Returned if the request is successful. */ getComponent(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -3181,11 +3097,11 @@ export class Client { * @return Returned if the request is successful. */ updateComponent(id: string, body: ProjectComponent, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -3257,11 +3173,11 @@ export class Client { * @return Returned if the request is successful. */ getComponentRelatedIssues(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -3320,8 +3236,8 @@ export class Client { * @return Returned if the request is successful. */ getConfiguration( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -3376,8 +3292,8 @@ export class Client { * @return Returned if the request is successful and time tracking is enabled. */ getSelectedTimeTrackingImplementation( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -3444,8 +3360,8 @@ export class Client { * @return Returned if the request is successful. */ selectTimeTrackingImplementation(body: TimeTrackingProvider, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); const content_ = JSON.stringify(body); @@ -3513,8 +3429,8 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTimeTrackingImplementations( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/list"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/list") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -3580,8 +3496,8 @@ export class Client { * @return Returned if the request is successful. */ getSharedTimeTrackingConfiguration( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -3640,8 +3556,8 @@ export class Client { * @return Returned if the request is successful. */ setSharedTimeTrackingConfiguration(body: TimeTrackingConfiguration, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); const content_ = JSON.stringify(body); @@ -3709,11 +3625,11 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldOption(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/customFieldOption/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/customFieldOption/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -3778,20 +3694,15 @@ export class Client { * @return Returned if the request is successful. */ getAllDashboards(filter?: Filter2 | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filter, 'filter'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("filter", filter) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -3858,12 +3769,11 @@ export class Client { * @return Returned if the request is successful. */ createDashboard(body: DashboardDetails, extendAdminPermissions?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -3933,8 +3843,8 @@ export class Client { * @return Returned if the request is successful. */ bulkEditDashboards(body: BulkEditShareableEntityRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/bulk/edit"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/bulk/edit") + .toString(); const content_ = JSON.stringify(body); @@ -4003,8 +3913,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAvailableDashboardGadgets( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/gadgets"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/gadgets") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -4096,52 +4006,31 @@ export class Client { * @return Returned if the request is successful. */ getDashboardsPaginated(dashboardName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, orderBy?: OrderBy3 | undefined, startAt?: number | undefined, maxResults?: number | undefined, status?: Status3 | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/search?"; - if (dashboardName === null) - throw new globalThis.Error("The parameter 'dashboardName' cannot be null."); - else if (dashboardName !== undefined) - url_ += "dashboardName=" + encodeURIComponent("" + dashboardName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(dashboardName, 'dashboardName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/search") + .param("dashboardName", dashboardName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("status", status) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -4210,23 +4099,17 @@ export class Client { * @return Returned if the request is successful. */ getAllGadgets(dashboardId: number, moduleKey?: string[] | undefined, uri?: string[] | undefined, gadgetId?: number[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget?"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - if (uri === null) - throw new globalThis.Error("The parameter 'uri' cannot be null."); - else if (uri !== undefined) - uri && uri.forEach(item => { url_ += "uri=" + encodeURIComponent("" + item) + "&"; }); - if (gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' cannot be null."); - else if (gadgetId !== undefined) - gadgetId && gadgetId.forEach(item => { url_ += "gadgetId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.notNull(moduleKey, 'moduleKey'); + Guard.notNull(uri, 'uri'); + Guard.notNull(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .paramArray("moduleKey", moduleKey) + .paramArray("uri", uri) + .paramArray("gadgetId", gadgetId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -4289,11 +4172,11 @@ export class Client { * @return Returned if the request is successful. */ addGadget(dashboardId: number, body: DashboardGadgetSettings, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .toString(); const content_ = JSON.stringify(body); @@ -4368,14 +4251,13 @@ export class Client { * @return Returned if the request is successful. */ removeGadget(dashboardId: number, gadgetId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -4440,14 +4322,13 @@ export class Client { * @return Returned if the request is successful. */ updateGadget(dashboardId: number, gadgetId: number, body: DashboardGadgetUpdateRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); const content_ = JSON.stringify(body); @@ -4523,14 +4404,13 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemPropertyKeys(dashboardId: string, itemId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -4598,17 +4478,15 @@ export class Client { * @return Returned if the dashboard item property is deleted. */ deleteDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -4691,17 +4569,15 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -4770,17 +4646,15 @@ export class Client { * @return Returned if the dashboard item property is updated. */ setDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string, body: any, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -4873,11 +4747,11 @@ export class Client { * @return Returned if the dashboard is deleted. */ deleteDashboard(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -4939,11 +4813,11 @@ export class Client { * @return Returned if the request is successful. */ getDashboard(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -5015,15 +4889,13 @@ export class Client { * @return Returned if the request is successful. */ updateDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -5101,15 +4973,13 @@ export class Client { * @return Returned if the request is successful. */ copyDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}/copy?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}/copy") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -5185,8 +5055,8 @@ export class Client { * @return Returned if the request is successful */ getPolicy( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/data-policy"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -5252,12 +5122,11 @@ export class Client { * @return Returned if the request is successful. */ getPolicies(ids?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/data-policy/project?"; - if (ids === null) - throw new globalThis.Error("The parameter 'ids' cannot be null."); - else if (ids !== undefined) - url_ += "ids=" + encodeURIComponent("" + ids) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(ids, 'ids'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy/project") + .param("ids", ids) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -5329,8 +5198,8 @@ export class Client { * @return Returned if the request is successful. */ getEvents( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/events"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/events") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -5402,12 +5271,11 @@ export class Client { * @return Returned if the request is successful. */ analyseExpression(body: JiraExpressionForAnalysis, check?: Check | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/expression/analyse?"; - if (check === null) - throw new globalThis.Error("The parameter 'check' cannot be null."); - else if (check !== undefined) - url_ += "check=" + encodeURIComponent("" + check) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(check, 'check'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/analyse") + .param("check", check) + .toString(); const content_ = JSON.stringify(body); @@ -5483,12 +5351,11 @@ export class Client { * @deprecated */ evaluateJiraExpression(body: JiraExpressionEvalRequestBean, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/expression/eval?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/eval") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -5563,12 +5430,11 @@ export class Client { * @return Returned if the evaluation results in a value. The result is a JSON primitive value, list, or object. */ evaluateJSISJiraExpression(body: JiraExpressionEvaluateRequestBean, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/expression/evaluate?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/evaluate") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -5641,8 +5507,8 @@ export class Client { * @return Returned if the request is successful. */ getFields( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -5705,8 +5571,8 @@ export class Client { * @return Returned if the custom field is created. */ createCustomField(body: CustomFieldDefinitionJsonBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); const content_ = JSON.stringify(body); @@ -5766,8 +5632,8 @@ export class Client { * @return Returned if the field association validation passes. */ removeAssociations(body: FieldAssociationsRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -5836,8 +5702,8 @@ export class Client { * @return Returned if the field association validation passes. */ createAssociations(body: FieldAssociationsRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -5926,40 +5792,25 @@ export class Client { * @return Returned if the request is successful. */ getFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, type?: Type2[] | undefined, id?: string[] | undefined, query?: string | undefined, orderBy?: OrderBy4 | undefined, expand?: string | undefined, projectIds?: number[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (type === null) - throw new globalThis.Error("The parameter 'type' cannot be null."); - else if (type !== undefined) - type && type.forEach(item => { url_ += "type=" + encodeURIComponent("" + item) + "&"; }); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(type, 'type'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectIds, 'projectIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("type", type) + .paramArray("id", id) + .param("query", query) + .param("orderBy", orderBy) + .param("expand", expand) + .paramArray("projectIds", projectIds) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -6038,32 +5889,21 @@ export class Client { * @return Returned if the request is successful. */ getTrashedFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, id?: string[] | undefined, query?: string | undefined, expand?: Expand | undefined, orderBy?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/search/trashed?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(expand, 'expand'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search/trashed") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("query", query) + .param("expand", expand) + .param("orderBy", orderBy) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -6134,11 +5974,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomField(fieldId: string, body: UpdateCustomFieldDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -6216,31 +6056,21 @@ export class Client { * @return Returned if the request is successful. */ getContextsForField(fieldId: string, isAnyIssueType?: boolean | undefined, isGlobalContext?: boolean | undefined, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (isAnyIssueType === null) - throw new globalThis.Error("The parameter 'isAnyIssueType' cannot be null."); - else if (isAnyIssueType !== undefined) - url_ += "isAnyIssueType=" + encodeURIComponent("" + isAnyIssueType) + "&"; - if (isGlobalContext === null) - throw new globalThis.Error("The parameter 'isGlobalContext' cannot be null."); - else if (isGlobalContext !== undefined) - url_ += "isGlobalContext=" + encodeURIComponent("" + isGlobalContext) + "&"; - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(isAnyIssueType, 'isAnyIssueType'); + Guard.notNull(isGlobalContext, 'isGlobalContext'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .param("isAnyIssueType", isAnyIssueType) + .param("isGlobalContext", isGlobalContext) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -6304,11 +6134,11 @@ export class Client { * @return Returned if the custom field context is created. */ createCustomFieldContext(fieldId: string, body: CreateCustomFieldContext, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -6383,23 +6213,17 @@ export class Client { * @return Returned if the request is successful. */ getDefaultValues(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -6463,11 +6287,11 @@ export class Client { * @return Returned if operation is successful. */ setDefaultValues(fieldId: string, body: CustomFieldContextDefaultValueUpdate, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -6543,23 +6367,17 @@ export class Client { * @return Returned if operation is successful. */ getIssueTypeMappingsForContexts(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -6622,19 +6440,15 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldContextsForProjectsAndIssueTypes(fieldId: string, body: ProjectIssueTypeMappings, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -6709,23 +6523,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectContextMapping(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -6790,14 +6598,13 @@ export class Client { * @return Returned if the context is deleted. */ deleteCustomFieldContext(fieldId: string, contextId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -6867,14 +6674,13 @@ export class Client { * @return Returned if the context is updated. */ updateCustomFieldContext(fieldId: string, contextId: number, body: CustomFieldContextUpdateDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6948,14 +6754,13 @@ export class Client { * @return Returned if operation is successful. */ addIssueTypesToContext(fieldId: string, contextId: number, body: IssueTypeIds, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7033,14 +6838,13 @@ export class Client { * @return Returned if operation is successful. */ removeIssueTypesFromContext(fieldId: string, contextId: number, body: IssueTypeIds, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7118,30 +6922,21 @@ export class Client { * @return Returned if the request is successful. */ getOptionsForContext(fieldId: string, contextId: number, optionId?: number | undefined, onlyOptions?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === null) - throw new globalThis.Error("The parameter 'optionId' cannot be null."); - else if (optionId !== undefined) - url_ += "optionId=" + encodeURIComponent("" + optionId) + "&"; - if (onlyOptions === null) - throw new globalThis.Error("The parameter 'onlyOptions' cannot be null."); - else if (onlyOptions !== undefined) - url_ += "onlyOptions=" + encodeURIComponent("" + onlyOptions) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(optionId, 'optionId'); + Guard.notNull(onlyOptions, 'onlyOptions'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .param("optionId", optionId) + .param("onlyOptions", onlyOptions) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -7210,14 +7005,13 @@ export class Client { * @return Returned if the request is successful. */ createCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionCreateRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7290,14 +7084,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionUpdateRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7370,14 +7163,13 @@ export class Client { * @return Returned if options are reordered. */ reorderCustomFieldOptions(fieldId: string, contextId: number, body: OrderOfCustomFieldOptions, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7452,17 +7244,15 @@ export class Client { * @return Returned if the option is deleted. */ deleteCustomFieldOption(fieldId: string, contextId: number, optionId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .path("optionId", optionId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -7529,25 +7319,19 @@ export class Client { * @param jql (optional) A JQL query that specifies the issues to be updated. For example, *project=10000*. */ replaceCustomFieldOption(fieldId: string, optionId: number, contextId: number, replaceWith?: number | undefined, jql?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(optionId, 'optionId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue") + .path("fieldId", fieldId) + .path("optionId", optionId) + .path("contextId", contextId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -7611,14 +7395,13 @@ export class Client { * @return Returned if operation is successful. */ assignProjectsToCustomFieldContext(fieldId: string, contextId: number, body: ProjectIds, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7692,14 +7475,13 @@ export class Client { * @return Returned if the custom field context is removed from the projects. */ removeCustomFieldContextFromProjects(fieldId: string, contextId: number, body: ProjectIds, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7775,19 +7557,15 @@ export class Client { * @deprecated */ getContextsForFieldDeprecated(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/contexts?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/contexts") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -7850,23 +7628,17 @@ export class Client { * @return Returned if the request is successful. */ getScreensForField(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/screens?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/screens") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -7931,19 +7703,15 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -8006,11 +7774,11 @@ export class Client { * @return Returned if the request is successful. */ createIssueFieldOption(fieldKey: string, body: IssueFieldOptionCreateBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .toString(); const content_ = JSON.stringify(body); @@ -8084,23 +7852,17 @@ export class Client { * @return Returned if the request is successful. */ getSelectableIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -8166,23 +7928,17 @@ export class Client { * @return Returned if the request is successful. */ getVisibleIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -8246,14 +8002,13 @@ export class Client { * @return Returned if the field option is deleted. */ deleteIssueFieldOption(fieldKey: string, optionId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -8322,14 +8077,13 @@ export class Client { * @return Returned if the requested option is returned. */ getIssueFieldOption(fieldKey: string, optionId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -8397,14 +8151,13 @@ export class Client { * @return Returned if the option is updated or created. */ updateIssueFieldOption(fieldKey: string, optionId: number, body: IssueFieldOption, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); const content_ = JSON.stringify(body); @@ -8479,30 +8232,21 @@ export class Client { * @param overrideEditableFlag (optional) Whether screen security is overridden to enable uneditable fields to be edited. Available to Connect and Forge app users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ replaceIssueFieldOption(fieldKey: string, optionId: number, replaceWith?: number | undefined, jql?: string | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -8564,11 +8308,11 @@ export class Client { * @param id The ID of a custom field. */ deleteCustomField(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -8654,11 +8398,11 @@ export class Client { * @return Returned if the request is successful. */ restoreCustomField(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/restore"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/restore") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "POST", @@ -8739,11 +8483,11 @@ export class Client { * @return Returned if the request is successful. */ trashCustomField(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/trash"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/trash") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "POST", @@ -8828,28 +8572,19 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurations(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, isDefault?: boolean | undefined, query?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (isDefault === null) - throw new globalThis.Error("The parameter 'isDefault' cannot be null."); - else if (isDefault !== undefined) - url_ += "isDefault=" + encodeURIComponent("" + isDefault) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(isDefault, 'isDefault'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("isDefault", isDefault) + .param("query", query) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -8908,8 +8643,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfiguration(body: FieldConfigurationDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .toString(); const content_ = JSON.stringify(body); @@ -8977,11 +8712,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfiguration(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -9050,11 +8785,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfiguration(id: number, body: FieldConfigurationDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9129,19 +8864,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationItems(id: number, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -9205,11 +8936,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationItems(id: number, body: FieldConfigurationItemsDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9284,20 +9015,15 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurationSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -9361,8 +9087,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfigurationScheme(body: UpdateFieldConfigurationSchemeDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -9432,20 +9158,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, fieldConfigurationSchemeId?: number[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fieldConfigurationSchemeId === null) - throw new globalThis.Error("The parameter 'fieldConfigurationSchemeId' cannot be null."); - else if (fieldConfigurationSchemeId !== undefined) - fieldConfigurationSchemeId && fieldConfigurationSchemeId.forEach(item => { url_ += "fieldConfigurationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fieldConfigurationSchemeId, 'fieldConfigurationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("fieldConfigurationSchemeId", fieldConfigurationSchemeId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -9515,20 +9236,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeProjectMapping(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -9591,8 +9307,8 @@ export class Client { * @return Returned if the request is successful. */ assignFieldConfigurationSchemeToProject(body: FieldConfigurationSchemeProjectAssociation, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -9665,11 +9381,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfigurationScheme(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -9739,11 +9455,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationScheme(id: number, body: UpdateFieldConfigurationSchemeDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9816,11 +9532,11 @@ export class Client { * @return Returned if the request is successful. */ setFieldConfigurationSchemeMapping(id: number, body: AssociateFieldConfigurationsWithIssueTypesRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9894,11 +9610,11 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypesFromGlobalFieldConfigurationScheme(id: number, body: IssueTypeIdsToRemove, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9988,16 +9704,13 @@ export class Client { * @return Returned if the request is successful. */ createFilter(body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter") + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -10060,8 +9773,8 @@ export class Client { * @return Returned if the request is successful. */ getDefaultShareScope( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -10116,8 +9829,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultShareScope(body: DefaultShareScope, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); const content_ = JSON.stringify(body); @@ -10184,12 +9897,11 @@ export class Client { * @return Returned if the request is successful. */ getFavouriteFilters(expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/favourite?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/favourite") + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -10256,16 +9968,13 @@ export class Client { * @return Returned if the request is successful. */ getMyFilters(expand?: string | undefined, includeFavourites?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/my?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (includeFavourites === null) - throw new globalThis.Error("The parameter 'includeFavourites' cannot be null."); - else if (includeFavourites !== undefined) - url_ += "includeFavourites=" + encodeURIComponent("" + includeFavourites) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(includeFavourites, 'includeFavourites'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/my") + .param("expand", expand) + .param("includeFavourites", includeFavourites) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -10361,60 +10070,35 @@ export class Client { * @return Returned if the request is successful. */ getFiltersPaginated(filterName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy5 | undefined, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, isSubstringMatch?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/search?"; - if (filterName === null) - throw new globalThis.Error("The parameter 'filterName' cannot be null."); - else if (filterName !== undefined) - url_ += "filterName=" + encodeURIComponent("" + filterName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - if (isSubstringMatch === null) - throw new globalThis.Error("The parameter 'isSubstringMatch' cannot be null."); - else if (isSubstringMatch !== undefined) - url_ += "isSubstringMatch=" + encodeURIComponent("" + isSubstringMatch) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filterName, 'filterName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + Guard.notNull(isSubstringMatch, 'isSubstringMatch'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/search") + .param("filterName", filterName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .param("isSubstringMatch", isSubstringMatch) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -10477,11 +10161,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFilter(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -10542,19 +10226,15 @@ export class Client { * @return Returned if the request is successful. */ getFilter(id: number, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -10620,19 +10300,15 @@ export class Client { * @return Returned if the request is successful. */ updateFilter(id: number, body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -10696,11 +10372,11 @@ export class Client { * @return Returned if the request is successful. */ resetColumns(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -10756,11 +10432,11 @@ export class Client { * @return Returned if the request is successful. */ getColumns(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -10833,17 +10509,15 @@ export class Client { * @return Returned if the request is successful. */ setColumns(id: number, body: ColumnRequestBody, columns?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_: AxiosRequestConfig = { data: content_, @@ -10910,15 +10584,13 @@ export class Client { * @return Returned if the request is successful. */ deleteFavouriteForFilter(id: number, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -10978,15 +10650,13 @@ export class Client { * @return Returned if the request is successful. */ setFavouriteForFilter(id: number, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "PUT", @@ -11043,11 +10713,11 @@ export class Client { * @return Returned if the request is successful. */ changeFilterOwner(id: number, body: ChangeFilterOwner, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/owner"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/owner") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -11116,11 +10786,11 @@ export class Client { * @return Returned if the request is successful. */ getSharePermissions(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -11187,11 +10857,11 @@ export class Client { * @return Returned if the request is successful. */ addSharePermission(id: number, body: SharePermissionInputBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -11267,14 +10937,13 @@ export class Client { * @return Returned if the request is successful. */ deleteSharePermission(id: number, permissionId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -11331,14 +11000,13 @@ export class Client { * @return Returned if the request is successful. */ getSharePermission(id: number, permissionId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -11402,24 +11070,17 @@ export class Client { * @return Returned if the request is successful. */ removeGroup(groupname?: string | undefined, groupId?: string | undefined, swapGroup?: string | undefined, swapGroupId?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (swapGroup === null) - throw new globalThis.Error("The parameter 'swapGroup' cannot be null."); - else if (swapGroup !== undefined) - url_ += "swapGroup=" + encodeURIComponent("" + swapGroup) + "&"; - if (swapGroupId === null) - throw new globalThis.Error("The parameter 'swapGroupId' cannot be null."); - else if (swapGroupId !== undefined) - url_ += "swapGroupId=" + encodeURIComponent("" + swapGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(swapGroup, 'swapGroup'); + Guard.notNull(swapGroupId, 'swapGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("swapGroup", swapGroup) + .param("swapGroupId", swapGroupId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -11487,20 +11148,15 @@ export class Client { * @deprecated */ getGroup(groupname?: string | undefined, groupId?: string | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -11568,8 +11224,8 @@ export class Client { * @return Returned if the request is successful. */ createGroup(body: AddGroupBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/group"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .toString(); const content_ = JSON.stringify(body); @@ -11642,32 +11298,21 @@ export class Client { * @return Returned if the request is successful. */ bulkGetGroups(startAt?: number | undefined, maxResults?: number | undefined, groupId?: string[] | undefined, groupName?: string[] | undefined, accessType?: string | undefined, applicationKey?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/bulk?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - groupId && groupId.forEach(item => { url_ += "groupId=" + encodeURIComponent("" + item) + "&"; }); - if (groupName === null) - throw new globalThis.Error("The parameter 'groupName' cannot be null."); - else if (groupName !== undefined) - groupName && groupName.forEach(item => { url_ += "groupName=" + encodeURIComponent("" + item) + "&"; }); - if (accessType === null) - throw new globalThis.Error("The parameter 'accessType' cannot be null."); - else if (accessType !== undefined) - url_ += "accessType=" + encodeURIComponent("" + accessType) + "&"; - if (applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' cannot be null."); - else if (applicationKey !== undefined) - url_ += "applicationKey=" + encodeURIComponent("" + applicationKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(groupName, 'groupName'); + Guard.notNull(accessType, 'accessType'); + Guard.notNull(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/bulk") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("groupId", groupId) + .paramArray("groupName", groupName) + .param("accessType", accessType) + .param("applicationKey", applicationKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -11740,28 +11385,19 @@ export class Client { * @return Returned if the request is successful. */ getUsersFromGroup(groupname?: string | undefined, groupId?: string | undefined, includeInactiveUsers?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/member?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (includeInactiveUsers === null) - throw new globalThis.Error("The parameter 'includeInactiveUsers' cannot be null."); - else if (includeInactiveUsers !== undefined) - url_ += "includeInactiveUsers=" + encodeURIComponent("" + includeInactiveUsers) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(includeInactiveUsers, 'includeInactiveUsers'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/member") + .param("groupname", groupname) + .param("groupId", groupId) + .param("includeInactiveUsers", includeInactiveUsers) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -11833,24 +11469,17 @@ export class Client { * @return Returned if the request is successful. */ removeUserFromGroup(accountId: string, groupname?: string | undefined, groupId?: string | undefined, username?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("accountId", accountId) + .param("groupname", groupname) + .param("groupId", groupId) + .param("username", username) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -11917,16 +11546,13 @@ export class Client { * @return Returned if the request is successful. */ addUserToGroup(body: UpdateUserToGroupBean, groupname?: string | undefined, groupId?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("groupname", groupname) + .param("groupId", groupId) + .toString(); const content_ = JSON.stringify(body); @@ -12009,36 +11635,23 @@ export class Client { * @return Returned if the request is successful. */ findGroups(accountId?: string | undefined, query?: string | undefined, exclude?: string[] | undefined, excludeId?: string[] | undefined, maxResults?: number | undefined, caseInsensitive?: boolean | undefined, userName?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/groups/picker?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeId === null) - throw new globalThis.Error("The parameter 'excludeId' cannot be null."); - else if (excludeId !== undefined) - excludeId && excludeId.forEach(item => { url_ += "excludeId=" + encodeURIComponent("" + item) + "&"; }); - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (userName === null) - throw new globalThis.Error("The parameter 'userName' cannot be null."); - else if (userName !== undefined) - url_ += "userName=" + encodeURIComponent("" + userName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeId, 'excludeId'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(userName, 'userName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groups/picker") + .param("accountId", accountId) + .param("query", query) + .paramArray("exclude", exclude) + .paramArray("excludeId", excludeId) + .param("maxResults", maxResults) + .param("caseInsensitive", caseInsensitive) + .param("userName", userName) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -12098,44 +11711,27 @@ export class Client { * @return Returned if the request is successful. */ findUsersAndGroups(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, fieldId?: string | undefined, projectId?: string[] | undefined, issueTypeId?: string[] | undefined, avatarSize?: AvatarSize | undefined, caseInsensitive?: boolean | undefined, excludeConnectAddons?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/groupuserpicker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' cannot be null."); - else if (fieldId !== undefined) - url_ += "fieldId=" + encodeURIComponent("" + fieldId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - issueTypeId && issueTypeId.forEach(item => { url_ += "issueTypeId=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(fieldId, 'fieldId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groupuserpicker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .param("fieldId", fieldId) + .paramArray("projectId", projectId) + .paramArray("issueTypeId", issueTypeId) + .param("avatarSize", avatarSize) + .param("caseInsensitive", caseInsensitive) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -12202,8 +11798,8 @@ export class Client { * @return Returned if the request is successful. */ getLicense( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/instance/license"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/instance/license") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -12259,12 +11855,11 @@ export class Client { * @return Returned if the request is successful. */ createIssue(body: IssueUpdateDetails, updateHistory?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue?"; - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(updateHistory, 'updateHistory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue") + .param("updateHistory", updateHistory) + .toString(); const content_ = JSON.stringify(body); @@ -12348,8 +11943,8 @@ export class Client { * @return Returns the URL to check the status of the submitted request. */ archiveIssues(body: ArchiveIssueAsyncRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -12422,8 +12017,8 @@ export class Client { * @return Returned if there is at least one valid issue to archive in the request. The return message will include the count of archived issues and subtasks, as well as error details for issues which failed to get archived. */ archiveIssues(body: IssueArchivalSyncRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -12502,8 +12097,8 @@ export class Client { * is invalid for any other reason. */ createIssues(body: IssuesUpdateBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/bulk"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulk") + .toString(); const content_ = JSON.stringify(body); @@ -12570,8 +12165,8 @@ export class Client { * @return Returned if the request is successful. A response may contain both successful issues and issue errors. */ bulkFetchIssues(body: BulkFetchIssueRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -12640,28 +12235,19 @@ export class Client { * @deprecated */ getCreateIssueMeta(projectIds?: string[] | undefined, projectKeys?: string[] | undefined, issuetypeIds?: string[] | undefined, issuetypeNames?: string[] | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta?"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - if (projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' cannot be null."); - else if (projectKeys !== undefined) - projectKeys && projectKeys.forEach(item => { url_ += "projectKeys=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeIds === null) - throw new globalThis.Error("The parameter 'issuetypeIds' cannot be null."); - else if (issuetypeIds !== undefined) - issuetypeIds && issuetypeIds.forEach(item => { url_ += "issuetypeIds=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeNames === null) - throw new globalThis.Error("The parameter 'issuetypeNames' cannot be null."); - else if (issuetypeNames !== undefined) - issuetypeNames && issuetypeNames.forEach(item => { url_ += "issuetypeNames=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIds, 'projectIds'); + Guard.notNull(projectKeys, 'projectKeys'); + Guard.notNull(issuetypeIds, 'issuetypeIds'); + Guard.notNull(issuetypeNames, 'issuetypeNames'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta") + .paramArray("projectIds", projectIds) + .paramArray("projectKeys", projectKeys) + .paramArray("issuetypeIds", issuetypeIds) + .paramArray("issuetypeNames", issuetypeNames) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -12719,19 +12305,15 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypes(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -12794,22 +12376,17 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypeId(projectIdOrKey: string, issueTypeId: string, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}") + .path("projectIdOrKey", projectIdOrKey) + .path("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -12871,12 +12448,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLimitReport(isReturningKeys?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/limit/report?"; - if (isReturningKeys === null) - throw new globalThis.Error("The parameter 'isReturningKeys' cannot be null."); - else if (isReturningKeys !== undefined) - url_ += "isReturningKeys=" + encodeURIComponent("" + isReturningKeys) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(isReturningKeys, 'isReturningKeys'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/limit/report") + .param("isReturningKeys", isReturningKeys) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -12941,32 +12517,21 @@ export class Client { * @return Returned if the request is successful. */ getIssuePickerResource(query?: string | undefined, currentJQL?: string | undefined, currentIssueKey?: string | undefined, currentProjectId?: string | undefined, showSubTasks?: boolean | undefined, showSubTaskParent?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/picker?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (currentJQL === null) - throw new globalThis.Error("The parameter 'currentJQL' cannot be null."); - else if (currentJQL !== undefined) - url_ += "currentJQL=" + encodeURIComponent("" + currentJQL) + "&"; - if (currentIssueKey === null) - throw new globalThis.Error("The parameter 'currentIssueKey' cannot be null."); - else if (currentIssueKey !== undefined) - url_ += "currentIssueKey=" + encodeURIComponent("" + currentIssueKey) + "&"; - if (currentProjectId === null) - throw new globalThis.Error("The parameter 'currentProjectId' cannot be null."); - else if (currentProjectId !== undefined) - url_ += "currentProjectId=" + encodeURIComponent("" + currentProjectId) + "&"; - if (showSubTasks === null) - throw new globalThis.Error("The parameter 'showSubTasks' cannot be null."); - else if (showSubTasks !== undefined) - url_ += "showSubTasks=" + encodeURIComponent("" + showSubTasks) + "&"; - if (showSubTaskParent === null) - throw new globalThis.Error("The parameter 'showSubTaskParent' cannot be null."); - else if (showSubTaskParent !== undefined) - url_ += "showSubTaskParent=" + encodeURIComponent("" + showSubTaskParent) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(currentJQL, 'currentJQL'); + Guard.notNull(currentIssueKey, 'currentIssueKey'); + Guard.notNull(currentProjectId, 'currentProjectId'); + Guard.notNull(showSubTasks, 'showSubTasks'); + Guard.notNull(showSubTaskParent, 'showSubTaskParent'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/picker") + .param("query", query) + .param("currentJQL", currentJQL) + .param("currentIssueKey", currentIssueKey) + .param("currentProjectId", currentProjectId) + .param("showSubTasks", showSubTasks) + .param("showSubTaskParent", showSubTaskParent) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -13021,8 +12586,8 @@ export class Client { * @param body Issue properties to be set or updated with values. */ bulkSetIssuesPropertiesList(body: IssueEntityProperties, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties") + .toString(); const content_ = JSON.stringify(body); @@ -13087,8 +12652,8 @@ export class Client { * @param body Details of the issue properties to be set or updated. Note that if an issue is not found, it is ignored. */ bulkSetIssuePropertiesByIssue(body: MultiIssueEntityProperties, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/multi"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/multi") + .toString(); const content_ = JSON.stringify(body); @@ -13160,11 +12725,11 @@ export class Client { * @param propertyKey The key of the property. */ bulkDeleteIssueProperty(propertyKey: string, body: IssueFilterForBulkPropertyDelete, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -13229,11 +12794,11 @@ export class Client { * @param propertyKey The key of the property. The maximum length is 255 characters. */ bulkSetIssueProperty(propertyKey: string, body: BulkIssuePropertyUpdateRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -13299,8 +12864,8 @@ export class Client { * @return Returned if there is at least one valid issue to unarchive in the request. It will return the count of unarchived issues, which also includes the count of the subtasks unarchived, and it will show the detailed errors for those issues which are not unarchived. */ unarchiveIssues(body: IssueArchivalSyncRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/unarchive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/unarchive") + .toString(); const content_ = JSON.stringify(body); @@ -13372,8 +12937,8 @@ export class Client { * @return Returned if the request is successful */ getIsWatchingIssueBulk(body: IssueList, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/watching"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/watching") + .toString(); const content_ = JSON.stringify(body); @@ -13434,15 +12999,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssue(issueIdOrKey: string, deleteSubtasks?: DeleteSubtasks | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (deleteSubtasks === null) - throw new globalThis.Error("The parameter 'deleteSubtasks' cannot be null."); - else if (deleteSubtasks !== undefined) - url_ += "deleteSubtasks=" + encodeURIComponent("" + deleteSubtasks) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(deleteSubtasks, 'deleteSubtasks'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("deleteSubtasks", deleteSubtasks) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -13545,35 +13108,23 @@ export class Client { * @return Returned if the request is successful. */ getIssue(issueIdOrKey: string, fields?: string[] | undefined, fieldsByKeys?: boolean | undefined, expand?: string | undefined, properties?: string[] | undefined, updateHistory?: boolean | undefined, failFast?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(fields, 'fields'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(updateHistory, 'updateHistory'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .paramArray("fields", fields) + .param("fieldsByKeys", fieldsByKeys) + .param("expand", expand) + .paramArray("properties", properties) + .param("updateHistory", updateHistory) + .param("failFast", failFast) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -13638,31 +13189,21 @@ export class Client { * @return Returned if the request is successful and the `returnIssue` parameter is `true` */ editIssue(issueIdOrKey: string, body: IssueUpdateDetails, notifyUsers?: boolean | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined, returnIssue?: boolean | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (returnIssue === null) - throw new globalThis.Error("The parameter 'returnIssue' cannot be null."); - else if (returnIssue !== undefined) - url_ += "returnIssue=" + encodeURIComponent("" + returnIssue) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(returnIssue, 'returnIssue'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .param("returnIssue", returnIssue) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -13752,11 +13293,11 @@ export class Client { * @return Returned if the request is successful. */ assignIssue(issueIdOrKey: string, body: User, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -13825,11 +13366,11 @@ export class Client { * @return Returned if the request is successful. */ addAttachment(issueIdOrKey: string, body: Blob, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = body; @@ -13906,19 +13447,15 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogs(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -13974,11 +13511,11 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogsByIds(issueIdOrKey: string, body: IssueChangelogIds, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -14046,27 +13583,19 @@ export class Client { * @return Returned if the request is successful. */ getComments(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy6 | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -14131,15 +13660,13 @@ export class Client { * @return Returned if the request is successful. */ addComment(issueIdOrKey: string, body: Comment, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -14212,14 +13739,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComment(issueIdOrKey: string, id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -14285,18 +13811,15 @@ export class Client { * @return Returned if the request is successful. */ getComment(issueIdOrKey: string, id: string, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -14360,26 +13883,19 @@ export class Client { * @return Returned if the request is successful. */ updateComment(issueIdOrKey: string, id: string, body: Comment, notifyUsers?: boolean | undefined, overrideEditableFlag?: boolean | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("overrideEditableFlag", overrideEditableFlag) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -14449,19 +13965,15 @@ export class Client { * @return Returned if the request is successful. */ getEditIssueMeta(issueIdOrKey: string, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta") + .path("issueIdOrKey", issueIdOrKey) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -14526,11 +14038,11 @@ export class Client { * @return Returned if the email is queued for sending. */ notify(issueIdOrKey: string, body: Notification, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -14599,11 +14111,11 @@ export class Client { * @return Returned if the request is successful. */ getIssuePropertyKeys(issueIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -14660,14 +14172,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueProperty(issueIdOrKey: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -14724,14 +14235,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueProperty(issueIdOrKey: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -14793,14 +14303,13 @@ export class Client { * @return Returned if the issue property is updated. */ setIssueProperty(issueIdOrKey: string, propertyKey: string, body: any, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -14882,15 +14391,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkByGlobalId(issueIdOrKey: string, globalId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === undefined || globalId === null) - throw new globalThis.Error("The parameter 'globalId' must be defined and cannot be null."); - else - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -14955,15 +14462,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinks(issueIdOrKey: string, globalId?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === null) - throw new globalThis.Error("The parameter 'globalId' cannot be null."); - else if (globalId !== undefined) - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -15035,11 +14540,11 @@ export class Client { * @return Returned if the remote issue link is updated. */ createOrUpdateRemoteIssueLink(issueIdOrKey: string, body: RemoteIssueLinkRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -15119,14 +14624,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkById(issueIdOrKey: string, linkId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -15191,14 +14695,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinkById(issueIdOrKey: string, linkId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -15267,14 +14770,13 @@ export class Client { * @return Returned if the request is successful. */ updateRemoteIssueLink(issueIdOrKey: string, linkId: string, body: RemoteIssueLinkRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); const content_ = JSON.stringify(body); @@ -15352,31 +14854,21 @@ export class Client { * @return Returned if the request is successful. */ getTransitions(issueIdOrKey: string, expand?: string | undefined, transitionId?: string | undefined, skipRemoteOnlyCondition?: boolean | undefined, includeUnavailableTransitions?: boolean | undefined, sortByOpsBarAndStatus?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' cannot be null."); - else if (transitionId !== undefined) - url_ += "transitionId=" + encodeURIComponent("" + transitionId) + "&"; - if (skipRemoteOnlyCondition === null) - throw new globalThis.Error("The parameter 'skipRemoteOnlyCondition' cannot be null."); - else if (skipRemoteOnlyCondition !== undefined) - url_ += "skipRemoteOnlyCondition=" + encodeURIComponent("" + skipRemoteOnlyCondition) + "&"; - if (includeUnavailableTransitions === null) - throw new globalThis.Error("The parameter 'includeUnavailableTransitions' cannot be null."); - else if (includeUnavailableTransitions !== undefined) - url_ += "includeUnavailableTransitions=" + encodeURIComponent("" + includeUnavailableTransitions) + "&"; - if (sortByOpsBarAndStatus === null) - throw new globalThis.Error("The parameter 'sortByOpsBarAndStatus' cannot be null."); - else if (sortByOpsBarAndStatus !== undefined) - url_ += "sortByOpsBarAndStatus=" + encodeURIComponent("" + sortByOpsBarAndStatus) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(transitionId, 'transitionId'); + Guard.notNull(skipRemoteOnlyCondition, 'skipRemoteOnlyCondition'); + Guard.notNull(includeUnavailableTransitions, 'includeUnavailableTransitions'); + Guard.notNull(sortByOpsBarAndStatus, 'sortByOpsBarAndStatus'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .param("transitionId", transitionId) + .param("skipRemoteOnlyCondition", skipRemoteOnlyCondition) + .param("includeUnavailableTransitions", includeUnavailableTransitions) + .param("sortByOpsBarAndStatus", sortByOpsBarAndStatus) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -15436,11 +14928,11 @@ export class Client { * @return Returned if the request is successful. */ doTransition(issueIdOrKey: string, body: IssueUpdateDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -15521,11 +15013,11 @@ export class Client { * @return Returned if the request is successful. */ removeVote(issueIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -15581,11 +15073,11 @@ export class Client { * @return Returned if the request is successful. */ getVotes(issueIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -15645,11 +15137,11 @@ export class Client { * @return Returned if the request is successful. */ addVote(issueIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "POST", @@ -15716,19 +15208,15 @@ export class Client { * @return Returned if the request is successful. */ removeWatcher(issueIdOrKey: string, username?: string | undefined, accountId?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .param("username", username) + .param("accountId", accountId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -15792,11 +15280,11 @@ export class Client { * @return Returned if the request is successful */ getIssueWatchers(issueIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -15857,11 +15345,11 @@ export class Client { * @return Returned if the request is successful. */ addWatcher(issueIdOrKey: string, body: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -15940,19 +15428,15 @@ export class Client { * @return Returned if the bulk deletion request was partially successful, with a message indicating partial success. */ bulkDeleteWorklogs(issueIdOrKey: string, body: WorklogIdsRequestBean, adjustEstimate?: AdjustEstimate | undefined, overrideEditableFlag?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -16025,31 +15509,21 @@ export class Client { * @return Returned if the request is successful */ getIssueWorklog(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, startedAfter?: number | undefined, startedBefore?: number | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (startedAfter === null) - throw new globalThis.Error("The parameter 'startedAfter' cannot be null."); - else if (startedAfter !== undefined) - url_ += "startedAfter=" + encodeURIComponent("" + startedAfter) + "&"; - if (startedBefore === null) - throw new globalThis.Error("The parameter 'startedBefore' cannot be null."); - else if (startedBefore !== undefined) - url_ += "startedBefore=" + encodeURIComponent("" + startedBefore) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(startedAfter, 'startedAfter'); + Guard.notNull(startedBefore, 'startedBefore'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("startedAfter", startedAfter) + .param("startedBefore", startedBefore) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -16120,35 +15594,23 @@ export class Client { * @return Returned if the request is successful. */ addWorklog(issueIdOrKey: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate2 | undefined, newEstimate?: string | undefined, reduceBy?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (reduceBy === null) - throw new globalThis.Error("The parameter 'reduceBy' cannot be null."); - else if (reduceBy !== undefined) - url_ += "reduceBy=" + encodeURIComponent("" + reduceBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(reduceBy, 'reduceBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("reduceBy", reduceBy) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -16225,19 +15687,15 @@ export class Client { * @return Returned if the request is partially successful. */ bulkMoveWorklogs(issueIdOrKey: string, body: WorklogsMoveRequestBean, adjustEstimate?: AdjustEstimate3 | undefined, overrideEditableFlag?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -16316,34 +15774,23 @@ export class Client { * @return Returned if the request is successful. */ deleteWorklog(issueIdOrKey: string, id: string, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate4 | undefined, newEstimate?: string | undefined, increaseBy?: string | undefined, overrideEditableFlag?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (increaseBy === null) - throw new globalThis.Error("The parameter 'increaseBy' cannot be null."); - else if (increaseBy !== undefined) - url_ += "increaseBy=" + encodeURIComponent("" + increaseBy) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(increaseBy, 'increaseBy'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("increaseBy", increaseBy) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -16407,18 +15854,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklog(issueIdOrKey: string, id: string, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -16488,34 +15932,23 @@ export class Client { * @return Returned if the request is successful */ updateWorklog(issueIdOrKey: string, id: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate5 | undefined, newEstimate?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -16584,14 +16017,13 @@ export class Client { * @return Returned if the request is successful. */ getWorklogPropertyKeys(issueIdOrKey: string, worklogId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -16657,17 +16089,15 @@ export class Client { * @return Returned if the worklog property is removed. */ deleteWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -16733,17 +16163,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -16810,17 +16238,15 @@ export class Client { * @return Returned if the worklog property is updated. */ setWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string, body: any, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -16901,8 +16327,8 @@ export class Client { * @return Returned if the request is successful. */ linkIssues(body: LinkIssueRequestJsonBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLink"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink") + .toString(); const content_ = JSON.stringify(body); @@ -16975,11 +16401,11 @@ export class Client { * @return 200 response */ deleteIssueLink(linkId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -17043,11 +16469,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLink(linkId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -17110,8 +16536,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkTypes( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -17170,8 +16596,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueLinkType(body: IssueLinkType, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); const content_ = JSON.stringify(body); @@ -17239,11 +16665,11 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueLinkType(issueLinkTypeId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -17303,11 +16729,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkType(issueLinkTypeId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -17371,11 +16797,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueLinkType(issueLinkTypeId: string, body: IssueLinkType, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); const content_ = JSON.stringify(body); @@ -17443,8 +16869,8 @@ export class Client { * @return Returns the details of your export task. You can use the [get task](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/#api-rest-api-3-task-taskid-get) API to view the progress of your request. */ exportArchivedIssues(body: ArchivedIssuesFilterRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issues/archive/export"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issues/archive/export") + .toString(); const content_ = JSON.stringify(body); @@ -17515,8 +16941,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecuritySchemes( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -17575,8 +17001,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueSecurityScheme(body: CreateIssueSecuritySchemeDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); const content_ = JSON.stringify(body); @@ -17657,28 +17083,19 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevels(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, onlyDefault?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .param("onlyDefault", onlyDefault) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -17750,8 +17167,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultLevels(body: SetDefaultLevelsRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default") + .toString(); const content_ = JSON.stringify(body); @@ -17847,32 +17264,21 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelMembers(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, levelId?: string[] | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (levelId === null) - throw new globalThis.Error("The parameter 'levelId' cannot be null."); - else if (levelId !== undefined) - levelId && levelId.forEach(item => { url_ += "levelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(levelId, 'levelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .paramArray("levelId", levelId) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -17939,24 +17345,17 @@ export class Client { * @return Returned if the request is successful. */ searchProjectsUsingSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, issueSecuritySchemeId?: string[] | undefined, projectId?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' cannot be null."); - else if (issueSecuritySchemeId !== undefined) - issueSecuritySchemeId && issueSecuritySchemeId.forEach(item => { url_ += "issueSecuritySchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecuritySchemeId", issueSecuritySchemeId) + .paramArray("projectId", projectId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -18027,8 +17426,8 @@ export class Client { * Associate security scheme to project */ associateSchemesToProjects(body: AssociateSecuritySchemeWithProjectDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .toString(); const content_ = JSON.stringify(body); @@ -18121,24 +17520,17 @@ export class Client { * @return Returned if the request is successful. */ searchSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -18202,11 +17594,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityScheme(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -18266,11 +17658,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueSecurityScheme(id: string, body: UpdateIssueSecuritySchemeRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -18365,27 +17757,19 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevelMembers(issueSecuritySchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, issueSecurityLevelId?: string[] | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members?"; - if (issueSecuritySchemeId === undefined || issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' must be defined."); - url_ = url_.replace("{issueSecuritySchemeId}", encodeURIComponent("" + issueSecuritySchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecurityLevelId === null) - throw new globalThis.Error("The parameter 'issueSecurityLevelId' cannot be null."); - else if (issueSecurityLevelId !== undefined) - issueSecurityLevelId && issueSecurityLevelId.forEach(item => { url_ += "issueSecurityLevelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecurityLevelId, 'issueSecurityLevelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members") + .path("issueSecuritySchemeId", issueSecuritySchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecurityLevelId", issueSecurityLevelId) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -18453,11 +17837,11 @@ export class Client { * @return Returned if the request is successful. */ deleteSecurityScheme(schemeId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -18538,11 +17922,11 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevel(schemeId: string, body: AddSecuritySchemeLevelsRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -18628,18 +18012,15 @@ export class Client { * @param replaceWith (optional) The ID of the issue security level that will replace the currently selected level. */ removeLevel(schemeId: string, levelId: string, replaceWith?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.notNull(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .param("replaceWith", replaceWith) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -18726,14 +18107,13 @@ export class Client { * @return Returned if the request is successful. */ updateSecurityLevel(schemeId: string, levelId: string, body: UpdateIssueSecurityLevelDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -18819,14 +18199,13 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevelMembers(schemeId: string, levelId: string, body: SecuritySchemeMembersRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -18913,17 +18292,15 @@ export class Client { * @return Returned if the request is successful. */ removeMemberFromSecurityLevel(schemeId: string, levelId: string, memberId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (memberId === undefined || memberId === null) - throw new globalThis.Error("The parameter 'memberId' must be defined."); - url_ = url_.replace("{memberId}", encodeURIComponent("" + memberId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.required(memberId, 'memberId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .path("memberId", memberId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -19003,8 +18380,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueAllTypes( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -19062,8 +18439,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueType(body: IssueTypeCreateBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); const content_ = JSON.stringify(body); @@ -19140,16 +18517,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypesForProject(projectId: number, level?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (level === null) - throw new globalThis.Error("The parameter 'level' cannot be null."); - else if (level !== undefined) - url_ += "level=" + encodeURIComponent("" + level) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(level, 'level'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/project") + .param("projectId", projectId) + .param("level", level) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -19217,15 +18591,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueType(id: string, alternativeIssueTypeId?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (alternativeIssueTypeId === null) - throw new globalThis.Error("The parameter 'alternativeIssueTypeId' cannot be null."); - else if (alternativeIssueTypeId !== undefined) - url_ += "alternativeIssueTypeId=" + encodeURIComponent("" + alternativeIssueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(alternativeIssueTypeId, 'alternativeIssueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .param("alternativeIssueTypeId", alternativeIssueTypeId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -19297,11 +18669,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueType(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -19361,11 +18733,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueType(id: string, body: IssueTypeUpdateBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -19441,11 +18813,11 @@ export class Client { * @return Returned if the request is successful. */ getAlternativeIssueTypes(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -19511,23 +18883,17 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeAvatar(id: string, size: number, body: any, x?: number | undefined, y?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2") + .path("id", id) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -19599,11 +18965,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypePropertyKeys(issueTypeId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties") + .path("issueTypeId", issueTypeId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -19664,14 +19030,13 @@ export class Client { * @return Returned if the issue type property is deleted. */ deleteIssueTypeProperty(issueTypeId: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -19736,14 +19101,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeProperty(issueTypeId: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -19809,14 +19173,13 @@ export class Client { * @return Returned if the issue type property is updated. */ setIssueTypeProperty(issueTypeId: string, propertyKey: string, body: any, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -19908,32 +19271,21 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueTypeSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy7 | undefined, expand?: string | undefined, queryString?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("expand", expand) + .param("queryString", queryString) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -19996,8 +19348,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScheme(body: IssueTypeSchemeDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .toString(); const content_ = JSON.stringify(body); @@ -20071,20 +19423,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemesMapping(startAt?: number | undefined, maxResults?: number | undefined, issueTypeSchemeId?: number[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' cannot be null."); - else if (issueTypeSchemeId !== undefined) - issueTypeSchemeId && issueTypeSchemeId.forEach(item => { url_ += "issueTypeSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeSchemeId", issueTypeSchemeId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -20150,20 +19497,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemeForProjects(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -20226,8 +19568,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeSchemeToProject(body: IssueTypeSchemeProjectAssociation, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -20300,11 +19642,11 @@ export class Client { * @return Returned if the issue type scheme is deleted. */ deleteIssueTypeScheme(issueTypeSchemeId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -20373,11 +19715,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeSchemeUpdateDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -20450,11 +19792,11 @@ export class Client { * @return Returned if the request is successful. */ addIssueTypesToIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeIds, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -20527,11 +19869,11 @@ export class Client { * @return Returned if the request is successful. */ reorderIssueTypesInIssueTypeScheme(issueTypeSchemeId: number, body: OrderOfIssueTypes, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -20605,14 +19947,13 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypeFromIssueTypeScheme(issueTypeSchemeId: number, issueTypeId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .path("issueTypeId", issueTypeId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -20689,32 +20030,21 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, orderBy?: OrderBy8 | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -20778,8 +20108,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScreenScheme(body: IssueTypeScreenSchemeDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -20857,20 +20187,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, issueTypeScreenSchemeId?: number[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' cannot be null."); - else if (issueTypeScreenSchemeId !== undefined) - issueTypeScreenSchemeId && issueTypeScreenSchemeId.forEach(item => { url_ += "issueTypeScreenSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -20936,20 +20261,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeProjectAssociations(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -21012,8 +20332,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeScreenSchemeToProject(body: IssueTypeScreenSchemeProjectAssociation, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -21086,11 +20406,11 @@ export class Client { * @return Returned if the issue type screen scheme is deleted. */ deleteIssueTypeScreenScheme(issueTypeScreenSchemeId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -21160,11 +20480,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeUpdateDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -21237,11 +20557,11 @@ export class Client { * @return Returned if the request is successful. */ appendMappingsForIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeMappingDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -21318,11 +20638,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultScreenScheme(issueTypeScreenSchemeId: string, body: UpdateDefaultScreenScheme, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -21395,11 +20715,11 @@ export class Client { * @return Returned if the screen scheme mappings are removed from the issue type screen scheme. */ removeMappingsFromIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeIds, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -21475,23 +20795,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectsForIssueTypeScreenScheme(issueTypeScreenSchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, query?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project?"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -21554,8 +20868,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoComplete( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -21610,8 +20924,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoCompletePost(body: SearchAutoCompleteFilter, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); const content_ = JSON.stringify(body); @@ -21678,24 +20992,17 @@ export class Client { * @return Returned if the request is successful. */ getFieldAutoCompleteForQueryString(fieldName?: string | undefined, fieldValue?: string | undefined, predicateName?: string | undefined, predicateValue?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions?"; - if (fieldName === null) - throw new globalThis.Error("The parameter 'fieldName' cannot be null."); - else if (fieldName !== undefined) - url_ += "fieldName=" + encodeURIComponent("" + fieldName) + "&"; - if (fieldValue === null) - throw new globalThis.Error("The parameter 'fieldValue' cannot be null."); - else if (fieldValue !== undefined) - url_ += "fieldValue=" + encodeURIComponent("" + fieldValue) + "&"; - if (predicateName === null) - throw new globalThis.Error("The parameter 'predicateName' cannot be null."); - else if (predicateName !== undefined) - url_ += "predicateName=" + encodeURIComponent("" + predicateName) + "&"; - if (predicateValue === null) - throw new globalThis.Error("The parameter 'predicateValue' cannot be null."); - else if (predicateValue !== undefined) - url_ += "predicateValue=" + encodeURIComponent("" + predicateValue) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(fieldName, 'fieldName'); + Guard.notNull(fieldValue, 'fieldValue'); + Guard.notNull(predicateName, 'predicateName'); + Guard.notNull(predicateValue, 'predicateValue'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions") + .param("fieldName", fieldName) + .param("fieldValue", fieldValue) + .param("predicateName", predicateName) + .param("predicateValue", predicateValue) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -21766,24 +21073,17 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputations(functionKey?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (functionKey === null) - throw new globalThis.Error("The parameter 'functionKey' cannot be null."); - else if (functionKey !== undefined) - functionKey && functionKey.forEach(item => { url_ += "functionKey=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(functionKey, 'functionKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .paramArray("functionKey", functionKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -21851,12 +21151,11 @@ export class Client { * @return 200 response */ updatePrecomputations(body: JqlFunctionPrecomputationUpdateRequestBean, skipNotFoundPrecomputations?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (skipNotFoundPrecomputations === null) - throw new globalThis.Error("The parameter 'skipNotFoundPrecomputations' cannot be null."); - else if (skipNotFoundPrecomputations !== undefined) - url_ += "skipNotFoundPrecomputations=" + encodeURIComponent("" + skipNotFoundPrecomputations) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(skipNotFoundPrecomputations, 'skipNotFoundPrecomputations'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .param("skipNotFoundPrecomputations", skipNotFoundPrecomputations) + .toString(); const content_ = JSON.stringify(body); @@ -21946,12 +21245,11 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputationsByID(body: JqlFunctionPrecomputationGetByIdRequest, orderBy?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation/search?"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation/search") + .param("orderBy", orderBy) + .toString(); const content_ = JSON.stringify(body); @@ -22022,8 +21320,8 @@ export class Client { * @return Returned if the request is successful. */ matchIssues(body: IssuesAndJQLQueries, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/match"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/match") + .toString(); const content_ = JSON.stringify(body); @@ -22087,12 +21385,11 @@ export class Client { * @return Returned if the request is successful. */ parseJqlQueries(validation: Validation, body: JqlQueriesToParse, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/parse?"; - if (validation === undefined || validation === null) - throw new globalThis.Error("The parameter 'validation' must be defined and cannot be null."); - else - url_ += "validation=" + encodeURIComponent("" + validation) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(validation, 'validation'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/parse") + .param("validation", validation) + .toString(); const content_ = JSON.stringify(body); @@ -22158,8 +21455,8 @@ export class Client { * @return Returned if the request is successful. Note that the JQL queries are returned in the same order that they were passed. */ migrateQueries(body: JQLPersonalDataMigrationRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/pdcleaner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/pdcleaner") + .toString(); const content_ = JSON.stringify(body); @@ -22230,8 +21527,8 @@ export class Client { * @return Returned if the request is successful. */ sanitiseJqlQueries(body: JqlQueriesToSanitize, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/sanitize"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/sanitize") + .toString(); const content_ = JSON.stringify(body); @@ -22309,16 +21606,13 @@ export class Client { * @return Returned if the request is successful. */ getAllLabels(startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/label?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/label") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -22369,8 +21663,8 @@ export class Client { * @return Returned if the request is successful. */ getApproximateLicenseCount( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -22436,11 +21730,11 @@ export class Client { * @return Returned if the request is successful. */ getApproximateApplicationLicenseCount(applicationKey: ApplicationKey, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}"; - if (applicationKey === undefined || applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' must be defined."); - url_ = url_.replace("{applicationKey}", encodeURIComponent("" + applicationKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}") + .path("applicationKey", applicationKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -22513,40 +21807,25 @@ export class Client { * @return Returned if the request is successful. */ getMyPermissions(projectKey?: string | undefined, projectId?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, permissions?: string | undefined, projectUuid?: string | undefined, projectConfigurationUuid?: string | undefined, commentId?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypermissions?"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (permissions === null) - throw new globalThis.Error("The parameter 'permissions' cannot be null."); - else if (permissions !== undefined) - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (projectUuid === null) - throw new globalThis.Error("The parameter 'projectUuid' cannot be null."); - else if (projectUuid !== undefined) - url_ += "projectUuid=" + encodeURIComponent("" + projectUuid) + "&"; - if (projectConfigurationUuid === null) - throw new globalThis.Error("The parameter 'projectConfigurationUuid' cannot be null."); - else if (projectConfigurationUuid !== undefined) - url_ += "projectConfigurationUuid=" + encodeURIComponent("" + projectConfigurationUuid) + "&"; - if (commentId === null) - throw new globalThis.Error("The parameter 'commentId' cannot be null."); - else if (commentId !== undefined) - url_ += "commentId=" + encodeURIComponent("" + commentId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(permissions, 'permissions'); + Guard.notNull(projectUuid, 'projectUuid'); + Guard.notNull(projectConfigurationUuid, 'projectConfigurationUuid'); + Guard.notNull(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypermissions") + .param("projectKey", projectKey) + .param("projectId", projectId) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("permissions", permissions) + .param("projectUuid", projectUuid) + .param("projectConfigurationUuid", projectConfigurationUuid) + .param("commentId", commentId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -22619,12 +21898,11 @@ export class Client { * @return Returned if the request is successful. */ removePreference(key: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -22680,12 +21958,11 @@ export class Client { * @return Returned if the request is successful. */ getPreference(key: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -22747,12 +22024,11 @@ export class Client { * @return Returned if the request is successful. */ setPreference(key: string, body: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); const content_ = JSON.stringify(body); @@ -22817,8 +22093,8 @@ export class Client { * @deprecated */ deleteLocale( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -22874,8 +22150,8 @@ export class Client { * @return Returned if the request is successful. */ getLocale( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -22932,8 +22208,8 @@ export class Client { * @deprecated */ setLocale(body: Locale, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); const content_ = JSON.stringify(body); @@ -23001,12 +22277,11 @@ export class Client { * @return Returned if the request is successful. */ getCurrentUser(expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/myself?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/myself") + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -23074,32 +22349,21 @@ export class Client { * @return Returned if the request is successful. Only returns notification schemes that the user has permission to access. An empty list is returned if the user lacks permission to access all notification schemes. */ getNotificationSchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -23158,8 +22422,8 @@ export class Client { * @return Returned if the request is successful. */ createNotificationScheme(body: CreateNotificationSchemeDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -23239,24 +22503,17 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeToProjectMappings(startAt?: string | undefined, maxResults?: string | undefined, notificationSchemeId?: string[] | undefined, projectId?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' cannot be null."); - else if (notificationSchemeId !== undefined) - notificationSchemeId && notificationSchemeId.forEach(item => { url_ += "notificationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(notificationSchemeId, 'notificationSchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("notificationSchemeId", notificationSchemeId) + .paramArray("projectId", projectId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -23330,15 +22587,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationScheme(id: number, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -23402,11 +22657,11 @@ export class Client { * @return Returned if the request is successful. */ updateNotificationScheme(id: string, body: UpdateNotificationSchemeDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -23491,11 +22746,11 @@ export class Client { * @return Returned if the request is successful. */ addNotifications(id: string, body: AddNotificationsDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -23580,11 +22835,11 @@ export class Client { * @return Returned if the request is successful. */ deleteNotificationScheme(notificationSchemeId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}") + .path("notificationSchemeId", notificationSchemeId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -23666,14 +22921,13 @@ export class Client { * @return Returned if the request is successful. */ removeNotificationFromNotificationScheme(notificationSchemeId: string, notificationId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - if (notificationId === undefined || notificationId === null) - throw new globalThis.Error("The parameter 'notificationId' must be defined."); - url_ = url_.replace("{notificationId}", encodeURIComponent("" + notificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + Guard.required(notificationId, 'notificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}") + .path("notificationSchemeId", notificationSchemeId) + .path("notificationId", notificationId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -23753,8 +23007,8 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissions( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissions"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -23814,8 +23068,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkPermissions(body: BulkPermissionsRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissions/check"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/check") + .toString(); const content_ = JSON.stringify(body); @@ -23884,8 +23138,8 @@ export class Client { * @return Returned if the request is successful. */ getPermittedProjects(body: PermissionsKeysBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissions/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/project") + .toString(); const content_ = JSON.stringify(body); @@ -23956,12 +23210,11 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissionSchemes(expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -24025,12 +23278,11 @@ export class Client { * @return Returned if the permission scheme is created. */ createPermissionScheme(body: PermissionScheme, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -24098,11 +23350,11 @@ export class Client { * @return Returned if the permission scheme is deleted. */ deletePermissionScheme(schemeId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -24170,15 +23422,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionScheme(schemeId: number, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -24246,15 +23496,13 @@ export class Client { * @return Returned if the scheme is updated. */ updatePermissionScheme(schemeId: number, body: PermissionScheme, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -24330,15 +23578,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrants(schemeId: number, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -24407,15 +23653,13 @@ export class Client { * @return Returned if the scheme permission is created. */ createPermissionGrant(schemeId: number, body: PermissionGrant, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -24484,14 +23728,13 @@ export class Client { * @return Returned if the permission grant is deleted. */ deletePermissionSchemeEntity(schemeId: number, permissionId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -24560,18 +23803,15 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrant(schemeId: number, permissionId: number, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -24634,24 +23874,17 @@ export class Client { * @return Returned if the request is successful. */ getPlans(includeTrashed?: boolean | undefined, includeArchived?: boolean | undefined, cursor?: string | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (includeTrashed === null) - throw new globalThis.Error("The parameter 'includeTrashed' cannot be null."); - else if (includeTrashed !== undefined) - url_ += "includeTrashed=" + encodeURIComponent("" + includeTrashed) + "&"; - if (includeArchived === null) - throw new globalThis.Error("The parameter 'includeArchived' cannot be null."); - else if (includeArchived !== undefined) - url_ += "includeArchived=" + encodeURIComponent("" + includeArchived) + "&"; - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(includeTrashed, 'includeTrashed'); + Guard.notNull(includeArchived, 'includeArchived'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("includeTrashed", includeTrashed) + .param("includeArchived", includeArchived) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -24717,12 +23950,11 @@ export class Client { * @return Returned if the request is successful. */ createPlan(body: CreatePlanRequest, useGroupId?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -24801,15 +24033,13 @@ export class Client { * @return Returned if the request is successful. */ getPlan(planId: number, useGroupId?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -24883,15 +24113,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlan(planId: number, body: any, useGroupId?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -24983,11 +24211,11 @@ export class Client { * @return Returned if the request is successful. */ archivePlan(planId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive") + .path("planId", planId) + .toString(); let options_: AxiosRequestConfig = { method: "PUT", @@ -25068,11 +24296,11 @@ export class Client { * @return Returned if the request is successful. */ duplicatePlan(planId: number, body: DuplicatePlanRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -25166,19 +24394,15 @@ export class Client { * @return Returned if the request is successful. */ getTeams(planId: number, cursor?: string | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team") + .path("planId", planId) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -25251,11 +24475,11 @@ export class Client { * @return Returned if the request is successful. */ addAtlassianTeam(planId: number, body: AddAtlassianTeamRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -25348,14 +24572,13 @@ export class Client { * @return Returned if the request is successful. */ removeAtlassianTeam(planId: number, atlassianTeamId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -25437,14 +24660,13 @@ export class Client { * @return Returned if the request is successful. */ getAtlassianTeam(planId: number, atlassianTeamId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -25525,14 +24747,13 @@ export class Client { * @return Returned if the request is successful. */ updateAtlassianTeam(planId: number, atlassianTeamId: string, body: any, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -25624,11 +24845,11 @@ export class Client { * @return Returned if the request is successful. */ createPlanOnlyTeam(planId: number, body: CreatePlanOnlyTeamRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -25721,14 +24942,13 @@ export class Client { * @return Returned if the request is successful. */ deletePlanOnlyTeam(planId: number, planOnlyTeamId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -25810,14 +25030,13 @@ export class Client { * @return Returned if the request is successful. */ getPlanOnlyTeam(planId: number, planOnlyTeamId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -25898,14 +25117,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlanOnlyTeam(planId: number, planOnlyTeamId: number, body: any, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -25997,11 +25215,11 @@ export class Client { * @return Returned if the request is successful. */ trashPlan(planId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash") + .path("planId", planId) + .toString(); let options_: AxiosRequestConfig = { method: "PUT", @@ -26082,8 +25300,8 @@ export class Client { * @deprecated */ getPriorities( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -26146,8 +25364,8 @@ export class Client { * @deprecated */ createPriority(body: CreatePriorityDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); const content_ = JSON.stringify(body); @@ -26223,8 +25441,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultPriority(body: SetDefaultPriorityRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/default") + .toString(); const content_ = JSON.stringify(body); @@ -26308,8 +25526,8 @@ export class Client { * @return Returned if the request is successful. */ movePriorities(body: ReorderIssuePriorities, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/move") + .toString(); const content_ = JSON.stringify(body); @@ -26401,36 +25619,23 @@ export class Client { * @deprecated */ searchPriorities(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, priorityName?: string | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (priorityName === null) - throw new globalThis.Error("The parameter 'priorityName' cannot be null."); - else if (priorityName !== undefined) - url_ += "priorityName=" + encodeURIComponent("" + priorityName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(priorityName, 'priorityName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("priorityName", priorityName) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -26488,11 +25693,11 @@ export class Client { * @param id The ID of the issue priority. */ deletePriority(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -26578,11 +25783,11 @@ export class Client { * @return Returned if the request is successful. */ getPriority(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -26643,11 +25848,11 @@ export class Client { * @deprecated */ updatePriority(id: string, body: UpdatePriorityDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26739,40 +25944,25 @@ export class Client { * @return Returned if the request is successful. */ getPrioritySchemes(startAt?: string | undefined, maxResults?: string | undefined, priorityId?: number[] | undefined, schemeId?: number[] | undefined, schemeName?: string | undefined, onlyDefault?: boolean | undefined, orderBy?: OrderBy9 | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (priorityId === null) - throw new globalThis.Error("The parameter 'priorityId' cannot be null."); - else if (priorityId !== undefined) - priorityId && priorityId.forEach(item => { url_ += "priorityId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeName === null) - throw new globalThis.Error("The parameter 'schemeName' cannot be null."); - else if (schemeName !== undefined) - url_ += "schemeName=" + encodeURIComponent("" + schemeName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(priorityId, 'priorityId'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(schemeName, 'schemeName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("priorityId", priorityId) + .paramArray("schemeId", schemeId) + .param("schemeName", schemeName) + .param("onlyDefault", onlyDefault) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -26831,8 +26021,8 @@ export class Client { * @return Returned if the request is completed. */ createPriorityScheme(body: CreatePrioritySchemeDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .toString(); const content_ = JSON.stringify(body); @@ -26910,8 +26100,8 @@ export class Client { * @return Returned if the request is successful. */ suggestedPrioritiesForMappings(body: SuggestedMappingsRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -26979,28 +26169,19 @@ export class Client { * @return Returned if the request is successful. */ getAvailablePrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, query?: string | undefined, exclude?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/priorities/available?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined and cannot be null."); - else - url_ += "schemeId=" + encodeURIComponent("" + schemeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/priorities/available") + .param("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .paramArray("exclude", exclude) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -27060,11 +26241,11 @@ export class Client { * @return Returned if the request is successful. */ deletePriorityScheme(schemeId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -27129,11 +26310,11 @@ export class Client { * @return Returned if the request is accepted. */ updatePriorityScheme(schemeId: number, body: UpdatePrioritySchemeRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -27207,19 +26388,15 @@ export class Client { * @return Returned if the request is successful. */ getPrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -27283,27 +26460,19 @@ export class Client { * @return Returned if the request is successful. */ getProjectsByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, projectId?: number[] | undefined, query?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("projectId", projectId) + .param("query", query) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -27371,20 +26540,15 @@ export class Client { * @deprecated */ getAllProjects(expand?: string | undefined, recent?: number | undefined, properties?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (recent === null) - throw new globalThis.Error("The parameter 'recent' cannot be null."); - else if (recent !== undefined) - url_ += "recent=" + encodeURIComponent("" + recent) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(recent, 'recent'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .param("expand", expand) + .param("recent", recent) + .paramArray("properties", properties) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -27447,8 +26611,8 @@ export class Client { * @return Returned if the project is created. */ createProject(body: CreateProjectDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .toString(); const content_ = JSON.stringify(body); @@ -27515,8 +26679,8 @@ export class Client { * @param body The JSON payload containing the project details and capabilities */ createProjectWithCustomTemplate(body: ProjectCustomTemplateCreateRequestDTO, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project-template"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project-template") + .toString(); const content_ = JSON.stringify(body); @@ -27582,21 +26746,13 @@ export class Client { * @return Returned if the request is successful. */ getRecent(expand?: string | undefined, properties?: StringList[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/recent?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/recent") + .param("expand", expand) + .paramArray("properties", properties) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -27707,65 +26863,35 @@ export class Client { * @return Returned if the request is successful. */ searchProjects(startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy10 | undefined, id?: number[] | undefined, keys?: string[] | undefined, query?: string | undefined, typeKey?: string | undefined, categoryId?: number | undefined, action?: Action | undefined, expand?: string | undefined, status?: Status4[] | undefined, properties?: StringList[] | undefined, propertyQuery?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (typeKey === null) - throw new globalThis.Error("The parameter 'typeKey' cannot be null."); - else if (typeKey !== undefined) - url_ += "typeKey=" + encodeURIComponent("" + typeKey) + "&"; - if (categoryId === null) - throw new globalThis.Error("The parameter 'categoryId' cannot be null."); - else if (categoryId !== undefined) - url_ += "categoryId=" + encodeURIComponent("" + categoryId) + "&"; - if (action === null) - throw new globalThis.Error("The parameter 'action' cannot be null."); - else if (action !== undefined) - url_ += "action=" + encodeURIComponent("" + action) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - if (propertyQuery === null) - throw new globalThis.Error("The parameter 'propertyQuery' cannot be null."); - else if (propertyQuery !== undefined) - url_ += "propertyQuery=" + encodeURIComponent("" + propertyQuery) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(id, 'id'); + Guard.notNull(keys, 'keys'); + Guard.notNull(query, 'query'); + Guard.notNull(typeKey, 'typeKey'); + Guard.notNull(categoryId, 'categoryId'); + Guard.notNull(action, 'action'); + Guard.notNull(expand, 'expand'); + Guard.notNull(status, 'status'); + Guard.notNull(properties, 'properties'); + Guard.notNull(propertyQuery, 'propertyQuery'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .paramArray("id", id) + .paramArray("keys", keys) + .param("query", query) + .param("typeKey", typeKey) + .param("categoryId", categoryId) + .param("action", action) + .param("expand", expand) + .paramArray("status", status) + .paramArray("properties", properties) + .param("propertyQuery", propertyQuery) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -27828,8 +26954,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectTypes( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -27891,8 +27017,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAccessibleProjectTypes( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type/accessible"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/accessible") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -27951,11 +27077,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectTypeByKey(projectTypeKey: ProjectTypeKey, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}") + .path("projectTypeKey", projectTypeKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -28015,11 +27141,11 @@ export class Client { * @return Returned if the request is successful. */ getAccessibleProjectTypeByKey(projectTypeKey: ProjectTypeKey2, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible") + .path("projectTypeKey", projectTypeKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -28080,15 +27206,13 @@ export class Client { * @return Returned if the project is deleted. */ deleteProject(projectIdOrKey: string, enableUndo?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (enableUndo === null) - throw new globalThis.Error("The parameter 'enableUndo' cannot be null."); - else if (enableUndo !== undefined) - url_ += "enableUndo=" + encodeURIComponent("" + enableUndo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(enableUndo, 'enableUndo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("enableUndo", enableUndo) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -28152,19 +27276,15 @@ export class Client { * @return Returned if successful. */ getProject(projectIdOrKey: string, expand?: string | undefined, properties?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .paramArray("properties", properties) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -28231,15 +27351,13 @@ export class Client { * @return Returned if the project is updated. */ updateProject(projectIdOrKey: string, body: UpdateProjectDetails, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -28311,11 +27429,11 @@ export class Client { * @return Returned if the request is successful. */ archiveProject(projectIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "POST", @@ -28384,11 +27502,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectAvatar(projectIdOrKey: string, body: Avatar, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -28458,14 +27576,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectAvatar(projectIdOrKey: string, id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -28528,23 +27645,17 @@ export class Client { * @return Returned if the request is successful. */ createProjectAvatar(projectIdOrKey: string, body: any, x?: number | undefined, y?: number | undefined, size?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + Guard.notNull(size, 'size'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2") + .path("projectIdOrKey", projectIdOrKey) + .param("x", x) + .param("y", y) + .param("size", size) + .toString(); const content_ = JSON.stringify(body); @@ -28616,11 +27727,11 @@ export class Client { * @return Returned if request is successful. */ getAllProjectAvatars(projectIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -28680,11 +27791,11 @@ export class Client { * @return Returned if the request is successful. */ removeDefaultProjectClassification(projectIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -28749,11 +27860,11 @@ export class Client { * @return Returned if the request is successful. */ getDefaultProjectClassification(projectIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -28814,11 +27925,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultProjectClassification(projectIdOrKey: string, body: UpdateDefaultProjectClassificationBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -28897,31 +28008,21 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponentsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy11 | undefined, componentSource?: ComponentSource | undefined, query?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(componentSource, 'componentSource'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("componentSource", componentSource) + .param("query", query) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -28982,15 +28083,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponents(projectIdOrKey: string, componentSource?: ComponentSource2 | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(componentSource, 'componentSource'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components") + .path("projectIdOrKey", projectIdOrKey) + .param("componentSource", componentSource) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -29056,11 +28155,11 @@ export class Client { * @param projectIdOrKey The project ID or project key (case sensitive). */ deleteProjectAsynchronously(projectIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "POST", @@ -29123,11 +28222,11 @@ export class Client { * @return Returned if the request is successful. */ getFeaturesForProject(projectIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -29197,14 +28296,13 @@ export class Client { * @return Returned if the request is successful. */ toggleFeatureForProject(projectIdOrKey: string, featureKey: string, body: ProjectFeatureState, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (featureKey === undefined || featureKey === null) - throw new globalThis.Error("The parameter 'featureKey' must be defined."); - url_ = url_.replace("{featureKey}", encodeURIComponent("" + featureKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(featureKey, 'featureKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("featureKey", featureKey) + .toString(); const content_ = JSON.stringify(body); @@ -29276,11 +28374,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectPropertyKeys(projectIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -29349,14 +28447,13 @@ export class Client { * @return Returned if the project property is deleted. */ deleteProjectProperty(projectIdOrKey: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -29421,14 +28518,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectProperty(projectIdOrKey: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -29498,14 +28594,13 @@ export class Client { * @return Returned if the project property is updated. */ setProjectProperty(projectIdOrKey: string, propertyKey: string, body: any, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -29586,11 +28681,11 @@ export class Client { * @return Returned if the request is successful. */ restore(projectIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "POST", @@ -29654,11 +28749,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoles(projectIdOrKey: string, cancelToken?: CancelToken): Promise<{ [key: string]: string; }> { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -29731,26 +28826,19 @@ export class Client { * @return Returned if the request is successful. */ deleteActor(projectIdOrKey: string, id: number, user?: string | undefined, group?: string | undefined, groupId?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(group, 'group'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("user", user) + .param("group", group) + .param("groupId", groupId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -29808,18 +28896,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRole(projectIdOrKey: string, id: number, excludeInactiveUsers?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (excludeInactiveUsers === null) - throw new globalThis.Error("The parameter 'excludeInactiveUsers' cannot be null."); - else if (excludeInactiveUsers !== undefined) - url_ += "excludeInactiveUsers=" + encodeURIComponent("" + excludeInactiveUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(excludeInactiveUsers, 'excludeInactiveUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("excludeInactiveUsers", excludeInactiveUsers) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -29887,14 +28972,13 @@ export class Client { For example, the cURL request above adds a group, *jira-developers*. For the response below to be returned as a result of that request, the user *Mia Krystof* would have previously been added as a `user` actor for this project. */ addActorUsers(projectIdOrKey: string, id: number, body: ActorsMap, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -29964,14 +29048,13 @@ export class Client { * @return Returned if the request is successful. The complete list of actors for the project is returned. */ setActors(projectIdOrKey: string, id: number, body: ProjectRoleActorsUpdateBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -30041,19 +29124,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleDetails(projectIdOrKey: string, currentMember?: boolean | undefined, excludeConnectAddons?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (currentMember === null) - throw new globalThis.Error("The parameter 'currentMember' cannot be null."); - else if (currentMember !== undefined) - url_ += "currentMember=" + encodeURIComponent("" + currentMember) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(currentMember, 'currentMember'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails") + .path("projectIdOrKey", projectIdOrKey) + .param("currentMember", currentMember) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -30120,11 +29199,11 @@ export class Client { * @return Returned if the request is successful. */ getAllStatuses(projectIdOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -30208,35 +29287,23 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersionsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy12 | undefined, query?: string | undefined, status?: string | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .param("status", status) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -30293,15 +29360,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersions(projectIdOrKey: string, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -30364,11 +29429,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectEmail(projectId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -30433,11 +29498,11 @@ export class Client { * @return Returned if the project's sender email address is successfully set. */ updateProjectEmail(projectId: number, body: ProjectEmailAddress, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); const content_ = JSON.stringify(body); @@ -30510,11 +29575,11 @@ export class Client { * @return Returned if the request is successful. */ getHierarchy(projectId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy") + .path("projectId", projectId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -30578,11 +29643,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueSecurityScheme(projectKeyOrId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme") + .path("projectKeyOrId", projectKeyOrId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -30658,15 +29723,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeForProject(projectKeyOrId: string, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -30738,15 +29801,13 @@ export class Client { * @return Returned if the request is successful. */ getAssignedPermissionScheme(projectKeyOrId: string, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -30818,15 +29879,13 @@ export class Client { * @return Returned if the request is successful. */ assignPermissionScheme(projectKeyOrId: string, body: IdBean, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -30894,11 +29953,11 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelsForProject(projectKeyOrId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel") + .path("projectKeyOrId", projectKeyOrId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -30953,8 +30012,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectCategories( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -31016,8 +30075,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectCategory(body: ProjectCategory, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); const content_ = JSON.stringify(body); @@ -31089,11 +30148,11 @@ export class Client { * @return Returned if the request is successful. */ removeProjectCategory(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -31153,11 +30212,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectCategoryById(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -31216,11 +30275,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectCategory(id: number, body: ProjectCategory, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -31292,12 +30351,11 @@ export class Client { * @return Returned if the request is successful. */ validateProjectKey(key?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/key?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/key") + .param("key", key) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -31353,12 +30411,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectKey(key?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey") + .param("key", key) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -31415,12 +30472,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectName(name: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectName?"; - if (name === undefined || name === null) - throw new globalThis.Error("The parameter 'name' must be defined and cannot be null."); - else - url_ += "name=" + encodeURIComponent("" + name) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(name, 'name'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectName") + .param("name", name) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -31485,8 +30541,8 @@ export class Client { * @deprecated */ getResolutions( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -31548,8 +30604,8 @@ export class Client { * @return Returned if the request is successful. */ createResolution(body: CreateResolutionDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); const content_ = JSON.stringify(body); @@ -31625,8 +30681,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultResolution(body: SetDefaultResolutionRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/default") + .toString(); const content_ = JSON.stringify(body); @@ -31710,8 +30766,8 @@ export class Client { * @return Returned if the request is successful. */ moveResolutions(body: ReorderIssueResolutionsRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/move") + .toString(); const content_ = JSON.stringify(body); @@ -31799,24 +30855,17 @@ export class Client { * @return Returned if the request is successful. */ searchResolutions(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, onlyDefault?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("onlyDefault", onlyDefault) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -31875,15 +30924,13 @@ export class Client { * @param replaceWith The ID of the issue resolution that will replace the currently selected resolution. */ deleteResolution(id: string, replaceWith: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (replaceWith === undefined || replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' must be defined and cannot be null."); - else - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .param("replaceWith", replaceWith) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -31969,11 +31016,11 @@ export class Client { * @return Returned if the request is successful. */ getResolution(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -32033,11 +31080,11 @@ export class Client { * @return Returned if the request is successful. */ updateResolution(id: string, body: UpdateResolutionDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32121,8 +31168,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectRoles( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -32188,8 +31235,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectRole(body: CreateUpdateRoleRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); const content_ = JSON.stringify(body); @@ -32262,15 +31309,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRole(id: number, swap?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (swap === null) - throw new globalThis.Error("The parameter 'swap' cannot be null."); - else if (swap !== undefined) - url_ += "swap=" + encodeURIComponent("" + swap) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(swap, 'swap'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .param("swap", swap) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -32338,11 +31383,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleById(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -32406,11 +31451,11 @@ export class Client { * @return Returned if the request is successful. */ partialUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32482,11 +31527,11 @@ export class Client { * @return Returned if the request is successful. */ fullyUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32561,23 +31606,17 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRoleActorsFromRole(id: number, user?: string | undefined, groupId?: string | undefined, group?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(group, 'group'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .param("user", user) + .param("groupId", groupId) + .param("group", group) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -32645,11 +31684,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleActorsForRole(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -32717,11 +31756,11 @@ export class Client { * @return Returned if the request is successful. */ addProjectRoleActorsToRole(id: number, body: ActorInputBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32801,32 +31840,21 @@ export class Client { * @return Returned if the request is successful. */ getScreens(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, scope?: Scope2[] | undefined, orderBy?: OrderBy13 | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - scope && scope.forEach(item => { url_ += "scope=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(scope, 'scope'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .paramArray("scope", scope) + .param("orderBy", orderBy) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -32885,8 +31913,8 @@ export class Client { * @return Returned if the request is successful. */ createScreen(body: ScreenDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .toString(); const content_ = JSON.stringify(body); @@ -32954,11 +31982,11 @@ export class Client { * @return Returned if the request is successful. */ addFieldToDefaultScreen(fieldId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}") + .path("fieldId", fieldId) + .toString(); let options_: AxiosRequestConfig = { method: "POST", @@ -33030,24 +32058,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkScreenTabs(screenId?: number[] | undefined, tabId?: number[] | undefined, startAt?: number | undefined, maxResult?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/tabs?"; - if (screenId === null) - throw new globalThis.Error("The parameter 'screenId' cannot be null."); - else if (screenId !== undefined) - screenId && screenId.forEach(item => { url_ += "screenId=" + encodeURIComponent("" + item) + "&"; }); - if (tabId === null) - throw new globalThis.Error("The parameter 'tabId' cannot be null."); - else if (tabId !== undefined) - tabId && tabId.forEach(item => { url_ += "tabId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(screenId, 'screenId'); + Guard.notNull(tabId, 'tabId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/tabs") + .paramArray("screenId", screenId) + .paramArray("tabId", tabId) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -33108,11 +32129,11 @@ export class Client { * @return Returned if the request is successful. */ deleteScreen(screenId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -33176,11 +32197,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreen(screenId: number, body: UpdateScreenDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -33252,11 +32273,11 @@ export class Client { * @return Returned if the request is successful. */ getAvailableScreenFields(screenId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields") + .path("screenId", screenId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -33328,15 +32349,13 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabs(screenId: number, projectKey?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .param("projectKey", projectKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -33411,11 +32430,11 @@ export class Client { * @return Returned if the request is successful. */ addScreenTab(screenId: number, body: ScreenableTab, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -33488,14 +32507,13 @@ export class Client { * @return Returned if the request is successful. */ deleteScreenTab(screenId: number, tabId: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -33556,14 +32574,13 @@ export class Client { * @return Returned if the request is successful. */ renameScreenTab(screenId: number, tabId: number, body: ScreenableTab, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -33637,18 +32654,15 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabFields(screenId: number, tabId: number, projectKey?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .param("projectKey", projectKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -33720,14 +32734,13 @@ export class Client { * @return Returned if the request is successful. */ addScreenTabField(screenId: number, tabId: number, body: AddFieldBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -33801,17 +32814,15 @@ export class Client { * @return Returned if the request is successful. */ removeScreenTabField(screenId: number, tabId: number, id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -33877,17 +32888,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTabField(screenId: number, tabId: number, id: string, body: MoveFieldBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -33962,17 +32971,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTab(screenId: number, tabId: number, pos: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (pos === undefined || pos === null) - throw new globalThis.Error("The parameter 'pos' must be defined."); - url_ = url_.replace("{pos}", encodeURIComponent("" + pos)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(pos, 'pos'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("pos", pos) + .toString(); let options_: AxiosRequestConfig = { method: "POST", @@ -34049,32 +33056,21 @@ export class Client { * @return Returned if the request is successful. */ getScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy14 | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -34133,8 +33129,8 @@ export class Client { * @return Returned if the request is successful. */ createScreenScheme(body: ScreenSchemeDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -34206,11 +33202,11 @@ export class Client { * @return Returned if the screen scheme is deleted. */ deleteScreenScheme(screenSchemeId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -34275,11 +33271,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreenScheme(screenSchemeId: string, body: UpdateScreenSchemeDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -34396,44 +33392,27 @@ export class Client { * @deprecated */ searchForIssuesUsingJql(jql?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, validateQuery?: ValidateQuery | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/search?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (validateQuery === null) - throw new globalThis.Error("The parameter 'validateQuery' cannot be null."); - else if (validateQuery !== undefined) - url_ += "validateQuery=" + encodeURIComponent("" + validateQuery) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(validateQuery, 'validateQuery'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .param("jql", jql) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("validateQuery", validateQuery) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -34494,8 +33473,8 @@ export class Client { * @deprecated */ searchForIssuesUsingJqlPost(body: SearchRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .toString(); const content_ = JSON.stringify(body); @@ -34559,8 +33538,8 @@ export class Client { * @return Returned if the request is successful. */ countIssues(body: JQLCountRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/approximate-count"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/approximate-count") + .toString(); const content_ = JSON.stringify(body); @@ -34625,8 +33604,8 @@ export class Client { * @deprecated */ searchForIssuesIds(body: IdSearchRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/id"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/id") + .toString(); const content_ = JSON.stringify(body); @@ -34733,44 +33712,27 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJql(jql?: string | undefined, nextPageToken?: string | undefined, maxResults?: number | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined, reconcileIssues?: number[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/jql?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - if (reconcileIssues === null) - throw new globalThis.Error("The parameter 'reconcileIssues' cannot be null."); - else if (reconcileIssues !== undefined) - reconcileIssues && reconcileIssues.forEach(item => { url_ += "reconcileIssues=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + Guard.notNull(reconcileIssues, 'reconcileIssues'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .param("jql", jql) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .paramArray("reconcileIssues", reconcileIssues) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -34829,8 +33791,8 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJqlPost(body: SearchAndReconcileRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/jql"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .toString(); const content_ = JSON.stringify(body); @@ -34894,11 +33856,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevel(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/securitylevel/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/securitylevel/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -34957,8 +33919,8 @@ export class Client { * @return Returned if the request is successful. */ getServerInfo( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/serverInfo"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/serverInfo") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -35013,8 +33975,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueNavigatorDefaultColumns( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -35088,14 +34050,12 @@ export class Client { * @return Returned if the request is successful. */ setIssueNavigatorDefaultColumns(body: ColumnRequestBody, columns?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_: AxiosRequestConfig = { data: content_, @@ -35160,8 +34120,8 @@ export class Client { * @return Returned if the request is successful. */ getStatuses( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/status"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -35224,11 +34184,11 @@ export class Client { * @return Returned if the request is successful. */ getStatus(idOrName: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/status/{idOrName}"; - if (idOrName === undefined || idOrName === null) - throw new globalThis.Error("The parameter 'idOrName' must be defined."); - url_ = url_.replace("{idOrName}", encodeURIComponent("" + idOrName)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrName, 'idOrName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status/{idOrName}") + .path("idOrName", idOrName) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -35287,8 +34247,8 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategories( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuscategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -35351,11 +34311,11 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategory(idOrKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}"; - if (idOrKey === undefined || idOrKey === null) - throw new globalThis.Error("The parameter 'idOrKey' must be defined."); - url_ = url_.replace("{idOrKey}", encodeURIComponent("" + idOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrKey, 'idOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}") + .path("idOrKey", idOrKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -35417,12 +34377,11 @@ export class Client { * @return Returned if the request is successful. */ deleteStatusesById(id: string[], cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -35491,16 +34450,13 @@ export class Client { * @return Returned if the request is successful. */ getStatusesById(id: string[], expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -35567,8 +34523,8 @@ export class Client { * @return Returned if the request is successful. */ createStatuses(body: StatusCreateRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -35643,8 +34599,8 @@ export class Client { * @return Returned if the request is successful. */ updateStatuses(body: StatusUpdateRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -35723,32 +34679,21 @@ export class Client { * @return Returned if the request is successful. */ search(expand?: string | undefined, projectId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, searchString?: string | undefined, statusCategory?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/search?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (searchString === null) - throw new globalThis.Error("The parameter 'searchString' cannot be null."); - else if (searchString !== undefined) - url_ += "searchString=" + encodeURIComponent("" + searchString) + "&"; - if (statusCategory === null) - throw new globalThis.Error("The parameter 'statusCategory' cannot be null."); - else if (statusCategory !== undefined) - url_ += "statusCategory=" + encodeURIComponent("" + statusCategory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(searchString, 'searchString'); + Guard.notNull(statusCategory, 'statusCategory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/search") + .param("expand", expand) + .param("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("searchString", searchString) + .param("statusCategory", statusCategory) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -35811,22 +34756,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueTypeUsagesForStatus(statusId: string, projectId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages") + .path("statusId", statusId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -35892,19 +34832,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -35970,19 +34906,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -36046,11 +34978,11 @@ export class Client { * @return Returned if the request is successful. */ getTask(taskId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}") + .path("taskId", taskId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -36114,11 +35046,11 @@ export class Client { * @return Returned if the request is successful. */ cancelTask(taskId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}/cancel"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}/cancel") + .path("taskId", taskId) + .toString(); let options_: AxiosRequestConfig = { method: "POST", @@ -36232,20 +35164,15 @@ export class Client { * @return Returned if the request is successful. */ getUiModifications(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -36309,8 +35236,8 @@ export class Client { * @return Returned if the UI modification is created. */ createUiModification(body: CreateUiModificationDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .toString(); const content_ = JSON.stringify(body); @@ -36385,11 +35312,11 @@ export class Client { * @return Returned if the UI modification is deleted. */ deleteUiModification(uiModificationId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -36455,11 +35382,11 @@ export class Client { * @return Returned if the UI modification is updated. */ updateUiModification(uiModificationId: string, body: UpdateUiModificationDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); const content_ = JSON.stringify(body); @@ -36536,14 +35463,13 @@ export class Client { * @return Returned if the request is successful. */ getAvatars(type: Type3, entityId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -36607,26 +35533,19 @@ export class Client { * @return Returned if the request is successful. */ storeAvatar(type: Type4, entityId: string, size: number, body: any, x?: number | undefined, y?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -36700,17 +35619,15 @@ export class Client { * @return Returned if the request is successful. */ deleteAvatar(type: Type5, owningObjectId: string, id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (owningObjectId === undefined || owningObjectId === null) - throw new globalThis.Error("The parameter 'owningObjectId' must be defined."); - url_ = url_.replace("{owningObjectId}", encodeURIComponent("" + owningObjectId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(owningObjectId, 'owningObjectId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}") + .path("type", type) + .path("owningObjectId", owningObjectId) + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -36772,19 +35689,15 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByType(type: Type6, size?: Size | undefined, format?: Format | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}") + .path("type", type) + .param("size", size) + .param("format", format) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -36860,22 +35773,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByID(type: Type7, id: number, size?: Size2 | undefined, format?: Format2 | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(id, 'id'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}") + .path("type", type) + .path("id", id) + .param("size", size) + .param("format", format) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -36958,22 +35866,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByOwner(type: Type8, entityId: string, size?: Size3 | undefined, format?: Format3 | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("format", format) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -37055,20 +35958,15 @@ export class Client { * @return Returned if the request is successful. */ removeUser(accountId: string, username?: string | undefined, key?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -37138,24 +36036,17 @@ export class Client { * @return Returned if the request is successful. */ getUser(accountId?: string | undefined, username?: string | undefined, key?: string | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -37219,8 +36110,8 @@ export class Client { * @return Returned if the request is successful. */ createUser(body: NewUserDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .toString(); const content_ = JSON.stringify(body); @@ -37293,32 +36184,21 @@ export class Client { * @return Returned if the request is successful. */ findBulkAssignableUsers(projectKeys: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch?"; - if (projectKeys === undefined || projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' must be defined and cannot be null."); - else - url_ += "projectKeys=" + encodeURIComponent("" + projectKeys) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeys, 'projectKeys'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch") + .param("projectKeys", projectKeys) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -37403,52 +36283,31 @@ export class Client { * @return Returned if the request is successful. */ findAssignableUsers(query?: string | undefined, sessionId?: string | undefined, username?: string | undefined, accountId?: string | undefined, project?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, actionDescriptorId?: number | undefined, recommend?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (sessionId === null) - throw new globalThis.Error("The parameter 'sessionId' cannot be null."); - else if (sessionId !== undefined) - url_ += "sessionId=" + encodeURIComponent("" + sessionId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (project === null) - throw new globalThis.Error("The parameter 'project' cannot be null."); - else if (project !== undefined) - url_ += "project=" + encodeURIComponent("" + project) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (actionDescriptorId === null) - throw new globalThis.Error("The parameter 'actionDescriptorId' cannot be null."); - else if (actionDescriptorId !== undefined) - url_ += "actionDescriptorId=" + encodeURIComponent("" + actionDescriptorId) + "&"; - if (recommend === null) - throw new globalThis.Error("The parameter 'recommend' cannot be null."); - else if (recommend !== undefined) - url_ += "recommend=" + encodeURIComponent("" + recommend) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(sessionId, 'sessionId'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(project, 'project'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(actionDescriptorId, 'actionDescriptorId'); + Guard.notNull(recommend, 'recommend'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/search") + .param("query", query) + .param("sessionId", sessionId) + .param("username", username) + .param("accountId", accountId) + .param("project", project) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("actionDescriptorId", actionDescriptorId) + .param("recommend", recommend) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -37527,28 +36386,19 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsers(accountId: string[], startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk") + .paramArray("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -37611,24 +36461,17 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsersMigration(startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/bulk/migration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk/migration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -37696,16 +36539,13 @@ export class Client { * @return Returned if the request is successful. */ resetUserColumns(accountId?: string | undefined, username?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -37762,16 +36602,13 @@ export class Client { * @return Returned if the request is successful. */ getUserDefaultColumns(accountId?: string | undefined, username?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -37844,18 +36681,15 @@ export class Client { * @return Returned if the request is successful. */ setUserColumns(body: UserColumnRequestBody, accountId?: string | undefined, columns?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_: AxiosRequestConfig = { data: content_, @@ -37930,12 +36764,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmail(accountId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/email?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email") + .param("accountId", accountId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -38003,12 +36836,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmailBulk(accountId: string[], cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/email/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email/bulk") + .paramArray("accountId", accountId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -38074,20 +36906,15 @@ export class Client { * @return Returned if the request is successful. */ getUserGroups(accountId: string, username?: string | undefined, key?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/groups?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/groups") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -38159,15 +36986,13 @@ export class Client { * @return Returned if the request is successful. */ getUserNavProperty(propertyKey: string, accountId?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -38237,15 +37062,13 @@ export class Client { * @return Returned if the user property is updated/created. */ setUserNavProperty(propertyKey: string, body: any, accountId?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); const content_ = JSON.stringify(body); @@ -38366,40 +37189,25 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithAllPermissions(permissions: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/permission/search?"; - if (permissions === undefined || permissions === null) - throw new globalThis.Error("The parameter 'permissions' must be defined and cannot be null."); - else - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(permissions, 'permissions'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/permission/search") + .param("permissions", permissions) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -38484,36 +37292,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersForPicker(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, exclude?: string[] | undefined, excludeAccountIds?: string[] | undefined, avatarSize?: string | undefined, excludeConnectUsers?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/picker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeAccountIds === null) - throw new globalThis.Error("The parameter 'excludeAccountIds' cannot be null."); - else if (excludeAccountIds !== undefined) - excludeAccountIds && excludeAccountIds.forEach(item => { url_ += "excludeAccountIds=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (excludeConnectUsers === null) - throw new globalThis.Error("The parameter 'excludeConnectUsers' cannot be null."); - else if (excludeConnectUsers !== undefined) - url_ += "excludeConnectUsers=" + encodeURIComponent("" + excludeConnectUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeAccountIds, 'excludeAccountIds'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(excludeConnectUsers, 'excludeConnectUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/picker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .paramArray("exclude", exclude) + .paramArray("excludeAccountIds", excludeAccountIds) + .param("avatarSize", avatarSize) + .param("excludeConnectUsers", excludeConnectUsers) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -38579,20 +37374,15 @@ export class Client { * @return Returned if the request is successful. */ getUserPropertyKeys(accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties") + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -38663,23 +37453,17 @@ export class Client { * @return Returned if the user property is deleted. */ deleteUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -38746,23 +37530,17 @@ export class Client { * @return Returned if the request is successful. */ getUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -38834,23 +37612,17 @@ export class Client { * @return Returned if the user property is updated. */ setUserProperty(propertyKey: string, body: any, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); const content_ = JSON.stringify(body); @@ -38940,32 +37712,21 @@ export class Client { * @return Returned if the request is successful. */ findUsers(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, property?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (property === null) - throw new globalThis.Error("The parameter 'property' cannot be null."); - else if (property !== undefined) - url_ += "property=" + encodeURIComponent("" + property) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(property, 'property'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("property", property) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -39038,20 +37799,15 @@ export class Client { * @return Returned if the request is successful. */ findUsersByQuery(query: string, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/search/query?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query") + .param("query", query) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -39133,20 +37889,15 @@ export class Client { * @return Returned if the request is successful. */ findUserKeysByQuery(query: string, startAt?: number | undefined, maxResult?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/search/query/key?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query/key") + .param("query", query) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -39232,36 +37983,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithBrowsePermission(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/viewissue/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/viewissue/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -39337,16 +38075,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsersDefault(startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/users?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -39418,16 +38153,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsers(startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/users/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -39497,8 +38229,8 @@ export class Client { * @return Returned if the request is successful. */ createVersion(body: Version, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version") + .toString(); const content_ = JSON.stringify(body); @@ -39569,19 +38301,15 @@ export class Client { * @deprecated */ deleteVersion(id: string, moveFixIssuesTo?: string | undefined, moveAffectedIssuesTo?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveFixIssuesTo === null) - throw new globalThis.Error("The parameter 'moveFixIssuesTo' cannot be null."); - else if (moveFixIssuesTo !== undefined) - url_ += "moveFixIssuesTo=" + encodeURIComponent("" + moveFixIssuesTo) + "&"; - if (moveAffectedIssuesTo === null) - throw new globalThis.Error("The parameter 'moveAffectedIssuesTo' cannot be null."); - else if (moveAffectedIssuesTo !== undefined) - url_ += "moveAffectedIssuesTo=" + encodeURIComponent("" + moveAffectedIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveFixIssuesTo, 'moveFixIssuesTo'); + Guard.notNull(moveAffectedIssuesTo, 'moveAffectedIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("moveFixIssuesTo", moveFixIssuesTo) + .param("moveAffectedIssuesTo", moveAffectedIssuesTo) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -39647,15 +38375,13 @@ export class Client { * @return Returned if the request is successful. */ getVersion(id: string, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -39715,11 +38441,11 @@ export class Client { * @return Returned if the request is successful. */ updateVersion(id: string, body: Version, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -39788,14 +38514,13 @@ export class Client { * @return Returned if the version is deleted. */ mergeVersions(id: string, moveIssuesTo: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === undefined || moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' must be defined."); - url_ = url_.replace("{moveIssuesTo}", encodeURIComponent("" + moveIssuesTo)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}") + .path("id", id) + .path("moveIssuesTo", moveIssuesTo) + .toString(); let options_: AxiosRequestConfig = { method: "PUT", @@ -39860,11 +38585,11 @@ export class Client { * @return Returned if the request is successful. */ moveVersion(id: string, body: VersionMoveBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/move"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/move") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -39932,11 +38657,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionRelatedIssues(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -39996,11 +38721,11 @@ export class Client { * @return Returned if the request is successful. */ getRelatedWork(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -40070,11 +38795,11 @@ export class Client { * @return Returned if the request is successful. */ createRelatedWork(id: string, body: VersionRelatedWork, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -40146,11 +38871,11 @@ export class Client { * @return Returned if the request is successful together with updated related work. */ updateRelatedWork(id: string, body: VersionRelatedWork, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -40222,11 +38947,11 @@ export class Client { * @return Returned if the version is deleted. */ deleteAndReplaceVersion(id: string, body: DeleteAndReplaceVersionBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -40295,11 +39020,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionUnresolvedIssues(id: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -40360,14 +39085,13 @@ export class Client { * @return Returned if the related work is deleted. */ deleteRelatedWork(versionId: string, relatedWorkId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}"; - if (versionId === undefined || versionId === null) - throw new globalThis.Error("The parameter 'versionId' must be defined."); - url_ = url_.replace("{versionId}", encodeURIComponent("" + versionId)); - if (relatedWorkId === undefined || relatedWorkId === null) - throw new globalThis.Error("The parameter 'relatedWorkId' must be defined."); - url_ = url_.replace("{relatedWorkId}", encodeURIComponent("" + relatedWorkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(versionId, 'versionId'); + Guard.required(relatedWorkId, 'relatedWorkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}") + .path("versionId", versionId) + .path("relatedWorkId", relatedWorkId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -40430,8 +39154,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWebhookById(body: ContainerForWebhookIDs, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -40498,16 +39222,13 @@ export class Client { * @return Returned if the request is successful. */ getDynamicWebhooksForApp(startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -40572,8 +39293,8 @@ export class Client { * @return Returned if the request is successful. */ registerDynamicWebhooks(body: WebhookRegistrationDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -40644,16 +39365,13 @@ export class Client { * @return Returned if the request is successful. */ getFailedWebhooks(maxResults?: number | undefined, after?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook/failed?"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (after === null) - throw new globalThis.Error("The parameter 'after' cannot be null."); - else if (after !== undefined) - url_ += "after=" + encodeURIComponent("" + after) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(after, 'after'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/failed") + .param("maxResults", maxResults) + .param("after", after) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -40718,8 +39436,8 @@ export class Client { * @return Returned if the request is successful. */ refreshWebhooks(body: ContainerForWebhookIDs, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook/refresh"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/refresh") + .toString(); const content_ = JSON.stringify(body); @@ -40790,12 +39508,11 @@ export class Client { * @deprecated */ getAllWorkflows(workflowName?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow?"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .param("workflowName", workflowName) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -40859,8 +39576,8 @@ export class Client { * @deprecated */ createWorkflow(body: CreateWorkflowDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .toString(); const content_ = JSON.stringify(body); @@ -40939,40 +39656,25 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowTransitionRuleConfigurations(types: Types[], startAt?: number | undefined, maxResults?: number | undefined, keys?: string[] | undefined, workflowNames?: string[] | undefined, withTags?: string[] | undefined, draft?: boolean | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config?"; - if (types === undefined || types === null) - throw new globalThis.Error("The parameter 'types' must be defined and cannot be null."); - else - types && types.forEach(item => { url_ += "types=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (workflowNames === null) - throw new globalThis.Error("The parameter 'workflowNames' cannot be null."); - else if (workflowNames !== undefined) - workflowNames && workflowNames.forEach(item => { url_ += "workflowNames=" + encodeURIComponent("" + item) + "&"; }); - if (withTags === null) - throw new globalThis.Error("The parameter 'withTags' cannot be null."); - else if (withTags !== undefined) - withTags && withTags.forEach(item => { url_ += "withTags=" + encodeURIComponent("" + item) + "&"; }); - if (draft === null) - throw new globalThis.Error("The parameter 'draft' cannot be null."); - else if (draft !== undefined) - url_ += "draft=" + encodeURIComponent("" + draft) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(types, 'types'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(keys, 'keys'); + Guard.notNull(workflowNames, 'workflowNames'); + Guard.notNull(withTags, 'withTags'); + Guard.notNull(draft, 'draft'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .paramArray("types", types) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("keys", keys) + .paramArray("workflowNames", workflowNames) + .paramArray("withTags", withTags) + .param("draft", draft) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -41045,8 +39747,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowTransitionRuleConfigurations(body: WorkflowTransitionRulesUpdate, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .toString(); const content_ = JSON.stringify(body); @@ -41119,8 +39821,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowTransitionRuleConfigurations(body: WorkflowsWithTransitionRulesDetails, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config/delete") + .toString(); const content_ = JSON.stringify(body); @@ -41211,36 +39913,23 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowsPaginated(startAt?: number | undefined, maxResults?: number | undefined, workflowName?: string[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy15 | undefined, isActive?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - workflowName && workflowName.forEach(item => { url_ += "workflowName=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("workflowName", workflowName) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("isActive", isActive) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -41306,23 +39995,17 @@ export class Client { * @return 200 response */ deleteWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, workflowMode?: WorkflowMode | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -41394,27 +40077,19 @@ export class Client { * @return 200 response */ getWorkflowTransitionProperties(transitionId: number, workflowName: string, includeReservedKeys?: boolean | undefined, key?: string | undefined, workflowMode?: WorkflowMode2 | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (includeReservedKeys === null) - throw new globalThis.Error("The parameter 'includeReservedKeys' cannot be null."); - else if (includeReservedKeys !== undefined) - url_ += "includeReservedKeys=" + encodeURIComponent("" + includeReservedKeys) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(includeReservedKeys, 'includeReservedKeys'); + Guard.notNull(key, 'key'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("workflowName", workflowName) + .param("includeReservedKeys", includeReservedKeys) + .param("key", key) + .param("workflowMode", workflowMode) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -41485,23 +40160,17 @@ export class Client { * @return 200 response */ createWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode3 | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -41576,23 +40245,17 @@ export class Client { * @return 200 response */ updateWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode4 | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -41668,11 +40331,11 @@ export class Client { * @return Returned if the workflow is deleted. */ deleteInactiveWorkflow(entityId: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{entityId}"; - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{entityId}") + .path("entityId", entityId) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -41739,22 +40402,17 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowProjectIssueTypeUsages(workflowId: string, projectId: number, nextPageToken?: string | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages") + .path("workflowId", workflowId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -41820,19 +40478,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -41898,19 +40552,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -41980,16 +40630,13 @@ export class Client { * @return Returned if the request is successful. */ readWorkflows(body: WorkflowReadRequest, expand?: string | undefined, useApprovalConfiguration?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (useApprovalConfiguration === null) - throw new globalThis.Error("The parameter 'useApprovalConfiguration' cannot be null."); - else if (useApprovalConfiguration !== undefined) - url_ += "useApprovalConfiguration=" + encodeURIComponent("" + useApprovalConfiguration) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(useApprovalConfiguration, 'useApprovalConfiguration'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows") + .param("expand", expand) + .param("useApprovalConfiguration", useApprovalConfiguration) + .toString(); const content_ = JSON.stringify(body); @@ -42055,20 +40702,15 @@ export class Client { * @return Returned if the request is successful. */ workflowCapabilities(workflowId?: string | undefined, projectId?: string | undefined, issueTypeId?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/capabilities?"; - if (workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' cannot be null."); - else if (workflowId !== undefined) - url_ += "workflowId=" + encodeURIComponent("" + workflowId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowId, 'workflowId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/capabilities") + .param("workflowId", workflowId) + .param("projectId", projectId) + .param("issueTypeId", issueTypeId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -42127,8 +40769,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflows(body: WorkflowCreateRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/create"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create") + .toString(); const content_ = JSON.stringify(body); @@ -42195,8 +40837,8 @@ export class Client { * @return Returned if the request is successful. */ validateCreateWorkflows(body: WorkflowCreateValidateRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/create/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create/validation") + .toString(); const content_ = JSON.stringify(body); @@ -42272,36 +40914,23 @@ export class Client { * @return Returned if the request is successful. */ searchWorkflows(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: string | undefined, scope?: string | undefined, isActive?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - url_ += "scope=" + encodeURIComponent("" + scope) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(scope, 'scope'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("scope", scope) + .param("isActive", isActive) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -42364,12 +40993,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflows(body: WorkflowUpdateRequest, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/update?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -42436,8 +41064,8 @@ export class Client { * @return Returned if the request is successful. */ validateUpdateWorkflows(body: WorkflowUpdateValidateRequestBean, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/update/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update/validation") + .toString(); const content_ = JSON.stringify(body); @@ -42502,16 +41130,13 @@ export class Client { * @return Returned if the request is successful. */ getAllWorkflowSchemes(startAt?: number | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -42570,8 +41195,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowScheme(body: WorkflowScheme, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .toString(); const content_ = JSON.stringify(body); @@ -42639,12 +41264,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeProjectAssociations(projectId: number[], cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .paramArray("projectId", projectId) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -42707,8 +41331,8 @@ export class Client { * @return Returned if the request is successful. */ assignSchemeToProject(body: WorkflowSchemeProjectAssociation, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -42785,12 +41409,11 @@ export class Client { * @return Returned if the request is successful. */ readWorkflowSchemes(body: WorkflowSchemeReadRequest, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/read?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/read") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -42860,8 +41483,8 @@ export class Client { * @return Returned if the request is successful and there is no asynchronous task. */ updateSchemes(body: WorkflowSchemeUpdateRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update") + .toString(); const content_ = JSON.stringify(body); @@ -42936,8 +41559,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeMappings(body: WorkflowSchemeUpdateRequiredMappingsRequest, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -43001,11 +41624,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowScheme(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -43075,15 +41698,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowScheme(id: number, returnDraftIfExists?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -43147,11 +41768,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowScheme(id: number, body: WorkflowScheme, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -43223,11 +41844,11 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowSchemeDraftFromParent(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "POST", @@ -43292,15 +41913,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDefaultWorkflow(id: number, updateDraftIfNeeded?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -43369,15 +41988,13 @@ export class Client { * @return Returned if the request is successful. */ getDefaultWorkflow(id: number, returnDraftIfExists?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -43442,11 +42059,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultWorkflow(id: number, body: DefaultWorkflow, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -43518,11 +42135,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraft(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -43582,11 +42199,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraft(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -43650,11 +42267,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeDraft(id: number, body: WorkflowScheme, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -43726,11 +42343,11 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftDefaultWorkflow(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -43794,11 +42411,11 @@ export class Client { * @return Returned if the request is successful. */ getDraftDefaultWorkflow(id: number, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -43863,11 +42480,11 @@ export class Client { * @return Returned if the request is successful. */ updateDraftDefaultWorkflow(id: number, body: DefaultWorkflow, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -43940,14 +42557,13 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraftIssueType(id: number, issueType: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -44012,14 +42628,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraftIssueType(id: number, issueType: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -44085,14 +42700,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeDraftIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -44166,15 +42780,13 @@ export class Client { * @return Returned if the request is only for validation and is successful. */ publishDraftWorkflowScheme(id: number, body: PublishDraftWorkflowScheme, validateOnly?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (validateOnly === null) - throw new globalThis.Error("The parameter 'validateOnly' cannot be null."); - else if (validateOnly !== undefined) - url_ += "validateOnly=" + encodeURIComponent("" + validateOnly) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(validateOnly, 'validateOnly'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish") + .path("id", id) + .param("validateOnly", validateOnly) + .toString(); const content_ = JSON.stringify(body); @@ -44250,15 +42862,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftWorkflowMapping(id: number, workflowName: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -44319,15 +42929,13 @@ export class Client { * @return Returned if the request is successful. */ getDraftWorkflow(id: number, workflowName?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -44392,15 +43000,13 @@ export class Client { * @return Returned if the request is successful. */ updateDraftWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -44474,18 +43080,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeIssueType(id: number, issueType: string, updateDraftIfNeeded?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -44555,18 +43158,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeIssueType(id: number, issueType: string, returnDraftIfExists?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -44632,14 +43232,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -44713,19 +43312,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowMapping(id: number, workflowName: string, updateDraftIfNeeded?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -44791,19 +43386,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflow(id: number, workflowName?: string | undefined, returnDraftIfExists?: boolean | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -44868,15 +43459,13 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -44950,19 +43539,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflowScheme(workflowSchemeId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages?"; - if (workflowSchemeId === undefined || workflowSchemeId === null) - throw new globalThis.Error("The parameter 'workflowSchemeId' must be defined."); - url_ = url_.replace("{workflowSchemeId}", encodeURIComponent("" + workflowSchemeId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowSchemeId, 'workflowSchemeId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages") + .path("workflowSchemeId", workflowSchemeId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -45026,12 +43611,11 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsDeletedSince(since?: number | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/worklog/deleted?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/deleted") + .param("since", since) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -45088,12 +43672,11 @@ export class Client { * @return Returned if the request is successful. */ getWorklogsForIds(body: WorklogIdsRequestBean, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/worklog/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -45165,16 +43748,13 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsModifiedSince(since?: number | undefined, expand?: string | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/api/3/worklog/updated?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/updated") + .param("since", since) + .param("expand", expand) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -45230,11 +43810,11 @@ export class Client { * @return Returned if the request is successful. */ deleteForgeAppProperty(propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -45304,11 +43884,11 @@ export class Client { * @return Returned if the property is updated. */ putForgeAppProperty(propertyKey: string, body: any, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -45400,11 +43980,11 @@ export class AddonPropertiesResource_getAddonPropertiesClient { * @return Returned if the request is successful. */ get(addonKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties") + .path("addonKey", addonKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -45478,14 +44058,13 @@ export class AddonPropertiesResource_deleteAddonPropertyClient { * @return Returned if the request is successful. */ delete(addonKey: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -45569,14 +44148,13 @@ export class AddonPropertiesResource_getAddonPropertyClient { * @return Returned if the request is successful. */ get(addonKey: string, propertyKey: string, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -45664,14 +44242,13 @@ export class AddonPropertiesResource_putAddonPropertyClient { * @return Returned if the property is updated. */ put(addonKey: string, propertyKey: string, body: any, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -45764,12 +44341,11 @@ export class DynamicModulesResource_removeModulesClient { * @return Returned if the request is successful. */ delete(moduleKey?: string[] | undefined, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic?"; - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(moduleKey, 'moduleKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .paramArray("moduleKey", moduleKey) + .toString(); let options_: AxiosRequestConfig = { method: "DELETE", @@ -45837,8 +44413,8 @@ export class DynamicModulesResource_getModulesClient { * @return Returned if the request is successful. */ get( cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -45910,8 +44486,8 @@ export class DynamicModulesResource_registerModulesClient { * @return Returned if the request is successful. */ post(body: ConnectModules, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); const content_ = JSON.stringify(body); @@ -45991,8 +44567,8 @@ export class AppIssueFieldValueUpdateResource_updateIssueFieldsClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, body: ConnectCustomFieldValues, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/field") + .toString(); const content_ = JSON.stringify(body); @@ -46073,11 +44649,11 @@ export class MigrationResource_updateEntityPropertiesValueClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, entityType: EntityType, body: EntityPropertyDetails[], cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}"; - if (entityType === undefined || entityType === null) - throw new globalThis.Error("The parameter 'entityType' must be defined."); - url_ = url_.replace("{entityType}", encodeURIComponent("" + entityType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityType, 'entityType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}") + .path("entityType", entityType) + .toString(); const content_ = JSON.stringify(body); @@ -46152,8 +44728,8 @@ export class MigrationResource_workflowRuleSearchClient { * @return Returned if the request is successful. */ post(atlassian_Transfer_Id: string, body: WorkflowRulesSearch, cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search") + .toString(); const content_ = JSON.stringify(body); @@ -46232,12 +44808,11 @@ export class ServiceRegistryResource_servicesClient { * @return Returned if the request is successful. */ get(serviceIds: string[], cancelToken?: CancelToken): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/service-registry?"; - if (serviceIds === undefined || serviceIds === null) - throw new globalThis.Error("The parameter 'serviceIds' must be defined and cannot be null."); - else - serviceIds && serviceIds.forEach(item => { url_ += "serviceIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(serviceIds, 'serviceIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/service-registry") + .paramArray("serviceIds", serviceIds) + .toString(); let options_: AxiosRequestConfig = { method: "GET", @@ -104996,4 +103571,68 @@ function throwException(message: string, status: number, response: string, heade function isAxiosError(obj: any): obj is AxiosError { return obj && obj.isAxiosError === true; +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..8be72d3cc 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 @@ -17,8 +17,8 @@ export class Client { * @return Returned if the request is successful. */ getBanner(): Promise { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); let options_: RequestInit = { method: "GET", @@ -69,8 +69,8 @@ export class Client { * @return Returned if the request is successful. */ setBanner(body: AnnouncementBannerConfigurationUpdate): Promise { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); const content_ = JSON.stringify(body); @@ -140,36 +140,23 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldsConfigurations(body: ConfigurationsListParameters, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/context/configuration/list?"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/context/configuration/list") + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -227,12 +214,11 @@ export class Client { * @return Returned if the request is successful. */ updateMultipleCustomFieldValues(body: MultipleCustomFieldValuesUpdateDetails, generateChangelog?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/value?"; - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/value") + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -294,39 +280,25 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldConfiguration(fieldIdOrKey: string, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -380,11 +352,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldConfiguration(fieldIdOrKey: string, body: CustomFieldConfigurations): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -444,15 +416,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldValue(fieldIdOrKey: string, body: CustomFieldValueUpdateDetails, generateChangelog?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value") + .path("fieldIdOrKey", fieldIdOrKey) + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -509,20 +479,15 @@ export class Client { * @return Returned if the request is successful. */ getApplicationProperty(key?: string | undefined, permissionLevel?: string | undefined, keyFilter?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/application-properties?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (permissionLevel === null) - throw new globalThis.Error("The parameter 'permissionLevel' cannot be null."); - else if (permissionLevel !== undefined) - url_ += "permissionLevel=" + encodeURIComponent("" + permissionLevel) + "&"; - if (keyFilter === null) - throw new globalThis.Error("The parameter 'keyFilter' cannot be null."); - else if (keyFilter !== undefined) - url_ += "keyFilter=" + encodeURIComponent("" + keyFilter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + Guard.notNull(permissionLevel, 'permissionLevel'); + Guard.notNull(keyFilter, 'keyFilter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties") + .param("key", key) + .param("permissionLevel", permissionLevel) + .param("keyFilter", keyFilter) + .toString(); let options_: RequestInit = { method: "GET", @@ -580,8 +545,8 @@ export class Client { * @return Returned if the request is successful. */ getAdvancedSettings(): Promise { - let url_ = this.baseUrl + "/rest/api/3/application-properties/advanced-settings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/advanced-settings") + .toString(); let options_: RequestInit = { method: "GET", @@ -634,11 +599,11 @@ export class Client { * @return Returned if the request is successful. */ setApplicationProperty(id: string, body: SimpleApplicationPropertyBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/application-properties/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -707,8 +672,8 @@ export class Client { * @return Returned if the request is successful. */ getAllApplicationRoles(): Promise { - let url_ = this.baseUrl + "/rest/api/3/applicationrole"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole") + .toString(); let options_: RequestInit = { method: "GET", @@ -761,11 +726,11 @@ export class Client { * @return Returned if the request is successful. */ getApplicationRole(key: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/applicationrole/{key}"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined."); - url_ = url_.replace("{key}", encodeURIComponent("" + key)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole/{key}") + .path("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -816,15 +781,13 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentContent(id: string, redirect?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/content/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/content/{id}") + .path("id", id) + .param("redirect", redirect) + .toString(); let options_: RequestInit = { method: "GET", @@ -896,8 +859,8 @@ export class Client { * @return Returned if the request is successful. */ getAttachmentMeta(): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/meta"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/meta") + .toString(); let options_: RequestInit = { method: "GET", @@ -943,27 +906,19 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentThumbnail(id: string, redirect?: boolean | undefined, fallbackToDefault?: boolean | undefined, width?: number | undefined, height?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - if (fallbackToDefault === null) - throw new globalThis.Error("The parameter 'fallbackToDefault' cannot be null."); - else if (fallbackToDefault !== undefined) - url_ += "fallbackToDefault=" + encodeURIComponent("" + fallbackToDefault) + "&"; - if (width === null) - throw new globalThis.Error("The parameter 'width' cannot be null."); - else if (width !== undefined) - url_ += "width=" + encodeURIComponent("" + width) + "&"; - if (height === null) - throw new globalThis.Error("The parameter 'height' cannot be null."); - else if (height !== undefined) - url_ += "height=" + encodeURIComponent("" + height) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + Guard.notNull(fallbackToDefault, 'fallbackToDefault'); + Guard.notNull(width, 'width'); + Guard.notNull(height, 'height'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}") + .path("id", id) + .param("redirect", redirect) + .param("fallbackToDefault", fallbackToDefault) + .param("width", width) + .param("height", height) + .toString(); let options_: RequestInit = { method: "GET", @@ -1028,11 +983,11 @@ export class Client { * @return Returned if the request is successful. */ removeAttachment(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -1074,11 +1029,11 @@ export class Client { * @return Returned if the request is successful. */ getAttachment(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -1128,11 +1083,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForHumans(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/human"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/human") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -1186,11 +1141,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForMachines(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -1248,28 +1203,19 @@ export class Client { * @return Returned if the request is successful. */ getAuditRecords(offset?: number | undefined, limit?: number | undefined, filter?: string | undefined, from?: string | undefined, to?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/auditing/record?"; - if (offset === null) - throw new globalThis.Error("The parameter 'offset' cannot be null."); - else if (offset !== undefined) - url_ += "offset=" + encodeURIComponent("" + offset) + "&"; - if (limit === null) - throw new globalThis.Error("The parameter 'limit' cannot be null."); - else if (limit !== undefined) - url_ += "limit=" + encodeURIComponent("" + limit) + "&"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (from === null) - throw new globalThis.Error("The parameter 'from' cannot be null."); - else if (from !== undefined) - url_ += "from=" + encodeURIComponent("" + from) + "&"; - if (to === null) - throw new globalThis.Error("The parameter 'to' cannot be null."); - else if (to !== undefined) - url_ += "to=" + encodeURIComponent("" + to) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(offset, 'offset'); + Guard.notNull(limit, 'limit'); + Guard.notNull(filter, 'filter'); + Guard.notNull(from, 'from'); + Guard.notNull(to, 'to'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/auditing/record") + .param("offset", offset) + .param("limit", limit) + .param("filter", filter) + .param("from", from) + .param("to", to) + .toString(); let options_: RequestInit = { method: "GET", @@ -1321,11 +1267,11 @@ export class Client { * @return Returned if the request is successful. */ getAllSystemAvatars(type: Type): Promise { - let url_ = this.baseUrl + "/rest/api/3/avatar/{type}/system"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/avatar/{type}/system") + .path("type", type) + .toString(); let options_: RequestInit = { method: "GET", @@ -1371,8 +1317,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkDelete(body: IssueBulkDeletePayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/delete") + .toString(); const content_ = JSON.stringify(body); @@ -1438,24 +1384,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkEditableFields(issueIdsOrKeys: string, searchText?: string | undefined, endingBefore?: string | undefined, startingAfter?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (searchText === null) - throw new globalThis.Error("The parameter 'searchText' cannot be null."); - else if (searchText !== undefined) - url_ += "searchText=" + encodeURIComponent("" + searchText) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(searchText, 'searchText'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("searchText", searchText) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); let options_: RequestInit = { method: "GET", @@ -1521,8 +1460,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkEdit(body: IssueBulkEditPayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .toString(); const content_ = JSON.stringify(body); @@ -1577,8 +1516,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkMove(body: IssueBulkMovePayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/move") + .toString(); const content_ = JSON.stringify(body); @@ -1636,20 +1575,15 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTransitions(issueIdsOrKeys: string, endingBefore?: string | undefined, startingAfter?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); let options_: RequestInit = { method: "GET", @@ -1708,8 +1642,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkTransition(body: IssueBulkTransitionPayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .toString(); const content_ = JSON.stringify(body); @@ -1772,8 +1706,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkUnwatch(body: IssueBulkWatchOrUnwatchPayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/unwatch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/unwatch") + .toString(); const content_ = JSON.stringify(body); @@ -1836,8 +1770,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkWatch(body: IssueBulkWatchOrUnwatchPayload): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/watch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/watch") + .toString(); const content_ = JSON.stringify(body); @@ -1900,11 +1834,11 @@ export class Client { * @return Returned if the request is successful. */ getBulkOperationProgress(taskId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/bulk/queue/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/queue/{taskId}") + .path("taskId", taskId) + .toString(); let options_: RequestInit = { method: "GET", @@ -1956,8 +1890,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkChangelogs(body: BulkChangelogRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/changelog/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/changelog/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -2004,16 +1938,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUserDataClassificationLevels(status?: Status2[] | undefined, orderBy?: OrderBy | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/classification-levels?"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(status, 'status'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/classification-levels") + .paramArray("status", status) + .param("orderBy", orderBy) + .toString(); let options_: RequestInit = { method: "GET", @@ -2059,12 +1990,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentsByIds(body: IssueCommentListRequestBean, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -2110,11 +2040,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentPropertyKeys(commentId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties") + .path("commentId", commentId) + .toString(); let options_: RequestInit = { method: "GET", @@ -2169,14 +2099,13 @@ export class Client { * @return Returned if the request is successful. */ deleteCommentProperty(commentId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -2227,14 +2156,13 @@ export class Client { * @return Returned if the request is successful. */ getCommentProperty(commentId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -2290,14 +2218,13 @@ export class Client { * @return Returned if the comment property is updated. */ setCommentProperty(commentId: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -2371,28 +2298,19 @@ export class Client { * @return Returned if the request is successful. */ findComponentsForProjects(projectIdsOrKeys?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy2 | undefined, query?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/component?"; - if (projectIdsOrKeys === null) - throw new globalThis.Error("The parameter 'projectIdsOrKeys' cannot be null."); - else if (projectIdsOrKeys !== undefined) - projectIdsOrKeys && projectIdsOrKeys.forEach(item => { url_ += "projectIdsOrKeys=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIdsOrKeys, 'projectIdsOrKeys'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .paramArray("projectIdsOrKeys", projectIdsOrKeys) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .toString(); let options_: RequestInit = { method: "GET", @@ -2437,8 +2355,8 @@ export class Client { * @return Returned if the request is successful. */ createComponent(body: ProjectComponent): Promise { - let url_ = this.baseUrl + "/rest/api/3/component"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .toString(); const content_ = JSON.stringify(body); @@ -2497,15 +2415,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComponent(id: string, moveIssuesTo?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' cannot be null."); - else if (moveIssuesTo !== undefined) - url_ += "moveIssuesTo=" + encodeURIComponent("" + moveIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .param("moveIssuesTo", moveIssuesTo) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -2551,11 +2467,11 @@ export class Client { * @return Returned if the request is successful. */ getComponent(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -2601,11 +2517,11 @@ export class Client { * @return Returned if the request is successful. */ updateComponent(id: string, body: ProjectComponent): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -2663,11 +2579,11 @@ export class Client { * @return Returned if the request is successful. */ getComponentRelatedIssues(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -2712,8 +2628,8 @@ export class Client { * @return Returned if the request is successful. */ getConfiguration(): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration") + .toString(); let options_: RequestInit = { method: "GET", @@ -2754,8 +2670,8 @@ export class Client { * @return Returned if the request is successful and time tracking is enabled. */ getSelectedTimeTrackingImplementation(): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); let options_: RequestInit = { method: "GET", @@ -2808,8 +2724,8 @@ export class Client { * @return Returned if the request is successful. */ selectTimeTrackingImplementation(body: TimeTrackingProvider): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); const content_ = JSON.stringify(body); @@ -2863,8 +2779,8 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTimeTrackingImplementations(): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/list"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/list") + .toString(); let options_: RequestInit = { method: "GET", @@ -2916,8 +2832,8 @@ export class Client { * @return Returned if the request is successful. */ getSharedTimeTrackingConfiguration(): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); let options_: RequestInit = { method: "GET", @@ -2962,8 +2878,8 @@ export class Client { * @return Returned if the request is successful. */ setSharedTimeTrackingConfiguration(body: TimeTrackingConfiguration): Promise { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); const content_ = JSON.stringify(body); @@ -3017,11 +2933,11 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldOption(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/customFieldOption/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/customFieldOption/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -3072,20 +2988,15 @@ export class Client { * @return Returned if the request is successful. */ getAllDashboards(filter?: Filter2 | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filter, 'filter'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("filter", filter) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -3138,12 +3049,11 @@ export class Client { * @return Returned if the request is successful. */ createDashboard(body: DashboardDetails, extendAdminPermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -3199,8 +3109,8 @@ export class Client { * @return Returned if the request is successful. */ bulkEditDashboards(body: BulkEditShareableEntityRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/bulk/edit"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/bulk/edit") + .toString(); const content_ = JSON.stringify(body); @@ -3255,8 +3165,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAvailableDashboardGadgets(): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/gadgets"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/gadgets") + .toString(); let options_: RequestInit = { method: "GET", @@ -3334,52 +3244,31 @@ export class Client { * @return Returned if the request is successful. */ getDashboardsPaginated(dashboardName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, orderBy?: OrderBy3 | undefined, startAt?: number | undefined, maxResults?: number | undefined, status?: Status3 | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/search?"; - if (dashboardName === null) - throw new globalThis.Error("The parameter 'dashboardName' cannot be null."); - else if (dashboardName !== undefined) - url_ += "dashboardName=" + encodeURIComponent("" + dashboardName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(dashboardName, 'dashboardName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/search") + .param("dashboardName", dashboardName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("status", status) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -3434,23 +3323,17 @@ export class Client { * @return Returned if the request is successful. */ getAllGadgets(dashboardId: number, moduleKey?: string[] | undefined, uri?: string[] | undefined, gadgetId?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget?"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - if (uri === null) - throw new globalThis.Error("The parameter 'uri' cannot be null."); - else if (uri !== undefined) - uri && uri.forEach(item => { url_ += "uri=" + encodeURIComponent("" + item) + "&"; }); - if (gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' cannot be null."); - else if (gadgetId !== undefined) - gadgetId && gadgetId.forEach(item => { url_ += "gadgetId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.notNull(moduleKey, 'moduleKey'); + Guard.notNull(uri, 'uri'); + Guard.notNull(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .paramArray("moduleKey", moduleKey) + .paramArray("uri", uri) + .paramArray("gadgetId", gadgetId) + .toString(); let options_: RequestInit = { method: "GET", @@ -3499,11 +3382,11 @@ export class Client { * @return Returned if the request is successful. */ addGadget(dashboardId: number, body: DashboardGadgetSettings): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .toString(); const content_ = JSON.stringify(body); @@ -3564,14 +3447,13 @@ export class Client { * @return Returned if the request is successful. */ removeGadget(dashboardId: number, gadgetId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -3622,14 +3504,13 @@ export class Client { * @return Returned if the request is successful. */ updateGadget(dashboardId: number, gadgetId: number, body: DashboardGadgetUpdateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); const content_ = JSON.stringify(body); @@ -3691,14 +3572,13 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemPropertyKeys(dashboardId: string, itemId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .toString(); let options_: RequestInit = { method: "GET", @@ -3752,17 +3632,15 @@ export class Client { * @return Returned if the dashboard item property is deleted. */ deleteDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -3831,17 +3709,15 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -3896,17 +3772,15 @@ export class Client { * @return Returned if the dashboard item property is updated. */ setDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -3985,11 +3859,11 @@ export class Client { * @return Returned if the dashboard is deleted. */ deleteDashboard(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -4037,11 +3911,11 @@ export class Client { * @return Returned if the request is successful. */ getDashboard(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -4099,15 +3973,13 @@ export class Client { * @return Returned if the request is successful. */ updateDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -4171,15 +4043,13 @@ export class Client { * @return Returned if the request is successful. */ copyDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}/copy?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}/copy") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -4241,8 +4111,8 @@ export class Client { * @return Returned if the request is successful */ getPolicy(): Promise { - let url_ = this.baseUrl + "/rest/api/3/data-policy"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy") + .toString(); let options_: RequestInit = { method: "GET", @@ -4294,12 +4164,11 @@ export class Client { * @return Returned if the request is successful. */ getPolicies(ids?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/data-policy/project?"; - if (ids === null) - throw new globalThis.Error("The parameter 'ids' cannot be null."); - else if (ids !== undefined) - url_ += "ids=" + encodeURIComponent("" + ids) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(ids, 'ids'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy/project") + .param("ids", ids) + .toString(); let options_: RequestInit = { method: "GET", @@ -4357,8 +4226,8 @@ export class Client { * @return Returned if the request is successful. */ getEvents(): Promise { - let url_ = this.baseUrl + "/rest/api/3/events"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/events") + .toString(); let options_: RequestInit = { method: "GET", @@ -4416,12 +4285,11 @@ export class Client { * @return Returned if the request is successful. */ analyseExpression(body: JiraExpressionForAnalysis, check?: Check | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/expression/analyse?"; - if (check === null) - throw new globalThis.Error("The parameter 'check' cannot be null."); - else if (check !== undefined) - url_ += "check=" + encodeURIComponent("" + check) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(check, 'check'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/analyse") + .param("check", check) + .toString(); const content_ = JSON.stringify(body); @@ -4483,12 +4351,11 @@ export class Client { * @deprecated */ evaluateJiraExpression(body: JiraExpressionEvalRequestBean, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/expression/eval?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/eval") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -4549,12 +4416,11 @@ export class Client { * @return Returned if the evaluation results in a value. The result is a JSON primitive value, list, or object. */ evaluateJSISJiraExpression(body: JiraExpressionEvaluateRequestBean, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/expression/evaluate?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/evaluate") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -4613,8 +4479,8 @@ export class Client { * @return Returned if the request is successful. */ getFields(): Promise { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); let options_: RequestInit = { method: "GET", @@ -4663,8 +4529,8 @@ export class Client { * @return Returned if the custom field is created. */ createCustomField(body: CustomFieldDefinitionJsonBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); const content_ = JSON.stringify(body); @@ -4710,8 +4576,8 @@ export class Client { * @return Returned if the field association validation passes. */ removeAssociations(body: FieldAssociationsRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -4766,8 +4632,8 @@ export class Client { * @return Returned if the field association validation passes. */ createAssociations(body: FieldAssociationsRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -4842,40 +4708,25 @@ export class Client { * @return Returned if the request is successful. */ getFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, type?: Type2[] | undefined, id?: string[] | undefined, query?: string | undefined, orderBy?: OrderBy4 | undefined, expand?: string | undefined, projectIds?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (type === null) - throw new globalThis.Error("The parameter 'type' cannot be null."); - else if (type !== undefined) - type && type.forEach(item => { url_ += "type=" + encodeURIComponent("" + item) + "&"; }); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(type, 'type'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectIds, 'projectIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("type", type) + .paramArray("id", id) + .param("query", query) + .param("orderBy", orderBy) + .param("expand", expand) + .paramArray("projectIds", projectIds) + .toString(); let options_: RequestInit = { method: "GET", @@ -4940,32 +4791,21 @@ export class Client { * @return Returned if the request is successful. */ getTrashedFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, id?: string[] | undefined, query?: string | undefined, expand?: Expand | undefined, orderBy?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/search/trashed?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(expand, 'expand'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search/trashed") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("query", query) + .param("expand", expand) + .param("orderBy", orderBy) + .toString(); let options_: RequestInit = { method: "GET", @@ -5022,11 +4862,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomField(fieldId: string, body: UpdateCustomFieldDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -5090,31 +4930,21 @@ export class Client { * @return Returned if the request is successful. */ getContextsForField(fieldId: string, isAnyIssueType?: boolean | undefined, isGlobalContext?: boolean | undefined, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (isAnyIssueType === null) - throw new globalThis.Error("The parameter 'isAnyIssueType' cannot be null."); - else if (isAnyIssueType !== undefined) - url_ += "isAnyIssueType=" + encodeURIComponent("" + isAnyIssueType) + "&"; - if (isGlobalContext === null) - throw new globalThis.Error("The parameter 'isGlobalContext' cannot be null."); - else if (isGlobalContext !== undefined) - url_ += "isGlobalContext=" + encodeURIComponent("" + isGlobalContext) + "&"; - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(isAnyIssueType, 'isAnyIssueType'); + Guard.notNull(isGlobalContext, 'isGlobalContext'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .param("isAnyIssueType", isAnyIssueType) + .param("isGlobalContext", isGlobalContext) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -5164,11 +4994,11 @@ export class Client { * @return Returned if the custom field context is created. */ createCustomFieldContext(fieldId: string, body: CreateCustomFieldContext): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -5229,23 +5059,17 @@ export class Client { * @return Returned if the request is successful. */ getDefaultValues(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -5295,11 +5119,11 @@ export class Client { * @return Returned if operation is successful. */ setDefaultValues(fieldId: string, body: CustomFieldContextDefaultValueUpdate): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -5361,23 +5185,17 @@ export class Client { * @return Returned if operation is successful. */ getIssueTypeMappingsForContexts(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -5426,19 +5244,15 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldContextsForProjectsAndIssueTypes(fieldId: string, body: ProjectIssueTypeMappings, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -5499,23 +5313,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectContextMapping(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -5566,14 +5374,13 @@ export class Client { * @return Returned if the context is deleted. */ deleteCustomFieldContext(fieldId: string, contextId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -5629,14 +5436,13 @@ export class Client { * @return Returned if the context is updated. */ updateCustomFieldContext(fieldId: string, contextId: number, body: CustomFieldContextUpdateDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -5696,14 +5502,13 @@ export class Client { * @return Returned if operation is successful. */ addIssueTypesToContext(fieldId: string, contextId: number, body: IssueTypeIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -5767,14 +5572,13 @@ export class Client { * @return Returned if operation is successful. */ removeIssueTypesFromContext(fieldId: string, contextId: number, body: IssueTypeIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -5838,30 +5642,21 @@ export class Client { * @return Returned if the request is successful. */ getOptionsForContext(fieldId: string, contextId: number, optionId?: number | undefined, onlyOptions?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === null) - throw new globalThis.Error("The parameter 'optionId' cannot be null."); - else if (optionId !== undefined) - url_ += "optionId=" + encodeURIComponent("" + optionId) + "&"; - if (onlyOptions === null) - throw new globalThis.Error("The parameter 'onlyOptions' cannot be null."); - else if (onlyOptions !== undefined) - url_ += "onlyOptions=" + encodeURIComponent("" + onlyOptions) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(optionId, 'optionId'); + Guard.notNull(onlyOptions, 'onlyOptions'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .param("optionId", optionId) + .param("onlyOptions", onlyOptions) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -5916,14 +5711,13 @@ export class Client { * @return Returned if the request is successful. */ createCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionCreateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -5982,14 +5776,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionUpdateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6048,14 +5841,13 @@ export class Client { * @return Returned if options are reordered. */ reorderCustomFieldOptions(fieldId: string, contextId: number, body: OrderOfCustomFieldOptions): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6116,17 +5908,15 @@ export class Client { * @return Returned if the option is deleted. */ deleteCustomFieldOption(fieldId: string, contextId: number, optionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .path("optionId", optionId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -6179,25 +5969,19 @@ export class Client { * @param jql (optional) A JQL query that specifies the issues to be updated. For example, *project=10000*. */ replaceCustomFieldOption(fieldId: string, optionId: number, contextId: number, replaceWith?: number | undefined, jql?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(optionId, 'optionId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue") + .path("fieldId", fieldId) + .path("optionId", optionId) + .path("contextId", contextId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -6247,14 +6031,13 @@ export class Client { * @return Returned if operation is successful. */ assignProjectsToCustomFieldContext(fieldId: string, contextId: number, body: ProjectIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6314,14 +6097,13 @@ export class Client { * @return Returned if the custom field context is removed from the projects. */ removeCustomFieldContextFromProjects(fieldId: string, contextId: number, body: ProjectIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -6383,19 +6165,15 @@ export class Client { * @deprecated */ getContextsForFieldDeprecated(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/contexts?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/contexts") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -6444,23 +6222,17 @@ export class Client { * @return Returned if the request is successful. */ getScreensForField(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/screens?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/screens") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -6511,19 +6283,15 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -6572,11 +6340,11 @@ export class Client { * @return Returned if the request is successful. */ createIssueFieldOption(fieldKey: string, body: IssueFieldOptionCreateBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .toString(); const content_ = JSON.stringify(body); @@ -6636,23 +6404,17 @@ export class Client { * @return Returned if the request is successful. */ getSelectableIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -6704,23 +6466,17 @@ export class Client { * @return Returned if the request is successful. */ getVisibleIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -6770,14 +6526,13 @@ export class Client { * @return Returned if the field option is deleted. */ deleteIssueFieldOption(fieldKey: string, optionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -6832,14 +6587,13 @@ export class Client { * @return Returned if the requested option is returned. */ getIssueFieldOption(fieldKey: string, optionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); let options_: RequestInit = { method: "GET", @@ -6893,14 +6647,13 @@ export class Client { * @return Returned if the option is updated or created. */ updateIssueFieldOption(fieldKey: string, optionId: number, body: IssueFieldOption): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); const content_ = JSON.stringify(body); @@ -6961,30 +6714,21 @@ export class Client { * @param overrideEditableFlag (optional) Whether screen security is overridden to enable uneditable fields to be edited. Available to Connect and Forge app users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ replaceIssueFieldOption(fieldKey: string, optionId: number, replaceWith?: number | undefined, jql?: string | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -7032,11 +6776,11 @@ export class Client { * @param id The ID of a custom field. */ deleteCustomField(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -7108,11 +6852,11 @@ export class Client { * @return Returned if the request is successful. */ restoreCustomField(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/restore"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/restore") + .path("id", id) + .toString(); let options_: RequestInit = { method: "POST", @@ -7179,11 +6923,11 @@ export class Client { * @return Returned if the request is successful. */ trashCustomField(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/trash"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/trash") + .path("id", id) + .toString(); let options_: RequestInit = { method: "POST", @@ -7254,28 +6998,19 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurations(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, isDefault?: boolean | undefined, query?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (isDefault === null) - throw new globalThis.Error("The parameter 'isDefault' cannot be null."); - else if (isDefault !== undefined) - url_ += "isDefault=" + encodeURIComponent("" + isDefault) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(isDefault, 'isDefault'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("isDefault", isDefault) + .param("query", query) + .toString(); let options_: RequestInit = { method: "GET", @@ -7320,8 +7055,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfiguration(body: FieldConfigurationDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .toString(); const content_ = JSON.stringify(body); @@ -7375,11 +7110,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfiguration(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -7434,11 +7169,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfiguration(id: number, body: FieldConfigurationDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -7499,19 +7234,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationItems(id: number, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -7561,11 +7292,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationItems(id: number, body: FieldConfigurationItemsDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -7626,20 +7357,15 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurationSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -7689,8 +7415,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfigurationScheme(body: UpdateFieldConfigurationSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -7746,20 +7472,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, fieldConfigurationSchemeId?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fieldConfigurationSchemeId === null) - throw new globalThis.Error("The parameter 'fieldConfigurationSchemeId' cannot be null."); - else if (fieldConfigurationSchemeId !== undefined) - fieldConfigurationSchemeId && fieldConfigurationSchemeId.forEach(item => { url_ += "fieldConfigurationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fieldConfigurationSchemeId, 'fieldConfigurationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("fieldConfigurationSchemeId", fieldConfigurationSchemeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -7815,20 +7536,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeProjectMapping(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -7877,8 +7593,8 @@ export class Client { * @return Returned if the request is successful. */ assignFieldConfigurationSchemeToProject(body: FieldConfigurationSchemeProjectAssociation): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -7937,11 +7653,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfigurationScheme(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -7997,11 +7713,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationScheme(id: number, body: UpdateFieldConfigurationSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -8060,11 +7776,11 @@ export class Client { * @return Returned if the request is successful. */ setFieldConfigurationSchemeMapping(id: number, body: AssociateFieldConfigurationsWithIssueTypesRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -8124,11 +7840,11 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypesFromGlobalFieldConfigurationScheme(id: number, body: IssueTypeIdsToRemove): Promise { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -8204,16 +7920,13 @@ export class Client { * @return Returned if the request is successful. */ createFilter(body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter") + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -8262,8 +7975,8 @@ export class Client { * @return Returned if the request is successful. */ getDefaultShareScope(): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); let options_: RequestInit = { method: "GET", @@ -8304,8 +8017,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultShareScope(body: DefaultShareScope): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); const content_ = JSON.stringify(body); @@ -8358,12 +8071,11 @@ export class Client { * @return Returned if the request is successful. */ getFavouriteFilters(expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/favourite?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/favourite") + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -8416,16 +8128,13 @@ export class Client { * @return Returned if the request is successful. */ getMyFilters(expand?: string | undefined, includeFavourites?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/my?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (includeFavourites === null) - throw new globalThis.Error("The parameter 'includeFavourites' cannot be null."); - else if (includeFavourites !== undefined) - url_ += "includeFavourites=" + encodeURIComponent("" + includeFavourites) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(includeFavourites, 'includeFavourites'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/my") + .param("expand", expand) + .param("includeFavourites", includeFavourites) + .toString(); let options_: RequestInit = { method: "GET", @@ -8507,60 +8216,35 @@ export class Client { * @return Returned if the request is successful. */ getFiltersPaginated(filterName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy5 | undefined, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, isSubstringMatch?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/search?"; - if (filterName === null) - throw new globalThis.Error("The parameter 'filterName' cannot be null."); - else if (filterName !== undefined) - url_ += "filterName=" + encodeURIComponent("" + filterName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - if (isSubstringMatch === null) - throw new globalThis.Error("The parameter 'isSubstringMatch' cannot be null."); - else if (isSubstringMatch !== undefined) - url_ += "isSubstringMatch=" + encodeURIComponent("" + isSubstringMatch) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filterName, 'filterName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + Guard.notNull(isSubstringMatch, 'isSubstringMatch'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/search") + .param("filterName", filterName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .param("isSubstringMatch", isSubstringMatch) + .toString(); let options_: RequestInit = { method: "GET", @@ -8609,11 +8293,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFilter(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -8660,19 +8344,15 @@ export class Client { * @return Returned if the request is successful. */ getFilter(id: number, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); let options_: RequestInit = { method: "GET", @@ -8724,19 +8404,15 @@ export class Client { * @return Returned if the request is successful. */ updateFilter(id: number, body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -8786,11 +8462,11 @@ export class Client { * @return Returned if the request is successful. */ resetColumns(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -8832,11 +8508,11 @@ export class Client { * @return Returned if the request is successful. */ getColumns(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -8895,17 +8571,15 @@ export class Client { * @return Returned if the request is successful. */ setColumns(id: number, body: ColumnRequestBody, columns?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_: RequestInit = { body: content_, @@ -8958,15 +8632,13 @@ export class Client { * @return Returned if the request is successful. */ deleteFavouriteForFilter(id: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -9012,15 +8684,13 @@ export class Client { * @return Returned if the request is successful. */ setFavouriteForFilter(id: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "PUT", @@ -9063,11 +8733,11 @@ export class Client { * @return Returned if the request is successful. */ changeFilterOwner(id: number, body: ChangeFilterOwner): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/owner"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/owner") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9122,11 +8792,11 @@ export class Client { * @return Returned if the request is successful. */ getSharePermissions(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -9179,11 +8849,11 @@ export class Client { * @return Returned if the request is successful. */ addSharePermission(id: number, body: SharePermissionInputBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9245,14 +8915,13 @@ export class Client { * @return Returned if the request is successful. */ deleteSharePermission(id: number, permissionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -9295,14 +8964,13 @@ export class Client { * @return Returned if the request is successful. */ getSharePermission(id: number, permissionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); let options_: RequestInit = { method: "GET", @@ -9352,24 +9020,17 @@ export class Client { * @return Returned if the request is successful. */ removeGroup(groupname?: string | undefined, groupId?: string | undefined, swapGroup?: string | undefined, swapGroupId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (swapGroup === null) - throw new globalThis.Error("The parameter 'swapGroup' cannot be null."); - else if (swapGroup !== undefined) - url_ += "swapGroup=" + encodeURIComponent("" + swapGroup) + "&"; - if (swapGroupId === null) - throw new globalThis.Error("The parameter 'swapGroupId' cannot be null."); - else if (swapGroupId !== undefined) - url_ += "swapGroupId=" + encodeURIComponent("" + swapGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(swapGroup, 'swapGroup'); + Guard.notNull(swapGroupId, 'swapGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("swapGroup", swapGroup) + .param("swapGroupId", swapGroupId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -9423,20 +9084,15 @@ export class Client { * @deprecated */ getGroup(groupname?: string | undefined, groupId?: string | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -9490,8 +9146,8 @@ export class Client { * @return Returned if the request is successful. */ createGroup(body: AddGroupBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/group"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .toString(); const content_ = JSON.stringify(body); @@ -9550,32 +9206,21 @@ export class Client { * @return Returned if the request is successful. */ bulkGetGroups(startAt?: number | undefined, maxResults?: number | undefined, groupId?: string[] | undefined, groupName?: string[] | undefined, accessType?: string | undefined, applicationKey?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/bulk?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - groupId && groupId.forEach(item => { url_ += "groupId=" + encodeURIComponent("" + item) + "&"; }); - if (groupName === null) - throw new globalThis.Error("The parameter 'groupName' cannot be null."); - else if (groupName !== undefined) - groupName && groupName.forEach(item => { url_ += "groupName=" + encodeURIComponent("" + item) + "&"; }); - if (accessType === null) - throw new globalThis.Error("The parameter 'accessType' cannot be null."); - else if (accessType !== undefined) - url_ += "accessType=" + encodeURIComponent("" + accessType) + "&"; - if (applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' cannot be null."); - else if (applicationKey !== undefined) - url_ += "applicationKey=" + encodeURIComponent("" + applicationKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(groupName, 'groupName'); + Guard.notNull(accessType, 'accessType'); + Guard.notNull(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/bulk") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("groupId", groupId) + .paramArray("groupName", groupName) + .param("accessType", accessType) + .param("applicationKey", applicationKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -9634,28 +9279,19 @@ export class Client { * @return Returned if the request is successful. */ getUsersFromGroup(groupname?: string | undefined, groupId?: string | undefined, includeInactiveUsers?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/member?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (includeInactiveUsers === null) - throw new globalThis.Error("The parameter 'includeInactiveUsers' cannot be null."); - else if (includeInactiveUsers !== undefined) - url_ += "includeInactiveUsers=" + encodeURIComponent("" + includeInactiveUsers) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(includeInactiveUsers, 'includeInactiveUsers'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/member") + .param("groupname", groupname) + .param("groupId", groupId) + .param("includeInactiveUsers", includeInactiveUsers) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -9713,24 +9349,17 @@ export class Client { * @return Returned if the request is successful. */ removeUserFromGroup(accountId: string, groupname?: string | undefined, groupId?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("accountId", accountId) + .param("groupname", groupname) + .param("groupId", groupId) + .param("username", username) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -9783,16 +9412,13 @@ export class Client { * @return Returned if the request is successful. */ addUserToGroup(body: UpdateUserToGroupBean, groupname?: string | undefined, groupId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("groupname", groupname) + .param("groupId", groupId) + .toString(); const content_ = JSON.stringify(body); @@ -9861,36 +9487,23 @@ export class Client { * @return Returned if the request is successful. */ findGroups(accountId?: string | undefined, query?: string | undefined, exclude?: string[] | undefined, excludeId?: string[] | undefined, maxResults?: number | undefined, caseInsensitive?: boolean | undefined, userName?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/groups/picker?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeId === null) - throw new globalThis.Error("The parameter 'excludeId' cannot be null."); - else if (excludeId !== undefined) - excludeId && excludeId.forEach(item => { url_ += "excludeId=" + encodeURIComponent("" + item) + "&"; }); - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (userName === null) - throw new globalThis.Error("The parameter 'userName' cannot be null."); - else if (userName !== undefined) - url_ += "userName=" + encodeURIComponent("" + userName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeId, 'excludeId'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(userName, 'userName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groups/picker") + .param("accountId", accountId) + .param("query", query) + .paramArray("exclude", exclude) + .paramArray("excludeId", excludeId) + .param("maxResults", maxResults) + .param("caseInsensitive", caseInsensitive) + .param("userName", userName) + .toString(); let options_: RequestInit = { method: "GET", @@ -9936,44 +9549,27 @@ export class Client { * @return Returned if the request is successful. */ findUsersAndGroups(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, fieldId?: string | undefined, projectId?: string[] | undefined, issueTypeId?: string[] | undefined, avatarSize?: AvatarSize | undefined, caseInsensitive?: boolean | undefined, excludeConnectAddons?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/groupuserpicker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' cannot be null."); - else if (fieldId !== undefined) - url_ += "fieldId=" + encodeURIComponent("" + fieldId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - issueTypeId && issueTypeId.forEach(item => { url_ += "issueTypeId=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(fieldId, 'fieldId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groupuserpicker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .param("fieldId", fieldId) + .paramArray("projectId", projectId) + .paramArray("issueTypeId", issueTypeId) + .param("avatarSize", avatarSize) + .param("caseInsensitive", caseInsensitive) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); let options_: RequestInit = { method: "GET", @@ -10026,8 +9622,8 @@ export class Client { * @return Returned if the request is successful. */ getLicense(): Promise { - let url_ = this.baseUrl + "/rest/api/3/instance/license"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/instance/license") + .toString(); let options_: RequestInit = { method: "GET", @@ -10069,12 +9665,11 @@ export class Client { * @return Returned if the request is successful. */ createIssue(body: IssueUpdateDetails, updateHistory?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue?"; - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(updateHistory, 'updateHistory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue") + .param("updateHistory", updateHistory) + .toString(); const content_ = JSON.stringify(body); @@ -10144,8 +9739,8 @@ export class Client { * @return Returns the URL to check the status of the submitted request. */ archiveIssues(body: ArchiveIssueAsyncRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -10204,8 +9799,8 @@ export class Client { * @return Returned if there is at least one valid issue to archive in the request. The return message will include the count of archived issues and subtasks, as well as error details for issues which failed to get archived. */ archiveIssues(body: IssueArchivalSyncRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -10270,8 +9865,8 @@ export class Client { * is invalid for any other reason. */ createIssues(body: IssuesUpdateBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/bulk"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulk") + .toString(); const content_ = JSON.stringify(body); @@ -10324,8 +9919,8 @@ export class Client { * @return Returned if the request is successful. A response may contain both successful issues and issue errors. */ bulkFetchIssues(body: BulkFetchIssueRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -10380,28 +9975,19 @@ export class Client { * @deprecated */ getCreateIssueMeta(projectIds?: string[] | undefined, projectKeys?: string[] | undefined, issuetypeIds?: string[] | undefined, issuetypeNames?: string[] | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta?"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - if (projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' cannot be null."); - else if (projectKeys !== undefined) - projectKeys && projectKeys.forEach(item => { url_ += "projectKeys=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeIds === null) - throw new globalThis.Error("The parameter 'issuetypeIds' cannot be null."); - else if (issuetypeIds !== undefined) - issuetypeIds && issuetypeIds.forEach(item => { url_ += "issuetypeIds=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeNames === null) - throw new globalThis.Error("The parameter 'issuetypeNames' cannot be null."); - else if (issuetypeNames !== undefined) - issuetypeNames && issuetypeNames.forEach(item => { url_ += "issuetypeNames=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIds, 'projectIds'); + Guard.notNull(projectKeys, 'projectKeys'); + Guard.notNull(issuetypeIds, 'issuetypeIds'); + Guard.notNull(issuetypeNames, 'issuetypeNames'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta") + .paramArray("projectIds", projectIds) + .paramArray("projectKeys", projectKeys) + .paramArray("issuetypeIds", issuetypeIds) + .paramArray("issuetypeNames", issuetypeNames) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -10445,19 +10031,15 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypes(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -10506,22 +10088,17 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypeId(projectIdOrKey: string, issueTypeId: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}") + .path("projectIdOrKey", projectIdOrKey) + .path("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -10569,12 +10146,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLimitReport(isReturningKeys?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/limit/report?"; - if (isReturningKeys === null) - throw new globalThis.Error("The parameter 'isReturningKeys' cannot be null."); - else if (isReturningKeys !== undefined) - url_ += "isReturningKeys=" + encodeURIComponent("" + isReturningKeys) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(isReturningKeys, 'isReturningKeys'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/limit/report") + .param("isReturningKeys", isReturningKeys) + .toString(); let options_: RequestInit = { method: "GET", @@ -10625,32 +10201,21 @@ export class Client { * @return Returned if the request is successful. */ getIssuePickerResource(query?: string | undefined, currentJQL?: string | undefined, currentIssueKey?: string | undefined, currentProjectId?: string | undefined, showSubTasks?: boolean | undefined, showSubTaskParent?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/picker?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (currentJQL === null) - throw new globalThis.Error("The parameter 'currentJQL' cannot be null."); - else if (currentJQL !== undefined) - url_ += "currentJQL=" + encodeURIComponent("" + currentJQL) + "&"; - if (currentIssueKey === null) - throw new globalThis.Error("The parameter 'currentIssueKey' cannot be null."); - else if (currentIssueKey !== undefined) - url_ += "currentIssueKey=" + encodeURIComponent("" + currentIssueKey) + "&"; - if (currentProjectId === null) - throw new globalThis.Error("The parameter 'currentProjectId' cannot be null."); - else if (currentProjectId !== undefined) - url_ += "currentProjectId=" + encodeURIComponent("" + currentProjectId) + "&"; - if (showSubTasks === null) - throw new globalThis.Error("The parameter 'showSubTasks' cannot be null."); - else if (showSubTasks !== undefined) - url_ += "showSubTasks=" + encodeURIComponent("" + showSubTasks) + "&"; - if (showSubTaskParent === null) - throw new globalThis.Error("The parameter 'showSubTaskParent' cannot be null."); - else if (showSubTaskParent !== undefined) - url_ += "showSubTaskParent=" + encodeURIComponent("" + showSubTaskParent) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(currentJQL, 'currentJQL'); + Guard.notNull(currentIssueKey, 'currentIssueKey'); + Guard.notNull(currentProjectId, 'currentProjectId'); + Guard.notNull(showSubTasks, 'showSubTasks'); + Guard.notNull(showSubTaskParent, 'showSubTaskParent'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/picker") + .param("query", query) + .param("currentJQL", currentJQL) + .param("currentIssueKey", currentIssueKey) + .param("currentProjectId", currentProjectId) + .param("showSubTasks", showSubTasks) + .param("showSubTaskParent", showSubTaskParent) + .toString(); let options_: RequestInit = { method: "GET", @@ -10691,8 +10256,8 @@ export class Client { * @param body Issue properties to be set or updated with values. */ bulkSetIssuesPropertiesList(body: IssueEntityProperties): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties") + .toString(); const content_ = JSON.stringify(body); @@ -10743,8 +10308,8 @@ export class Client { * @param body Details of the issue properties to be set or updated. Note that if an issue is not found, it is ignored. */ bulkSetIssuePropertiesByIssue(body: MultiIssueEntityProperties): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/multi"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/multi") + .toString(); const content_ = JSON.stringify(body); @@ -10802,11 +10367,11 @@ export class Client { * @param propertyKey The key of the property. */ bulkDeleteIssueProperty(propertyKey: string, body: IssueFilterForBulkPropertyDelete): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -10857,11 +10422,11 @@ export class Client { * @param propertyKey The key of the property. The maximum length is 255 characters. */ bulkSetIssueProperty(propertyKey: string, body: BulkIssuePropertyUpdateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -10913,8 +10478,8 @@ export class Client { * @return Returned if there is at least one valid issue to unarchive in the request. It will return the count of unarchived issues, which also includes the count of the subtasks unarchived, and it will show the detailed errors for those issues which are not unarchived. */ unarchiveIssues(body: IssueArchivalSyncRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/unarchive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/unarchive") + .toString(); const content_ = JSON.stringify(body); @@ -10972,8 +10537,8 @@ export class Client { * @return Returned if the request is successful */ getIsWatchingIssueBulk(body: IssueList): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/watching"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/watching") + .toString(); const content_ = JSON.stringify(body); @@ -11020,15 +10585,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssue(issueIdOrKey: string, deleteSubtasks?: DeleteSubtasks | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (deleteSubtasks === null) - throw new globalThis.Error("The parameter 'deleteSubtasks' cannot be null."); - else if (deleteSubtasks !== undefined) - url_ += "deleteSubtasks=" + encodeURIComponent("" + deleteSubtasks) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(deleteSubtasks, 'deleteSubtasks'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("deleteSubtasks", deleteSubtasks) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -11117,35 +10680,23 @@ export class Client { * @return Returned if the request is successful. */ getIssue(issueIdOrKey: string, fields?: string[] | undefined, fieldsByKeys?: boolean | undefined, expand?: string | undefined, properties?: string[] | undefined, updateHistory?: boolean | undefined, failFast?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(fields, 'fields'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(updateHistory, 'updateHistory'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .paramArray("fields", fields) + .param("fieldsByKeys", fieldsByKeys) + .param("expand", expand) + .paramArray("properties", properties) + .param("updateHistory", updateHistory) + .param("failFast", failFast) + .toString(); let options_: RequestInit = { method: "GET", @@ -11196,31 +10747,21 @@ export class Client { * @return Returned if the request is successful and the `returnIssue` parameter is `true` */ editIssue(issueIdOrKey: string, body: IssueUpdateDetails, notifyUsers?: boolean | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined, returnIssue?: boolean | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (returnIssue === null) - throw new globalThis.Error("The parameter 'returnIssue' cannot be null."); - else if (returnIssue !== undefined) - url_ += "returnIssue=" + encodeURIComponent("" + returnIssue) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(returnIssue, 'returnIssue'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .param("returnIssue", returnIssue) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -11296,11 +10837,11 @@ export class Client { * @return Returned if the request is successful. */ assignIssue(issueIdOrKey: string, body: User): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -11355,11 +10896,11 @@ export class Client { * @return Returned if the request is successful. */ addAttachment(issueIdOrKey: string, body: Blob): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = body; @@ -11422,19 +10963,15 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogs(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -11476,11 +11013,11 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogsByIds(issueIdOrKey: string, body: IssueChangelogIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -11534,27 +11071,19 @@ export class Client { * @return Returned if the request is successful. */ getComments(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy6 | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -11605,15 +11134,13 @@ export class Client { * @return Returned if the request is successful. */ addComment(issueIdOrKey: string, body: Comment, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -11672,14 +11199,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComment(issueIdOrKey: string, id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -11731,18 +11257,15 @@ export class Client { * @return Returned if the request is successful. */ getComment(issueIdOrKey: string, id: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -11792,26 +11315,19 @@ export class Client { * @return Returned if the request is successful. */ updateComment(issueIdOrKey: string, id: string, body: Comment, notifyUsers?: boolean | undefined, overrideEditableFlag?: boolean | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("overrideEditableFlag", overrideEditableFlag) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -11867,19 +11383,15 @@ export class Client { * @return Returned if the request is successful. */ getEditIssueMeta(issueIdOrKey: string, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta") + .path("issueIdOrKey", issueIdOrKey) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_: RequestInit = { method: "GET", @@ -11930,11 +11442,11 @@ export class Client { * @return Returned if the email is queued for sending. */ notify(issueIdOrKey: string, body: Notification): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -11989,11 +11501,11 @@ export class Client { * @return Returned if the request is successful. */ getIssuePropertyKeys(issueIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -12036,14 +11548,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueProperty(issueIdOrKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -12086,14 +11597,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueProperty(issueIdOrKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -12141,14 +11651,13 @@ export class Client { * @return Returned if the issue property is updated. */ setIssueProperty(issueIdOrKey: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -12216,15 +11725,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkByGlobalId(issueIdOrKey: string, globalId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === undefined || globalId === null) - throw new globalThis.Error("The parameter 'globalId' must be defined and cannot be null."); - else - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -12275,15 +11782,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinks(issueIdOrKey: string, globalId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === null) - throw new globalThis.Error("The parameter 'globalId' cannot be null."); - else if (globalId !== undefined) - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); let options_: RequestInit = { method: "GET", @@ -12341,11 +11846,11 @@ export class Client { * @return Returned if the remote issue link is updated. */ createOrUpdateRemoteIssueLink(issueIdOrKey: string, body: RemoteIssueLinkRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -12411,14 +11916,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkById(issueIdOrKey: string, linkId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -12469,14 +11973,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinkById(issueIdOrKey: string, linkId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); let options_: RequestInit = { method: "GET", @@ -12531,14 +12034,13 @@ export class Client { * @return Returned if the request is successful. */ updateRemoteIssueLink(issueIdOrKey: string, linkId: string, body: RemoteIssueLinkRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); const content_ = JSON.stringify(body); @@ -12602,31 +12104,21 @@ export class Client { * @return Returned if the request is successful. */ getTransitions(issueIdOrKey: string, expand?: string | undefined, transitionId?: string | undefined, skipRemoteOnlyCondition?: boolean | undefined, includeUnavailableTransitions?: boolean | undefined, sortByOpsBarAndStatus?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' cannot be null."); - else if (transitionId !== undefined) - url_ += "transitionId=" + encodeURIComponent("" + transitionId) + "&"; - if (skipRemoteOnlyCondition === null) - throw new globalThis.Error("The parameter 'skipRemoteOnlyCondition' cannot be null."); - else if (skipRemoteOnlyCondition !== undefined) - url_ += "skipRemoteOnlyCondition=" + encodeURIComponent("" + skipRemoteOnlyCondition) + "&"; - if (includeUnavailableTransitions === null) - throw new globalThis.Error("The parameter 'includeUnavailableTransitions' cannot be null."); - else if (includeUnavailableTransitions !== undefined) - url_ += "includeUnavailableTransitions=" + encodeURIComponent("" + includeUnavailableTransitions) + "&"; - if (sortByOpsBarAndStatus === null) - throw new globalThis.Error("The parameter 'sortByOpsBarAndStatus' cannot be null."); - else if (sortByOpsBarAndStatus !== undefined) - url_ += "sortByOpsBarAndStatus=" + encodeURIComponent("" + sortByOpsBarAndStatus) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(transitionId, 'transitionId'); + Guard.notNull(skipRemoteOnlyCondition, 'skipRemoteOnlyCondition'); + Guard.notNull(includeUnavailableTransitions, 'includeUnavailableTransitions'); + Guard.notNull(sortByOpsBarAndStatus, 'sortByOpsBarAndStatus'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .param("transitionId", transitionId) + .param("skipRemoteOnlyCondition", skipRemoteOnlyCondition) + .param("includeUnavailableTransitions", includeUnavailableTransitions) + .param("sortByOpsBarAndStatus", sortByOpsBarAndStatus) + .toString(); let options_: RequestInit = { method: "GET", @@ -12672,11 +12164,11 @@ export class Client { * @return Returned if the request is successful. */ doTransition(issueIdOrKey: string, body: IssueUpdateDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -12743,11 +12235,11 @@ export class Client { * @return Returned if the request is successful. */ removeVote(issueIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -12789,11 +12281,11 @@ export class Client { * @return Returned if the request is successful. */ getVotes(issueIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -12839,11 +12331,11 @@ export class Client { * @return Returned if the request is successful. */ addVote(issueIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: RequestInit = { method: "POST", @@ -12896,19 +12388,15 @@ export class Client { * @return Returned if the request is successful. */ removeWatcher(issueIdOrKey: string, username?: string | undefined, accountId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .param("username", username) + .param("accountId", accountId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -12958,11 +12446,11 @@ export class Client { * @return Returned if the request is successful */ getIssueWatchers(issueIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -13009,11 +12497,11 @@ export class Client { * @return Returned if the request is successful. */ addWatcher(issueIdOrKey: string, body: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -13078,19 +12566,15 @@ export class Client { * @return Returned if the bulk deletion request was partially successful, with a message indicating partial success. */ bulkDeleteWorklogs(issueIdOrKey: string, body: WorklogIdsRequestBean, adjustEstimate?: AdjustEstimate | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -13149,31 +12633,21 @@ export class Client { * @return Returned if the request is successful */ getIssueWorklog(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, startedAfter?: number | undefined, startedBefore?: number | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (startedAfter === null) - throw new globalThis.Error("The parameter 'startedAfter' cannot be null."); - else if (startedAfter !== undefined) - url_ += "startedAfter=" + encodeURIComponent("" + startedAfter) + "&"; - if (startedBefore === null) - throw new globalThis.Error("The parameter 'startedBefore' cannot be null."); - else if (startedBefore !== undefined) - url_ += "startedBefore=" + encodeURIComponent("" + startedBefore) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(startedAfter, 'startedAfter'); + Guard.notNull(startedBefore, 'startedBefore'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("startedAfter", startedAfter) + .param("startedBefore", startedBefore) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -13230,35 +12704,23 @@ export class Client { * @return Returned if the request is successful. */ addWorklog(issueIdOrKey: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate2 | undefined, newEstimate?: string | undefined, reduceBy?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (reduceBy === null) - throw new globalThis.Error("The parameter 'reduceBy' cannot be null."); - else if (reduceBy !== undefined) - url_ += "reduceBy=" + encodeURIComponent("" + reduceBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(reduceBy, 'reduceBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("reduceBy", reduceBy) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -13321,19 +12783,15 @@ export class Client { * @return Returned if the request is partially successful. */ bulkMoveWorklogs(issueIdOrKey: string, body: WorklogsMoveRequestBean, adjustEstimate?: AdjustEstimate3 | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -13398,34 +12856,23 @@ export class Client { * @return Returned if the request is successful. */ deleteWorklog(issueIdOrKey: string, id: string, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate4 | undefined, newEstimate?: string | undefined, increaseBy?: string | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (increaseBy === null) - throw new globalThis.Error("The parameter 'increaseBy' cannot be null."); - else if (increaseBy !== undefined) - url_ += "increaseBy=" + encodeURIComponent("" + increaseBy) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(increaseBy, 'increaseBy'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("increaseBy", increaseBy) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -13475,18 +12922,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklog(issueIdOrKey: string, id: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -13542,34 +12986,23 @@ export class Client { * @return Returned if the request is successful */ updateWorklog(issueIdOrKey: string, id: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate5 | undefined, newEstimate?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -13624,14 +13057,13 @@ export class Client { * @return Returned if the request is successful. */ getWorklogPropertyKeys(issueIdOrKey: string, worklogId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .toString(); let options_: RequestInit = { method: "GET", @@ -13683,17 +13115,15 @@ export class Client { * @return Returned if the worklog property is removed. */ deleteWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -13745,17 +13175,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -13808,17 +13236,15 @@ export class Client { * @return Returned if the worklog property is updated. */ setWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -13885,8 +13311,8 @@ export class Client { * @return Returned if the request is successful. */ linkIssues(body: LinkIssueRequestJsonBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLink"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink") + .toString(); const content_ = JSON.stringify(body); @@ -13945,11 +13371,11 @@ export class Client { * @return 200 response */ deleteIssueLink(linkId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -13999,11 +13425,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLink(linkId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); let options_: RequestInit = { method: "GET", @@ -14052,8 +13478,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkTypes(): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); let options_: RequestInit = { method: "GET", @@ -14098,8 +13524,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueLinkType(body: IssueLinkType): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); const content_ = JSON.stringify(body); @@ -14153,11 +13579,11 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueLinkType(issueLinkTypeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -14203,11 +13629,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkType(issueLinkTypeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -14257,11 +13683,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueLinkType(issueLinkTypeId: string, body: IssueLinkType): Promise { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); const content_ = JSON.stringify(body); @@ -14315,8 +13741,8 @@ export class Client { * @return Returns the details of your export task. You can use the [get task](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/#api-rest-api-3-task-taskid-get) API to view the progress of your request. */ exportArchivedIssues(body: ArchivedIssuesFilterRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issues/archive/export"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issues/archive/export") + .toString(); const content_ = JSON.stringify(body); @@ -14373,8 +13799,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecuritySchemes(): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); let options_: RequestInit = { method: "GET", @@ -14419,8 +13845,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueSecurityScheme(body: CreateIssueSecuritySchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); const content_ = JSON.stringify(body); @@ -14487,28 +13913,19 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevels(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, onlyDefault?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .param("onlyDefault", onlyDefault) + .toString(); let options_: RequestInit = { method: "GET", @@ -14566,8 +13983,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultLevels(body: SetDefaultLevelsRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default") + .toString(); const content_ = JSON.stringify(body); @@ -14649,32 +14066,21 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelMembers(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, levelId?: string[] | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (levelId === null) - throw new globalThis.Error("The parameter 'levelId' cannot be null."); - else if (levelId !== undefined) - levelId && levelId.forEach(item => { url_ += "levelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(levelId, 'levelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .paramArray("levelId", levelId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -14727,24 +14133,17 @@ export class Client { * @return Returned if the request is successful. */ searchProjectsUsingSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, issueSecuritySchemeId?: string[] | undefined, projectId?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' cannot be null."); - else if (issueSecuritySchemeId !== undefined) - issueSecuritySchemeId && issueSecuritySchemeId.forEach(item => { url_ += "issueSecuritySchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecuritySchemeId", issueSecuritySchemeId) + .paramArray("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -14801,8 +14200,8 @@ export class Client { * Associate security scheme to project */ associateSchemesToProjects(body: AssociateSecuritySchemeWithProjectDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .toString(); const content_ = JSON.stringify(body); @@ -14881,24 +14280,17 @@ export class Client { * @return Returned if the request is successful. */ searchSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -14948,11 +14340,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityScheme(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -14998,11 +14390,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueSecurityScheme(id: string, body: UpdateIssueSecuritySchemeRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -15083,27 +14475,19 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevelMembers(issueSecuritySchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, issueSecurityLevelId?: string[] | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members?"; - if (issueSecuritySchemeId === undefined || issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' must be defined."); - url_ = url_.replace("{issueSecuritySchemeId}", encodeURIComponent("" + issueSecuritySchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecurityLevelId === null) - throw new globalThis.Error("The parameter 'issueSecurityLevelId' cannot be null."); - else if (issueSecurityLevelId !== undefined) - issueSecurityLevelId && issueSecurityLevelId.forEach(item => { url_ += "issueSecurityLevelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecurityLevelId, 'issueSecurityLevelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members") + .path("issueSecuritySchemeId", issueSecuritySchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecurityLevelId", issueSecurityLevelId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -15157,11 +14541,11 @@ export class Client { * @return Returned if the request is successful. */ deleteSecurityScheme(schemeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -15228,11 +14612,11 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevel(schemeId: string, body: AddSecuritySchemeLevelsRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -15304,18 +14688,15 @@ export class Client { * @param replaceWith (optional) The ID of the issue security level that will replace the currently selected level. */ removeLevel(schemeId: string, levelId: string, replaceWith?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.notNull(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .param("replaceWith", replaceWith) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -15388,14 +14769,13 @@ export class Client { * @return Returned if the request is successful. */ updateSecurityLevel(schemeId: string, levelId: string, body: UpdateIssueSecurityLevelDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -15467,14 +14847,13 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevelMembers(schemeId: string, levelId: string, body: SecuritySchemeMembersRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -15547,17 +14926,15 @@ export class Client { * @return Returned if the request is successful. */ removeMemberFromSecurityLevel(schemeId: string, levelId: string, memberId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (memberId === undefined || memberId === null) - throw new globalThis.Error("The parameter 'memberId' must be defined."); - url_ = url_.replace("{memberId}", encodeURIComponent("" + memberId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.required(memberId, 'memberId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .path("memberId", memberId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -15623,8 +15000,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueAllTypes(): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); let options_: RequestInit = { method: "GET", @@ -15668,8 +15045,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueType(body: IssueTypeCreateBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); const content_ = JSON.stringify(body); @@ -15732,16 +15109,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypesForProject(projectId: number, level?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (level === null) - throw new globalThis.Error("The parameter 'level' cannot be null."); - else if (level !== undefined) - url_ += "level=" + encodeURIComponent("" + level) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(level, 'level'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/project") + .param("projectId", projectId) + .param("level", level) + .toString(); let options_: RequestInit = { method: "GET", @@ -15795,15 +15169,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueType(id: string, alternativeIssueTypeId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (alternativeIssueTypeId === null) - throw new globalThis.Error("The parameter 'alternativeIssueTypeId' cannot be null."); - else if (alternativeIssueTypeId !== undefined) - url_ += "alternativeIssueTypeId=" + encodeURIComponent("" + alternativeIssueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(alternativeIssueTypeId, 'alternativeIssueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .param("alternativeIssueTypeId", alternativeIssueTypeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -15861,11 +15233,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueType(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -15911,11 +15283,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueType(id: string, body: IssueTypeUpdateBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -15977,11 +15349,11 @@ export class Client { * @return Returned if the request is successful. */ getAlternativeIssueTypes(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -16033,23 +15405,17 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeAvatar(id: string, size: number, body: any, x?: number | undefined, y?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2") + .path("id", id) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -16107,11 +15473,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypePropertyKeys(issueTypeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties") + .path("issueTypeId", issueTypeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -16158,14 +15524,13 @@ export class Client { * @return Returned if the issue type property is deleted. */ deleteIssueTypeProperty(issueTypeId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -16216,14 +15581,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeProperty(issueTypeId: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -16275,14 +15639,13 @@ export class Client { * @return Returned if the issue type property is updated. */ setIssueTypeProperty(issueTypeId: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -16360,32 +15723,21 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueTypeSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy7 | undefined, expand?: string | undefined, queryString?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("expand", expand) + .param("queryString", queryString) + .toString(); let options_: RequestInit = { method: "GET", @@ -16434,8 +15786,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScheme(body: IssueTypeSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .toString(); const content_ = JSON.stringify(body); @@ -16495,20 +15847,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemesMapping(startAt?: number | undefined, maxResults?: number | undefined, issueTypeSchemeId?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' cannot be null."); - else if (issueTypeSchemeId !== undefined) - issueTypeSchemeId && issueTypeSchemeId.forEach(item => { url_ += "issueTypeSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeSchemeId", issueTypeSchemeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -16560,20 +15907,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemeForProjects(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -16622,8 +15964,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeSchemeToProject(body: IssueTypeSchemeProjectAssociation): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -16682,11 +16024,11 @@ export class Client { * @return Returned if the issue type scheme is deleted. */ deleteIssueTypeScheme(issueTypeSchemeId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -16741,11 +16083,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeSchemeUpdateDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -16804,11 +16146,11 @@ export class Client { * @return Returned if the request is successful. */ addIssueTypesToIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -16867,11 +16209,11 @@ export class Client { * @return Returned if the request is successful. */ reorderIssueTypesInIssueTypeScheme(issueTypeSchemeId: number, body: OrderOfIssueTypes): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -16931,14 +16273,13 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypeFromIssueTypeScheme(issueTypeSchemeId: number, issueTypeId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .path("issueTypeId", issueTypeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -17001,32 +16342,21 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, orderBy?: OrderBy8 | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -17076,8 +16406,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScreenScheme(body: IssueTypeScreenSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -17141,20 +16471,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, issueTypeScreenSchemeId?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' cannot be null."); - else if (issueTypeScreenSchemeId !== undefined) - issueTypeScreenSchemeId && issueTypeScreenSchemeId.forEach(item => { url_ += "issueTypeScreenSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -17206,20 +16531,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeProjectAssociations(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -17268,8 +16588,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeScreenSchemeToProject(body: IssueTypeScreenSchemeProjectAssociation): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -17328,11 +16648,11 @@ export class Client { * @return Returned if the issue type screen scheme is deleted. */ deleteIssueTypeScreenScheme(issueTypeScreenSchemeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -17388,11 +16708,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeUpdateDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -17451,11 +16771,11 @@ export class Client { * @return Returned if the request is successful. */ appendMappingsForIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeMappingDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -17518,11 +16838,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultScreenScheme(issueTypeScreenSchemeId: string, body: UpdateDefaultScreenScheme): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -17581,11 +16901,11 @@ export class Client { * @return Returned if the screen scheme mappings are removed from the issue type screen scheme. */ removeMappingsFromIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeIds): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -17647,23 +16967,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectsForIssueTypeScreenScheme(issueTypeScreenSchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, query?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project?"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .toString(); let options_: RequestInit = { method: "GET", @@ -17712,8 +17026,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoComplete(): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); let options_: RequestInit = { method: "GET", @@ -17754,8 +17068,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoCompletePost(body: SearchAutoCompleteFilter): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); const content_ = JSON.stringify(body); @@ -17808,24 +17122,17 @@ export class Client { * @return Returned if the request is successful. */ getFieldAutoCompleteForQueryString(fieldName?: string | undefined, fieldValue?: string | undefined, predicateName?: string | undefined, predicateValue?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions?"; - if (fieldName === null) - throw new globalThis.Error("The parameter 'fieldName' cannot be null."); - else if (fieldName !== undefined) - url_ += "fieldName=" + encodeURIComponent("" + fieldName) + "&"; - if (fieldValue === null) - throw new globalThis.Error("The parameter 'fieldValue' cannot be null."); - else if (fieldValue !== undefined) - url_ += "fieldValue=" + encodeURIComponent("" + fieldValue) + "&"; - if (predicateName === null) - throw new globalThis.Error("The parameter 'predicateName' cannot be null."); - else if (predicateName !== undefined) - url_ += "predicateName=" + encodeURIComponent("" + predicateName) + "&"; - if (predicateValue === null) - throw new globalThis.Error("The parameter 'predicateValue' cannot be null."); - else if (predicateValue !== undefined) - url_ += "predicateValue=" + encodeURIComponent("" + predicateValue) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(fieldName, 'fieldName'); + Guard.notNull(fieldValue, 'fieldValue'); + Guard.notNull(predicateName, 'predicateName'); + Guard.notNull(predicateValue, 'predicateValue'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions") + .param("fieldName", fieldName) + .param("fieldValue", fieldValue) + .param("predicateName", predicateName) + .param("predicateValue", predicateValue) + .toString(); let options_: RequestInit = { method: "GET", @@ -17882,24 +17189,17 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputations(functionKey?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (functionKey === null) - throw new globalThis.Error("The parameter 'functionKey' cannot be null."); - else if (functionKey !== undefined) - functionKey && functionKey.forEach(item => { url_ += "functionKey=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(functionKey, 'functionKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .paramArray("functionKey", functionKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .toString(); let options_: RequestInit = { method: "GET", @@ -17953,12 +17253,11 @@ export class Client { * @return 200 response */ updatePrecomputations(body: JqlFunctionPrecomputationUpdateRequestBean, skipNotFoundPrecomputations?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (skipNotFoundPrecomputations === null) - throw new globalThis.Error("The parameter 'skipNotFoundPrecomputations' cannot be null."); - else if (skipNotFoundPrecomputations !== undefined) - url_ += "skipNotFoundPrecomputations=" + encodeURIComponent("" + skipNotFoundPrecomputations) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(skipNotFoundPrecomputations, 'skipNotFoundPrecomputations'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .param("skipNotFoundPrecomputations", skipNotFoundPrecomputations) + .toString(); const content_ = JSON.stringify(body); @@ -18034,12 +17333,11 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputationsByID(body: JqlFunctionPrecomputationGetByIdRequest, orderBy?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation/search?"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation/search") + .param("orderBy", orderBy) + .toString(); const content_ = JSON.stringify(body); @@ -18096,8 +17394,8 @@ export class Client { * @return Returned if the request is successful. */ matchIssues(body: IssuesAndJQLQueries): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/match"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/match") + .toString(); const content_ = JSON.stringify(body); @@ -18147,12 +17445,11 @@ export class Client { * @return Returned if the request is successful. */ parseJqlQueries(validation: Validation, body: JqlQueriesToParse): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/parse?"; - if (validation === undefined || validation === null) - throw new globalThis.Error("The parameter 'validation' must be defined and cannot be null."); - else - url_ += "validation=" + encodeURIComponent("" + validation) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(validation, 'validation'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/parse") + .param("validation", validation) + .toString(); const content_ = JSON.stringify(body); @@ -18204,8 +17501,8 @@ export class Client { * @return Returned if the request is successful. Note that the JQL queries are returned in the same order that they were passed. */ migrateQueries(body: JQLPersonalDataMigrationRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/pdcleaner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/pdcleaner") + .toString(); const content_ = JSON.stringify(body); @@ -18262,8 +17559,8 @@ export class Client { * @return Returned if the request is successful. */ sanitiseJqlQueries(body: JqlQueriesToSanitize): Promise { - let url_ = this.baseUrl + "/rest/api/3/jql/sanitize"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/sanitize") + .toString(); const content_ = JSON.stringify(body); @@ -18327,16 +17624,13 @@ export class Client { * @return Returned if the request is successful. */ getAllLabels(startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/label?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/label") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -18373,8 +17667,8 @@ export class Client { * @return Returned if the request is successful. */ getApproximateLicenseCount(): Promise { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount") + .toString(); let options_: RequestInit = { method: "GET", @@ -18426,11 +17720,11 @@ export class Client { * @return Returned if the request is successful. */ getApproximateApplicationLicenseCount(applicationKey: ApplicationKey): Promise { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}"; - if (applicationKey === undefined || applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' must be defined."); - url_ = url_.replace("{applicationKey}", encodeURIComponent("" + applicationKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}") + .path("applicationKey", applicationKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -18489,40 +17783,25 @@ export class Client { * @return Returned if the request is successful. */ getMyPermissions(projectKey?: string | undefined, projectId?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, permissions?: string | undefined, projectUuid?: string | undefined, projectConfigurationUuid?: string | undefined, commentId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypermissions?"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (permissions === null) - throw new globalThis.Error("The parameter 'permissions' cannot be null."); - else if (permissions !== undefined) - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (projectUuid === null) - throw new globalThis.Error("The parameter 'projectUuid' cannot be null."); - else if (projectUuid !== undefined) - url_ += "projectUuid=" + encodeURIComponent("" + projectUuid) + "&"; - if (projectConfigurationUuid === null) - throw new globalThis.Error("The parameter 'projectConfigurationUuid' cannot be null."); - else if (projectConfigurationUuid !== undefined) - url_ += "projectConfigurationUuid=" + encodeURIComponent("" + projectConfigurationUuid) + "&"; - if (commentId === null) - throw new globalThis.Error("The parameter 'commentId' cannot be null."); - else if (commentId !== undefined) - url_ += "commentId=" + encodeURIComponent("" + commentId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(permissions, 'permissions'); + Guard.notNull(projectUuid, 'projectUuid'); + Guard.notNull(projectConfigurationUuid, 'projectConfigurationUuid'); + Guard.notNull(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypermissions") + .param("projectKey", projectKey) + .param("projectId", projectId) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("permissions", permissions) + .param("projectUuid", projectUuid) + .param("projectConfigurationUuid", projectConfigurationUuid) + .param("commentId", commentId) + .toString(); let options_: RequestInit = { method: "GET", @@ -18581,12 +17860,11 @@ export class Client { * @return Returned if the request is successful. */ removePreference(key: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -18628,12 +17906,11 @@ export class Client { * @return Returned if the request is successful. */ getPreference(key: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -18681,12 +17958,11 @@ export class Client { * @return Returned if the request is successful. */ setPreference(key: string, body: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); const content_ = JSON.stringify(body); @@ -18737,8 +18013,8 @@ export class Client { * @deprecated */ deleteLocale(): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); let options_: RequestInit = { method: "DELETE", @@ -18780,8 +18056,8 @@ export class Client { * @return Returned if the request is successful. */ getLocale(): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); let options_: RequestInit = { method: "GET", @@ -18824,8 +18100,8 @@ export class Client { * @deprecated */ setLocale(body: Locale): Promise { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); const content_ = JSON.stringify(body); @@ -18879,12 +18155,11 @@ export class Client { * @return Returned if the request is successful. */ getCurrentUser(expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/myself?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/myself") + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -18938,32 +18213,21 @@ export class Client { * @return Returned if the request is successful. Only returns notification schemes that the user has permission to access. An empty list is returned if the user lacks permission to access all notification schemes. */ getNotificationSchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -19008,8 +18272,8 @@ export class Client { * @return Returned if the request is successful. */ createNotificationScheme(body: CreateNotificationSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -19075,24 +18339,17 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeToProjectMappings(startAt?: string | undefined, maxResults?: string | undefined, notificationSchemeId?: string[] | undefined, projectId?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' cannot be null."); - else if (notificationSchemeId !== undefined) - notificationSchemeId && notificationSchemeId.forEach(item => { url_ += "notificationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(notificationSchemeId, 'notificationSchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("notificationSchemeId", notificationSchemeId) + .paramArray("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -19152,15 +18409,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationScheme(id: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -19210,11 +18465,11 @@ export class Client { * @return Returned if the request is successful. */ updateNotificationScheme(id: string, body: UpdateNotificationSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -19285,11 +18540,11 @@ export class Client { * @return Returned if the request is successful. */ addNotifications(id: string, body: AddNotificationsDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -19360,11 +18615,11 @@ export class Client { * @return Returned if the request is successful. */ deleteNotificationScheme(notificationSchemeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}") + .path("notificationSchemeId", notificationSchemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -19432,14 +18687,13 @@ export class Client { * @return Returned if the request is successful. */ removeNotificationFromNotificationScheme(notificationSchemeId: string, notificationId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - if (notificationId === undefined || notificationId === null) - throw new globalThis.Error("The parameter 'notificationId' must be defined."); - url_ = url_.replace("{notificationId}", encodeURIComponent("" + notificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + Guard.required(notificationId, 'notificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}") + .path("notificationSchemeId", notificationSchemeId) + .path("notificationId", notificationId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -19505,8 +18759,8 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissions(): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissions"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions") + .toString(); let options_: RequestInit = { method: "GET", @@ -19552,8 +18806,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkPermissions(body: BulkPermissionsRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissions/check"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/check") + .toString(); const content_ = JSON.stringify(body); @@ -19608,8 +18862,8 @@ export class Client { * @return Returned if the request is successful. */ getPermittedProjects(body: PermissionsKeysBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissions/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/project") + .toString(); const content_ = JSON.stringify(body); @@ -19666,12 +18920,11 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissionSchemes(expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -19721,12 +18974,11 @@ export class Client { * @return Returned if the permission scheme is created. */ createPermissionScheme(body: PermissionScheme, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -19780,11 +19032,11 @@ export class Client { * @return Returned if the permission scheme is deleted. */ deletePermissionScheme(schemeId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -19838,15 +19090,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionScheme(schemeId: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -19900,15 +19150,13 @@ export class Client { * @return Returned if the scheme is updated. */ updatePermissionScheme(schemeId: number, body: PermissionScheme, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -19970,15 +19218,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrants(schemeId: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -20033,15 +19279,13 @@ export class Client { * @return Returned if the scheme permission is created. */ createPermissionGrant(schemeId: number, body: PermissionGrant, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -20096,14 +19340,13 @@ export class Client { * @return Returned if the permission grant is deleted. */ deletePermissionSchemeEntity(schemeId: number, permissionId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -20158,18 +19401,15 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrant(schemeId: number, permissionId: number, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -20218,24 +19458,17 @@ export class Client { * @return Returned if the request is successful. */ getPlans(includeTrashed?: boolean | undefined, includeArchived?: boolean | undefined, cursor?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (includeTrashed === null) - throw new globalThis.Error("The parameter 'includeTrashed' cannot be null."); - else if (includeTrashed !== undefined) - url_ += "includeTrashed=" + encodeURIComponent("" + includeTrashed) + "&"; - if (includeArchived === null) - throw new globalThis.Error("The parameter 'includeArchived' cannot be null."); - else if (includeArchived !== undefined) - url_ += "includeArchived=" + encodeURIComponent("" + includeArchived) + "&"; - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(includeTrashed, 'includeTrashed'); + Guard.notNull(includeArchived, 'includeArchived'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("includeTrashed", includeTrashed) + .param("includeArchived", includeArchived) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -20287,12 +19520,11 @@ export class Client { * @return Returned if the request is successful. */ createPlan(body: CreatePlanRequest, useGroupId?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -20357,15 +19589,13 @@ export class Client { * @return Returned if the request is successful. */ getPlan(planId: number, useGroupId?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); let options_: RequestInit = { method: "GET", @@ -20425,15 +19655,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlan(planId: number, body: any, useGroupId?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -20511,11 +19739,11 @@ export class Client { * @return Returned if the request is successful. */ archivePlan(planId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive") + .path("planId", planId) + .toString(); let options_: RequestInit = { method: "PUT", @@ -20582,11 +19810,11 @@ export class Client { * @return Returned if the request is successful. */ duplicatePlan(planId: number, body: DuplicatePlanRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -20666,19 +19894,15 @@ export class Client { * @return Returned if the request is successful. */ getTeams(planId: number, cursor?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team") + .path("planId", planId) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -20737,11 +19961,11 @@ export class Client { * @return Returned if the request is successful. */ addAtlassianTeam(planId: number, body: AddAtlassianTeamRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -20820,14 +20044,13 @@ export class Client { * @return Returned if the request is successful. */ removeAtlassianTeam(planId: number, atlassianTeamId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -20895,14 +20118,13 @@ export class Client { * @return Returned if the request is successful. */ getAtlassianTeam(planId: number, atlassianTeamId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); let options_: RequestInit = { method: "GET", @@ -20969,14 +20191,13 @@ export class Client { * @return Returned if the request is successful. */ updateAtlassianTeam(planId: number, atlassianTeamId: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -21054,11 +20275,11 @@ export class Client { * @return Returned if the request is successful. */ createPlanOnlyTeam(planId: number, body: CreatePlanOnlyTeamRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -21137,14 +20358,13 @@ export class Client { * @return Returned if the request is successful. */ deletePlanOnlyTeam(planId: number, planOnlyTeamId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -21212,14 +20432,13 @@ export class Client { * @return Returned if the request is successful. */ getPlanOnlyTeam(planId: number, planOnlyTeamId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); let options_: RequestInit = { method: "GET", @@ -21286,14 +20505,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlanOnlyTeam(planId: number, planOnlyTeamId: number, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -21371,11 +20589,11 @@ export class Client { * @return Returned if the request is successful. */ trashPlan(planId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash") + .path("planId", planId) + .toString(); let options_: RequestInit = { method: "PUT", @@ -21442,8 +20660,8 @@ export class Client { * @deprecated */ getPriorities(): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); let options_: RequestInit = { method: "GET", @@ -21492,8 +20710,8 @@ export class Client { * @deprecated */ createPriority(body: CreatePriorityDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); const content_ = JSON.stringify(body); @@ -21555,8 +20773,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultPriority(body: SetDefaultPriorityRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/default") + .toString(); const content_ = JSON.stringify(body); @@ -21626,8 +20844,8 @@ export class Client { * @return Returned if the request is successful. */ movePriorities(body: ReorderIssuePriorities): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/move") + .toString(); const content_ = JSON.stringify(body); @@ -21705,36 +20923,23 @@ export class Client { * @deprecated */ searchPriorities(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, priorityName?: string | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (priorityName === null) - throw new globalThis.Error("The parameter 'priorityName' cannot be null."); - else if (priorityName !== undefined) - url_ += "priorityName=" + encodeURIComponent("" + priorityName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(priorityName, 'priorityName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("priorityName", priorityName) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -21778,11 +20983,11 @@ export class Client { * @param id The ID of the issue priority. */ deletePriority(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -21854,11 +21059,11 @@ export class Client { * @return Returned if the request is successful. */ getPriority(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -21905,11 +21110,11 @@ export class Client { * @deprecated */ updatePriority(id: string, body: UpdatePriorityDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -21987,40 +21192,25 @@ export class Client { * @return Returned if the request is successful. */ getPrioritySchemes(startAt?: string | undefined, maxResults?: string | undefined, priorityId?: number[] | undefined, schemeId?: number[] | undefined, schemeName?: string | undefined, onlyDefault?: boolean | undefined, orderBy?: OrderBy9 | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (priorityId === null) - throw new globalThis.Error("The parameter 'priorityId' cannot be null."); - else if (priorityId !== undefined) - priorityId && priorityId.forEach(item => { url_ += "priorityId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeName === null) - throw new globalThis.Error("The parameter 'schemeName' cannot be null."); - else if (schemeName !== undefined) - url_ += "schemeName=" + encodeURIComponent("" + schemeName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(priorityId, 'priorityId'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(schemeName, 'schemeName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("priorityId", priorityId) + .paramArray("schemeId", schemeId) + .param("schemeName", schemeName) + .param("onlyDefault", onlyDefault) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -22065,8 +21255,8 @@ export class Client { * @return Returned if the request is completed. */ createPriorityScheme(body: CreatePrioritySchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .toString(); const content_ = JSON.stringify(body); @@ -22130,8 +21320,8 @@ export class Client { * @return Returned if the request is successful. */ suggestedPrioritiesForMappings(body: SuggestedMappingsRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -22185,28 +21375,19 @@ export class Client { * @return Returned if the request is successful. */ getAvailablePrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, query?: string | undefined, exclude?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/priorities/available?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined and cannot be null."); - else - url_ += "schemeId=" + encodeURIComponent("" + schemeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/priorities/available") + .param("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .paramArray("exclude", exclude) + .toString(); let options_: RequestInit = { method: "GET", @@ -22252,11 +21433,11 @@ export class Client { * @return Returned if the request is successful. */ deletePriorityScheme(schemeId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -22307,11 +21488,11 @@ export class Client { * @return Returned if the request is accepted. */ updatePriorityScheme(schemeId: number, body: UpdatePrioritySchemeRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -22371,19 +21552,15 @@ export class Client { * @return Returned if the request is successful. */ getPrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -22433,27 +21610,19 @@ export class Client { * @return Returned if the request is successful. */ getProjectsByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, projectId?: number[] | undefined, query?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("projectId", projectId) + .param("query", query) + .toString(); let options_: RequestInit = { method: "GET", @@ -22507,20 +21676,15 @@ export class Client { * @deprecated */ getAllProjects(expand?: string | undefined, recent?: number | undefined, properties?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (recent === null) - throw new globalThis.Error("The parameter 'recent' cannot be null."); - else if (recent !== undefined) - url_ += "recent=" + encodeURIComponent("" + recent) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(recent, 'recent'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .param("expand", expand) + .param("recent", recent) + .paramArray("properties", properties) + .toString(); let options_: RequestInit = { method: "GET", @@ -22569,8 +21733,8 @@ export class Client { * @return Returned if the project is created. */ createProject(body: CreateProjectDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .toString(); const content_ = JSON.stringify(body); @@ -22623,8 +21787,8 @@ export class Client { * @param body The JSON payload containing the project details and capabilities */ createProjectWithCustomTemplate(body: ProjectCustomTemplateCreateRequestDTO): Promise { - let url_ = this.baseUrl + "/rest/api/3/project-template"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project-template") + .toString(); const content_ = JSON.stringify(body); @@ -22676,21 +21840,13 @@ export class Client { * @return Returned if the request is successful. */ getRecent(expand?: string | undefined, properties?: StringList[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/recent?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/recent") + .param("expand", expand) + .paramArray("properties", properties) + .toString(); let options_: RequestInit = { method: "GET", @@ -22787,65 +21943,35 @@ export class Client { * @return Returned if the request is successful. */ searchProjects(startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy10 | undefined, id?: number[] | undefined, keys?: string[] | undefined, query?: string | undefined, typeKey?: string | undefined, categoryId?: number | undefined, action?: Action | undefined, expand?: string | undefined, status?: Status4[] | undefined, properties?: StringList[] | undefined, propertyQuery?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (typeKey === null) - throw new globalThis.Error("The parameter 'typeKey' cannot be null."); - else if (typeKey !== undefined) - url_ += "typeKey=" + encodeURIComponent("" + typeKey) + "&"; - if (categoryId === null) - throw new globalThis.Error("The parameter 'categoryId' cannot be null."); - else if (categoryId !== undefined) - url_ += "categoryId=" + encodeURIComponent("" + categoryId) + "&"; - if (action === null) - throw new globalThis.Error("The parameter 'action' cannot be null."); - else if (action !== undefined) - url_ += "action=" + encodeURIComponent("" + action) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - if (propertyQuery === null) - throw new globalThis.Error("The parameter 'propertyQuery' cannot be null."); - else if (propertyQuery !== undefined) - url_ += "propertyQuery=" + encodeURIComponent("" + propertyQuery) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(id, 'id'); + Guard.notNull(keys, 'keys'); + Guard.notNull(query, 'query'); + Guard.notNull(typeKey, 'typeKey'); + Guard.notNull(categoryId, 'categoryId'); + Guard.notNull(action, 'action'); + Guard.notNull(expand, 'expand'); + Guard.notNull(status, 'status'); + Guard.notNull(properties, 'properties'); + Guard.notNull(propertyQuery, 'propertyQuery'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .paramArray("id", id) + .paramArray("keys", keys) + .param("query", query) + .param("typeKey", typeKey) + .param("categoryId", categoryId) + .param("action", action) + .param("expand", expand) + .paramArray("status", status) + .paramArray("properties", properties) + .param("propertyQuery", propertyQuery) + .toString(); let options_: RequestInit = { method: "GET", @@ -22894,8 +22020,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectTypes(): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type") + .toString(); let options_: RequestInit = { method: "GET", @@ -22943,8 +22069,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAccessibleProjectTypes(): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type/accessible"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/accessible") + .toString(); let options_: RequestInit = { method: "GET", @@ -22989,11 +22115,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectTypeByKey(projectTypeKey: ProjectTypeKey): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}") + .path("projectTypeKey", projectTypeKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -23039,11 +22165,11 @@ export class Client { * @return Returned if the request is successful. */ getAccessibleProjectTypeByKey(projectTypeKey: ProjectTypeKey2): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible") + .path("projectTypeKey", projectTypeKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -23090,15 +22216,13 @@ export class Client { * @return Returned if the project is deleted. */ deleteProject(projectIdOrKey: string, enableUndo?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (enableUndo === null) - throw new globalThis.Error("The parameter 'enableUndo' cannot be null."); - else if (enableUndo !== undefined) - url_ += "enableUndo=" + encodeURIComponent("" + enableUndo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(enableUndo, 'enableUndo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("enableUndo", enableUndo) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -23148,19 +22272,15 @@ export class Client { * @return Returned if successful. */ getProject(projectIdOrKey: string, expand?: string | undefined, properties?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .paramArray("properties", properties) + .toString(); let options_: RequestInit = { method: "GET", @@ -23213,15 +22333,13 @@ export class Client { * @return Returned if the project is updated. */ updateProject(projectIdOrKey: string, body: UpdateProjectDetails, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -23279,11 +22397,11 @@ export class Client { * @return Returned if the request is successful. */ archiveProject(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "POST", @@ -23338,11 +22456,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectAvatar(projectIdOrKey: string, body: Avatar): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -23398,14 +22516,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectAvatar(projectIdOrKey: string, id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -23454,23 +22571,17 @@ export class Client { * @return Returned if the request is successful. */ createProjectAvatar(projectIdOrKey: string, body: any, x?: number | undefined, y?: number | undefined, size?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + Guard.notNull(size, 'size'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2") + .path("projectIdOrKey", projectIdOrKey) + .param("x", x) + .param("y", y) + .param("size", size) + .toString(); const content_ = JSON.stringify(body); @@ -23528,11 +22639,11 @@ export class Client { * @return Returned if request is successful. */ getAllProjectAvatars(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -23578,11 +22689,11 @@ export class Client { * @return Returned if the request is successful. */ removeDefaultProjectClassification(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -23633,11 +22744,11 @@ export class Client { * @return Returned if the request is successful. */ getDefaultProjectClassification(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -23684,11 +22795,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultProjectClassification(projectIdOrKey: string, body: UpdateDefaultProjectClassificationBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -23753,31 +22864,21 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponentsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy11 | undefined, componentSource?: ComponentSource | undefined, query?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(componentSource, 'componentSource'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("componentSource", componentSource) + .param("query", query) + .toString(); let options_: RequestInit = { method: "GET", @@ -23824,15 +22925,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponents(projectIdOrKey: string, componentSource?: ComponentSource2 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(componentSource, 'componentSource'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components") + .path("projectIdOrKey", projectIdOrKey) + .param("componentSource", componentSource) + .toString(); let options_: RequestInit = { method: "GET", @@ -23884,11 +22983,11 @@ export class Client { * @param projectIdOrKey The project ID or project key (case sensitive). */ deleteProjectAsynchronously(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "POST", @@ -23937,11 +23036,11 @@ export class Client { * @return Returned if the request is successful. */ getFeaturesForProject(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -23997,14 +23096,13 @@ export class Client { * @return Returned if the request is successful. */ toggleFeatureForProject(projectIdOrKey: string, featureKey: string, body: ProjectFeatureState): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (featureKey === undefined || featureKey === null) - throw new globalThis.Error("The parameter 'featureKey' must be defined."); - url_ = url_.replace("{featureKey}", encodeURIComponent("" + featureKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(featureKey, 'featureKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("featureKey", featureKey) + .toString(); const content_ = JSON.stringify(body); @@ -24062,11 +23160,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectPropertyKeys(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -24121,14 +23219,13 @@ export class Client { * @return Returned if the project property is deleted. */ deleteProjectProperty(projectIdOrKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -24179,14 +23276,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectProperty(projectIdOrKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -24242,14 +23338,13 @@ export class Client { * @return Returned if the project property is updated. */ setProjectProperty(projectIdOrKey: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -24316,11 +23411,11 @@ export class Client { * @return Returned if the request is successful. */ restore(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "POST", @@ -24370,11 +23465,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoles(projectIdOrKey: string): Promise<{ [key: string]: string; }> { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -24433,26 +23528,19 @@ export class Client { * @return Returned if the request is successful. */ deleteActor(projectIdOrKey: string, id: number, user?: string | undefined, group?: string | undefined, groupId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(group, 'group'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("user", user) + .param("group", group) + .param("groupId", groupId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -24496,18 +23584,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRole(projectIdOrKey: string, id: number, excludeInactiveUsers?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (excludeInactiveUsers === null) - throw new globalThis.Error("The parameter 'excludeInactiveUsers' cannot be null."); - else if (excludeInactiveUsers !== undefined) - url_ += "excludeInactiveUsers=" + encodeURIComponent("" + excludeInactiveUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(excludeInactiveUsers, 'excludeInactiveUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("excludeInactiveUsers", excludeInactiveUsers) + .toString(); let options_: RequestInit = { method: "GET", @@ -24561,14 +23646,13 @@ export class Client { For example, the cURL request above adds a group, *jira-developers*. For the response below to be returned as a result of that request, the user *Mia Krystof* would have previously been added as a `user` actor for this project. */ addActorUsers(projectIdOrKey: string, id: number, body: ActorsMap): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -24624,14 +23708,13 @@ export class Client { * @return Returned if the request is successful. The complete list of actors for the project is returned. */ setActors(projectIdOrKey: string, id: number, body: ProjectRoleActorsUpdateBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -24687,19 +23770,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleDetails(projectIdOrKey: string, currentMember?: boolean | undefined, excludeConnectAddons?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (currentMember === null) - throw new globalThis.Error("The parameter 'currentMember' cannot be null."); - else if (currentMember !== undefined) - url_ += "currentMember=" + encodeURIComponent("" + currentMember) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(currentMember, 'currentMember'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails") + .path("projectIdOrKey", projectIdOrKey) + .param("currentMember", currentMember) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); let options_: RequestInit = { method: "GET", @@ -24752,11 +23831,11 @@ export class Client { * @return Returned if the request is successful. */ getAllStatuses(projectIdOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -24826,35 +23905,23 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersionsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy12 | undefined, query?: string | undefined, status?: string | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .param("status", status) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -24897,15 +23964,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersions(projectIdOrKey: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -24954,11 +24019,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectEmail(projectId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -25009,11 +24074,11 @@ export class Client { * @return Returned if the project's sender email address is successfully set. */ updateProjectEmail(projectId: number, body: ProjectEmailAddress): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); const content_ = JSON.stringify(body); @@ -25072,11 +24137,11 @@ export class Client { * @return Returned if the request is successful. */ getHierarchy(projectId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy") + .path("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -25126,11 +24191,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueSecurityScheme(projectKeyOrId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme") + .path("projectKeyOrId", projectKeyOrId) + .toString(); let options_: RequestInit = { method: "GET", @@ -25192,15 +24257,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeForProject(projectKeyOrId: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -25258,15 +24321,13 @@ export class Client { * @return Returned if the request is successful. */ getAssignedPermissionScheme(projectKeyOrId: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -25324,15 +24385,13 @@ export class Client { * @return Returned if the request is successful. */ assignPermissionScheme(projectKeyOrId: string, body: IdBean, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -25386,11 +24445,11 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelsForProject(projectKeyOrId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel") + .path("projectKeyOrId", projectKeyOrId) + .toString(); let options_: RequestInit = { method: "GET", @@ -25431,8 +24490,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectCategories(): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); let options_: RequestInit = { method: "GET", @@ -25480,8 +24539,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectCategory(body: ProjectCategory): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); const content_ = JSON.stringify(body); @@ -25539,11 +24598,11 @@ export class Client { * @return Returned if the request is successful. */ removeProjectCategory(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -25589,11 +24648,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectCategoryById(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -25638,11 +24697,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectCategory(id: number, body: ProjectCategory): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -25700,12 +24759,11 @@ export class Client { * @return Returned if the request is successful. */ validateProjectKey(key?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/key?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/key") + .param("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -25747,12 +24805,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectKey(key?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey") + .param("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -25795,12 +24852,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectName(name: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectName?"; - if (name === undefined || name === null) - throw new globalThis.Error("The parameter 'name' must be defined and cannot be null."); - else - url_ += "name=" + encodeURIComponent("" + name) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(name, 'name'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectName") + .param("name", name) + .toString(); let options_: RequestInit = { method: "GET", @@ -25851,8 +24907,8 @@ export class Client { * @deprecated */ getResolutions(): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); let options_: RequestInit = { method: "GET", @@ -25900,8 +24956,8 @@ export class Client { * @return Returned if the request is successful. */ createResolution(body: CreateResolutionDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); const content_ = JSON.stringify(body); @@ -25963,8 +25019,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultResolution(body: SetDefaultResolutionRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/default") + .toString(); const content_ = JSON.stringify(body); @@ -26034,8 +25090,8 @@ export class Client { * @return Returned if the request is successful. */ moveResolutions(body: ReorderIssueResolutionsRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/move") + .toString(); const content_ = JSON.stringify(body); @@ -26109,24 +25165,17 @@ export class Client { * @return Returned if the request is successful. */ searchResolutions(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, onlyDefault?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("onlyDefault", onlyDefault) + .toString(); let options_: RequestInit = { method: "GET", @@ -26171,15 +25220,13 @@ export class Client { * @param replaceWith The ID of the issue resolution that will replace the currently selected resolution. */ deleteResolution(id: string, replaceWith: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (replaceWith === undefined || replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' must be defined and cannot be null."); - else - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .param("replaceWith", replaceWith) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -26251,11 +25298,11 @@ export class Client { * @return Returned if the request is successful. */ getResolution(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -26301,11 +25348,11 @@ export class Client { * @return Returned if the request is successful. */ updateResolution(id: string, body: UpdateResolutionDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26375,8 +25422,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectRoles(): Promise { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); let options_: RequestInit = { method: "GET", @@ -26428,8 +25475,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectRole(body: CreateUpdateRoleRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); const content_ = JSON.stringify(body); @@ -26488,15 +25535,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRole(id: number, swap?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (swap === null) - throw new globalThis.Error("The parameter 'swap' cannot be null."); - else if (swap !== undefined) - url_ += "swap=" + encodeURIComponent("" + swap) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(swap, 'swap'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .param("swap", swap) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -26550,11 +25595,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleById(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -26604,11 +25649,11 @@ export class Client { * @return Returned if the request is successful. */ partialUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26666,11 +25711,11 @@ export class Client { * @return Returned if the request is successful. */ fullyUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26731,23 +25776,17 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRoleActorsFromRole(id: number, user?: string | undefined, groupId?: string | undefined, group?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(group, 'group'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .param("user", user) + .param("groupId", groupId) + .param("group", group) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -26801,11 +25840,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleActorsForRole(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -26859,11 +25898,11 @@ export class Client { * @return Returned if the request is successful. */ addProjectRoleActorsToRole(id: number, body: ActorInputBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -26929,32 +25968,21 @@ export class Client { * @return Returned if the request is successful. */ getScreens(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, scope?: Scope2[] | undefined, orderBy?: OrderBy13 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - scope && scope.forEach(item => { url_ += "scope=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(scope, 'scope'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .paramArray("scope", scope) + .param("orderBy", orderBy) + .toString(); let options_: RequestInit = { method: "GET", @@ -26999,8 +26027,8 @@ export class Client { * @return Returned if the request is successful. */ createScreen(body: ScreenDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .toString(); const content_ = JSON.stringify(body); @@ -27054,11 +26082,11 @@ export class Client { * @return Returned if the request is successful. */ addFieldToDefaultScreen(fieldId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}") + .path("fieldId", fieldId) + .toString(); let options_: RequestInit = { method: "POST", @@ -27116,24 +26144,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkScreenTabs(screenId?: number[] | undefined, tabId?: number[] | undefined, startAt?: number | undefined, maxResult?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/tabs?"; - if (screenId === null) - throw new globalThis.Error("The parameter 'screenId' cannot be null."); - else if (screenId !== undefined) - screenId && screenId.forEach(item => { url_ += "screenId=" + encodeURIComponent("" + item) + "&"; }); - if (tabId === null) - throw new globalThis.Error("The parameter 'tabId' cannot be null."); - else if (tabId !== undefined) - tabId && tabId.forEach(item => { url_ += "tabId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(screenId, 'screenId'); + Guard.notNull(tabId, 'tabId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/tabs") + .paramArray("screenId", screenId) + .paramArray("tabId", tabId) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); let options_: RequestInit = { method: "GET", @@ -27180,11 +26201,11 @@ export class Client { * @return Returned if the request is successful. */ deleteScreen(screenId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -27234,11 +26255,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreen(screenId: number, body: UpdateScreenDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -27296,11 +26317,11 @@ export class Client { * @return Returned if the request is successful. */ getAvailableScreenFields(screenId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields") + .path("screenId", screenId) + .toString(); let options_: RequestInit = { method: "GET", @@ -27358,15 +26379,13 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabs(screenId: number, projectKey?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .param("projectKey", projectKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -27427,11 +26446,11 @@ export class Client { * @return Returned if the request is successful. */ addScreenTab(screenId: number, body: ScreenableTab): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -27490,14 +26509,13 @@ export class Client { * @return Returned if the request is successful. */ deleteScreenTab(screenId: number, tabId: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -27544,14 +26562,13 @@ export class Client { * @return Returned if the request is successful. */ renameScreenTab(screenId: number, tabId: number, body: ScreenableTab): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -27611,18 +26628,15 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabFields(screenId: number, tabId: number, projectKey?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .param("projectKey", projectKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -27680,14 +26694,13 @@ export class Client { * @return Returned if the request is successful. */ addScreenTabField(screenId: number, tabId: number, body: AddFieldBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -27747,17 +26760,15 @@ export class Client { * @return Returned if the request is successful. */ removeScreenTabField(screenId: number, tabId: number, id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -27809,17 +26820,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTabField(screenId: number, tabId: number, id: string, body: MoveFieldBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -27880,17 +26889,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTab(screenId: number, tabId: number, pos: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (pos === undefined || pos === null) - throw new globalThis.Error("The parameter 'pos' must be defined."); - url_ = url_.replace("{pos}", encodeURIComponent("" + pos)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(pos, 'pos'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("pos", pos) + .toString(); let options_: RequestInit = { method: "POST", @@ -27953,32 +26960,21 @@ export class Client { * @return Returned if the request is successful. */ getScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy14 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .toString(); let options_: RequestInit = { method: "GET", @@ -28023,8 +27019,8 @@ export class Client { * @return Returned if the request is successful. */ createScreenScheme(body: ScreenSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -28082,11 +27078,11 @@ export class Client { * @return Returned if the screen scheme is deleted. */ deleteScreenScheme(screenSchemeId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -28137,11 +27133,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreenScheme(screenSchemeId: string, body: UpdateScreenSchemeDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -28244,44 +27240,27 @@ export class Client { * @deprecated */ searchForIssuesUsingJql(jql?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, validateQuery?: ValidateQuery | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/search?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (validateQuery === null) - throw new globalThis.Error("The parameter 'validateQuery' cannot be null."); - else if (validateQuery !== undefined) - url_ += "validateQuery=" + encodeURIComponent("" + validateQuery) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(validateQuery, 'validateQuery'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .param("jql", jql) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("validateQuery", validateQuery) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .toString(); let options_: RequestInit = { method: "GET", @@ -28328,8 +27307,8 @@ export class Client { * @deprecated */ searchForIssuesUsingJqlPost(body: SearchRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .toString(); const content_ = JSON.stringify(body); @@ -28379,8 +27358,8 @@ export class Client { * @return Returned if the request is successful. */ countIssues(body: JQLCountRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/approximate-count"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/approximate-count") + .toString(); const content_ = JSON.stringify(body); @@ -28431,8 +27410,8 @@ export class Client { * @deprecated */ searchForIssuesIds(body: IdSearchRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/id"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/id") + .toString(); const content_ = JSON.stringify(body); @@ -28525,44 +27504,27 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJql(jql?: string | undefined, nextPageToken?: string | undefined, maxResults?: number | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined, reconcileIssues?: number[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/jql?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - if (reconcileIssues === null) - throw new globalThis.Error("The parameter 'reconcileIssues' cannot be null."); - else if (reconcileIssues !== undefined) - reconcileIssues && reconcileIssues.forEach(item => { url_ += "reconcileIssues=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + Guard.notNull(reconcileIssues, 'reconcileIssues'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .param("jql", jql) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .paramArray("reconcileIssues", reconcileIssues) + .toString(); let options_: RequestInit = { method: "GET", @@ -28607,8 +27569,8 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJqlPost(body: SearchAndReconcileRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/search/jql"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .toString(); const content_ = JSON.stringify(body); @@ -28658,11 +27620,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevel(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/securitylevel/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/securitylevel/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -28707,8 +27669,8 @@ export class Client { * @return Returned if the request is successful. */ getServerInfo(): Promise { - let url_ = this.baseUrl + "/rest/api/3/serverInfo"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/serverInfo") + .toString(); let options_: RequestInit = { method: "GET", @@ -28749,8 +27711,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueNavigatorDefaultColumns(): Promise { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); let options_: RequestInit = { method: "GET", @@ -28810,14 +27772,12 @@ export class Client { * @return Returned if the request is successful. */ setIssueNavigatorDefaultColumns(body: ColumnRequestBody, columns?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_: RequestInit = { body: content_, @@ -28868,8 +27828,8 @@ export class Client { * @return Returned if the request is successful. */ getStatuses(): Promise { - let url_ = this.baseUrl + "/rest/api/3/status"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status") + .toString(); let options_: RequestInit = { method: "GET", @@ -28918,11 +27878,11 @@ export class Client { * @return Returned if the request is successful. */ getStatus(idOrName: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/status/{idOrName}"; - if (idOrName === undefined || idOrName === null) - throw new globalThis.Error("The parameter 'idOrName' must be defined."); - url_ = url_.replace("{idOrName}", encodeURIComponent("" + idOrName)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrName, 'idOrName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status/{idOrName}") + .path("idOrName", idOrName) + .toString(); let options_: RequestInit = { method: "GET", @@ -28967,8 +27927,8 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategories(): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuscategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory") + .toString(); let options_: RequestInit = { method: "GET", @@ -29017,11 +27977,11 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategory(idOrKey: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}"; - if (idOrKey === undefined || idOrKey === null) - throw new globalThis.Error("The parameter 'idOrKey' must be defined."); - url_ = url_.replace("{idOrKey}", encodeURIComponent("" + idOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrKey, 'idOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}") + .path("idOrKey", idOrKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -29069,12 +28029,11 @@ export class Client { * @return Returned if the request is successful. */ deleteStatusesById(id: string[]): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -29129,16 +28088,13 @@ export class Client { * @return Returned if the request is successful. */ getStatusesById(id: string[], expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -29191,8 +28147,8 @@ export class Client { * @return Returned if the request is successful. */ createStatuses(body: StatusCreateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -29253,8 +28209,8 @@ export class Client { * @return Returned if the request is successful. */ updateStatuses(body: StatusUpdateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -29319,32 +28275,21 @@ export class Client { * @return Returned if the request is successful. */ search(expand?: string | undefined, projectId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, searchString?: string | undefined, statusCategory?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/search?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (searchString === null) - throw new globalThis.Error("The parameter 'searchString' cannot be null."); - else if (searchString !== undefined) - url_ += "searchString=" + encodeURIComponent("" + searchString) + "&"; - if (statusCategory === null) - throw new globalThis.Error("The parameter 'statusCategory' cannot be null."); - else if (statusCategory !== undefined) - url_ += "statusCategory=" + encodeURIComponent("" + statusCategory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(searchString, 'searchString'); + Guard.notNull(statusCategory, 'statusCategory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/search") + .param("expand", expand) + .param("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("searchString", searchString) + .param("statusCategory", statusCategory) + .toString(); let options_: RequestInit = { method: "GET", @@ -29393,22 +28338,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueTypeUsagesForStatus(statusId: string, projectId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages") + .path("statusId", statusId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -29460,19 +28400,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -29524,19 +28460,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -29586,11 +28518,11 @@ export class Client { * @return Returned if the request is successful. */ getTask(taskId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}") + .path("taskId", taskId) + .toString(); let options_: RequestInit = { method: "GET", @@ -29640,11 +28572,11 @@ export class Client { * @return Returned if the request is successful. */ cancelTask(taskId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}/cancel"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}/cancel") + .path("taskId", taskId) + .toString(); let options_: RequestInit = { method: "POST", @@ -29744,20 +28676,15 @@ export class Client { * @return Returned if the request is successful. */ getUiModifications(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -29807,8 +28734,8 @@ export class Client { * @return Returned if the UI modification is created. */ createUiModification(body: CreateUiModificationDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .toString(); const content_ = JSON.stringify(body); @@ -29869,11 +28796,11 @@ export class Client { * @return Returned if the UI modification is deleted. */ deleteUiModification(uiModificationId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -29925,11 +28852,11 @@ export class Client { * @return Returned if the UI modification is updated. */ updateUiModification(uiModificationId: string, body: UpdateUiModificationDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); const content_ = JSON.stringify(body); @@ -29992,14 +28919,13 @@ export class Client { * @return Returned if the request is successful. */ getAvatars(type: Type3, entityId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .toString(); let options_: RequestInit = { method: "GET", @@ -30049,26 +28975,19 @@ export class Client { * @return Returned if the request is successful. */ storeAvatar(type: Type4, entityId: string, size: number, body: any, x?: number | undefined, y?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -30128,17 +29047,15 @@ export class Client { * @return Returned if the request is successful. */ deleteAvatar(type: Type5, owningObjectId: string, id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (owningObjectId === undefined || owningObjectId === null) - throw new globalThis.Error("The parameter 'owningObjectId' must be defined."); - url_ = url_.replace("{owningObjectId}", encodeURIComponent("" + owningObjectId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(owningObjectId, 'owningObjectId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}") + .path("type", type) + .path("owningObjectId", owningObjectId) + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -30186,19 +29103,15 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByType(type: Type6, size?: Size | undefined, format?: Format | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}") + .path("type", type) + .param("size", size) + .param("format", format) + .toString(); let options_: RequestInit = { method: "GET", @@ -30260,22 +29173,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByID(type: Type7, id: number, size?: Size2 | undefined, format?: Format2 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(id, 'id'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}") + .path("type", type) + .path("id", id) + .param("size", size) + .param("format", format) + .toString(); let options_: RequestInit = { method: "GET", @@ -30344,22 +29252,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByOwner(type: Type8, entityId: string, size?: Size3 | undefined, format?: Format3 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("format", format) + .toString(); let options_: RequestInit = { method: "GET", @@ -30427,20 +29330,15 @@ export class Client { * @return Returned if the request is successful. */ removeUser(accountId: string, username?: string | undefined, key?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -30496,24 +29394,17 @@ export class Client { * @return Returned if the request is successful. */ getUser(accountId?: string | undefined, username?: string | undefined, key?: string | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -30563,8 +29454,8 @@ export class Client { * @return Returned if the request is successful. */ createUser(body: NewUserDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/user"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .toString(); const content_ = JSON.stringify(body); @@ -30623,32 +29514,21 @@ export class Client { * @return Returned if the request is successful. */ findBulkAssignableUsers(projectKeys: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch?"; - if (projectKeys === undefined || projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' must be defined and cannot be null."); - else - url_ += "projectKeys=" + encodeURIComponent("" + projectKeys) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeys, 'projectKeys'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch") + .param("projectKeys", projectKeys) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -30719,52 +29599,31 @@ export class Client { * @return Returned if the request is successful. */ findAssignableUsers(query?: string | undefined, sessionId?: string | undefined, username?: string | undefined, accountId?: string | undefined, project?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, actionDescriptorId?: number | undefined, recommend?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (sessionId === null) - throw new globalThis.Error("The parameter 'sessionId' cannot be null."); - else if (sessionId !== undefined) - url_ += "sessionId=" + encodeURIComponent("" + sessionId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (project === null) - throw new globalThis.Error("The parameter 'project' cannot be null."); - else if (project !== undefined) - url_ += "project=" + encodeURIComponent("" + project) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (actionDescriptorId === null) - throw new globalThis.Error("The parameter 'actionDescriptorId' cannot be null."); - else if (actionDescriptorId !== undefined) - url_ += "actionDescriptorId=" + encodeURIComponent("" + actionDescriptorId) + "&"; - if (recommend === null) - throw new globalThis.Error("The parameter 'recommend' cannot be null."); - else if (recommend !== undefined) - url_ += "recommend=" + encodeURIComponent("" + recommend) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(sessionId, 'sessionId'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(project, 'project'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(actionDescriptorId, 'actionDescriptorId'); + Guard.notNull(recommend, 'recommend'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/search") + .param("query", query) + .param("sessionId", sessionId) + .param("username", username) + .param("accountId", accountId) + .param("project", project) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("actionDescriptorId", actionDescriptorId) + .param("recommend", recommend) + .toString(); let options_: RequestInit = { method: "GET", @@ -30829,28 +29688,19 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsers(accountId: string[], startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk") + .paramArray("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -30899,24 +29749,17 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsersMigration(startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/bulk/migration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk/migration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -30970,16 +29813,13 @@ export class Client { * @return Returned if the request is successful. */ resetUserColumns(accountId?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -31022,16 +29862,13 @@ export class Client { * @return Returned if the request is successful. */ getUserDefaultColumns(accountId?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); let options_: RequestInit = { method: "GET", @@ -31090,18 +29927,15 @@ export class Client { * @return Returned if the request is successful. */ setUserColumns(body: UserColumnRequestBody, accountId?: string | undefined, columns?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let options_: RequestInit = { body: content_, @@ -31162,12 +29996,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmail(accountId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/email?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email") + .param("accountId", accountId) + .toString(); let options_: RequestInit = { method: "GET", @@ -31221,12 +30054,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmailBulk(accountId: string[]): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/email/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email/bulk") + .paramArray("accountId", accountId) + .toString(); let options_: RequestInit = { method: "GET", @@ -31278,20 +30110,15 @@ export class Client { * @return Returned if the request is successful. */ getUserGroups(accountId: string, username?: string | undefined, key?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/groups?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/groups") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); let options_: RequestInit = { method: "GET", @@ -31349,15 +30176,13 @@ export class Client { * @return Returned if the request is successful. */ getUserNavProperty(propertyKey: string, accountId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); let options_: RequestInit = { method: "GET", @@ -31413,15 +30238,13 @@ export class Client { * @return Returned if the user property is updated/created. */ setUserNavProperty(propertyKey: string, body: any, accountId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); const content_ = JSON.stringify(body); @@ -31528,40 +30351,25 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithAllPermissions(permissions: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/permission/search?"; - if (permissions === undefined || permissions === null) - throw new globalThis.Error("The parameter 'permissions' must be defined and cannot be null."); - else - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(permissions, 'permissions'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/permission/search") + .param("permissions", permissions) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -31632,36 +30440,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersForPicker(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, exclude?: string[] | undefined, excludeAccountIds?: string[] | undefined, avatarSize?: string | undefined, excludeConnectUsers?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/picker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeAccountIds === null) - throw new globalThis.Error("The parameter 'excludeAccountIds' cannot be null."); - else if (excludeAccountIds !== undefined) - excludeAccountIds && excludeAccountIds.forEach(item => { url_ += "excludeAccountIds=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (excludeConnectUsers === null) - throw new globalThis.Error("The parameter 'excludeConnectUsers' cannot be null."); - else if (excludeConnectUsers !== undefined) - url_ += "excludeConnectUsers=" + encodeURIComponent("" + excludeConnectUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeAccountIds, 'excludeAccountIds'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(excludeConnectUsers, 'excludeConnectUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/picker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .paramArray("exclude", exclude) + .paramArray("excludeAccountIds", excludeAccountIds) + .param("avatarSize", avatarSize) + .param("excludeConnectUsers", excludeConnectUsers) + .toString(); let options_: RequestInit = { method: "GET", @@ -31713,20 +30508,15 @@ export class Client { * @return Returned if the request is successful. */ getUserPropertyKeys(accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties") + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_: RequestInit = { method: "GET", @@ -31783,23 +30573,17 @@ export class Client { * @return Returned if the user property is deleted. */ deleteUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -31852,23 +30636,17 @@ export class Client { * @return Returned if the request is successful. */ getUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let options_: RequestInit = { method: "GET", @@ -31926,23 +30704,17 @@ export class Client { * @return Returned if the user property is updated. */ setUserProperty(propertyKey: string, body: any, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); const content_ = JSON.stringify(body); @@ -32018,32 +30790,21 @@ export class Client { * @return Returned if the request is successful. */ findUsers(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, property?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (property === null) - throw new globalThis.Error("The parameter 'property' cannot be null."); - else if (property !== undefined) - url_ += "property=" + encodeURIComponent("" + property) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(property, 'property'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("property", property) + .toString(); let options_: RequestInit = { method: "GET", @@ -32102,20 +30863,15 @@ export class Client { * @return Returned if the request is successful. */ findUsersByQuery(query: string, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/search/query?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query") + .param("query", query) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -32183,20 +30939,15 @@ export class Client { * @return Returned if the request is successful. */ findUserKeysByQuery(query: string, startAt?: number | undefined, maxResult?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/search/query/key?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query/key") + .param("query", query) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); let options_: RequestInit = { method: "GET", @@ -32268,36 +31019,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithBrowsePermission(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/user/viewissue/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/viewissue/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -32359,16 +31097,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsersDefault(startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/users?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -32426,16 +31161,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsers(startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/users/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -32491,8 +31223,8 @@ export class Client { * @return Returned if the request is successful. */ createVersion(body: Version): Promise { - let url_ = this.baseUrl + "/rest/api/3/version"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version") + .toString(); const content_ = JSON.stringify(body); @@ -32549,19 +31281,15 @@ export class Client { * @deprecated */ deleteVersion(id: string, moveFixIssuesTo?: string | undefined, moveAffectedIssuesTo?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveFixIssuesTo === null) - throw new globalThis.Error("The parameter 'moveFixIssuesTo' cannot be null."); - else if (moveFixIssuesTo !== undefined) - url_ += "moveFixIssuesTo=" + encodeURIComponent("" + moveFixIssuesTo) + "&"; - if (moveAffectedIssuesTo === null) - throw new globalThis.Error("The parameter 'moveAffectedIssuesTo' cannot be null."); - else if (moveAffectedIssuesTo !== undefined) - url_ += "moveAffectedIssuesTo=" + encodeURIComponent("" + moveAffectedIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveFixIssuesTo, 'moveFixIssuesTo'); + Guard.notNull(moveAffectedIssuesTo, 'moveAffectedIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("moveFixIssuesTo", moveFixIssuesTo) + .param("moveAffectedIssuesTo", moveAffectedIssuesTo) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -32613,15 +31341,13 @@ export class Client { * @return Returned if the request is successful. */ getVersion(id: string, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -32667,11 +31393,11 @@ export class Client { * @return Returned if the request is successful. */ updateVersion(id: string, body: Version): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32726,14 +31452,13 @@ export class Client { * @return Returned if the version is deleted. */ mergeVersions(id: string, moveIssuesTo: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === undefined || moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' must be defined."); - url_ = url_.replace("{moveIssuesTo}", encodeURIComponent("" + moveIssuesTo)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}") + .path("id", id) + .path("moveIssuesTo", moveIssuesTo) + .toString(); let options_: RequestInit = { method: "PUT", @@ -32784,11 +31509,11 @@ export class Client { * @return Returned if the request is successful. */ moveVersion(id: string, body: VersionMoveBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/move"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/move") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32842,11 +31567,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionRelatedIssues(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -32892,11 +31617,11 @@ export class Client { * @return Returned if the request is successful. */ getRelatedWork(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -32952,11 +31677,11 @@ export class Client { * @return Returned if the request is successful. */ createRelatedWork(id: string, body: VersionRelatedWork): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -33014,11 +31739,11 @@ export class Client { * @return Returned if the request is successful together with updated related work. */ updateRelatedWork(id: string, body: VersionRelatedWork): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -33076,11 +31801,11 @@ export class Client { * @return Returned if the version is deleted. */ deleteAndReplaceVersion(id: string, body: DeleteAndReplaceVersionBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -33135,11 +31860,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionUnresolvedIssues(id: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -33186,14 +31911,13 @@ export class Client { * @return Returned if the related work is deleted. */ deleteRelatedWork(versionId: string, relatedWorkId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}"; - if (versionId === undefined || versionId === null) - throw new globalThis.Error("The parameter 'versionId' must be defined."); - url_ = url_.replace("{versionId}", encodeURIComponent("" + versionId)); - if (relatedWorkId === undefined || relatedWorkId === null) - throw new globalThis.Error("The parameter 'relatedWorkId' must be defined."); - url_ = url_.replace("{relatedWorkId}", encodeURIComponent("" + relatedWorkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(versionId, 'versionId'); + Guard.required(relatedWorkId, 'relatedWorkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}") + .path("versionId", versionId) + .path("relatedWorkId", relatedWorkId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -33242,8 +31966,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWebhookById(body: ContainerForWebhookIDs): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -33296,16 +32020,13 @@ export class Client { * @return Returned if the request is successful. */ getDynamicWebhooksForApp(startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -33356,8 +32077,8 @@ export class Client { * @return Returned if the request is successful. */ registerDynamicWebhooks(body: WebhookRegistrationDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -33414,16 +32135,13 @@ export class Client { * @return Returned if the request is successful. */ getFailedWebhooks(maxResults?: number | undefined, after?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook/failed?"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (after === null) - throw new globalThis.Error("The parameter 'after' cannot be null."); - else if (after !== undefined) - url_ += "after=" + encodeURIComponent("" + after) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(after, 'after'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/failed") + .param("maxResults", maxResults) + .param("after", after) + .toString(); let options_: RequestInit = { method: "GET", @@ -33474,8 +32192,8 @@ export class Client { * @return Returned if the request is successful. */ refreshWebhooks(body: ContainerForWebhookIDs): Promise { - let url_ = this.baseUrl + "/rest/api/3/webhook/refresh"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/refresh") + .toString(); const content_ = JSON.stringify(body); @@ -33532,12 +32250,11 @@ export class Client { * @deprecated */ getAllWorkflows(workflowName?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow?"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .param("workflowName", workflowName) + .toString(); let options_: RequestInit = { method: "GET", @@ -33587,8 +32304,8 @@ export class Client { * @deprecated */ createWorkflow(body: CreateWorkflowDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .toString(); const content_ = JSON.stringify(body); @@ -33653,40 +32370,25 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowTransitionRuleConfigurations(types: Types[], startAt?: number | undefined, maxResults?: number | undefined, keys?: string[] | undefined, workflowNames?: string[] | undefined, withTags?: string[] | undefined, draft?: boolean | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config?"; - if (types === undefined || types === null) - throw new globalThis.Error("The parameter 'types' must be defined and cannot be null."); - else - types && types.forEach(item => { url_ += "types=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (workflowNames === null) - throw new globalThis.Error("The parameter 'workflowNames' cannot be null."); - else if (workflowNames !== undefined) - workflowNames && workflowNames.forEach(item => { url_ += "workflowNames=" + encodeURIComponent("" + item) + "&"; }); - if (withTags === null) - throw new globalThis.Error("The parameter 'withTags' cannot be null."); - else if (withTags !== undefined) - withTags && withTags.forEach(item => { url_ += "withTags=" + encodeURIComponent("" + item) + "&"; }); - if (draft === null) - throw new globalThis.Error("The parameter 'draft' cannot be null."); - else if (draft !== undefined) - url_ += "draft=" + encodeURIComponent("" + draft) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(types, 'types'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(keys, 'keys'); + Guard.notNull(workflowNames, 'workflowNames'); + Guard.notNull(withTags, 'withTags'); + Guard.notNull(draft, 'draft'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .paramArray("types", types) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("keys", keys) + .paramArray("workflowNames", workflowNames) + .paramArray("withTags", withTags) + .param("draft", draft) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -33745,8 +32447,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowTransitionRuleConfigurations(body: WorkflowTransitionRulesUpdate): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .toString(); const content_ = JSON.stringify(body); @@ -33805,8 +32507,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowTransitionRuleConfigurations(body: WorkflowsWithTransitionRulesDetails): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config/delete") + .toString(); const content_ = JSON.stringify(body); @@ -33883,36 +32585,23 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowsPaginated(startAt?: number | undefined, maxResults?: number | undefined, workflowName?: string[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy15 | undefined, isActive?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - workflowName && workflowName.forEach(item => { url_ += "workflowName=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("workflowName", workflowName) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("isActive", isActive) + .toString(); let options_: RequestInit = { method: "GET", @@ -33964,23 +32653,17 @@ export class Client { * @return 200 response */ deleteWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, workflowMode?: WorkflowMode | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -34038,27 +32721,19 @@ export class Client { * @return 200 response */ getWorkflowTransitionProperties(transitionId: number, workflowName: string, includeReservedKeys?: boolean | undefined, key?: string | undefined, workflowMode?: WorkflowMode2 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (includeReservedKeys === null) - throw new globalThis.Error("The parameter 'includeReservedKeys' cannot be null."); - else if (includeReservedKeys !== undefined) - url_ += "includeReservedKeys=" + encodeURIComponent("" + includeReservedKeys) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(includeReservedKeys, 'includeReservedKeys'); + Guard.notNull(key, 'key'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("workflowName", workflowName) + .param("includeReservedKeys", includeReservedKeys) + .param("key", key) + .param("workflowMode", workflowMode) + .toString(); let options_: RequestInit = { method: "GET", @@ -34115,23 +32790,17 @@ export class Client { * @return 200 response */ createWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode3 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -34192,23 +32861,17 @@ export class Client { * @return 200 response */ updateWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode4 | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -34270,11 +32933,11 @@ export class Client { * @return Returned if the workflow is deleted. */ deleteInactiveWorkflow(entityId: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{entityId}"; - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{entityId}") + .path("entityId", entityId) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -34327,22 +32990,17 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowProjectIssueTypeUsages(workflowId: string, projectId: number, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages") + .path("workflowId", workflowId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -34394,19 +33052,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -34458,19 +33112,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -34526,16 +33176,13 @@ export class Client { * @return Returned if the request is successful. */ readWorkflows(body: WorkflowReadRequest, expand?: string | undefined, useApprovalConfiguration?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (useApprovalConfiguration === null) - throw new globalThis.Error("The parameter 'useApprovalConfiguration' cannot be null."); - else if (useApprovalConfiguration !== undefined) - url_ += "useApprovalConfiguration=" + encodeURIComponent("" + useApprovalConfiguration) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(useApprovalConfiguration, 'useApprovalConfiguration'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows") + .param("expand", expand) + .param("useApprovalConfiguration", useApprovalConfiguration) + .toString(); const content_ = JSON.stringify(body); @@ -34587,20 +33234,15 @@ export class Client { * @return Returned if the request is successful. */ workflowCapabilities(workflowId?: string | undefined, projectId?: string | undefined, issueTypeId?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/capabilities?"; - if (workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' cannot be null."); - else if (workflowId !== undefined) - url_ += "workflowId=" + encodeURIComponent("" + workflowId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowId, 'workflowId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/capabilities") + .param("workflowId", workflowId) + .param("projectId", projectId) + .param("issueTypeId", issueTypeId) + .toString(); let options_: RequestInit = { method: "GET", @@ -34645,8 +33287,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflows(body: WorkflowCreateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/create"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create") + .toString(); const content_ = JSON.stringify(body); @@ -34699,8 +33341,8 @@ export class Client { * @return Returned if the request is successful. */ validateCreateWorkflows(body: WorkflowCreateValidateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/create/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create/validation") + .toString(); const content_ = JSON.stringify(body); @@ -34762,36 +33404,23 @@ export class Client { * @return Returned if the request is successful. */ searchWorkflows(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: string | undefined, scope?: string | undefined, isActive?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - url_ += "scope=" + encodeURIComponent("" + scope) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(scope, 'scope'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("scope", scope) + .param("isActive", isActive) + .toString(); let options_: RequestInit = { method: "GET", @@ -34840,12 +33469,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflows(body: WorkflowUpdateRequest, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/update?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -34898,8 +33526,8 @@ export class Client { * @return Returned if the request is successful. */ validateUpdateWorkflows(body: WorkflowUpdateValidateRequestBean): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflows/update/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update/validation") + .toString(); const content_ = JSON.stringify(body); @@ -34950,16 +33578,13 @@ export class Client { * @return Returned if the request is successful. */ getAllWorkflowSchemes(startAt?: number | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -35004,8 +33629,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowScheme(body: WorkflowScheme): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .toString(); const content_ = JSON.stringify(body); @@ -35059,12 +33684,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeProjectAssociations(projectId: number[]): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .paramArray("projectId", projectId) + .toString(); let options_: RequestInit = { method: "GET", @@ -35113,8 +33737,8 @@ export class Client { * @return Returned if the request is successful. */ assignSchemeToProject(body: WorkflowSchemeProjectAssociation): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -35177,12 +33801,11 @@ export class Client { * @return Returned if the request is successful. */ readWorkflowSchemes(body: WorkflowSchemeReadRequest, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/read?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/read") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -35238,8 +33861,8 @@ export class Client { * @return Returned if the request is successful and there is no asynchronous task. */ updateSchemes(body: WorkflowSchemeUpdateRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update") + .toString(); const content_ = JSON.stringify(body); @@ -35300,8 +33923,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeMappings(body: WorkflowSchemeUpdateRequiredMappingsRequest): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -35351,11 +33974,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowScheme(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -35411,15 +34034,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowScheme(id: number, returnDraftIfExists?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: RequestInit = { method: "GET", @@ -35469,11 +34090,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowScheme(id: number, body: WorkflowScheme): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -35531,11 +34152,11 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowSchemeDraftFromParent(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft") + .path("id", id) + .toString(); let options_: RequestInit = { method: "POST", @@ -35586,15 +34207,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDefaultWorkflow(id: number, updateDraftIfNeeded?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -35649,15 +34268,13 @@ export class Client { * @return Returned if the request is successful. */ getDefaultWorkflow(id: number, returnDraftIfExists?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: RequestInit = { method: "GET", @@ -35708,11 +34325,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultWorkflow(id: number, body: DefaultWorkflow): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -35770,11 +34387,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraft(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -35820,11 +34437,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraft(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -35874,11 +34491,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeDraft(id: number, body: WorkflowScheme): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -35936,11 +34553,11 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftDefaultWorkflow(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -35990,11 +34607,11 @@ export class Client { * @return Returned if the request is successful. */ getDraftDefaultWorkflow(id: number): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); let options_: RequestInit = { method: "GET", @@ -36045,11 +34662,11 @@ export class Client { * @return Returned if the request is successful. */ updateDraftDefaultWorkflow(id: number, body: DefaultWorkflow): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -36108,14 +34725,13 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraftIssueType(id: number, issueType: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -36166,14 +34782,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraftIssueType(id: number, issueType: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); let options_: RequestInit = { method: "GET", @@ -36225,14 +34840,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeDraftIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -36292,15 +34906,13 @@ export class Client { * @return Returned if the request is only for validation and is successful. */ publishDraftWorkflowScheme(id: number, body: PublishDraftWorkflowScheme, validateOnly?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (validateOnly === null) - throw new globalThis.Error("The parameter 'validateOnly' cannot be null."); - else if (validateOnly !== undefined) - url_ += "validateOnly=" + encodeURIComponent("" + validateOnly) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(validateOnly, 'validateOnly'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish") + .path("id", id) + .param("validateOnly", validateOnly) + .toString(); const content_ = JSON.stringify(body); @@ -36362,15 +34974,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftWorkflowMapping(id: number, workflowName: string): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -36417,15 +35027,13 @@ export class Client { * @return Returned if the request is successful. */ getDraftWorkflow(id: number, workflowName?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); let options_: RequestInit = { method: "GET", @@ -36476,15 +35084,13 @@ export class Client { * @return Returned if the request is successful. */ updateDraftWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -36544,18 +35150,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeIssueType(id: number, issueType: string, updateDraftIfNeeded?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -36611,18 +35214,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeIssueType(id: number, issueType: string, returnDraftIfExists?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: RequestInit = { method: "GET", @@ -36674,14 +35274,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -36741,19 +35340,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowMapping(id: number, workflowName: string, updateDraftIfNeeded?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -36805,19 +35400,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflow(id: number, workflowName?: string | undefined, returnDraftIfExists?: boolean | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let options_: RequestInit = { method: "GET", @@ -36868,15 +35459,13 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -36936,19 +35525,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflowScheme(workflowSchemeId: string, nextPageToken?: string | undefined, maxResults?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages?"; - if (workflowSchemeId === undefined || workflowSchemeId === null) - throw new globalThis.Error("The parameter 'workflowSchemeId' must be defined."); - url_ = url_.replace("{workflowSchemeId}", encodeURIComponent("" + workflowSchemeId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowSchemeId, 'workflowSchemeId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages") + .path("workflowSchemeId", workflowSchemeId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let options_: RequestInit = { method: "GET", @@ -36998,12 +35583,11 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsDeletedSince(since?: number | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/worklog/deleted?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/deleted") + .param("since", since) + .toString(); let options_: RequestInit = { method: "GET", @@ -37046,12 +35630,11 @@ export class Client { * @return Returned if the request is successful. */ getWorklogsForIds(body: WorklogIdsRequestBean, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/worklog/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -37109,16 +35692,13 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsModifiedSince(since?: number | undefined, expand?: string | undefined): Promise { - let url_ = this.baseUrl + "/rest/api/3/worklog/updated?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/updated") + .param("since", since) + .param("expand", expand) + .toString(); let options_: RequestInit = { method: "GET", @@ -37160,11 +35740,11 @@ export class Client { * @return Returned if the request is successful. */ deleteForgeAppProperty(propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -37220,11 +35800,11 @@ export class Client { * @return Returned if the property is updated. */ putForgeAppProperty(propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -37299,11 +35879,11 @@ export class AddonPropertiesResource_getAddonPropertiesClient { * @return Returned if the request is successful. */ get(addonKey: string): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties") + .path("addonKey", addonKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -37360,14 +35940,13 @@ export class AddonPropertiesResource_deleteAddonPropertyClient { * @return Returned if the request is successful. */ delete(addonKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -37434,14 +36013,13 @@ export class AddonPropertiesResource_getAddonPropertyClient { * @return Returned if the request is successful. */ get(addonKey: string, propertyKey: string): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); let options_: RequestInit = { method: "GET", @@ -37512,14 +36090,13 @@ export class AddonPropertiesResource_putAddonPropertyClient { * @return Returned if the property is updated. */ put(addonKey: string, propertyKey: string, body: any): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -37595,12 +36172,11 @@ export class DynamicModulesResource_removeModulesClient { * @return Returned if the request is successful. */ delete(moduleKey?: string[] | undefined): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic?"; - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(moduleKey, 'moduleKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .paramArray("moduleKey", moduleKey) + .toString(); let options_: RequestInit = { method: "DELETE", @@ -37651,8 +36227,8 @@ export class DynamicModulesResource_getModulesClient { * @return Returned if the request is successful. */ get(): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); let options_: RequestInit = { method: "GET", @@ -37707,8 +36283,8 @@ export class DynamicModulesResource_registerModulesClient { * @return Returned if the request is successful. */ post(body: ConnectModules): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); const content_ = JSON.stringify(body); @@ -37771,8 +36347,8 @@ export class AppIssueFieldValueUpdateResource_updateIssueFieldsClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, body: ConnectCustomFieldValues): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/field") + .toString(); const content_ = JSON.stringify(body); @@ -37836,11 +36412,11 @@ export class MigrationResource_updateEntityPropertiesValueClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, entityType: EntityType, body: EntityPropertyDetails[]): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}"; - if (entityType === undefined || entityType === null) - throw new globalThis.Error("The parameter 'entityType' must be defined."); - url_ = url_.replace("{entityType}", encodeURIComponent("" + entityType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityType, 'entityType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}") + .path("entityType", entityType) + .toString(); const content_ = JSON.stringify(body); @@ -37898,8 +36474,8 @@ export class MigrationResource_workflowRuleSearchClient { * @return Returned if the request is successful. */ post(atlassian_Transfer_Id: string, body: WorkflowRulesSearch): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search") + .toString(); const content_ = JSON.stringify(body); @@ -37961,12 +36537,11 @@ export class ServiceRegistryResource_servicesClient { * @return Returned if the request is successful. */ get(serviceIds: string[]): Promise { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/service-registry?"; - if (serviceIds === undefined || serviceIds === null) - throw new globalThis.Error("The parameter 'serviceIds' must be defined and cannot be null."); - else - serviceIds && serviceIds.forEach(item => { url_ += "serviceIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(serviceIds, 'serviceIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/service-registry") + .paramArray("serviceIds", serviceIds) + .toString(); let options_: RequestInit = { method: "GET", @@ -96707,4 +95282,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_JQueryCallbacks.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_JQueryCallbacks.verified.txt index c309b9270..44dc4dd18 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_JQueryCallbacks.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_JQueryCallbacks.verified.txt @@ -18,8 +18,8 @@ export class Client { * @return Returned if the request is successful. */ getBanner(onSuccess?: (result: AnnouncementBannerConfiguration) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -88,8 +88,8 @@ export class Client { * @return Returned if the request is successful. */ setBanner(body: AnnouncementBannerConfigurationUpdate, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); const content_ = JSON.stringify(body); @@ -177,36 +177,23 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldsConfigurations(body: ConfigurationsListParameters, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanBulkContextualConfiguration) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/app/field/context/configuration/list?"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/context/configuration/list") + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -282,12 +269,11 @@ export class Client { * @return Returned if the request is successful. */ updateMultipleCustomFieldValues(body: MultipleCustomFieldValuesUpdateDetails, generateChangelog?: boolean | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/app/field/value?"; - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/value") + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -367,39 +353,25 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldConfiguration(fieldIdOrKey: string, id?: number[] | undefined, fieldContextId?: number[] | undefined, issueId?: number | undefined, projectKeyOrId?: string | undefined, issueTypeId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanContextualConfiguration) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -471,11 +443,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldConfiguration(fieldIdOrKey: string, body: CustomFieldConfigurations, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -553,15 +525,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldValue(fieldIdOrKey: string, body: CustomFieldValueUpdateDetails, generateChangelog?: boolean | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value") + .path("fieldIdOrKey", fieldIdOrKey) + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -636,20 +606,15 @@ export class Client { * @return Returned if the request is successful. */ getApplicationProperty(key?: string | undefined, permissionLevel?: string | undefined, keyFilter?: string | undefined, onSuccess?: (result: ApplicationProperty[]) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/application-properties?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (permissionLevel === null) - throw new globalThis.Error("The parameter 'permissionLevel' cannot be null."); - else if (permissionLevel !== undefined) - url_ += "permissionLevel=" + encodeURIComponent("" + permissionLevel) + "&"; - if (keyFilter === null) - throw new globalThis.Error("The parameter 'keyFilter' cannot be null."); - else if (keyFilter !== undefined) - url_ += "keyFilter=" + encodeURIComponent("" + keyFilter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + Guard.notNull(permissionLevel, 'permissionLevel'); + Guard.notNull(keyFilter, 'keyFilter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties") + .param("key", key) + .param("permissionLevel", permissionLevel) + .param("keyFilter", keyFilter) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -725,8 +690,8 @@ export class Client { * @return Returned if the request is successful. */ getAdvancedSettings(onSuccess?: (result: ApplicationProperty[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/application-properties/advanced-settings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/advanced-settings") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -797,11 +762,11 @@ export class Client { * @return Returned if the request is successful. */ setApplicationProperty(id: string, body: SimpleApplicationPropertyBean, onSuccess?: (result: ApplicationProperty) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/application-properties/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -888,8 +853,8 @@ export class Client { * @return Returned if the request is successful. */ getAllApplicationRoles(onSuccess?: (result: ApplicationRole[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/applicationrole"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -960,11 +925,11 @@ export class Client { * @return Returned if the request is successful. */ getApplicationRole(key: string, onSuccess?: (result: ApplicationRole) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/applicationrole/{key}"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined."); - url_ = url_.replace("{key}", encodeURIComponent("" + key)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole/{key}") + .path("key", key) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -1033,15 +998,13 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentContent(id: string, redirect?: boolean | undefined, onSuccess?: (result: any[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/attachment/content/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/content/{id}") + .path("id", id) + .param("redirect", redirect) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -1131,8 +1094,8 @@ export class Client { * @return Returned if the request is successful. */ getAttachmentMeta(onSuccess?: (result: AttachmentSettings) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/attachment/meta"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/meta") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -1196,27 +1159,19 @@ export class Client { * @return Returned if the request is successful when `redirect` is set to `false`. */ getAttachmentThumbnail(id: string, redirect?: boolean | undefined, fallbackToDefault?: boolean | undefined, width?: number | undefined, height?: number | undefined, onSuccess?: (result: any[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - if (fallbackToDefault === null) - throw new globalThis.Error("The parameter 'fallbackToDefault' cannot be null."); - else if (fallbackToDefault !== undefined) - url_ += "fallbackToDefault=" + encodeURIComponent("" + fallbackToDefault) + "&"; - if (width === null) - throw new globalThis.Error("The parameter 'width' cannot be null."); - else if (width !== undefined) - url_ += "width=" + encodeURIComponent("" + width) + "&"; - if (height === null) - throw new globalThis.Error("The parameter 'height' cannot be null."); - else if (height !== undefined) - url_ += "height=" + encodeURIComponent("" + height) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + Guard.notNull(fallbackToDefault, 'fallbackToDefault'); + Guard.notNull(width, 'width'); + Guard.notNull(height, 'height'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}") + .path("id", id) + .param("redirect", redirect) + .param("fallbackToDefault", fallbackToDefault) + .param("width", width) + .param("height", height) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -1299,11 +1254,11 @@ export class Client { * @return Returned if the request is successful. */ removeAttachment(id: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -1363,11 +1318,11 @@ export class Client { * @return Returned if the request is successful. */ getAttachment(id: string, onSuccess?: (result: AttachmentMetadata) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -1435,11 +1390,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForHumans(id: string, onSuccess?: (result: AttachmentArchiveMetadataReadable) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/human"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/human") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -1511,11 +1466,11 @@ export class Client { * @return Returned if the request is successful. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive. */ expandAttachmentForMachines(id: string, onSuccess?: (result: AttachmentArchiveImpl) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -1591,28 +1546,19 @@ export class Client { * @return Returned if the request is successful. */ getAuditRecords(offset?: number | undefined, limit?: number | undefined, filter?: string | undefined, from?: string | undefined, to?: string | undefined, onSuccess?: (result: AuditRecords) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/auditing/record?"; - if (offset === null) - throw new globalThis.Error("The parameter 'offset' cannot be null."); - else if (offset !== undefined) - url_ += "offset=" + encodeURIComponent("" + offset) + "&"; - if (limit === null) - throw new globalThis.Error("The parameter 'limit' cannot be null."); - else if (limit !== undefined) - url_ += "limit=" + encodeURIComponent("" + limit) + "&"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (from === null) - throw new globalThis.Error("The parameter 'from' cannot be null."); - else if (from !== undefined) - url_ += "from=" + encodeURIComponent("" + from) + "&"; - if (to === null) - throw new globalThis.Error("The parameter 'to' cannot be null."); - else if (to !== undefined) - url_ += "to=" + encodeURIComponent("" + to) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(offset, 'offset'); + Guard.notNull(limit, 'limit'); + Guard.notNull(filter, 'filter'); + Guard.notNull(from, 'from'); + Guard.notNull(to, 'to'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/auditing/record") + .param("offset", offset) + .param("limit", limit) + .param("filter", filter) + .param("from", from) + .param("to", to) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -1682,11 +1628,11 @@ export class Client { * @return Returned if the request is successful. */ getAllSystemAvatars(type: Type, onSuccess?: (result: SystemAvatars) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/avatar/{type}/system"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/avatar/{type}/system") + .path("type", type) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -1750,8 +1696,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkDelete(body: IssueBulkDeletePayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/delete") + .toString(); const content_ = JSON.stringify(body); @@ -1835,24 +1781,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkEditableFields(issueIdsOrKeys: string, searchText?: string | undefined, endingBefore?: string | undefined, startingAfter?: string | undefined, onSuccess?: (result: BulkEditGetFields) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (searchText === null) - throw new globalThis.Error("The parameter 'searchText' cannot be null."); - else if (searchText !== undefined) - url_ += "searchText=" + encodeURIComponent("" + searchText) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(searchText, 'searchText'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("searchText", searchText) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -1936,8 +1875,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkEdit(body: IssueBulkEditPayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .toString(); const content_ = JSON.stringify(body); @@ -2010,8 +1949,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkMove(body: IssueBulkMovePayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/move") + .toString(); const content_ = JSON.stringify(body); @@ -2087,20 +2026,15 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTransitions(issueIdsOrKeys: string, endingBefore?: string | undefined, startingAfter?: string | undefined, onSuccess?: (result: BulkTransitionGetAvailableTransitions) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -2177,8 +2111,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkTransition(body: IssueBulkTransitionPayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .toString(); const content_ = JSON.stringify(body); @@ -2259,8 +2193,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkUnwatch(body: IssueBulkWatchOrUnwatchPayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/unwatch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/unwatch") + .toString(); const content_ = JSON.stringify(body); @@ -2341,8 +2275,8 @@ export class Client { * @return Returned if the request is successful. */ submitBulkWatch(body: IssueBulkWatchOrUnwatchPayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/watch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/watch") + .toString(); const content_ = JSON.stringify(body); @@ -2423,11 +2357,11 @@ export class Client { * @return Returned if the request is successful. */ getBulkOperationProgress(taskId: string, onSuccess?: (result: BulkOperationProgress) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/bulk/queue/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/queue/{taskId}") + .path("taskId", taskId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -2497,8 +2431,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkChangelogs(body: BulkChangelogRequestBean, onSuccess?: (result: BulkChangelogResponseBean) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/changelog/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/changelog/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -2563,16 +2497,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUserDataClassificationLevels(status?: Status2[] | undefined, orderBy?: OrderBy | undefined, onSuccess?: (result: DataClassificationLevelsBean) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/classification-levels?"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(status, 'status'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/classification-levels") + .paramArray("status", status) + .param("orderBy", orderBy) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -2636,12 +2567,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentsByIds(body: IssueCommentListRequestBean, expand?: string | undefined, onSuccess?: (result: PageBeanComment) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/comment/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -2705,11 +2635,11 @@ export class Client { * @return Returned if the request is successful. */ getCommentPropertyKeys(commentId: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties") + .path("commentId", commentId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -2782,14 +2712,13 @@ export class Client { * @return Returned if the request is successful. */ deleteCommentProperty(commentId: string, propertyKey: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -2858,14 +2787,13 @@ export class Client { * @return Returned if the request is successful. */ getCommentProperty(commentId: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -2939,14 +2867,13 @@ export class Client { * @return Returned if the comment property is updated. */ setCommentProperty(commentId: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -3038,28 +2965,19 @@ export class Client { * @return Returned if the request is successful. */ findComponentsForProjects(projectIdsOrKeys?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy2 | undefined, query?: string | undefined, onSuccess?: (result: PageBean2ComponentJsonBean) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/component?"; - if (projectIdsOrKeys === null) - throw new globalThis.Error("The parameter 'projectIdsOrKeys' cannot be null."); - else if (projectIdsOrKeys !== undefined) - projectIdsOrKeys && projectIdsOrKeys.forEach(item => { url_ += "projectIdsOrKeys=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIdsOrKeys, 'projectIdsOrKeys'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .paramArray("projectIdsOrKeys", projectIdsOrKeys) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -3122,8 +3040,8 @@ export class Client { * @return Returned if the request is successful. */ createComponent(body: ProjectComponent, onSuccess?: (result: ProjectComponent) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/component"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .toString(); const content_ = JSON.stringify(body); @@ -3200,15 +3118,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComponent(id: string, moveIssuesTo?: string | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/component/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' cannot be null."); - else if (moveIssuesTo !== undefined) - url_ += "moveIssuesTo=" + encodeURIComponent("" + moveIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .param("moveIssuesTo", moveIssuesTo) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -3272,11 +3188,11 @@ export class Client { * @return Returned if the request is successful. */ getComponent(id: string, onSuccess?: (result: ProjectComponent) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -3340,11 +3256,11 @@ export class Client { * @return Returned if the request is successful. */ updateComponent(id: string, body: ProjectComponent, onSuccess?: (result: ProjectComponent) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -3420,11 +3336,11 @@ export class Client { * @return Returned if the request is successful. */ getComponentRelatedIssues(id: string, onSuccess?: (result: ComponentIssuesCount) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -3487,8 +3403,8 @@ export class Client { * @return Returned if the request is successful. */ getConfiguration(onSuccess?: (result: Configuration) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/configuration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -3547,8 +3463,8 @@ export class Client { * @return Returned if the request is successful and time tracking is enabled. */ getSelectedTimeTrackingImplementation(onSuccess?: (result: TimeTrackingProvider) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -3619,8 +3535,8 @@ export class Client { * @return Returned if the request is successful. */ selectTimeTrackingImplementation(body: TimeTrackingProvider, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); const content_ = JSON.stringify(body); @@ -3692,8 +3608,8 @@ export class Client { * @return Returned if the request is successful. */ getAvailableTimeTrackingImplementations(onSuccess?: (result: TimeTrackingProvider[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/list"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/list") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -3763,8 +3679,8 @@ export class Client { * @return Returned if the request is successful. */ getSharedTimeTrackingConfiguration(onSuccess?: (result: TimeTrackingConfiguration) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -3827,8 +3743,8 @@ export class Client { * @return Returned if the request is successful. */ setSharedTimeTrackingConfiguration(body: TimeTrackingConfiguration, onSuccess?: (result: TimeTrackingConfiguration) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); const content_ = JSON.stringify(body); @@ -3900,11 +3816,11 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldOption(id: string, onSuccess?: (result: CustomFieldOption) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/customFieldOption/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/customFieldOption/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -3973,20 +3889,15 @@ export class Client { * @return Returned if the request is successful. */ getAllDashboards(filter?: Filter2 | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageOfDashboards) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filter, 'filter'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("filter", filter) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -4057,12 +3968,11 @@ export class Client { * @return Returned if the request is successful. */ createDashboard(body: DashboardDetails, extendAdminPermissions?: boolean | undefined, onSuccess?: (result: Dashboard) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -4136,8 +4046,8 @@ export class Client { * @return Returned if the request is successful. */ bulkEditDashboards(body: BulkEditShareableEntityRequest, onSuccess?: (result: BulkEditShareableEntityResponse) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/bulk/edit"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/bulk/edit") + .toString(); const content_ = JSON.stringify(body); @@ -4210,8 +4120,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAvailableDashboardGadgets(onSuccess?: (result: AvailableDashboardGadgetsResponse) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/gadgets"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/gadgets") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -4307,52 +4217,31 @@ export class Client { * @return Returned if the request is successful. */ getDashboardsPaginated(dashboardName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, orderBy?: OrderBy3 | undefined, startAt?: number | undefined, maxResults?: number | undefined, status?: Status3 | undefined, expand?: string | undefined, onSuccess?: (result: PageBeanDashboard) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/search?"; - if (dashboardName === null) - throw new globalThis.Error("The parameter 'dashboardName' cannot be null."); - else if (dashboardName !== undefined) - url_ += "dashboardName=" + encodeURIComponent("" + dashboardName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(dashboardName, 'dashboardName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/search") + .param("dashboardName", dashboardName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("status", status) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -4425,23 +4314,17 @@ export class Client { * @return Returned if the request is successful. */ getAllGadgets(dashboardId: number, moduleKey?: string[] | undefined, uri?: string[] | undefined, gadgetId?: number[] | undefined, onSuccess?: (result: DashboardGadgetResponse) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget?"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - if (uri === null) - throw new globalThis.Error("The parameter 'uri' cannot be null."); - else if (uri !== undefined) - uri && uri.forEach(item => { url_ += "uri=" + encodeURIComponent("" + item) + "&"; }); - if (gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' cannot be null."); - else if (gadgetId !== undefined) - gadgetId && gadgetId.forEach(item => { url_ += "gadgetId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.notNull(moduleKey, 'moduleKey'); + Guard.notNull(uri, 'uri'); + Guard.notNull(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .paramArray("moduleKey", moduleKey) + .paramArray("uri", uri) + .paramArray("gadgetId", gadgetId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -4508,11 +4391,11 @@ export class Client { * @return Returned if the request is successful. */ addGadget(dashboardId: number, body: DashboardGadgetSettings, onSuccess?: (result: DashboardGadget) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .toString(); const content_ = JSON.stringify(body); @@ -4591,14 +4474,13 @@ export class Client { * @return Returned if the request is successful. */ removeGadget(dashboardId: number, gadgetId: number, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -4667,14 +4549,13 @@ export class Client { * @return Returned if the request is successful. */ updateGadget(dashboardId: number, gadgetId: number, body: DashboardGadgetUpdateRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); const content_ = JSON.stringify(body); @@ -4754,14 +4635,13 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemPropertyKeys(dashboardId: string, itemId: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -4833,17 +4713,15 @@ export class Client { * @return Returned if the dashboard item property is deleted. */ deleteDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -4930,17 +4808,15 @@ export class Client { * @return Returned if the request is successful. */ getDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -5013,17 +4889,15 @@ export class Client { * @return Returned if the dashboard item property is updated. */ setDashboardItemProperty(dashboardId: string, itemId: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -5120,11 +4994,11 @@ export class Client { * @return Returned if the dashboard is deleted. */ deleteDashboard(id: string, onSuccess?: () => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -5190,11 +5064,11 @@ export class Client { * @return Returned if the request is successful. */ getDashboard(id: string, onSuccess?: (result: Dashboard) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -5270,15 +5144,13 @@ export class Client { * @return Returned if the request is successful. */ updateDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined, onSuccess?: (result: Dashboard) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -5360,15 +5232,13 @@ export class Client { * @return Returned if the request is successful. */ copyDashboard(id: string, body: DashboardDetails, extendAdminPermissions?: boolean | undefined, onSuccess?: (result: Dashboard) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}/copy?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}/copy") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -5448,8 +5318,8 @@ export class Client { * @return Returned if the request is successful */ getPolicy(onSuccess?: (result: WorkspaceDataPolicy) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/data-policy"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -5519,12 +5389,11 @@ export class Client { * @return Returned if the request is successful. */ getPolicies(ids?: string | undefined, onSuccess?: (result: ProjectDataPolicies) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/data-policy/project?"; - if (ids === null) - throw new globalThis.Error("The parameter 'ids' cannot be null."); - else if (ids !== undefined) - url_ += "ids=" + encodeURIComponent("" + ids) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(ids, 'ids'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy/project") + .param("ids", ids) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -5600,8 +5469,8 @@ export class Client { * @return Returned if the request is successful. */ getEvents(onSuccess?: (result: IssueEvent[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/events"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/events") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -5677,12 +5546,11 @@ export class Client { * @return Returned if the request is successful. */ analyseExpression(body: JiraExpressionForAnalysis, check?: Check | undefined, onSuccess?: (result: JiraExpressionsAnalysis) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/expression/analyse?"; - if (check === null) - throw new globalThis.Error("The parameter 'check' cannot be null."); - else if (check !== undefined) - url_ += "check=" + encodeURIComponent("" + check) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(check, 'check'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/analyse") + .param("check", check) + .toString(); const content_ = JSON.stringify(body); @@ -5762,12 +5630,11 @@ export class Client { * @deprecated */ evaluateJiraExpression(body: JiraExpressionEvalRequestBean, expand?: string | undefined, onSuccess?: (result: JiraExpressionResult) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/expression/eval?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/eval") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -5846,12 +5713,11 @@ export class Client { * @return Returned if the evaluation results in a value. The result is a JSON primitive value, list, or object. */ evaluateJSISJiraExpression(body: JiraExpressionEvaluateRequestBean, expand?: string | undefined, onSuccess?: (result: JExpEvaluateJiraExpressionResultBean) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/expression/evaluate?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/evaluate") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -5928,8 +5794,8 @@ export class Client { * @return Returned if the request is successful. */ getFields(onSuccess?: (result: FieldDetails[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -5996,8 +5862,8 @@ export class Client { * @return Returned if the custom field is created. */ createCustomField(body: CustomFieldDefinitionJsonBean, onSuccess?: (result: FieldDetails) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); const content_ = JSON.stringify(body); @@ -6061,8 +5927,8 @@ export class Client { * @return Returned if the field association validation passes. */ removeAssociations(body: FieldAssociationsRequest, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -6135,8 +6001,8 @@ export class Client { * @return Returned if the field association validation passes. */ createAssociations(body: FieldAssociationsRequest, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -6229,40 +6095,25 @@ export class Client { * @return Returned if the request is successful. */ getFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, type?: Type2[] | undefined, id?: string[] | undefined, query?: string | undefined, orderBy?: OrderBy4 | undefined, expand?: string | undefined, projectIds?: number[] | undefined, onSuccess?: (result: PageBeanField) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (type === null) - throw new globalThis.Error("The parameter 'type' cannot be null."); - else if (type !== undefined) - type && type.forEach(item => { url_ += "type=" + encodeURIComponent("" + item) + "&"; }); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(type, 'type'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectIds, 'projectIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("type", type) + .paramArray("id", id) + .param("query", query) + .param("orderBy", orderBy) + .param("expand", expand) + .paramArray("projectIds", projectIds) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -6345,32 +6196,21 @@ export class Client { * @return Returned if the request is successful. */ getTrashedFieldsPaginated(startAt?: number | undefined, maxResults?: number | undefined, id?: string[] | undefined, query?: string | undefined, expand?: Expand | undefined, orderBy?: string | undefined, onSuccess?: (result: PageBeanField) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/search/trashed?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(expand, 'expand'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search/trashed") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("query", query) + .param("expand", expand) + .param("orderBy", orderBy) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -6445,11 +6285,11 @@ export class Client { * @return Returned if the request is successful. */ updateCustomField(fieldId: string, body: UpdateCustomFieldDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -6531,31 +6371,21 @@ export class Client { * @return Returned if the request is successful. */ getContextsForField(fieldId: string, isAnyIssueType?: boolean | undefined, isGlobalContext?: boolean | undefined, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanCustomFieldContext) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (isAnyIssueType === null) - throw new globalThis.Error("The parameter 'isAnyIssueType' cannot be null."); - else if (isAnyIssueType !== undefined) - url_ += "isAnyIssueType=" + encodeURIComponent("" + isAnyIssueType) + "&"; - if (isGlobalContext === null) - throw new globalThis.Error("The parameter 'isGlobalContext' cannot be null."); - else if (isGlobalContext !== undefined) - url_ += "isGlobalContext=" + encodeURIComponent("" + isGlobalContext) + "&"; - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(isAnyIssueType, 'isAnyIssueType'); + Guard.notNull(isGlobalContext, 'isGlobalContext'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .param("isAnyIssueType", isAnyIssueType) + .param("isGlobalContext", isGlobalContext) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -6623,11 +6453,11 @@ export class Client { * @return Returned if the custom field context is created. */ createCustomFieldContext(fieldId: string, body: CreateCustomFieldContext, onSuccess?: (result: CreateCustomFieldContext) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -6706,23 +6536,17 @@ export class Client { * @return Returned if the request is successful. */ getDefaultValues(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanCustomFieldContextDefaultValue) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -6790,11 +6614,11 @@ export class Client { * @return Returned if operation is successful. */ setDefaultValues(fieldId: string, body: CustomFieldContextDefaultValueUpdate, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -6874,23 +6698,17 @@ export class Client { * @return Returned if operation is successful. */ getIssueTypeMappingsForContexts(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanIssueTypeToContextMapping) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -6957,19 +6775,15 @@ export class Client { * @return Returned if the request is successful. */ getCustomFieldContextsForProjectsAndIssueTypes(fieldId: string, body: ProjectIssueTypeMappings, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanContextForProjectAndIssueType) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -7048,23 +6862,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectContextMapping(fieldId: string, contextId?: number[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanCustomFieldContextProjectMapping) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -7133,14 +6941,13 @@ export class Client { * @return Returned if the context is deleted. */ deleteCustomFieldContext(fieldId: string, contextId: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -7214,14 +7021,13 @@ export class Client { * @return Returned if the context is updated. */ updateCustomFieldContext(fieldId: string, contextId: number, body: CustomFieldContextUpdateDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7299,14 +7105,13 @@ export class Client { * @return Returned if operation is successful. */ addIssueTypesToContext(fieldId: string, contextId: number, body: IssueTypeIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7388,14 +7193,13 @@ export class Client { * @return Returned if operation is successful. */ removeIssueTypesFromContext(fieldId: string, contextId: number, body: IssueTypeIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7477,30 +7281,21 @@ export class Client { * @return Returned if the request is successful. */ getOptionsForContext(fieldId: string, contextId: number, optionId?: number | undefined, onlyOptions?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanCustomFieldContextOption) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === null) - throw new globalThis.Error("The parameter 'optionId' cannot be null."); - else if (optionId !== undefined) - url_ += "optionId=" + encodeURIComponent("" + optionId) + "&"; - if (onlyOptions === null) - throw new globalThis.Error("The parameter 'onlyOptions' cannot be null."); - else if (onlyOptions !== undefined) - url_ += "onlyOptions=" + encodeURIComponent("" + onlyOptions) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(optionId, 'optionId'); + Guard.notNull(onlyOptions, 'onlyOptions'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .param("optionId", optionId) + .param("onlyOptions", onlyOptions) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -7573,14 +7368,13 @@ export class Client { * @return Returned if the request is successful. */ createCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionCreateRequest, onSuccess?: (result: CustomFieldCreatedContextOptionsList) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7657,14 +7451,13 @@ export class Client { * @return Returned if the request is successful. */ updateCustomFieldOption(fieldId: string, contextId: number, body: BulkCustomFieldOptionUpdateRequest, onSuccess?: (result: CustomFieldUpdatedContextOptionsList) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7741,14 +7534,13 @@ export class Client { * @return Returned if options are reordered. */ reorderCustomFieldOptions(fieldId: string, contextId: number, body: OrderOfCustomFieldOptions, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7827,17 +7619,15 @@ export class Client { * @return Returned if the option is deleted. */ deleteCustomFieldOption(fieldId: string, contextId: number, optionId: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .path("optionId", optionId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -7908,25 +7698,19 @@ export class Client { * @param jql (optional) A JQL query that specifies the issues to be updated. For example, *project=10000*. */ replaceCustomFieldOption(fieldId: string, optionId: number, contextId: number, replaceWith?: number | undefined, jql?: string | undefined, onSuccess?: () => void, onFail?: (exception: TaskProgressBeanRemoveOptionFromIssuesResult | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(optionId, 'optionId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue") + .path("fieldId", fieldId) + .path("optionId", optionId) + .path("contextId", contextId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -7994,14 +7778,13 @@ export class Client { * @return Returned if operation is successful. */ assignProjectsToCustomFieldContext(fieldId: string, contextId: number, body: ProjectIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -8079,14 +7862,13 @@ export class Client { * @return Returned if the custom field context is removed from the projects. */ removeCustomFieldContextFromProjects(fieldId: string, contextId: number, body: ProjectIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -8166,19 +7948,15 @@ export class Client { * @deprecated */ getContextsForFieldDeprecated(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanContext) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/contexts?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/contexts") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -8245,23 +8023,17 @@ export class Client { * @return Returned if the request is successful. */ getScreensForField(fieldId: string, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, onSuccess?: (result: PageBeanScreenWithTab) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/screens?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/screens") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -8330,19 +8102,15 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanIssueFieldOption) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -8409,11 +8177,11 @@ export class Client { * @return Returned if the request is successful. */ createIssueFieldOption(fieldKey: string, body: IssueFieldOptionCreateBean, onSuccess?: (result: IssueFieldOption) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .toString(); const content_ = JSON.stringify(body); @@ -8491,23 +8259,17 @@ export class Client { * @return Returned if the request is successful. */ getSelectableIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined, onSuccess?: (result: PageBeanIssueFieldOption) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -8577,23 +8339,17 @@ export class Client { * @return Returned if the request is successful. */ getVisibleIssueFieldOptions(fieldKey: string, startAt?: number | undefined, maxResults?: number | undefined, projectId?: number | undefined, onSuccess?: (result: PageBeanIssueFieldOption) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -8661,14 +8417,13 @@ export class Client { * @return Returned if the field option is deleted. */ deleteIssueFieldOption(fieldKey: string, optionId: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -8741,14 +8496,13 @@ export class Client { * @return Returned if the requested option is returned. */ getIssueFieldOption(fieldKey: string, optionId: number, onSuccess?: (result: IssueFieldOption) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -8820,14 +8574,13 @@ export class Client { * @return Returned if the option is updated or created. */ updateIssueFieldOption(fieldKey: string, optionId: number, body: IssueFieldOption, onSuccess?: (result: IssueFieldOption) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); const content_ = JSON.stringify(body); @@ -8906,30 +8659,21 @@ export class Client { * @param overrideEditableFlag (optional) Whether screen security is overridden to enable uneditable fields to be edited. Available to Connect and Forge app users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). */ replaceIssueFieldOption(fieldKey: string, optionId: number, replaceWith?: number | undefined, jql?: string | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined, onSuccess?: () => void, onFail?: (exception: TaskProgressBeanRemoveOptionFromIssuesResult | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -8995,11 +8739,11 @@ export class Client { * @param id The ID of a custom field. */ deleteCustomField(id: string, onSuccess?: () => void, onFail?: (exception: TaskProgressBeanObject | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -9089,11 +8833,11 @@ export class Client { * @return Returned if the request is successful. */ restoreCustomField(id: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/restore"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/restore") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -9178,11 +8922,11 @@ export class Client { * @return Returned if the request is successful. */ trashCustomField(id: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/trash"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/trash") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -9271,28 +9015,19 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurations(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, isDefault?: boolean | undefined, query?: string | undefined, onSuccess?: (result: PageBeanFieldConfigurationDetails) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (isDefault === null) - throw new globalThis.Error("The parameter 'isDefault' cannot be null."); - else if (isDefault !== undefined) - url_ += "isDefault=" + encodeURIComponent("" + isDefault) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(isDefault, 'isDefault'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("isDefault", isDefault) + .param("query", query) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -9355,8 +9090,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfiguration(body: FieldConfigurationDetails, onSuccess?: (result: FieldConfiguration) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .toString(); const content_ = JSON.stringify(body); @@ -9428,11 +9163,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfiguration(id: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -9505,11 +9240,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfiguration(id: number, body: FieldConfigurationDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9588,19 +9323,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationItems(id: number, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanFieldConfigurationItem) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -9668,11 +9399,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationItems(id: number, body: FieldConfigurationItemsDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9751,20 +9482,15 @@ export class Client { * @return Returned if the request is successful. */ getAllFieldConfigurationSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, onSuccess?: (result: PageBeanFieldConfigurationScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -9832,8 +9558,8 @@ export class Client { * @return Returned if the request is successful. */ createFieldConfigurationScheme(body: UpdateFieldConfigurationSchemeDetails, onSuccess?: (result: FieldConfigurationScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -9907,20 +9633,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, fieldConfigurationSchemeId?: number[] | undefined, onSuccess?: (result: PageBeanFieldConfigurationIssueTypeItem) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fieldConfigurationSchemeId === null) - throw new globalThis.Error("The parameter 'fieldConfigurationSchemeId' cannot be null."); - else if (fieldConfigurationSchemeId !== undefined) - fieldConfigurationSchemeId && fieldConfigurationSchemeId.forEach(item => { url_ += "fieldConfigurationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fieldConfigurationSchemeId, 'fieldConfigurationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("fieldConfigurationSchemeId", fieldConfigurationSchemeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -9994,20 +9715,15 @@ export class Client { * @return Returned if the request is successful. */ getFieldConfigurationSchemeProjectMapping(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanFieldConfigurationSchemeProjects) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -10074,8 +9790,8 @@ export class Client { * @return Returned if the request is successful. */ assignFieldConfigurationSchemeToProject(body: FieldConfigurationSchemeProjectAssociation, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -10152,11 +9868,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFieldConfigurationScheme(id: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -10230,11 +9946,11 @@ export class Client { * @return Returned if the request is successful. */ updateFieldConfigurationScheme(id: number, body: UpdateFieldConfigurationSchemeDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -10311,11 +10027,11 @@ export class Client { * @return Returned if the request is successful. */ setFieldConfigurationSchemeMapping(id: number, body: AssociateFieldConfigurationsWithIssueTypesRequest, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -10393,11 +10109,11 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypesFromGlobalFieldConfigurationScheme(id: number, body: IssueTypeIdsToRemove, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -10491,16 +10207,13 @@ export class Client { * @return Returned if the request is successful. */ createFilter(body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, onSuccess?: (result: Filter) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter") + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -10567,8 +10280,8 @@ export class Client { * @return Returned if the request is successful. */ getDefaultShareScope(onSuccess?: (result: DefaultShareScope) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -10627,8 +10340,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultShareScope(body: DefaultShareScope, onSuccess?: (result: DefaultShareScope) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); const content_ = JSON.stringify(body); @@ -10699,12 +10412,11 @@ export class Client { * @return Returned if the request is successful. */ getFavouriteFilters(expand?: string | undefined, onSuccess?: (result: Filter[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/favourite?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/favourite") + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -10775,16 +10487,13 @@ export class Client { * @return Returned if the request is successful. */ getMyFilters(expand?: string | undefined, includeFavourites?: boolean | undefined, onSuccess?: (result: Filter[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/my?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (includeFavourites === null) - throw new globalThis.Error("The parameter 'includeFavourites' cannot be null."); - else if (includeFavourites !== undefined) - url_ += "includeFavourites=" + encodeURIComponent("" + includeFavourites) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(includeFavourites, 'includeFavourites'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/my") + .param("expand", expand) + .param("includeFavourites", includeFavourites) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -10884,60 +10593,35 @@ export class Client { * @return Returned if the request is successful. */ getFiltersPaginated(filterName?: string | undefined, accountId?: string | undefined, owner?: string | undefined, groupname?: string | undefined, groupId?: string | undefined, projectId?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy5 | undefined, startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, isSubstringMatch?: boolean | undefined, onSuccess?: (result: PageBeanFilterDetails) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/search?"; - if (filterName === null) - throw new globalThis.Error("The parameter 'filterName' cannot be null."); - else if (filterName !== undefined) - url_ += "filterName=" + encodeURIComponent("" + filterName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - if (isSubstringMatch === null) - throw new globalThis.Error("The parameter 'isSubstringMatch' cannot be null."); - else if (isSubstringMatch !== undefined) - url_ += "isSubstringMatch=" + encodeURIComponent("" + isSubstringMatch) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filterName, 'filterName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + Guard.notNull(isSubstringMatch, 'isSubstringMatch'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/search") + .param("filterName", filterName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .param("isSubstringMatch", isSubstringMatch) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -11004,11 +10688,11 @@ export class Client { * @return Returned if the request is successful. */ deleteFilter(id: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -11073,19 +10757,15 @@ export class Client { * @return Returned if the request is successful. */ getFilter(id: number, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, onSuccess?: (result: Filter) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -11155,19 +10835,15 @@ export class Client { * @return Returned if the request is successful. */ updateFilter(id: number, body: Filter, expand?: string | undefined, overrideSharePermissions?: boolean | undefined, onSuccess?: (result: Filter) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -11235,11 +10911,11 @@ export class Client { * @return Returned if the request is successful. */ resetColumns(id: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -11299,11 +10975,11 @@ export class Client { * @return Returned if the request is successful. */ getColumns(id: number, onSuccess?: (result: ColumnItem[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -11380,17 +11056,15 @@ export class Client { * @return Returned if the request is successful. */ setColumns(id: number, body: ColumnRequestBody, columns?: string[] | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let jqXhr = jQuery.ajax({ url: url_, @@ -11462,15 +11136,13 @@ export class Client { * @return Returned if the request is successful. */ deleteFavouriteForFilter(id: number, expand?: string | undefined, onSuccess?: (result: Filter) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -11534,15 +11206,13 @@ export class Client { * @return Returned if the request is successful. */ setFavouriteForFilter(id: number, expand?: string | undefined, onSuccess?: (result: Filter) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -11603,11 +11273,11 @@ export class Client { * @return Returned if the request is successful. */ changeFilterOwner(id: number, body: ChangeFilterOwner, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/owner"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/owner") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -11680,11 +11350,11 @@ export class Client { * @return Returned if the request is successful. */ getSharePermissions(id: number, onSuccess?: (result: SharePermission[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -11755,11 +11425,11 @@ export class Client { * @return Returned if the request is successful. */ addSharePermission(id: number, body: SharePermissionInputBean, onSuccess?: (result: SharePermission[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -11839,14 +11509,13 @@ export class Client { * @return Returned if the request is successful. */ deleteSharePermission(id: number, permissionId: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -11907,14 +11576,13 @@ export class Client { * @return Returned if the request is successful. */ getSharePermission(id: number, permissionId: number, onSuccess?: (result: SharePermission) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -11982,24 +11650,17 @@ export class Client { * @return Returned if the request is successful. */ removeGroup(groupname?: string | undefined, groupId?: string | undefined, swapGroup?: string | undefined, swapGroupId?: string | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (swapGroup === null) - throw new globalThis.Error("The parameter 'swapGroup' cannot be null."); - else if (swapGroup !== undefined) - url_ += "swapGroup=" + encodeURIComponent("" + swapGroup) + "&"; - if (swapGroupId === null) - throw new globalThis.Error("The parameter 'swapGroupId' cannot be null."); - else if (swapGroupId !== undefined) - url_ += "swapGroupId=" + encodeURIComponent("" + swapGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(swapGroup, 'swapGroup'); + Guard.notNull(swapGroupId, 'swapGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("swapGroup", swapGroup) + .param("swapGroupId", swapGroupId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -12071,20 +11732,15 @@ export class Client { * @deprecated */ getGroup(groupname?: string | undefined, groupId?: string | undefined, expand?: string | undefined, onSuccess?: (result: Group) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -12156,8 +11812,8 @@ export class Client { * @return Returned if the request is successful. */ createGroup(body: AddGroupBean, onSuccess?: (result: Group) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/group"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .toString(); const content_ = JSON.stringify(body); @@ -12234,32 +11890,21 @@ export class Client { * @return Returned if the request is successful. */ bulkGetGroups(startAt?: number | undefined, maxResults?: number | undefined, groupId?: string[] | undefined, groupName?: string[] | undefined, accessType?: string | undefined, applicationKey?: string | undefined, onSuccess?: (result: PageBeanGroupDetails) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/group/bulk?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - groupId && groupId.forEach(item => { url_ += "groupId=" + encodeURIComponent("" + item) + "&"; }); - if (groupName === null) - throw new globalThis.Error("The parameter 'groupName' cannot be null."); - else if (groupName !== undefined) - groupName && groupName.forEach(item => { url_ += "groupName=" + encodeURIComponent("" + item) + "&"; }); - if (accessType === null) - throw new globalThis.Error("The parameter 'accessType' cannot be null."); - else if (accessType !== undefined) - url_ += "accessType=" + encodeURIComponent("" + accessType) + "&"; - if (applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' cannot be null."); - else if (applicationKey !== undefined) - url_ += "applicationKey=" + encodeURIComponent("" + applicationKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(groupName, 'groupName'); + Guard.notNull(accessType, 'accessType'); + Guard.notNull(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/bulk") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("groupId", groupId) + .paramArray("groupName", groupName) + .param("accessType", accessType) + .param("applicationKey", applicationKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -12336,28 +11981,19 @@ export class Client { * @return Returned if the request is successful. */ getUsersFromGroup(groupname?: string | undefined, groupId?: string | undefined, includeInactiveUsers?: boolean | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanUserDetails) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/group/member?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (includeInactiveUsers === null) - throw new globalThis.Error("The parameter 'includeInactiveUsers' cannot be null."); - else if (includeInactiveUsers !== undefined) - url_ += "includeInactiveUsers=" + encodeURIComponent("" + includeInactiveUsers) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(includeInactiveUsers, 'includeInactiveUsers'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/member") + .param("groupname", groupname) + .param("groupId", groupId) + .param("includeInactiveUsers", includeInactiveUsers) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -12433,24 +12069,17 @@ export class Client { * @return Returned if the request is successful. */ removeUserFromGroup(accountId: string, groupname?: string | undefined, groupId?: string | undefined, username?: string | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("accountId", accountId) + .param("groupname", groupname) + .param("groupId", groupId) + .param("username", username) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -12521,16 +12150,13 @@ export class Client { * @return Returned if the request is successful. */ addUserToGroup(body: UpdateUserToGroupBean, groupname?: string | undefined, groupId?: string | undefined, onSuccess?: (result: Group) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("groupname", groupname) + .param("groupId", groupId) + .toString(); const content_ = JSON.stringify(body); @@ -12617,36 +12243,23 @@ export class Client { * @return Returned if the request is successful. */ findGroups(accountId?: string | undefined, query?: string | undefined, exclude?: string[] | undefined, excludeId?: string[] | undefined, maxResults?: number | undefined, caseInsensitive?: boolean | undefined, userName?: string | undefined, onSuccess?: (result: FoundGroups) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/groups/picker?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeId === null) - throw new globalThis.Error("The parameter 'excludeId' cannot be null."); - else if (excludeId !== undefined) - excludeId && excludeId.forEach(item => { url_ += "excludeId=" + encodeURIComponent("" + item) + "&"; }); - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (userName === null) - throw new globalThis.Error("The parameter 'userName' cannot be null."); - else if (userName !== undefined) - url_ += "userName=" + encodeURIComponent("" + userName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeId, 'excludeId'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(userName, 'userName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groups/picker") + .param("accountId", accountId) + .param("query", query) + .paramArray("exclude", exclude) + .paramArray("excludeId", excludeId) + .param("maxResults", maxResults) + .param("caseInsensitive", caseInsensitive) + .param("userName", userName) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -12710,44 +12323,27 @@ export class Client { * @return Returned if the request is successful. */ findUsersAndGroups(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, fieldId?: string | undefined, projectId?: string[] | undefined, issueTypeId?: string[] | undefined, avatarSize?: AvatarSize | undefined, caseInsensitive?: boolean | undefined, excludeConnectAddons?: boolean | undefined, onSuccess?: (result: FoundUsersAndGroups) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/groupuserpicker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' cannot be null."); - else if (fieldId !== undefined) - url_ += "fieldId=" + encodeURIComponent("" + fieldId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - issueTypeId && issueTypeId.forEach(item => { url_ += "issueTypeId=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(fieldId, 'fieldId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groupuserpicker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .param("fieldId", fieldId) + .paramArray("projectId", projectId) + .paramArray("issueTypeId", issueTypeId) + .param("avatarSize", avatarSize) + .param("caseInsensitive", caseInsensitive) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -12818,8 +12414,8 @@ export class Client { * @return Returned if the request is successful. */ getLicense(onSuccess?: (result: License) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/instance/license"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/instance/license") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -12879,12 +12475,11 @@ export class Client { * @return Returned if the request is successful. */ createIssue(body: IssueUpdateDetails, updateHistory?: boolean | undefined, onSuccess?: (result: CreatedIssue) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue?"; - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(updateHistory, 'updateHistory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue") + .param("updateHistory", updateHistory) + .toString(); const content_ = JSON.stringify(body); @@ -12972,8 +12567,8 @@ export class Client { * @return Returns the URL to check the status of the submitted request. */ archiveIssues(body: ArchiveIssueAsyncRequest, onSuccess?: (result: string) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -13050,8 +12645,8 @@ export class Client { * @return Returned if there is at least one valid issue to archive in the request. The return message will include the count of archived issues and subtasks, as well as error details for issues which failed to get archived. */ archiveIssues(body: IssueArchivalSyncRequest, onSuccess?: (result: IssueArchivalSyncResponse) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -13134,8 +12729,8 @@ export class Client { * is invalid for any other reason. */ createIssues(body: IssuesUpdateBean, onSuccess?: (result: CreatedIssues) => void, onFail?: (exception: CreatedIssues | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/bulk"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulk") + .toString(); const content_ = JSON.stringify(body); @@ -13206,8 +12801,8 @@ export class Client { * @return Returned if the request is successful. A response may contain both successful issues and issue errors. */ bulkFetchIssues(body: BulkFetchIssueRequestBean, onSuccess?: (result: BulkIssueResults) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -13280,28 +12875,19 @@ export class Client { * @deprecated */ getCreateIssueMeta(projectIds?: string[] | undefined, projectKeys?: string[] | undefined, issuetypeIds?: string[] | undefined, issuetypeNames?: string[] | undefined, expand?: string | undefined, onSuccess?: (result: IssueCreateMetadata) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta?"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - if (projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' cannot be null."); - else if (projectKeys !== undefined) - projectKeys && projectKeys.forEach(item => { url_ += "projectKeys=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeIds === null) - throw new globalThis.Error("The parameter 'issuetypeIds' cannot be null."); - else if (issuetypeIds !== undefined) - issuetypeIds && issuetypeIds.forEach(item => { url_ += "issuetypeIds=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeNames === null) - throw new globalThis.Error("The parameter 'issuetypeNames' cannot be null."); - else if (issuetypeNames !== undefined) - issuetypeNames && issuetypeNames.forEach(item => { url_ += "issuetypeNames=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIds, 'projectIds'); + Guard.notNull(projectKeys, 'projectKeys'); + Guard.notNull(issuetypeIds, 'issuetypeIds'); + Guard.notNull(issuetypeNames, 'issuetypeNames'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta") + .paramArray("projectIds", projectIds) + .paramArray("projectKeys", projectKeys) + .paramArray("issuetypeIds", issuetypeIds) + .paramArray("issuetypeNames", issuetypeNames) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -13363,19 +12949,15 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypes(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageOfCreateMetaIssueTypes) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -13442,22 +13024,17 @@ export class Client { * @return Returned if the request is successful. */ getCreateIssueMetaIssueTypeId(projectIdOrKey: string, issueTypeId: string, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageOfCreateMetaIssueTypeWithField) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}") + .path("projectIdOrKey", projectIdOrKey) + .path("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -13523,12 +13100,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLimitReport(isReturningKeys?: boolean | undefined, onSuccess?: (result: IssueLimitReportResponseBean) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/limit/report?"; - if (isReturningKeys === null) - throw new globalThis.Error("The parameter 'isReturningKeys' cannot be null."); - else if (isReturningKeys !== undefined) - url_ += "isReturningKeys=" + encodeURIComponent("" + isReturningKeys) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(isReturningKeys, 'isReturningKeys'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/limit/report") + .param("isReturningKeys", isReturningKeys) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -13597,32 +13173,21 @@ export class Client { * @return Returned if the request is successful. */ getIssuePickerResource(query?: string | undefined, currentJQL?: string | undefined, currentIssueKey?: string | undefined, currentProjectId?: string | undefined, showSubTasks?: boolean | undefined, showSubTaskParent?: boolean | undefined, onSuccess?: (result: IssuePickerSuggestions) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/picker?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (currentJQL === null) - throw new globalThis.Error("The parameter 'currentJQL' cannot be null."); - else if (currentJQL !== undefined) - url_ += "currentJQL=" + encodeURIComponent("" + currentJQL) + "&"; - if (currentIssueKey === null) - throw new globalThis.Error("The parameter 'currentIssueKey' cannot be null."); - else if (currentIssueKey !== undefined) - url_ += "currentIssueKey=" + encodeURIComponent("" + currentIssueKey) + "&"; - if (currentProjectId === null) - throw new globalThis.Error("The parameter 'currentProjectId' cannot be null."); - else if (currentProjectId !== undefined) - url_ += "currentProjectId=" + encodeURIComponent("" + currentProjectId) + "&"; - if (showSubTasks === null) - throw new globalThis.Error("The parameter 'showSubTasks' cannot be null."); - else if (showSubTasks !== undefined) - url_ += "showSubTasks=" + encodeURIComponent("" + showSubTasks) + "&"; - if (showSubTaskParent === null) - throw new globalThis.Error("The parameter 'showSubTaskParent' cannot be null."); - else if (showSubTaskParent !== undefined) - url_ += "showSubTaskParent=" + encodeURIComponent("" + showSubTaskParent) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(currentJQL, 'currentJQL'); + Guard.notNull(currentIssueKey, 'currentIssueKey'); + Guard.notNull(currentProjectId, 'currentProjectId'); + Guard.notNull(showSubTasks, 'showSubTasks'); + Guard.notNull(showSubTaskParent, 'showSubTaskParent'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/picker") + .param("query", query) + .param("currentJQL", currentJQL) + .param("currentIssueKey", currentIssueKey) + .param("currentProjectId", currentProjectId) + .param("showSubTasks", showSubTasks) + .param("showSubTaskParent", showSubTaskParent) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -13681,8 +13246,8 @@ export class Client { * @param body Issue properties to be set or updated with values. */ bulkSetIssuesPropertiesList(body: IssueEntityProperties, onSuccess?: () => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/properties"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties") + .toString(); const content_ = JSON.stringify(body); @@ -13751,8 +13316,8 @@ export class Client { * @param body Details of the issue properties to be set or updated. Note that if an issue is not found, it is ignored. */ bulkSetIssuePropertiesByIssue(body: MultiIssueEntityProperties, onSuccess?: () => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/multi"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/multi") + .toString(); const content_ = JSON.stringify(body); @@ -13828,11 +13393,11 @@ export class Client { * @param propertyKey The key of the property. */ bulkDeleteIssueProperty(propertyKey: string, body: IssueFilterForBulkPropertyDelete, onSuccess?: () => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -13901,11 +13466,11 @@ export class Client { * @param propertyKey The key of the property. The maximum length is 255 characters. */ bulkSetIssueProperty(propertyKey: string, body: BulkIssuePropertyUpdateRequest, onSuccess?: () => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -13975,8 +13540,8 @@ export class Client { * @return Returned if there is at least one valid issue to unarchive in the request. It will return the count of unarchived issues, which also includes the count of the subtasks unarchived, and it will show the detailed errors for those issues which are not unarchived. */ unarchiveIssues(body: IssueArchivalSyncRequest, onSuccess?: (result: IssueArchivalSyncResponse) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/unarchive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/unarchive") + .toString(); const content_ = JSON.stringify(body); @@ -14052,8 +13617,8 @@ export class Client { * @return Returned if the request is successful */ getIsWatchingIssueBulk(body: IssueList, onSuccess?: (result: BulkIssueIsWatching) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/watching"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/watching") + .toString(); const content_ = JSON.stringify(body); @@ -14118,15 +13683,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssue(issueIdOrKey: string, deleteSubtasks?: DeleteSubtasks | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (deleteSubtasks === null) - throw new globalThis.Error("The parameter 'deleteSubtasks' cannot be null."); - else if (deleteSubtasks !== undefined) - url_ += "deleteSubtasks=" + encodeURIComponent("" + deleteSubtasks) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(deleteSubtasks, 'deleteSubtasks'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("deleteSubtasks", deleteSubtasks) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -14233,35 +13796,23 @@ export class Client { * @return Returned if the request is successful. */ getIssue(issueIdOrKey: string, fields?: string[] | undefined, fieldsByKeys?: boolean | undefined, expand?: string | undefined, properties?: string[] | undefined, updateHistory?: boolean | undefined, failFast?: boolean | undefined, onSuccess?: (result: IssueBean) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(fields, 'fields'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(updateHistory, 'updateHistory'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .paramArray("fields", fields) + .param("fieldsByKeys", fieldsByKeys) + .param("expand", expand) + .paramArray("properties", properties) + .param("updateHistory", updateHistory) + .param("failFast", failFast) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -14330,31 +13881,21 @@ export class Client { * @return Returned if the request is successful and the `returnIssue` parameter is `true` */ editIssue(issueIdOrKey: string, body: IssueUpdateDetails, notifyUsers?: boolean | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined, returnIssue?: boolean | undefined, expand?: string | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (returnIssue === null) - throw new globalThis.Error("The parameter 'returnIssue' cannot be null."); - else if (returnIssue !== undefined) - url_ += "returnIssue=" + encodeURIComponent("" + returnIssue) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(returnIssue, 'returnIssue'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .param("returnIssue", returnIssue) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -14448,11 +13989,11 @@ export class Client { * @return Returned if the request is successful. */ assignIssue(issueIdOrKey: string, body: User, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -14525,11 +14066,11 @@ export class Client { * @return Returned if the request is successful. */ addAttachment(issueIdOrKey: string, body: Blob, onSuccess?: (result: Attachment[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = body; @@ -14610,19 +14151,15 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogs(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanChangelog) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -14682,11 +14219,11 @@ export class Client { * @return Returned if the request is successful. */ getChangeLogsByIds(issueIdOrKey: string, body: IssueChangelogIds, onSuccess?: (result: PageOfChangelogs) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -14758,27 +14295,19 @@ export class Client { * @return Returned if the request is successful. */ getComments(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy6 | undefined, expand?: string | undefined, onSuccess?: (result: PageOfComments) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -14847,15 +14376,13 @@ export class Client { * @return Returned if the request is successful. */ addComment(issueIdOrKey: string, body: Comment, expand?: string | undefined, onSuccess?: (result: Comment) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -14932,14 +14459,13 @@ export class Client { * @return Returned if the request is successful. */ deleteComment(issueIdOrKey: string, id: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -15009,18 +14535,15 @@ export class Client { * @return Returned if the request is successful. */ getComment(issueIdOrKey: string, id: string, expand?: string | undefined, onSuccess?: (result: Comment) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -15088,26 +14611,19 @@ export class Client { * @return Returned if the request is successful. */ updateComment(issueIdOrKey: string, id: string, body: Comment, notifyUsers?: boolean | undefined, overrideEditableFlag?: boolean | undefined, expand?: string | undefined, onSuccess?: (result: Comment) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("overrideEditableFlag", overrideEditableFlag) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -15181,19 +14697,15 @@ export class Client { * @return Returned if the request is successful. */ getEditIssueMeta(issueIdOrKey: string, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined, onSuccess?: (result: IssueUpdateMetadata) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta") + .path("issueIdOrKey", issueIdOrKey) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -15262,11 +14774,11 @@ export class Client { * @return Returned if the email is queued for sending. */ notify(issueIdOrKey: string, body: Notification, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -15339,11 +14851,11 @@ export class Client { * @return Returned if the request is successful. */ getIssuePropertyKeys(issueIdOrKey: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -15404,14 +14916,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueProperty(issueIdOrKey: string, propertyKey: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -15472,14 +14983,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueProperty(issueIdOrKey: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -15545,14 +15055,13 @@ export class Client { * @return Returned if the issue property is updated. */ setIssueProperty(issueIdOrKey: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -15638,15 +15147,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkByGlobalId(issueIdOrKey: string, globalId: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === undefined || globalId === null) - throw new globalThis.Error("The parameter 'globalId' must be defined and cannot be null."); - else - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -15715,15 +15222,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinks(issueIdOrKey: string, globalId?: string | undefined, onSuccess?: (result: RemoteIssueLink) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === null) - throw new globalThis.Error("The parameter 'globalId' cannot be null."); - else if (globalId !== undefined) - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -15799,11 +15304,11 @@ export class Client { * @return Returned if the remote issue link is updated. */ createOrUpdateRemoteIssueLink(issueIdOrKey: string, body: RemoteIssueLinkRequest, onSuccess?: (result: RemoteIssueLinkIdentifies) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -15887,14 +15392,13 @@ export class Client { * @return Returned if the request is successful. */ deleteRemoteIssueLinkById(issueIdOrKey: string, linkId: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -15963,14 +15467,13 @@ export class Client { * @return Returned if the request is successful. */ getRemoteIssueLinkById(issueIdOrKey: string, linkId: string, onSuccess?: (result: RemoteIssueLink) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -16043,14 +15546,13 @@ export class Client { * @return Returned if the request is successful. */ updateRemoteIssueLink(issueIdOrKey: string, linkId: string, body: RemoteIssueLinkRequest, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); const content_ = JSON.stringify(body); @@ -16132,31 +15634,21 @@ export class Client { * @return Returned if the request is successful. */ getTransitions(issueIdOrKey: string, expand?: string | undefined, transitionId?: string | undefined, skipRemoteOnlyCondition?: boolean | undefined, includeUnavailableTransitions?: boolean | undefined, sortByOpsBarAndStatus?: boolean | undefined, onSuccess?: (result: Transitions) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' cannot be null."); - else if (transitionId !== undefined) - url_ += "transitionId=" + encodeURIComponent("" + transitionId) + "&"; - if (skipRemoteOnlyCondition === null) - throw new globalThis.Error("The parameter 'skipRemoteOnlyCondition' cannot be null."); - else if (skipRemoteOnlyCondition !== undefined) - url_ += "skipRemoteOnlyCondition=" + encodeURIComponent("" + skipRemoteOnlyCondition) + "&"; - if (includeUnavailableTransitions === null) - throw new globalThis.Error("The parameter 'includeUnavailableTransitions' cannot be null."); - else if (includeUnavailableTransitions !== undefined) - url_ += "includeUnavailableTransitions=" + encodeURIComponent("" + includeUnavailableTransitions) + "&"; - if (sortByOpsBarAndStatus === null) - throw new globalThis.Error("The parameter 'sortByOpsBarAndStatus' cannot be null."); - else if (sortByOpsBarAndStatus !== undefined) - url_ += "sortByOpsBarAndStatus=" + encodeURIComponent("" + sortByOpsBarAndStatus) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(transitionId, 'transitionId'); + Guard.notNull(skipRemoteOnlyCondition, 'skipRemoteOnlyCondition'); + Guard.notNull(includeUnavailableTransitions, 'includeUnavailableTransitions'); + Guard.notNull(sortByOpsBarAndStatus, 'sortByOpsBarAndStatus'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .param("transitionId", transitionId) + .param("skipRemoteOnlyCondition", skipRemoteOnlyCondition) + .param("includeUnavailableTransitions", includeUnavailableTransitions) + .param("sortByOpsBarAndStatus", sortByOpsBarAndStatus) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -16220,11 +15712,11 @@ export class Client { * @return Returned if the request is successful. */ doTransition(issueIdOrKey: string, body: IssueUpdateDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -16309,11 +15801,11 @@ export class Client { * @return Returned if the request is successful. */ removeVote(issueIdOrKey: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -16373,11 +15865,11 @@ export class Client { * @return Returned if the request is successful. */ getVotes(issueIdOrKey: string, onSuccess?: (result: Votes) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -16441,11 +15933,11 @@ export class Client { * @return Returned if the request is successful. */ addVote(issueIdOrKey: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -16516,19 +16008,15 @@ export class Client { * @return Returned if the request is successful. */ removeWatcher(issueIdOrKey: string, username?: string | undefined, accountId?: string | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .param("username", username) + .param("accountId", accountId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -16596,11 +16084,11 @@ export class Client { * @return Returned if the request is successful */ getIssueWatchers(issueIdOrKey: string, onSuccess?: (result: Watchers) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -16665,11 +16153,11 @@ export class Client { * @return Returned if the request is successful. */ addWatcher(issueIdOrKey: string, body: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -16752,19 +16240,15 @@ export class Client { * @return Returned if the bulk deletion request was partially successful, with a message indicating partial success. */ bulkDeleteWorklogs(issueIdOrKey: string, body: WorklogIdsRequestBean, adjustEstimate?: AdjustEstimate | undefined, overrideEditableFlag?: boolean | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -16841,31 +16325,21 @@ export class Client { * @return Returned if the request is successful */ getIssueWorklog(issueIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, startedAfter?: number | undefined, startedBefore?: number | undefined, expand?: string | undefined, onSuccess?: (result: PageOfWorklogs) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (startedAfter === null) - throw new globalThis.Error("The parameter 'startedAfter' cannot be null."); - else if (startedAfter !== undefined) - url_ += "startedAfter=" + encodeURIComponent("" + startedAfter) + "&"; - if (startedBefore === null) - throw new globalThis.Error("The parameter 'startedBefore' cannot be null."); - else if (startedBefore !== undefined) - url_ += "startedBefore=" + encodeURIComponent("" + startedBefore) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(startedAfter, 'startedAfter'); + Guard.notNull(startedBefore, 'startedBefore'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("startedAfter", startedAfter) + .param("startedBefore", startedBefore) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -16940,35 +16414,23 @@ export class Client { * @return Returned if the request is successful. */ addWorklog(issueIdOrKey: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate2 | undefined, newEstimate?: string | undefined, reduceBy?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined, onSuccess?: (result: Worklog) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (reduceBy === null) - throw new globalThis.Error("The parameter 'reduceBy' cannot be null."); - else if (reduceBy !== undefined) - url_ += "reduceBy=" + encodeURIComponent("" + reduceBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(reduceBy, 'reduceBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("reduceBy", reduceBy) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -17049,19 +16511,15 @@ export class Client { * @return Returned if the request is partially successful. */ bulkMoveWorklogs(issueIdOrKey: string, body: WorklogsMoveRequestBean, adjustEstimate?: AdjustEstimate3 | undefined, overrideEditableFlag?: boolean | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -17144,34 +16602,23 @@ export class Client { * @return Returned if the request is successful. */ deleteWorklog(issueIdOrKey: string, id: string, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate4 | undefined, newEstimate?: string | undefined, increaseBy?: string | undefined, overrideEditableFlag?: boolean | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (increaseBy === null) - throw new globalThis.Error("The parameter 'increaseBy' cannot be null."); - else if (increaseBy !== undefined) - url_ += "increaseBy=" + encodeURIComponent("" + increaseBy) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(increaseBy, 'increaseBy'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("increaseBy", increaseBy) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -17239,18 +16686,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklog(issueIdOrKey: string, id: string, expand?: string | undefined, onSuccess?: (result: Worklog) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -17324,34 +16768,23 @@ export class Client { * @return Returned if the request is successful */ updateWorklog(issueIdOrKey: string, id: string, body: Worklog, notifyUsers?: boolean | undefined, adjustEstimate?: AdjustEstimate5 | undefined, newEstimate?: string | undefined, expand?: string | undefined, overrideEditableFlag?: boolean | undefined, onSuccess?: (result: Worklog) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -17424,14 +16857,13 @@ export class Client { * @return Returned if the request is successful. */ getWorklogPropertyKeys(issueIdOrKey: string, worklogId: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -17501,17 +16933,15 @@ export class Client { * @return Returned if the worklog property is removed. */ deleteWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -17581,17 +17011,15 @@ export class Client { * @return Returned if the request is successful. */ getWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -17662,17 +17090,15 @@ export class Client { * @return Returned if the worklog property is updated. */ setWorklogProperty(issueIdOrKey: string, worklogId: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -17757,8 +17183,8 @@ export class Client { * @return Returned if the request is successful. */ linkIssues(body: LinkIssueRequestJsonBean, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issueLink"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink") + .toString(); const content_ = JSON.stringify(body); @@ -17835,11 +17261,11 @@ export class Client { * @return 200 response */ deleteIssueLink(linkId: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -17907,11 +17333,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLink(linkId: string, onSuccess?: (result: IssueLink) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -17978,8 +17404,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkTypes(onSuccess?: (result: IssueLinkTypes) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -18042,8 +17468,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueLinkType(body: IssueLinkType, onSuccess?: (result: IssueLinkType) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); const content_ = JSON.stringify(body); @@ -18115,11 +17541,11 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueLinkType(issueLinkTypeId: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -18183,11 +17609,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueLinkType(issueLinkTypeId: string, onSuccess?: (result: IssueLinkType) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -18255,11 +17681,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueLinkType(issueLinkTypeId: string, body: IssueLinkType, onSuccess?: (result: IssueLinkType) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); const content_ = JSON.stringify(body); @@ -18331,8 +17757,8 @@ export class Client { * @return Returns the details of your export task. You can use the [get task](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/#api-rest-api-3-task-taskid-get) API to view the progress of your request. */ exportArchivedIssues(body: ArchivedIssuesFilterRequest, onSuccess?: (result: ExportArchivedIssuesTaskProgressResponse) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issues/archive/export"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issues/archive/export") + .toString(); const content_ = JSON.stringify(body); @@ -18407,8 +17833,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecuritySchemes(onSuccess?: (result: SecuritySchemes) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -18471,8 +17897,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueSecurityScheme(body: CreateIssueSecuritySchemeDetails, onSuccess?: (result: SecuritySchemeId) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); const content_ = JSON.stringify(body); @@ -18557,28 +17983,19 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevels(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, onlyDefault?: boolean | undefined, onSuccess?: (result: PageBeanSecurityLevel) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .param("onlyDefault", onlyDefault) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -18654,8 +18071,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultLevels(body: SetDefaultLevelsRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default") + .toString(); const content_ = JSON.stringify(body); @@ -18755,32 +18172,21 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelMembers(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, schemeId?: string[] | undefined, levelId?: string[] | undefined, expand?: string | undefined, onSuccess?: (result: PageBeanSecurityLevelMember) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (levelId === null) - throw new globalThis.Error("The parameter 'levelId' cannot be null."); - else if (levelId !== undefined) - levelId && levelId.forEach(item => { url_ += "levelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(levelId, 'levelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .paramArray("levelId", levelId) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -18851,24 +18257,17 @@ export class Client { * @return Returned if the request is successful. */ searchProjectsUsingSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, issueSecuritySchemeId?: string[] | undefined, projectId?: string[] | undefined, onSuccess?: (result: PageBeanIssueSecuritySchemeToProjectMapping) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' cannot be null."); - else if (issueSecuritySchemeId !== undefined) - issueSecuritySchemeId && issueSecuritySchemeId.forEach(item => { url_ += "issueSecuritySchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecuritySchemeId", issueSecuritySchemeId) + .paramArray("projectId", projectId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -18943,8 +18342,8 @@ export class Client { * Associate security scheme to project */ associateSchemesToProjects(body: AssociateSecuritySchemeWithProjectDetails, onSuccess?: () => void, onFail?: (exception: TaskProgressBeanObject | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .toString(); const content_ = JSON.stringify(body); @@ -19041,24 +18440,17 @@ export class Client { * @return Returned if the request is successful. */ searchSecuritySchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, onSuccess?: (result: PageBeanSecuritySchemeWithProjects) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -19126,11 +18518,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityScheme(id: number, onSuccess?: (result: SecurityScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -19194,11 +18586,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueSecurityScheme(id: string, body: UpdateIssueSecuritySchemeRequestBean, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -19297,27 +18689,19 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevelMembers(issueSecuritySchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, issueSecurityLevelId?: string[] | undefined, expand?: string | undefined, onSuccess?: (result: PageBeanIssueSecurityLevelMember) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members?"; - if (issueSecuritySchemeId === undefined || issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' must be defined."); - url_ = url_.replace("{issueSecuritySchemeId}", encodeURIComponent("" + issueSecuritySchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecurityLevelId === null) - throw new globalThis.Error("The parameter 'issueSecurityLevelId' cannot be null."); - else if (issueSecurityLevelId !== undefined) - issueSecurityLevelId && issueSecurityLevelId.forEach(item => { url_ += "issueSecurityLevelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecurityLevelId, 'issueSecurityLevelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members") + .path("issueSecuritySchemeId", issueSecuritySchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecurityLevelId", issueSecurityLevelId) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -19389,11 +18773,11 @@ export class Client { * @return Returned if the request is successful. */ deleteSecurityScheme(schemeId: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}") + .path("schemeId", schemeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -19478,11 +18862,11 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevel(schemeId: string, body: AddSecuritySchemeLevelsRequestBean, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -19572,18 +18956,15 @@ export class Client { * @param replaceWith (optional) The ID of the issue security level that will replace the currently selected level. */ removeLevel(schemeId: string, levelId: string, replaceWith?: string | undefined, onSuccess?: () => void, onFail?: (exception: TaskProgressBeanObject | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.notNull(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .param("replaceWith", replaceWith) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -19674,14 +19055,13 @@ export class Client { * @return Returned if the request is successful. */ updateSecurityLevel(schemeId: string, levelId: string, body: UpdateIssueSecurityLevelDetails, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -19771,14 +19151,13 @@ export class Client { * @return Returned if the request is successful. */ addSecurityLevelMembers(schemeId: string, levelId: string, body: SecuritySchemeMembersRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -19869,17 +19248,15 @@ export class Client { * @return Returned if the request is successful. */ removeMemberFromSecurityLevel(schemeId: string, levelId: string, memberId: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (memberId === undefined || memberId === null) - throw new globalThis.Error("The parameter 'memberId' must be defined."); - url_ = url_.replace("{memberId}", encodeURIComponent("" + memberId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.required(memberId, 'memberId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .path("memberId", memberId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -19963,8 +19340,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueAllTypes(onSuccess?: (result: IssueTypeDetails[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -20026,8 +19403,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueType(body: IssueTypeCreateBean, onSuccess?: (result: IssueTypeDetails) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); const content_ = JSON.stringify(body); @@ -20108,16 +19485,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypesForProject(projectId: number, level?: number | undefined, onSuccess?: (result: IssueTypeDetails[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (level === null) - throw new globalThis.Error("The parameter 'level' cannot be null."); - else if (level !== undefined) - url_ += "level=" + encodeURIComponent("" + level) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(level, 'level'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/project") + .param("projectId", projectId) + .param("level", level) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -20189,15 +19563,13 @@ export class Client { * @return Returned if the request is successful. */ deleteIssueType(id: string, alternativeIssueTypeId?: string | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (alternativeIssueTypeId === null) - throw new globalThis.Error("The parameter 'alternativeIssueTypeId' cannot be null."); - else if (alternativeIssueTypeId !== undefined) - url_ += "alternativeIssueTypeId=" + encodeURIComponent("" + alternativeIssueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(alternativeIssueTypeId, 'alternativeIssueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .param("alternativeIssueTypeId", alternativeIssueTypeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -20273,11 +19645,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueType(id: string, onSuccess?: (result: IssueTypeDetails) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -20341,11 +19713,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueType(id: string, body: IssueTypeUpdateBean, onSuccess?: (result: IssueTypeDetails) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -20425,11 +19797,11 @@ export class Client { * @return Returned if the request is successful. */ getAlternativeIssueTypes(id: string, onSuccess?: (result: IssueTypeDetails[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -20499,23 +19871,17 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeAvatar(id: string, size: number, body: any, x?: number | undefined, y?: number | undefined, onSuccess?: (result: Avatar) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2") + .path("id", id) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -20591,11 +19957,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypePropertyKeys(issueTypeId: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties") + .path("issueTypeId", issueTypeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -20660,14 +20026,13 @@ export class Client { * @return Returned if the issue type property is deleted. */ deleteIssueTypeProperty(issueTypeId: string, propertyKey: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -20736,14 +20101,13 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeProperty(issueTypeId: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -20813,14 +20177,13 @@ export class Client { * @return Returned if the issue type property is updated. */ setIssueTypeProperty(issueTypeId: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -20916,32 +20279,21 @@ export class Client { * @return Returned if the request is successful. */ getAllIssueTypeSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, orderBy?: OrderBy7 | undefined, expand?: string | undefined, queryString?: string | undefined, onSuccess?: (result: PageBeanIssueTypeScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("expand", expand) + .param("queryString", queryString) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -21008,8 +20360,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScheme(body: IssueTypeSchemeDetails, onSuccess?: (result: IssueTypeSchemeID) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .toString(); const content_ = JSON.stringify(body); @@ -21087,20 +20439,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemesMapping(startAt?: number | undefined, maxResults?: number | undefined, issueTypeSchemeId?: number[] | undefined, onSuccess?: (result: PageBeanIssueTypeSchemeMapping) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' cannot be null."); - else if (issueTypeSchemeId !== undefined) - issueTypeSchemeId && issueTypeSchemeId.forEach(item => { url_ += "issueTypeSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeSchemeId", issueTypeSchemeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -21170,20 +20517,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeSchemeForProjects(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanIssueTypeSchemeProjects) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -21250,8 +20592,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeSchemeToProject(body: IssueTypeSchemeProjectAssociation, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -21328,11 +20670,11 @@ export class Client { * @return Returned if the issue type scheme is deleted. */ deleteIssueTypeScheme(issueTypeSchemeId: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -21405,11 +20747,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeSchemeUpdateDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -21486,11 +20828,11 @@ export class Client { * @return Returned if the request is successful. */ addIssueTypesToIssueTypeScheme(issueTypeSchemeId: number, body: IssueTypeIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -21567,11 +20909,11 @@ export class Client { * @return Returned if the request is successful. */ reorderIssueTypesInIssueTypeScheme(issueTypeSchemeId: number, body: OrderOfIssueTypes, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -21649,14 +20991,13 @@ export class Client { * @return Returned if the request is successful. */ removeIssueTypeFromIssueTypeScheme(issueTypeSchemeId: number, issueTypeId: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .path("issueTypeId", issueTypeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -21737,32 +21078,21 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, orderBy?: OrderBy8 | undefined, expand?: string | undefined, onSuccess?: (result: PageBeanIssueTypeScreenScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -21830,8 +21160,8 @@ export class Client { * @return Returned if the request is successful. */ createIssueTypeScreenScheme(body: IssueTypeScreenSchemeDetails, onSuccess?: (result: IssueTypeScreenSchemeId) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -21913,20 +21243,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeMappings(startAt?: number | undefined, maxResults?: number | undefined, issueTypeScreenSchemeId?: number[] | undefined, onSuccess?: (result: PageBeanIssueTypeScreenSchemeItem) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' cannot be null."); - else if (issueTypeScreenSchemeId !== undefined) - issueTypeScreenSchemeId && issueTypeScreenSchemeId.forEach(item => { url_ += "issueTypeScreenSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -21996,20 +21321,15 @@ export class Client { * @return Returned if the request is successful. */ getIssueTypeScreenSchemeProjectAssociations(projectId: number[], startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanIssueTypeScreenSchemesProjects) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -22076,8 +21396,8 @@ export class Client { * @return Returned if the request is successful. */ assignIssueTypeScreenSchemeToProject(body: IssueTypeScreenSchemeProjectAssociation, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -22154,11 +21474,11 @@ export class Client { * @return Returned if the issue type screen scheme is deleted. */ deleteIssueTypeScreenScheme(issueTypeScreenSchemeId: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -22232,11 +21552,11 @@ export class Client { * @return Returned if the request is successful. */ updateIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeUpdateDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -22313,11 +21633,11 @@ export class Client { * @return Returned if the request is successful. */ appendMappingsForIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeMappingDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -22398,11 +21718,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultScreenScheme(issueTypeScreenSchemeId: string, body: UpdateDefaultScreenScheme, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -22479,11 +21799,11 @@ export class Client { * @return Returned if the screen scheme mappings are removed from the issue type screen scheme. */ removeMappingsFromIssueTypeScreenScheme(issueTypeScreenSchemeId: string, body: IssueTypeIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -22563,23 +21883,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectsForIssueTypeScreenScheme(issueTypeScreenSchemeId: number, startAt?: number | undefined, maxResults?: number | undefined, query?: string | undefined, onSuccess?: (result: PageBeanProjectDetails) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project?"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -22646,8 +21960,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoComplete(onSuccess?: (result: JQLReferenceData) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -22706,8 +22020,8 @@ export class Client { * @return Returned if the request is successful. */ getAutoCompletePost(body: SearchAutoCompleteFilter, onSuccess?: (result: JQLReferenceData) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); const content_ = JSON.stringify(body); @@ -22778,24 +22092,17 @@ export class Client { * @return Returned if the request is successful. */ getFieldAutoCompleteForQueryString(fieldName?: string | undefined, fieldValue?: string | undefined, predicateName?: string | undefined, predicateValue?: string | undefined, onSuccess?: (result: AutoCompleteSuggestions) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions?"; - if (fieldName === null) - throw new globalThis.Error("The parameter 'fieldName' cannot be null."); - else if (fieldName !== undefined) - url_ += "fieldName=" + encodeURIComponent("" + fieldName) + "&"; - if (fieldValue === null) - throw new globalThis.Error("The parameter 'fieldValue' cannot be null."); - else if (fieldValue !== undefined) - url_ += "fieldValue=" + encodeURIComponent("" + fieldValue) + "&"; - if (predicateName === null) - throw new globalThis.Error("The parameter 'predicateName' cannot be null."); - else if (predicateName !== undefined) - url_ += "predicateName=" + encodeURIComponent("" + predicateName) + "&"; - if (predicateValue === null) - throw new globalThis.Error("The parameter 'predicateValue' cannot be null."); - else if (predicateValue !== undefined) - url_ += "predicateValue=" + encodeURIComponent("" + predicateValue) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(fieldName, 'fieldName'); + Guard.notNull(fieldValue, 'fieldValue'); + Guard.notNull(predicateName, 'predicateName'); + Guard.notNull(predicateValue, 'predicateValue'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions") + .param("fieldName", fieldName) + .param("fieldValue", fieldValue) + .param("predicateName", predicateName) + .param("predicateValue", predicateValue) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -22870,24 +22177,17 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputations(functionKey?: string[] | undefined, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: string | undefined, onSuccess?: (result: PageBean2JqlFunctionPrecomputationBean) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (functionKey === null) - throw new globalThis.Error("The parameter 'functionKey' cannot be null."); - else if (functionKey !== undefined) - functionKey && functionKey.forEach(item => { url_ += "functionKey=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(functionKey, 'functionKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .paramArray("functionKey", functionKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -22959,12 +22259,11 @@ export class Client { * @return 200 response */ updatePrecomputations(body: JqlFunctionPrecomputationUpdateRequestBean, skipNotFoundPrecomputations?: boolean | undefined, onSuccess?: (result: JqlFunctionPrecomputationUpdateResponse) => void, onFail?: (exception: JqlFunctionPrecomputationUpdateErrorResponse | JqlFunctionPrecomputationUpdateErrorResponse | JqlFunctionPrecomputationUpdateErrorResponse | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (skipNotFoundPrecomputations === null) - throw new globalThis.Error("The parameter 'skipNotFoundPrecomputations' cannot be null."); - else if (skipNotFoundPrecomputations !== undefined) - url_ += "skipNotFoundPrecomputations=" + encodeURIComponent("" + skipNotFoundPrecomputations) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(skipNotFoundPrecomputations, 'skipNotFoundPrecomputations'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .param("skipNotFoundPrecomputations", skipNotFoundPrecomputations) + .toString(); const content_ = JSON.stringify(body); @@ -23058,12 +22357,11 @@ export class Client { * @return Returned if the request is successful. */ getPrecomputationsByID(body: JqlFunctionPrecomputationGetByIdRequest, orderBy?: string | undefined, onSuccess?: (result: JqlFunctionPrecomputationGetByIdResponse) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation/search?"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation/search") + .param("orderBy", orderBy) + .toString(); const content_ = JSON.stringify(body); @@ -23138,8 +22436,8 @@ export class Client { * @return Returned if the request is successful. */ matchIssues(body: IssuesAndJQLQueries, onSuccess?: (result: IssueMatches) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/jql/match"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/match") + .toString(); const content_ = JSON.stringify(body); @@ -23207,12 +22505,11 @@ export class Client { * @return Returned if the request is successful. */ parseJqlQueries(validation: Validation, body: JqlQueriesToParse, onSuccess?: (result: ParsedJqlQueries) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/jql/parse?"; - if (validation === undefined || validation === null) - throw new globalThis.Error("The parameter 'validation' must be defined and cannot be null."); - else - url_ += "validation=" + encodeURIComponent("" + validation) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(validation, 'validation'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/parse") + .param("validation", validation) + .toString(); const content_ = JSON.stringify(body); @@ -23282,8 +22579,8 @@ export class Client { * @return Returned if the request is successful. Note that the JQL queries are returned in the same order that they were passed. */ migrateQueries(body: JQLPersonalDataMigrationRequest, onSuccess?: (result: ConvertedJQLQueries) => void, onFail?: (exception: string | string | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/jql/pdcleaner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/pdcleaner") + .toString(); const content_ = JSON.stringify(body); @@ -23358,8 +22655,8 @@ export class Client { * @return Returned if the request is successful. */ sanitiseJqlQueries(body: JqlQueriesToSanitize, onSuccess?: (result: SanitizedJqlQueries) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/jql/sanitize"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/sanitize") + .toString(); const content_ = JSON.stringify(body); @@ -23441,16 +22738,13 @@ export class Client { * @return Returned if the request is successful. */ getAllLabels(startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanString) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/label?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/label") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -23505,8 +22799,8 @@ export class Client { * @return Returned if the request is successful. */ getApproximateLicenseCount(onSuccess?: (result: LicenseMetric) => void, onFail?: (exception: ErrorCollections | ErrorCollections | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -23576,11 +22870,11 @@ export class Client { * @return Returned if the request is successful. */ getApproximateApplicationLicenseCount(applicationKey: ApplicationKey, onSuccess?: (result: LicenseMetric) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}"; - if (applicationKey === undefined || applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' must be defined."); - url_ = url_.replace("{applicationKey}", encodeURIComponent("" + applicationKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}") + .path("applicationKey", applicationKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -23657,40 +22951,25 @@ export class Client { * @return Returned if the request is successful. */ getMyPermissions(projectKey?: string | undefined, projectId?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, permissions?: string | undefined, projectUuid?: string | undefined, projectConfigurationUuid?: string | undefined, commentId?: string | undefined, onSuccess?: (result: Permissions) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/mypermissions?"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (permissions === null) - throw new globalThis.Error("The parameter 'permissions' cannot be null."); - else if (permissions !== undefined) - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (projectUuid === null) - throw new globalThis.Error("The parameter 'projectUuid' cannot be null."); - else if (projectUuid !== undefined) - url_ += "projectUuid=" + encodeURIComponent("" + projectUuid) + "&"; - if (projectConfigurationUuid === null) - throw new globalThis.Error("The parameter 'projectConfigurationUuid' cannot be null."); - else if (projectConfigurationUuid !== undefined) - url_ += "projectConfigurationUuid=" + encodeURIComponent("" + projectConfigurationUuid) + "&"; - if (commentId === null) - throw new globalThis.Error("The parameter 'commentId' cannot be null."); - else if (commentId !== undefined) - url_ += "commentId=" + encodeURIComponent("" + commentId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(permissions, 'permissions'); + Guard.notNull(projectUuid, 'projectUuid'); + Guard.notNull(projectConfigurationUuid, 'projectConfigurationUuid'); + Guard.notNull(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypermissions") + .param("projectKey", projectKey) + .param("projectId", projectId) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("permissions", permissions) + .param("projectUuid", projectUuid) + .param("projectConfigurationUuid", projectConfigurationUuid) + .param("commentId", commentId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -23767,12 +23046,11 @@ export class Client { * @return Returned if the request is successful. */ removePreference(key: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -23832,12 +23110,11 @@ export class Client { * @return Returned if the request is successful. */ getPreference(key: string, onSuccess?: (result: string) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -23903,12 +23180,11 @@ export class Client { * @return Returned if the request is successful. */ setPreference(key: string, body: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); const content_ = JSON.stringify(body); @@ -23977,8 +23253,8 @@ export class Client { * @deprecated */ deleteLocale(onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -24038,8 +23314,8 @@ export class Client { * @return Returned if the request is successful. */ getLocale(onSuccess?: (result: Locale) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -24100,8 +23376,8 @@ export class Client { * @deprecated */ setLocale(body: Locale, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); const content_ = JSON.stringify(body); @@ -24173,12 +23449,11 @@ export class Client { * @return Returned if the request is successful. */ getCurrentUser(expand?: string | undefined, onSuccess?: (result: User) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/myself?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/myself") + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -24250,32 +23525,21 @@ export class Client { * @return Returned if the request is successful. Only returns notification schemes that the user has permission to access. An empty list is returned if the user lacks permission to access all notification schemes. */ getNotificationSchemes(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined, onSuccess?: (result: PageBeanNotificationScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -24338,8 +23602,8 @@ export class Client { * @return Returned if the request is successful. */ createNotificationScheme(body: CreateNotificationSchemeDetails, onSuccess?: (result: NotificationSchemeId) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -24423,24 +23687,17 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeToProjectMappings(startAt?: string | undefined, maxResults?: string | undefined, notificationSchemeId?: string[] | undefined, projectId?: string[] | undefined, onSuccess?: (result: PageBeanNotificationSchemeAndProjectMappingJsonBean) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' cannot be null."); - else if (notificationSchemeId !== undefined) - notificationSchemeId && notificationSchemeId.forEach(item => { url_ += "notificationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(notificationSchemeId, 'notificationSchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("notificationSchemeId", notificationSchemeId) + .paramArray("projectId", projectId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -24518,15 +23775,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationScheme(id: number, expand?: string | undefined, onSuccess?: (result: NotificationScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -24594,11 +23849,11 @@ export class Client { * @return Returned if the request is successful. */ updateNotificationScheme(id: string, body: UpdateNotificationSchemeDetails, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -24687,11 +23942,11 @@ export class Client { * @return Returned if the request is successful. */ addNotifications(id: string, body: AddNotificationsDetails, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -24780,11 +24035,11 @@ export class Client { * @return Returned if the request is successful. */ deleteNotificationScheme(notificationSchemeId: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}") + .path("notificationSchemeId", notificationSchemeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -24870,14 +24125,13 @@ export class Client { * @return Returned if the request is successful. */ removeNotificationFromNotificationScheme(notificationSchemeId: string, notificationId: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - if (notificationId === undefined || notificationId === null) - throw new globalThis.Error("The parameter 'notificationId' must be defined."); - url_ = url_.replace("{notificationId}", encodeURIComponent("" + notificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + Guard.required(notificationId, 'notificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}") + .path("notificationSchemeId", notificationSchemeId) + .path("notificationId", notificationId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -24961,8 +24215,8 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissions(onSuccess?: (result: Permissions) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissions"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -25026,8 +24280,8 @@ export class Client { * @return Returned if the request is successful. */ getBulkPermissions(body: BulkPermissionsRequestBean, onSuccess?: (result: BulkPermissionGrants) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissions/check"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/check") + .toString(); const content_ = JSON.stringify(body); @@ -25100,8 +24354,8 @@ export class Client { * @return Returned if the request is successful. */ getPermittedProjects(body: PermissionsKeysBean, onSuccess?: (result: PermittedProjects) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissions/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/project") + .toString(); const content_ = JSON.stringify(body); @@ -25176,12 +24430,11 @@ export class Client { * @return Returned if the request is successful. */ getAllPermissionSchemes(expand?: string | undefined, onSuccess?: (result: PermissionSchemes) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -25249,12 +24502,11 @@ export class Client { * @return Returned if the permission scheme is created. */ createPermissionScheme(body: PermissionScheme, expand?: string | undefined, onSuccess?: (result: PermissionScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -25326,11 +24578,11 @@ export class Client { * @return Returned if the permission scheme is deleted. */ deletePermissionScheme(schemeId: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -25402,15 +24654,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionScheme(schemeId: number, expand?: string | undefined, onSuccess?: (result: PermissionScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -25482,15 +24732,13 @@ export class Client { * @return Returned if the scheme is updated. */ updatePermissionScheme(schemeId: number, body: PermissionScheme, expand?: string | undefined, onSuccess?: (result: PermissionScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -25570,15 +24818,13 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrants(schemeId: number, expand?: string | undefined, onSuccess?: (result: PermissionGrants) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -25651,15 +24897,13 @@ export class Client { * @return Returned if the scheme permission is created. */ createPermissionGrant(schemeId: number, body: PermissionGrant, expand?: string | undefined, onSuccess?: (result: PermissionGrant) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -25732,14 +24976,13 @@ export class Client { * @return Returned if the permission grant is deleted. */ deletePermissionSchemeEntity(schemeId: number, permissionId: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -25812,18 +25055,15 @@ export class Client { * @return Returned if the request is successful. */ getPermissionSchemeGrant(schemeId: number, permissionId: number, expand?: string | undefined, onSuccess?: (result: PermissionGrant) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -25890,24 +25130,17 @@ export class Client { * @return Returned if the request is successful. */ getPlans(includeTrashed?: boolean | undefined, includeArchived?: boolean | undefined, cursor?: string | undefined, maxResults?: number | undefined, onSuccess?: (result: PageWithCursorGetPlanResponseForPage) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (includeTrashed === null) - throw new globalThis.Error("The parameter 'includeTrashed' cannot be null."); - else if (includeTrashed !== undefined) - url_ += "includeTrashed=" + encodeURIComponent("" + includeTrashed) + "&"; - if (includeArchived === null) - throw new globalThis.Error("The parameter 'includeArchived' cannot be null."); - else if (includeArchived !== undefined) - url_ += "includeArchived=" + encodeURIComponent("" + includeArchived) + "&"; - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(includeTrashed, 'includeTrashed'); + Guard.notNull(includeArchived, 'includeArchived'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("includeTrashed", includeTrashed) + .param("includeArchived", includeArchived) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -25977,12 +25210,11 @@ export class Client { * @return Returned if the request is successful. */ createPlan(body: CreatePlanRequest, useGroupId?: boolean | undefined, onSuccess?: (result: number) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -26065,15 +25297,13 @@ export class Client { * @return Returned if the request is successful. */ getPlan(planId: number, useGroupId?: boolean | undefined, onSuccess?: (result: GetPlanResponse) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -26151,15 +25381,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlan(planId: number, body: any, useGroupId?: boolean | undefined, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -26255,11 +25483,11 @@ export class Client { * @return Returned if the request is successful. */ archivePlan(planId: number, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive") + .path("planId", planId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -26344,11 +25572,11 @@ export class Client { * @return Returned if the request is successful. */ duplicatePlan(planId: number, body: DuplicatePlanRequest, onSuccess?: (result: number) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -26446,19 +25674,15 @@ export class Client { * @return Returned if the request is successful. */ getTeams(planId: number, cursor?: string | undefined, maxResults?: number | undefined, onSuccess?: (result: PageWithCursorGetTeamResponseForPage) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team") + .path("planId", planId) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -26535,11 +25759,11 @@ export class Client { * @return Returned if the request is successful. */ addAtlassianTeam(planId: number, body: AddAtlassianTeamRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -26636,14 +25860,13 @@ export class Client { * @return Returned if the request is successful. */ removeAtlassianTeam(planId: number, atlassianTeamId: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -26729,14 +25952,13 @@ export class Client { * @return Returned if the request is successful. */ getAtlassianTeam(planId: number, atlassianTeamId: string, onSuccess?: (result: GetAtlassianTeamResponse) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -26821,14 +26043,13 @@ export class Client { * @return Returned if the request is successful. */ updateAtlassianTeam(planId: number, atlassianTeamId: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -26924,11 +26145,11 @@ export class Client { * @return Returned if the request is successful. */ createPlanOnlyTeam(planId: number, body: CreatePlanOnlyTeamRequest, onSuccess?: (result: number) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -27025,14 +26246,13 @@ export class Client { * @return Returned if the request is successful. */ deletePlanOnlyTeam(planId: number, planOnlyTeamId: number, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -27118,14 +26338,13 @@ export class Client { * @return Returned if the request is successful. */ getPlanOnlyTeam(planId: number, planOnlyTeamId: number, onSuccess?: (result: GetPlanOnlyTeamResponse) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -27210,14 +26429,13 @@ export class Client { * @return Returned if the request is successful. */ updatePlanOnlyTeam(planId: number, planOnlyTeamId: number, body: any, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -27313,11 +26531,11 @@ export class Client { * @return Returned if the request is successful. */ trashPlan(planId: number, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash") + .path("planId", planId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -27402,8 +26620,8 @@ export class Client { * @deprecated */ getPriorities(onSuccess?: (result: Priority[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -27470,8 +26688,8 @@ export class Client { * @deprecated */ createPriority(body: CreatePriorityDetails, onSuccess?: (result: PriorityId) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); const content_ = JSON.stringify(body); @@ -27551,8 +26769,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultPriority(body: SetDefaultPriorityRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priority/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/default") + .toString(); const content_ = JSON.stringify(body); @@ -27640,8 +26858,8 @@ export class Client { * @return Returned if the request is successful. */ movePriorities(body: ReorderIssuePriorities, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priority/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/move") + .toString(); const content_ = JSON.stringify(body); @@ -27737,36 +26955,23 @@ export class Client { * @deprecated */ searchPriorities(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, projectId?: string[] | undefined, priorityName?: string | undefined, onlyDefault?: boolean | undefined, expand?: string | undefined, onSuccess?: (result: PageBeanPriority) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priority/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (priorityName === null) - throw new globalThis.Error("The parameter 'priorityName' cannot be null."); - else if (priorityName !== undefined) - url_ += "priorityName=" + encodeURIComponent("" + priorityName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(priorityName, 'priorityName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("priorityName", priorityName) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -27828,11 +27033,11 @@ export class Client { * @param id The ID of the issue priority. */ deletePriority(id: string, onSuccess?: () => void, onFail?: (exception: TaskProgressBeanObject | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -27922,11 +27127,11 @@ export class Client { * @return Returned if the request is successful. */ getPriority(id: string, onSuccess?: (result: Priority) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -27991,11 +27196,11 @@ export class Client { * @deprecated */ updatePriority(id: string, body: UpdatePriorityDetails, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -28091,40 +27296,25 @@ export class Client { * @return Returned if the request is successful. */ getPrioritySchemes(startAt?: string | undefined, maxResults?: string | undefined, priorityId?: number[] | undefined, schemeId?: number[] | undefined, schemeName?: string | undefined, onlyDefault?: boolean | undefined, orderBy?: OrderBy9 | undefined, expand?: string | undefined, onSuccess?: (result: PageBeanPrioritySchemeWithPaginatedPrioritiesAndProjects) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (priorityId === null) - throw new globalThis.Error("The parameter 'priorityId' cannot be null."); - else if (priorityId !== undefined) - priorityId && priorityId.forEach(item => { url_ += "priorityId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeName === null) - throw new globalThis.Error("The parameter 'schemeName' cannot be null."); - else if (schemeName !== undefined) - url_ += "schemeName=" + encodeURIComponent("" + schemeName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(priorityId, 'priorityId'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(schemeName, 'schemeName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("priorityId", priorityId) + .paramArray("schemeId", schemeId) + .param("schemeName", schemeName) + .param("onlyDefault", onlyDefault) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -28187,8 +27377,8 @@ export class Client { * @return Returned if the request is completed. */ createPriorityScheme(body: CreatePrioritySchemeDetails, onSuccess?: (result: PrioritySchemeId) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .toString(); const content_ = JSON.stringify(body); @@ -28270,8 +27460,8 @@ export class Client { * @return Returned if the request is successful. */ suggestedPrioritiesForMappings(body: SuggestedMappingsRequestBean, onSuccess?: (result: PageBeanPriorityWithSequence) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -28343,28 +27533,19 @@ export class Client { * @return Returned if the request is successful. */ getAvailablePrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, query?: string | undefined, exclude?: string[] | undefined, onSuccess?: (result: PageBeanPriorityWithSequence) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/priorities/available?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined and cannot be null."); - else - url_ += "schemeId=" + encodeURIComponent("" + schemeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/priorities/available") + .param("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .paramArray("exclude", exclude) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -28428,11 +27609,11 @@ export class Client { * @return Returned if the request is successful. */ deletePriorityScheme(schemeId: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -28501,11 +27682,11 @@ export class Client { * @return Returned if the request is accepted. */ updatePriorityScheme(schemeId: number, body: UpdatePrioritySchemeRequestBean, onSuccess?: (result: UpdatePrioritySchemeResponseBean) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -28583,19 +27764,15 @@ export class Client { * @return Returned if the request is successful. */ getPrioritiesByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, onSuccess?: (result: PageBeanPriorityWithSequence) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -28663,27 +27840,19 @@ export class Client { * @return Returned if the request is successful. */ getProjectsByPriorityScheme(schemeId: string, startAt?: string | undefined, maxResults?: string | undefined, projectId?: number[] | undefined, query?: string | undefined, onSuccess?: (result: PageBeanProject) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("projectId", projectId) + .param("query", query) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -28755,20 +27924,15 @@ export class Client { * @deprecated */ getAllProjects(expand?: string | undefined, recent?: number | undefined, properties?: string[] | undefined, onSuccess?: (result: Project[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (recent === null) - throw new globalThis.Error("The parameter 'recent' cannot be null."); - else if (recent !== undefined) - url_ += "recent=" + encodeURIComponent("" + recent) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(recent, 'recent'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .param("expand", expand) + .param("recent", recent) + .paramArray("properties", properties) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -28835,8 +27999,8 @@ export class Client { * @return Returned if the project is created. */ createProject(body: CreateProjectDetails, onSuccess?: (result: ProjectIdentifiers) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .toString(); const content_ = JSON.stringify(body); @@ -28907,8 +28071,8 @@ export class Client { * @param body The JSON payload containing the project details and capabilities */ createProjectWithCustomTemplate(body: ProjectCustomTemplateCreateRequestDTO, onSuccess?: () => void, onFail?: (exception: any | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project-template"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project-template") + .toString(); const content_ = JSON.stringify(body); @@ -28978,21 +28142,13 @@ export class Client { * @return Returned if the request is successful. */ getRecent(expand?: string | undefined, properties?: StringList[] | undefined, onSuccess?: (result: Project[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/recent?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/recent") + .param("expand", expand) + .paramArray("properties", properties) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -29107,65 +28263,35 @@ export class Client { * @return Returned if the request is successful. */ searchProjects(startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy10 | undefined, id?: number[] | undefined, keys?: string[] | undefined, query?: string | undefined, typeKey?: string | undefined, categoryId?: number | undefined, action?: Action | undefined, expand?: string | undefined, status?: Status4[] | undefined, properties?: StringList[] | undefined, propertyQuery?: string | undefined, onSuccess?: (result: PageBeanProject) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (typeKey === null) - throw new globalThis.Error("The parameter 'typeKey' cannot be null."); - else if (typeKey !== undefined) - url_ += "typeKey=" + encodeURIComponent("" + typeKey) + "&"; - if (categoryId === null) - throw new globalThis.Error("The parameter 'categoryId' cannot be null."); - else if (categoryId !== undefined) - url_ += "categoryId=" + encodeURIComponent("" + categoryId) + "&"; - if (action === null) - throw new globalThis.Error("The parameter 'action' cannot be null."); - else if (action !== undefined) - url_ += "action=" + encodeURIComponent("" + action) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - if (propertyQuery === null) - throw new globalThis.Error("The parameter 'propertyQuery' cannot be null."); - else if (propertyQuery !== undefined) - url_ += "propertyQuery=" + encodeURIComponent("" + propertyQuery) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(id, 'id'); + Guard.notNull(keys, 'keys'); + Guard.notNull(query, 'query'); + Guard.notNull(typeKey, 'typeKey'); + Guard.notNull(categoryId, 'categoryId'); + Guard.notNull(action, 'action'); + Guard.notNull(expand, 'expand'); + Guard.notNull(status, 'status'); + Guard.notNull(properties, 'properties'); + Guard.notNull(propertyQuery, 'propertyQuery'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .paramArray("id", id) + .paramArray("keys", keys) + .param("query", query) + .param("typeKey", typeKey) + .param("categoryId", categoryId) + .param("action", action) + .param("expand", expand) + .paramArray("status", status) + .paramArray("properties", properties) + .param("propertyQuery", propertyQuery) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -29232,8 +28358,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectTypes(onSuccess?: (result: ProjectType[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/type"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -29299,8 +28425,8 @@ export class Client { * @return Returned if the request is successful. */ getAllAccessibleProjectTypes(onSuccess?: (result: ProjectType[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/type/accessible"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/accessible") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -29363,11 +28489,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectTypeByKey(projectTypeKey: ProjectTypeKey, onSuccess?: (result: ProjectType) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}") + .path("projectTypeKey", projectTypeKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -29431,11 +28557,11 @@ export class Client { * @return Returned if the request is successful. */ getAccessibleProjectTypeByKey(projectTypeKey: ProjectTypeKey2, onSuccess?: (result: ProjectType) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible") + .path("projectTypeKey", projectTypeKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -29500,15 +28626,13 @@ export class Client { * @return Returned if the project is deleted. */ deleteProject(projectIdOrKey: string, enableUndo?: boolean | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (enableUndo === null) - throw new globalThis.Error("The parameter 'enableUndo' cannot be null."); - else if (enableUndo !== undefined) - url_ += "enableUndo=" + encodeURIComponent("" + enableUndo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(enableUndo, 'enableUndo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("enableUndo", enableUndo) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -29576,19 +28700,15 @@ export class Client { * @return Returned if successful. */ getProject(projectIdOrKey: string, expand?: string | undefined, properties?: string[] | undefined, onSuccess?: (result: Project) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .paramArray("properties", properties) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -29659,15 +28779,13 @@ export class Client { * @return Returned if the project is updated. */ updateProject(projectIdOrKey: string, body: UpdateProjectDetails, expand?: string | undefined, onSuccess?: (result: Project) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -29743,11 +28861,11 @@ export class Client { * @return Returned if the request is successful. */ archiveProject(projectIdOrKey: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -29820,11 +28938,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectAvatar(projectIdOrKey: string, body: Avatar, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -29898,14 +29016,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectAvatar(projectIdOrKey: string, id: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -29972,23 +29089,17 @@ export class Client { * @return Returned if the request is successful. */ createProjectAvatar(projectIdOrKey: string, body: any, x?: number | undefined, y?: number | undefined, size?: number | undefined, onSuccess?: (result: Avatar) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + Guard.notNull(size, 'size'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2") + .path("projectIdOrKey", projectIdOrKey) + .param("x", x) + .param("y", y) + .param("size", size) + .toString(); const content_ = JSON.stringify(body); @@ -30064,11 +29175,11 @@ export class Client { * @return Returned if request is successful. */ getAllProjectAvatars(projectIdOrKey: string, onSuccess?: (result: ProjectAvatars) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -30132,11 +29243,11 @@ export class Client { * @return Returned if the request is successful. */ removeDefaultProjectClassification(projectIdOrKey: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -30205,11 +29316,11 @@ export class Client { * @return Returned if the request is successful. */ getDefaultProjectClassification(projectIdOrKey: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -30274,11 +29385,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultProjectClassification(projectIdOrKey: string, body: UpdateDefaultProjectClassificationBean, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -30361,31 +29472,21 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponentsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy11 | undefined, componentSource?: ComponentSource | undefined, query?: string | undefined, onSuccess?: (result: PageBeanComponentWithIssueCount) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(componentSource, 'componentSource'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("componentSource", componentSource) + .param("query", query) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -30450,15 +29551,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectComponents(projectIdOrKey: string, componentSource?: ComponentSource2 | undefined, onSuccess?: (result: ProjectComponent[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(componentSource, 'componentSource'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components") + .path("projectIdOrKey", projectIdOrKey) + .param("componentSource", componentSource) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -30528,11 +29627,11 @@ export class Client { * @param projectIdOrKey The project ID or project key (case sensitive). */ deleteProjectAsynchronously(projectIdOrKey: string, onSuccess?: () => void, onFail?: (exception: TaskProgressBeanObject | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -30599,11 +29698,11 @@ export class Client { * @return Returned if the request is successful. */ getFeaturesForProject(projectIdOrKey: string, onSuccess?: (result: ContainerForProjectFeatures) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -30677,14 +29776,13 @@ export class Client { * @return Returned if the request is successful. */ toggleFeatureForProject(projectIdOrKey: string, featureKey: string, body: ProjectFeatureState, onSuccess?: (result: ContainerForProjectFeatures) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (featureKey === undefined || featureKey === null) - throw new globalThis.Error("The parameter 'featureKey' must be defined."); - url_ = url_.replace("{featureKey}", encodeURIComponent("" + featureKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(featureKey, 'featureKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("featureKey", featureKey) + .toString(); const content_ = JSON.stringify(body); @@ -30760,11 +29858,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectPropertyKeys(projectIdOrKey: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -30837,14 +29935,13 @@ export class Client { * @return Returned if the project property is deleted. */ deleteProjectProperty(projectIdOrKey: string, propertyKey: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -30913,14 +30010,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectProperty(projectIdOrKey: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -30994,14 +30090,13 @@ export class Client { * @return Returned if the project property is updated. */ setProjectProperty(projectIdOrKey: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -31086,11 +30181,11 @@ export class Client { * @return Returned if the request is successful. */ restore(projectIdOrKey: string, onSuccess?: (result: Project) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -31158,11 +30253,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoles(projectIdOrKey: string, onSuccess?: (result: { [key: string]: string; }) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -31239,26 +30334,19 @@ export class Client { * @return Returned if the request is successful. */ deleteActor(projectIdOrKey: string, id: number, user?: string | undefined, group?: string | undefined, groupId?: string | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(group, 'group'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("user", user) + .param("group", group) + .param("groupId", groupId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -31320,18 +30408,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRole(projectIdOrKey: string, id: number, excludeInactiveUsers?: boolean | undefined, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (excludeInactiveUsers === null) - throw new globalThis.Error("The parameter 'excludeInactiveUsers' cannot be null."); - else if (excludeInactiveUsers !== undefined) - url_ += "excludeInactiveUsers=" + encodeURIComponent("" + excludeInactiveUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(excludeInactiveUsers, 'excludeInactiveUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("excludeInactiveUsers", excludeInactiveUsers) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -31403,14 +30488,13 @@ export class Client { For example, the cURL request above adds a group, *jira-developers*. For the response below to be returned as a result of that request, the user *Mia Krystof* would have previously been added as a `user` actor for this project. */ addActorUsers(projectIdOrKey: string, id: number, body: ActorsMap, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -31484,14 +30568,13 @@ export class Client { * @return Returned if the request is successful. The complete list of actors for the project is returned. */ setActors(projectIdOrKey: string, id: number, body: ProjectRoleActorsUpdateBean, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -31565,19 +30648,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleDetails(projectIdOrKey: string, currentMember?: boolean | undefined, excludeConnectAddons?: boolean | undefined, onSuccess?: (result: ProjectRoleDetails[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (currentMember === null) - throw new globalThis.Error("The parameter 'currentMember' cannot be null."); - else if (currentMember !== undefined) - url_ += "currentMember=" + encodeURIComponent("" + currentMember) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(currentMember, 'currentMember'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails") + .path("projectIdOrKey", projectIdOrKey) + .param("currentMember", currentMember) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -31648,11 +30727,11 @@ export class Client { * @return Returned if the request is successful. */ getAllStatuses(projectIdOrKey: string, onSuccess?: (result: IssueTypeWithStatus[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses") + .path("projectIdOrKey", projectIdOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -31740,35 +30819,23 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersionsPaginated(projectIdOrKey: string, startAt?: number | undefined, maxResults?: number | undefined, orderBy?: OrderBy12 | undefined, query?: string | undefined, status?: string | undefined, expand?: string | undefined, onSuccess?: (result: PageBeanVersion) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .param("status", status) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -31829,15 +30896,13 @@ export class Client { * @return Returned if the request is successful. */ getProjectVersions(projectIdOrKey: string, expand?: string | undefined, onSuccess?: (result: Version[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -31904,11 +30969,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectEmail(projectId: number, onSuccess?: (result: ProjectEmailAddress) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -31977,11 +31042,11 @@ export class Client { * @return Returned if the project's sender email address is successfully set. */ updateProjectEmail(projectId: number, body: ProjectEmailAddress, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); const content_ = JSON.stringify(body); @@ -32058,11 +31123,11 @@ export class Client { * @return Returned if the request is successful. */ getHierarchy(projectId: number, onSuccess?: (result: ProjectIssueTypeHierarchy) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy") + .path("projectId", projectId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -32130,11 +31195,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueSecurityScheme(projectKeyOrId: string, onSuccess?: (result: SecurityScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme") + .path("projectKeyOrId", projectKeyOrId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -32214,15 +31279,13 @@ export class Client { * @return Returned if the request is successful. */ getNotificationSchemeForProject(projectKeyOrId: string, expand?: string | undefined, onSuccess?: (result: NotificationScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -32298,15 +31361,13 @@ export class Client { * @return Returned if the request is successful. */ getAssignedPermissionScheme(projectKeyOrId: string, expand?: string | undefined, onSuccess?: (result: PermissionScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -32382,15 +31443,13 @@ export class Client { * @return Returned if the request is successful. */ assignPermissionScheme(projectKeyOrId: string, body: IdBean, expand?: string | undefined, onSuccess?: (result: PermissionScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -32462,11 +31521,11 @@ export class Client { * @return Returned if the request is successful. */ getSecurityLevelsForProject(projectKeyOrId: string, onSuccess?: (result: ProjectIssueSecurityLevels) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel") + .path("projectKeyOrId", projectKeyOrId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -32525,8 +31584,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectCategories(onSuccess?: (result: ProjectCategory[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -32592,8 +31651,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectCategory(body: ProjectCategory, onSuccess?: (result: ProjectCategory) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); const content_ = JSON.stringify(body); @@ -32669,11 +31728,11 @@ export class Client { * @return Returned if the request is successful. */ removeProjectCategory(id: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -32737,11 +31796,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectCategoryById(id: number, onSuccess?: (result: ProjectCategory) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -32804,11 +31863,11 @@ export class Client { * @return Returned if the request is successful. */ updateProjectCategory(id: number, body: ProjectCategory, onSuccess?: (result: UpdatedProjectCategory) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32884,12 +31943,11 @@ export class Client { * @return Returned if the request is successful. */ validateProjectKey(key?: string | undefined, onSuccess?: (result: ErrorCollection) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/key?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/key") + .param("key", key) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -32949,12 +32007,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectKey(key?: string | undefined, onSuccess?: (result: string) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey") + .param("key", key) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -33015,12 +32072,11 @@ export class Client { * @return Returned if the request is successful. */ getValidProjectName(name: string, onSuccess?: (result: string) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectName?"; - if (name === undefined || name === null) - throw new globalThis.Error("The parameter 'name' must be defined and cannot be null."); - else - url_ += "name=" + encodeURIComponent("" + name) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(name, 'name'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectName") + .param("name", name) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -33089,8 +32145,8 @@ export class Client { * @deprecated */ getResolutions(onSuccess?: (result: Resolution[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -33156,8 +32212,8 @@ export class Client { * @return Returned if the request is successful. */ createResolution(body: CreateResolutionDetails, onSuccess?: (result: ResolutionId) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); const content_ = JSON.stringify(body); @@ -33237,8 +32293,8 @@ export class Client { * @return Returned if the request is successful. */ setDefaultResolution(body: SetDefaultResolutionRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/resolution/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/default") + .toString(); const content_ = JSON.stringify(body); @@ -33326,8 +32382,8 @@ export class Client { * @return Returned if the request is successful. */ moveResolutions(body: ReorderIssueResolutionsRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/resolution/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/move") + .toString(); const content_ = JSON.stringify(body); @@ -33419,24 +32475,17 @@ export class Client { * @return Returned if the request is successful. */ searchResolutions(startAt?: string | undefined, maxResults?: string | undefined, id?: string[] | undefined, onlyDefault?: boolean | undefined, onSuccess?: (result: PageBeanResolutionJsonBean) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/resolution/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("onlyDefault", onlyDefault) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -33499,15 +32548,13 @@ export class Client { * @param replaceWith The ID of the issue resolution that will replace the currently selected resolution. */ deleteResolution(id: string, replaceWith: string, onSuccess?: () => void, onFail?: (exception: TaskProgressBeanObject | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (replaceWith === undefined || replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' must be defined and cannot be null."); - else - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .param("replaceWith", replaceWith) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -33597,11 +32644,11 @@ export class Client { * @return Returned if the request is successful. */ getResolution(id: string, onSuccess?: (result: Resolution) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -33665,11 +32712,11 @@ export class Client { * @return Returned if the request is successful. */ updateResolution(id: string, body: UpdateResolutionDetails, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -33757,8 +32804,8 @@ export class Client { * @return Returned if the request is successful. */ getAllProjectRoles(onSuccess?: (result: ProjectRole[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -33828,8 +32875,8 @@ export class Client { * @return Returned if the request is successful. */ createProjectRole(body: CreateUpdateRoleRequestBean, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); const content_ = JSON.stringify(body); @@ -33906,15 +32953,13 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRole(id: number, swap?: number | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/role/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (swap === null) - throw new globalThis.Error("The parameter 'swap' cannot be null."); - else if (swap !== undefined) - url_ += "swap=" + encodeURIComponent("" + swap) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(swap, 'swap'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .param("swap", swap) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -33986,11 +33031,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleById(id: number, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -34058,11 +33103,11 @@ export class Client { * @return Returned if the request is successful. */ partialUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -34138,11 +33183,11 @@ export class Client { * @return Returned if the request is successful. */ fullyUpdateProjectRole(id: number, body: CreateUpdateRoleRequestBean, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -34221,23 +33266,17 @@ export class Client { * @return Returned if the request is successful. */ deleteProjectRoleActorsFromRole(id: number, user?: string | undefined, groupId?: string | undefined, group?: string | undefined, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(group, 'group'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .param("user", user) + .param("groupId", groupId) + .param("group", group) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -34309,11 +33348,11 @@ export class Client { * @return Returned if the request is successful. */ getProjectRoleActorsForRole(id: number, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -34385,11 +33424,11 @@ export class Client { * @return Returned if the request is successful. */ addProjectRoleActorsToRole(id: number, body: ActorInputBean, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -34473,32 +33512,21 @@ export class Client { * @return Returned if the request is successful. */ getScreens(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, queryString?: string | undefined, scope?: Scope2[] | undefined, orderBy?: OrderBy13 | undefined, onSuccess?: (result: PageBeanScreen) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - scope && scope.forEach(item => { url_ += "scope=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(scope, 'scope'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .paramArray("scope", scope) + .param("orderBy", orderBy) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -34561,8 +33589,8 @@ export class Client { * @return Returned if the request is successful. */ createScreen(body: ScreenDetails, onSuccess?: (result: Screen) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .toString(); const content_ = JSON.stringify(body); @@ -34634,11 +33662,11 @@ export class Client { * @return Returned if the request is successful. */ addFieldToDefaultScreen(fieldId: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}") + .path("fieldId", fieldId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -34714,24 +33742,17 @@ export class Client { * @return Returned if the request is successful. */ getBulkScreenTabs(screenId?: number[] | undefined, tabId?: number[] | undefined, startAt?: number | undefined, maxResult?: number | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/tabs?"; - if (screenId === null) - throw new globalThis.Error("The parameter 'screenId' cannot be null."); - else if (screenId !== undefined) - screenId && screenId.forEach(item => { url_ += "screenId=" + encodeURIComponent("" + item) + "&"; }); - if (tabId === null) - throw new globalThis.Error("The parameter 'tabId' cannot be null."); - else if (tabId !== undefined) - tabId && tabId.forEach(item => { url_ += "tabId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(screenId, 'screenId'); + Guard.notNull(tabId, 'tabId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/tabs") + .paramArray("screenId", screenId) + .paramArray("tabId", tabId) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -34796,11 +33817,11 @@ export class Client { * @return Returned if the request is successful. */ deleteScreen(screenId: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -34868,11 +33889,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreen(screenId: number, body: UpdateScreenDetails, onSuccess?: (result: Screen) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -34948,11 +33969,11 @@ export class Client { * @return Returned if the request is successful. */ getAvailableScreenFields(screenId: number, onSuccess?: (result: ScreenableField[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields") + .path("screenId", screenId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -35028,15 +34049,13 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabs(screenId: number, projectKey?: string | undefined, onSuccess?: (result: ScreenableTab[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .param("projectKey", projectKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -35115,11 +34134,11 @@ export class Client { * @return Returned if the request is successful. */ addScreenTab(screenId: number, body: ScreenableTab, onSuccess?: (result: ScreenableTab) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -35196,14 +34215,13 @@ export class Client { * @return Returned if the request is successful. */ deleteScreenTab(screenId: number, tabId: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -35268,14 +34286,13 @@ export class Client { * @return Returned if the request is successful. */ renameScreenTab(screenId: number, tabId: number, body: ScreenableTab, onSuccess?: (result: ScreenableTab) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -35353,18 +34370,15 @@ export class Client { * @return Returned if the request is successful. */ getAllScreenTabFields(screenId: number, tabId: number, projectKey?: string | undefined, onSuccess?: (result: ScreenableField[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .param("projectKey", projectKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -35440,14 +34454,13 @@ export class Client { * @return Returned if the request is successful. */ addScreenTabField(screenId: number, tabId: number, body: AddFieldBean, onSuccess?: (result: ScreenableField) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -35525,17 +34538,15 @@ export class Client { * @return Returned if the request is successful. */ removeScreenTabField(screenId: number, tabId: number, id: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -35605,17 +34616,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTabField(screenId: number, tabId: number, id: string, body: MoveFieldBean, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -35694,17 +34703,15 @@ export class Client { * @return Returned if the request is successful. */ moveScreenTab(screenId: number, tabId: number, pos: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (pos === undefined || pos === null) - throw new globalThis.Error("The parameter 'pos' must be defined."); - url_ = url_.replace("{pos}", encodeURIComponent("" + pos)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(pos, 'pos'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("pos", pos) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -35785,32 +34792,21 @@ export class Client { * @return Returned if the request is successful. */ getScreenSchemes(startAt?: number | undefined, maxResults?: number | undefined, id?: number[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy14 | undefined, onSuccess?: (result: PageBeanScreenScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -35873,8 +34869,8 @@ export class Client { * @return Returned if the request is successful. */ createScreenScheme(body: ScreenSchemeDetails, onSuccess?: (result: ScreenSchemeId) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -35950,11 +34946,11 @@ export class Client { * @return Returned if the screen scheme is deleted. */ deleteScreenScheme(screenSchemeId: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -36023,11 +35019,11 @@ export class Client { * @return Returned if the request is successful. */ updateScreenScheme(screenSchemeId: string, body: UpdateScreenSchemeDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -36148,44 +35144,27 @@ export class Client { * @deprecated */ searchForIssuesUsingJql(jql?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, validateQuery?: ValidateQuery | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined, onSuccess?: (result: SearchResults) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/search?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (validateQuery === null) - throw new globalThis.Error("The parameter 'validateQuery' cannot be null."); - else if (validateQuery !== undefined) - url_ += "validateQuery=" + encodeURIComponent("" + validateQuery) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(validateQuery, 'validateQuery'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .param("jql", jql) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("validateQuery", validateQuery) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -36250,8 +35229,8 @@ export class Client { * @deprecated */ searchForIssuesUsingJqlPost(body: SearchRequestBean, onSuccess?: (result: SearchResults) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .toString(); const content_ = JSON.stringify(body); @@ -36319,8 +35298,8 @@ export class Client { * @return Returned if the request is successful. */ countIssues(body: JQLCountRequestBean, onSuccess?: (result: JQLCountResultsBean) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/search/approximate-count"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/approximate-count") + .toString(); const content_ = JSON.stringify(body); @@ -36389,8 +35368,8 @@ export class Client { * @deprecated */ searchForIssuesIds(body: IdSearchRequestBean, onSuccess?: (result: IdSearchResults) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/search/id"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/id") + .toString(); const content_ = JSON.stringify(body); @@ -36501,44 +35480,27 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJql(jql?: string | undefined, nextPageToken?: string | undefined, maxResults?: number | undefined, fields?: string[] | undefined, expand?: string | undefined, properties?: string[] | undefined, fieldsByKeys?: boolean | undefined, failFast?: boolean | undefined, reconcileIssues?: number[] | undefined, onSuccess?: (result: SearchAndReconcileResults) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/search/jql?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - if (reconcileIssues === null) - throw new globalThis.Error("The parameter 'reconcileIssues' cannot be null."); - else if (reconcileIssues !== undefined) - reconcileIssues && reconcileIssues.forEach(item => { url_ += "reconcileIssues=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + Guard.notNull(reconcileIssues, 'reconcileIssues'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .param("jql", jql) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .paramArray("reconcileIssues", reconcileIssues) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -36601,8 +35563,8 @@ export class Client { * @return Returned if the request is successful. */ searchAndReconsileIssuesUsingJqlPost(body: SearchAndReconcileRequestBean, onSuccess?: (result: SearchAndReconcileResults) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/search/jql"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .toString(); const content_ = JSON.stringify(body); @@ -36670,11 +35632,11 @@ export class Client { * @return Returned if the request is successful. */ getIssueSecurityLevel(id: string, onSuccess?: (result: SecurityLevel) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/securitylevel/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/securitylevel/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -36737,8 +35699,8 @@ export class Client { * @return Returned if the request is successful. */ getServerInfo(onSuccess?: (result: ServerInformation) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/serverInfo"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/serverInfo") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -36797,8 +35759,8 @@ export class Client { * @return Returned if the request is successful. */ getIssueNavigatorDefaultColumns(onSuccess?: (result: ColumnItem[]) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -36876,14 +35838,12 @@ export class Client { * @return Returned if the request is successful. */ setIssueNavigatorDefaultColumns(body: ColumnRequestBody, columns?: string[] | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let jqXhr = jQuery.ajax({ url: url_, @@ -36953,8 +35913,8 @@ export class Client { * @return Returned if the request is successful. */ getStatuses(onSuccess?: (result: StatusDetails[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/status"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -37021,11 +35981,11 @@ export class Client { * @return Returned if the request is successful. */ getStatus(idOrName: string, onSuccess?: (result: StatusDetails) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/status/{idOrName}"; - if (idOrName === undefined || idOrName === null) - throw new globalThis.Error("The parameter 'idOrName' must be defined."); - url_ = url_.replace("{idOrName}", encodeURIComponent("" + idOrName)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrName, 'idOrName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status/{idOrName}") + .path("idOrName", idOrName) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -37088,8 +36048,8 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategories(onSuccess?: (result: StatusCategory[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/statuscategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -37156,11 +36116,11 @@ export class Client { * @return Returned if the request is successful. */ getStatusCategory(idOrKey: string, onSuccess?: (result: StatusCategory) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}"; - if (idOrKey === undefined || idOrKey === null) - throw new globalThis.Error("The parameter 'idOrKey' must be defined."); - url_ = url_.replace("{idOrKey}", encodeURIComponent("" + idOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrKey, 'idOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}") + .path("idOrKey", idOrKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -37226,12 +36186,11 @@ export class Client { * @return Returned if the request is successful. */ deleteStatusesById(id: string[], onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -37304,16 +36263,13 @@ export class Client { * @return Returned if the request is successful. */ getStatusesById(id: string[], expand?: string | undefined, onSuccess?: (result: JiraStatus[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -37384,8 +36340,8 @@ export class Client { * @return Returned if the request is successful. */ createStatuses(body: StatusCreateRequest, onSuccess?: (result: JiraStatus[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -37464,8 +36420,8 @@ export class Client { * @return Returned if the request is successful. */ updateStatuses(body: StatusUpdateRequest, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -37548,32 +36504,21 @@ export class Client { * @return Returned if the request is successful. */ search(expand?: string | undefined, projectId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, searchString?: string | undefined, statusCategory?: string | undefined, onSuccess?: (result: PageOfStatuses) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/statuses/search?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (searchString === null) - throw new globalThis.Error("The parameter 'searchString' cannot be null."); - else if (searchString !== undefined) - url_ += "searchString=" + encodeURIComponent("" + searchString) + "&"; - if (statusCategory === null) - throw new globalThis.Error("The parameter 'statusCategory' cannot be null."); - else if (statusCategory !== undefined) - url_ += "statusCategory=" + encodeURIComponent("" + statusCategory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(searchString, 'searchString'); + Guard.notNull(statusCategory, 'statusCategory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/search") + .param("expand", expand) + .param("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("searchString", searchString) + .param("statusCategory", statusCategory) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -37640,22 +36585,17 @@ export class Client { * @return Returned if the request is successful. */ getProjectIssueTypeUsagesForStatus(statusId: string, projectId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, onSuccess?: (result: StatusProjectIssueTypeUsageDTO) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages") + .path("statusId", statusId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -37725,19 +36665,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, onSuccess?: (result: StatusProjectUsageDTO) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -37807,19 +36743,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowUsagesForStatus(statusId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, onSuccess?: (result: StatusWorkflowUsageDTO) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -37887,11 +36819,11 @@ export class Client { * @return Returned if the request is successful. */ getTask(taskId: string, onSuccess?: (result: TaskProgressBeanObject) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}") + .path("taskId", taskId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -37959,11 +36891,11 @@ export class Client { * @return Returned if the request is successful. */ cancelTask(taskId: string, onSuccess?: (result: any) => void, onFail?: (exception: string[] | string[] | string[] | string[] | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}/cancel"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}/cancel") + .path("taskId", taskId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -38081,20 +37013,15 @@ export class Client { * @return Returned if the request is successful. */ getUiModifications(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, onSuccess?: (result: PageBeanUiModificationDetails) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/uiModifications?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -38162,8 +37089,8 @@ export class Client { * @return Returned if the UI modification is created. */ createUiModification(body: CreateUiModificationDetails, onSuccess?: (result: UiModificationIdentifiers) => void, onFail?: (exception: DetailedErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/uiModifications"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .toString(); const content_ = JSON.stringify(body); @@ -38242,11 +37169,11 @@ export class Client { * @return Returned if the UI modification is deleted. */ deleteUiModification(uiModificationId: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -38316,11 +37243,11 @@ export class Client { * @return Returned if the UI modification is updated. */ updateUiModification(uiModificationId: string, body: UpdateUiModificationDetails, onSuccess?: (result: any) => void, onFail?: (exception: DetailedErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); const content_ = JSON.stringify(body); @@ -38401,14 +37328,13 @@ export class Client { * @return Returned if the request is successful. */ getAvatars(type: Type3, entityId: string, onSuccess?: (result: Avatars) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -38476,26 +37402,19 @@ export class Client { * @return Returned if the request is successful. */ storeAvatar(type: Type4, entityId: string, size: number, body: any, x?: number | undefined, y?: number | undefined, onSuccess?: (result: Avatar) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -38573,17 +37492,15 @@ export class Client { * @return Returned if the request is successful. */ deleteAvatar(type: Type5, owningObjectId: string, id: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (owningObjectId === undefined || owningObjectId === null) - throw new globalThis.Error("The parameter 'owningObjectId' must be defined."); - url_ = url_.replace("{owningObjectId}", encodeURIComponent("" + owningObjectId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(owningObjectId, 'owningObjectId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}") + .path("type", type) + .path("owningObjectId", owningObjectId) + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -38649,19 +37566,15 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByType(type: Type6, size?: Size | undefined, format?: Format | undefined, onSuccess?: (result: StreamingResponseBody) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}") + .path("type", type) + .param("size", size) + .param("format", format) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -38741,22 +37654,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByID(type: Type7, id: number, size?: Size2 | undefined, format?: Format2 | undefined, onSuccess?: (result: StreamingResponseBody) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(id, 'id'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}") + .path("type", type) + .path("id", id) + .param("size", size) + .param("format", format) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -38843,22 +37751,17 @@ export class Client { * @return Returned if the request is successful. */ getAvatarImageByOwner(type: Type8, entityId: string, size?: Size3 | undefined, format?: Format3 | undefined, onSuccess?: (result: StreamingResponseBody) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("format", format) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -38944,20 +37847,15 @@ export class Client { * @return Returned if the request is successful. */ removeUser(accountId: string, username?: string | undefined, key?: string | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -39031,24 +37929,17 @@ export class Client { * @return Returned if the request is successful. */ getUser(accountId?: string | undefined, username?: string | undefined, key?: string | undefined, expand?: string | undefined, onSuccess?: (result: User) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -39116,8 +38007,8 @@ export class Client { * @return Returned if the request is successful. */ createUser(body: NewUserDetails, onSuccess?: (result: User) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .toString(); const content_ = JSON.stringify(body); @@ -39194,32 +38085,21 @@ export class Client { * @return Returned if the request is successful. */ findBulkAssignableUsers(projectKeys: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch?"; - if (projectKeys === undefined || projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' must be defined and cannot be null."); - else - url_ += "projectKeys=" + encodeURIComponent("" + projectKeys) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeys, 'projectKeys'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch") + .param("projectKeys", projectKeys) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -39308,52 +38188,31 @@ export class Client { * @return Returned if the request is successful. */ findAssignableUsers(query?: string | undefined, sessionId?: string | undefined, username?: string | undefined, accountId?: string | undefined, project?: string | undefined, issueKey?: string | undefined, issueId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, actionDescriptorId?: number | undefined, recommend?: boolean | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (sessionId === null) - throw new globalThis.Error("The parameter 'sessionId' cannot be null."); - else if (sessionId !== undefined) - url_ += "sessionId=" + encodeURIComponent("" + sessionId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (project === null) - throw new globalThis.Error("The parameter 'project' cannot be null."); - else if (project !== undefined) - url_ += "project=" + encodeURIComponent("" + project) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (actionDescriptorId === null) - throw new globalThis.Error("The parameter 'actionDescriptorId' cannot be null."); - else if (actionDescriptorId !== undefined) - url_ += "actionDescriptorId=" + encodeURIComponent("" + actionDescriptorId) + "&"; - if (recommend === null) - throw new globalThis.Error("The parameter 'recommend' cannot be null."); - else if (recommend !== undefined) - url_ += "recommend=" + encodeURIComponent("" + recommend) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(sessionId, 'sessionId'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(project, 'project'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(actionDescriptorId, 'actionDescriptorId'); + Guard.notNull(recommend, 'recommend'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/search") + .param("query", query) + .param("sessionId", sessionId) + .param("username", username) + .param("accountId", accountId) + .param("project", project) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("actionDescriptorId", actionDescriptorId) + .param("recommend", recommend) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -39436,28 +38295,19 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsers(accountId: string[], startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined, onSuccess?: (result: PageBeanUser) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk") + .paramArray("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -39524,24 +38374,17 @@ export class Client { * @return Returned if the request is successful. */ bulkGetUsersMigration(startAt?: number | undefined, maxResults?: number | undefined, username?: string[] | undefined, key?: string[] | undefined, onSuccess?: (result: UserMigrationBean[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/bulk/migration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk/migration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -39613,16 +38456,13 @@ export class Client { * @return Returned if the request is successful. */ resetUserColumns(accountId?: string | undefined, username?: string | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -39683,16 +38523,13 @@ export class Client { * @return Returned if the request is successful. */ getUserDefaultColumns(accountId?: string | undefined, username?: string | undefined, onSuccess?: (result: ColumnItem[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -39769,18 +38606,15 @@ export class Client { * @return Returned if the request is successful. */ setUserColumns(body: UserColumnRequestBody, accountId?: string | undefined, columns?: string[] | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .toString(); + + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); let jqXhr = jQuery.ajax({ url: url_, @@ -39860,12 +38694,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmail(accountId: string, onSuccess?: (result: UnrestrictedUserEmail) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/email?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email") + .param("accountId", accountId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -39937,12 +38770,11 @@ export class Client { * @return Returned if the request is successful. */ getUserEmailBulk(accountId: string[], onSuccess?: (result: UnrestrictedUserEmail) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/email/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email/bulk") + .paramArray("accountId", accountId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -40012,20 +38844,15 @@ export class Client { * @return Returned if the request is successful. */ getUserGroups(accountId: string, username?: string | undefined, key?: string | undefined, onSuccess?: (result: GroupName[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/groups?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/groups") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -40101,15 +38928,13 @@ export class Client { * @return Returned if the request is successful. */ getUserNavProperty(propertyKey: string, accountId?: string | undefined, onSuccess?: (result: UserNavPropertyJsonBean) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -40183,15 +39008,13 @@ export class Client { * @return Returned if the user property is updated/created. */ setUserNavProperty(propertyKey: string, body: any, accountId?: string | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); const content_ = JSON.stringify(body); @@ -40316,40 +39139,25 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithAllPermissions(permissions: string, query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/permission/search?"; - if (permissions === undefined || permissions === null) - throw new globalThis.Error("The parameter 'permissions' must be defined and cannot be null."); - else - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(permissions, 'permissions'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/permission/search") + .param("permissions", permissions) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -40438,36 +39246,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersForPicker(query: string, maxResults?: number | undefined, showAvatar?: boolean | undefined, exclude?: string[] | undefined, excludeAccountIds?: string[] | undefined, avatarSize?: string | undefined, excludeConnectUsers?: boolean | undefined, onSuccess?: (result: FoundUsers) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/picker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeAccountIds === null) - throw new globalThis.Error("The parameter 'excludeAccountIds' cannot be null."); - else if (excludeAccountIds !== undefined) - excludeAccountIds && excludeAccountIds.forEach(item => { url_ += "excludeAccountIds=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (excludeConnectUsers === null) - throw new globalThis.Error("The parameter 'excludeConnectUsers' cannot be null."); - else if (excludeConnectUsers !== undefined) - url_ += "excludeConnectUsers=" + encodeURIComponent("" + excludeConnectUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeAccountIds, 'excludeAccountIds'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(excludeConnectUsers, 'excludeConnectUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/picker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .paramArray("exclude", exclude) + .paramArray("excludeAccountIds", excludeAccountIds) + .param("avatarSize", avatarSize) + .param("excludeConnectUsers", excludeConnectUsers) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -40537,20 +39332,15 @@ export class Client { * @return Returned if the request is successful. */ getUserPropertyKeys(accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/properties?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties") + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -40625,23 +39415,17 @@ export class Client { * @return Returned if the user property is deleted. */ deleteUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -40712,23 +39496,17 @@ export class Client { * @return Returned if the request is successful. */ getUserProperty(propertyKey: string, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -40804,23 +39582,17 @@ export class Client { * @return Returned if the user property is updated. */ setUserProperty(propertyKey: string, body: any, accountId?: string | undefined, userKey?: string | undefined, username?: string | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); const content_ = JSON.stringify(body); @@ -40914,32 +39686,21 @@ export class Client { * @return Returned if the request is successful. */ findUsers(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, property?: string | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (property === null) - throw new globalThis.Error("The parameter 'property' cannot be null."); - else if (property !== undefined) - url_ += "property=" + encodeURIComponent("" + property) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(property, 'property'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("property", property) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -41016,20 +39777,15 @@ export class Client { * @return Returned if the request is successful. */ findUsersByQuery(query: string, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanUser) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/search/query?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query") + .param("query", query) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -41115,20 +39871,15 @@ export class Client { * @return Returned if the request is successful. */ findUserKeysByQuery(query: string, startAt?: number | undefined, maxResult?: number | undefined, onSuccess?: (result: PageBeanUserKey) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/search/query/key?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query/key") + .param("query", query) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -41218,36 +39969,23 @@ export class Client { * @return Returned if the request is successful. */ findUsersWithBrowsePermission(query?: string | undefined, username?: string | undefined, accountId?: string | undefined, issueKey?: string | undefined, projectKey?: string | undefined, startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/user/viewissue/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/viewissue/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -41327,16 +40065,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsersDefault(startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/users?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -41412,16 +40147,13 @@ export class Client { * @return Returned if the request is successful. */ getAllUsers(startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/users/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -41495,8 +40227,8 @@ export class Client { * @return Returned if the request is successful. */ createVersion(body: Version, onSuccess?: (result: Version) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version") + .toString(); const content_ = JSON.stringify(body); @@ -41571,19 +40303,15 @@ export class Client { * @deprecated */ deleteVersion(id: string, moveFixIssuesTo?: string | undefined, moveAffectedIssuesTo?: string | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveFixIssuesTo === null) - throw new globalThis.Error("The parameter 'moveFixIssuesTo' cannot be null."); - else if (moveFixIssuesTo !== undefined) - url_ += "moveFixIssuesTo=" + encodeURIComponent("" + moveFixIssuesTo) + "&"; - if (moveAffectedIssuesTo === null) - throw new globalThis.Error("The parameter 'moveAffectedIssuesTo' cannot be null."); - else if (moveAffectedIssuesTo !== undefined) - url_ += "moveAffectedIssuesTo=" + encodeURIComponent("" + moveAffectedIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveFixIssuesTo, 'moveFixIssuesTo'); + Guard.notNull(moveAffectedIssuesTo, 'moveAffectedIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("moveFixIssuesTo", moveFixIssuesTo) + .param("moveAffectedIssuesTo", moveAffectedIssuesTo) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -41653,15 +40381,13 @@ export class Client { * @return Returned if the request is successful. */ getVersion(id: string, expand?: string | undefined, onSuccess?: (result: Version) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -41725,11 +40451,11 @@ export class Client { * @return Returned if the request is successful. */ updateVersion(id: string, body: Version, onSuccess?: (result: Version) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -41802,14 +40528,13 @@ export class Client { * @return Returned if the version is deleted. */ mergeVersions(id: string, moveIssuesTo: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === undefined || moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' must be defined."); - url_ = url_.replace("{moveIssuesTo}", encodeURIComponent("" + moveIssuesTo)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}") + .path("id", id) + .path("moveIssuesTo", moveIssuesTo) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -41878,11 +40603,11 @@ export class Client { * @return Returned if the request is successful. */ moveVersion(id: string, body: VersionMoveBean, onSuccess?: (result: Version) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/move"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/move") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -41954,11 +40679,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionRelatedIssues(id: string, onSuccess?: (result: VersionIssueCounts) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -42022,11 +40747,11 @@ export class Client { * @return Returned if the request is successful. */ getRelatedWork(id: string, onSuccess?: (result: VersionRelatedWork[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -42100,11 +40825,11 @@ export class Client { * @return Returned if the request is successful. */ createRelatedWork(id: string, body: VersionRelatedWork, onSuccess?: (result: VersionRelatedWork) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -42180,11 +40905,11 @@ export class Client { * @return Returned if the request is successful together with updated related work. */ updateRelatedWork(id: string, body: VersionRelatedWork, onSuccess?: (result: VersionRelatedWork) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -42260,11 +40985,11 @@ export class Client { * @return Returned if the version is deleted. */ deleteAndReplaceVersion(id: string, body: DeleteAndReplaceVersionBean, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -42337,11 +41062,11 @@ export class Client { * @return Returned if the request is successful. */ getVersionUnresolvedIssues(id: string, onSuccess?: (result: VersionUnresolvedIssuesCount) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -42406,14 +41131,13 @@ export class Client { * @return Returned if the related work is deleted. */ deleteRelatedWork(versionId: string, relatedWorkId: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}"; - if (versionId === undefined || versionId === null) - throw new globalThis.Error("The parameter 'versionId' must be defined."); - url_ = url_.replace("{versionId}", encodeURIComponent("" + versionId)); - if (relatedWorkId === undefined || relatedWorkId === null) - throw new globalThis.Error("The parameter 'relatedWorkId' must be defined."); - url_ = url_.replace("{relatedWorkId}", encodeURIComponent("" + relatedWorkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(versionId, 'versionId'); + Guard.required(relatedWorkId, 'relatedWorkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}") + .path("versionId", versionId) + .path("relatedWorkId", relatedWorkId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -42480,8 +41204,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWebhookById(body: ContainerForWebhookIDs, onSuccess?: () => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -42552,16 +41276,13 @@ export class Client { * @return Returned if the request is successful. */ getDynamicWebhooksForApp(startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanWebhook) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/webhook?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -42630,8 +41351,8 @@ export class Client { * @return Returned if the request is successful. */ registerDynamicWebhooks(body: WebhookRegistrationDetails, onSuccess?: (result: ContainerForRegisteredWebhooks) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -42706,16 +41427,13 @@ export class Client { * @return Returned if the request is successful. */ getFailedWebhooks(maxResults?: number | undefined, after?: number | undefined, onSuccess?: (result: FailedWebhooks) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/webhook/failed?"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (after === null) - throw new globalThis.Error("The parameter 'after' cannot be null."); - else if (after !== undefined) - url_ += "after=" + encodeURIComponent("" + after) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(after, 'after'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/failed") + .param("maxResults", maxResults) + .param("after", after) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -42784,8 +41502,8 @@ export class Client { * @return Returned if the request is successful. */ refreshWebhooks(body: ContainerForWebhookIDs, onSuccess?: (result: WebhooksExpirationDate) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/webhook/refresh"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/refresh") + .toString(); const content_ = JSON.stringify(body); @@ -42860,12 +41578,11 @@ export class Client { * @deprecated */ getAllWorkflows(workflowName?: string | undefined, onSuccess?: (result: DeprecatedWorkflow[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow?"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .param("workflowName", workflowName) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -42933,8 +41650,8 @@ export class Client { * @deprecated */ createWorkflow(body: CreateWorkflowDetails, onSuccess?: (result: WorkflowIDs) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .toString(); const content_ = JSON.stringify(body); @@ -43017,40 +41734,25 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowTransitionRuleConfigurations(types: Types[], startAt?: number | undefined, maxResults?: number | undefined, keys?: string[] | undefined, workflowNames?: string[] | undefined, withTags?: string[] | undefined, draft?: boolean | undefined, expand?: string | undefined, onSuccess?: (result: PageBeanWorkflowTransitionRules) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config?"; - if (types === undefined || types === null) - throw new globalThis.Error("The parameter 'types' must be defined and cannot be null."); - else - types && types.forEach(item => { url_ += "types=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (workflowNames === null) - throw new globalThis.Error("The parameter 'workflowNames' cannot be null."); - else if (workflowNames !== undefined) - workflowNames && workflowNames.forEach(item => { url_ += "workflowNames=" + encodeURIComponent("" + item) + "&"; }); - if (withTags === null) - throw new globalThis.Error("The parameter 'withTags' cannot be null."); - else if (withTags !== undefined) - withTags && withTags.forEach(item => { url_ += "withTags=" + encodeURIComponent("" + item) + "&"; }); - if (draft === null) - throw new globalThis.Error("The parameter 'draft' cannot be null."); - else if (draft !== undefined) - url_ += "draft=" + encodeURIComponent("" + draft) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(types, 'types'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(keys, 'keys'); + Guard.notNull(workflowNames, 'workflowNames'); + Guard.notNull(withTags, 'withTags'); + Guard.notNull(draft, 'draft'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .paramArray("types", types) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("keys", keys) + .paramArray("workflowNames", workflowNames) + .paramArray("withTags", withTags) + .param("draft", draft) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -43127,8 +41829,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowTransitionRuleConfigurations(body: WorkflowTransitionRulesUpdate, onSuccess?: (result: WorkflowTransitionRulesUpdateErrors) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .toString(); const content_ = JSON.stringify(body); @@ -43205,8 +41907,8 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowTransitionRuleConfigurations(body: WorkflowsWithTransitionRulesDetails, onSuccess?: (result: WorkflowTransitionRulesUpdateErrors) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config/delete") + .toString(); const content_ = JSON.stringify(body); @@ -43301,36 +42003,23 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowsPaginated(startAt?: number | undefined, maxResults?: number | undefined, workflowName?: string[] | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: OrderBy15 | undefined, isActive?: boolean | undefined, onSuccess?: (result: PageBeanWorkflow) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - workflowName && workflowName.forEach(item => { url_ += "workflowName=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("workflowName", workflowName) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("isActive", isActive) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -43400,23 +42089,17 @@ export class Client { * @return 200 response */ deleteWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, workflowMode?: WorkflowMode | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -43492,27 +42175,19 @@ export class Client { * @return 200 response */ getWorkflowTransitionProperties(transitionId: number, workflowName: string, includeReservedKeys?: boolean | undefined, key?: string | undefined, workflowMode?: WorkflowMode2 | undefined, onSuccess?: (result: WorkflowTransitionProperty) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (includeReservedKeys === null) - throw new globalThis.Error("The parameter 'includeReservedKeys' cannot be null."); - else if (includeReservedKeys !== undefined) - url_ += "includeReservedKeys=" + encodeURIComponent("" + includeReservedKeys) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(includeReservedKeys, 'includeReservedKeys'); + Guard.notNull(key, 'key'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("workflowName", workflowName) + .param("includeReservedKeys", includeReservedKeys) + .param("key", key) + .param("workflowMode", workflowMode) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -43587,23 +42262,17 @@ export class Client { * @return 200 response */ createWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode3 | undefined, onSuccess?: (result: WorkflowTransitionProperty) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -43682,23 +42351,17 @@ export class Client { * @return 200 response */ updateWorkflowTransitionProperty(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode?: WorkflowMode4 | undefined, onSuccess?: (result: WorkflowTransitionProperty) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -43778,11 +42441,11 @@ export class Client { * @return Returned if the workflow is deleted. */ deleteInactiveWorkflow(entityId: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/{entityId}"; - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{entityId}") + .path("entityId", entityId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -43853,22 +42516,17 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowProjectIssueTypeUsages(workflowId: string, projectId: number, nextPageToken?: string | undefined, maxResults?: number | undefined, onSuccess?: (result: WorkflowProjectIssueTypeUsageDTO) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages") + .path("workflowId", workflowId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -43938,19 +42596,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, onSuccess?: (result: WorkflowProjectUsageDTO) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -44020,19 +42674,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeUsagesForWorkflow(workflowId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, onSuccess?: (result: WorkflowSchemeUsageDTO) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -44106,16 +42756,13 @@ export class Client { * @return Returned if the request is successful. */ readWorkflows(body: WorkflowReadRequest, expand?: string | undefined, useApprovalConfiguration?: boolean | undefined, onSuccess?: (result: WorkflowReadResponse) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflows?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (useApprovalConfiguration === null) - throw new globalThis.Error("The parameter 'useApprovalConfiguration' cannot be null."); - else if (useApprovalConfiguration !== undefined) - url_ += "useApprovalConfiguration=" + encodeURIComponent("" + useApprovalConfiguration) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(useApprovalConfiguration, 'useApprovalConfiguration'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows") + .param("expand", expand) + .param("useApprovalConfiguration", useApprovalConfiguration) + .toString(); const content_ = JSON.stringify(body); @@ -44185,20 +42832,15 @@ export class Client { * @return Returned if the request is successful. */ workflowCapabilities(workflowId?: string | undefined, projectId?: string | undefined, issueTypeId?: string | undefined, onSuccess?: (result: WorkflowCapabilities) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflows/capabilities?"; - if (workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' cannot be null."); - else if (workflowId !== undefined) - url_ += "workflowId=" + encodeURIComponent("" + workflowId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowId, 'workflowId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/capabilities") + .param("workflowId", workflowId) + .param("projectId", projectId) + .param("issueTypeId", issueTypeId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -44261,8 +42903,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflows(body: WorkflowCreateRequest, onSuccess?: (result: WorkflowCreateResponse) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflows/create"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create") + .toString(); const content_ = JSON.stringify(body); @@ -44333,8 +42975,8 @@ export class Client { * @return Returned if the request is successful. */ validateCreateWorkflows(body: WorkflowCreateValidateRequest, onSuccess?: (result: WorkflowValidationErrorList) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflows/create/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create/validation") + .toString(); const content_ = JSON.stringify(body); @@ -44414,36 +43056,23 @@ export class Client { * @return Returned if the request is successful. */ searchWorkflows(startAt?: number | undefined, maxResults?: number | undefined, expand?: string | undefined, queryString?: string | undefined, orderBy?: string | undefined, scope?: string | undefined, isActive?: boolean | undefined, onSuccess?: (result: WorkflowSearchResponse) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflows/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - url_ += "scope=" + encodeURIComponent("" + scope) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(scope, 'scope'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("scope", scope) + .param("isActive", isActive) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -44510,12 +43139,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflows(body: WorkflowUpdateRequest, expand?: string | undefined, onSuccess?: (result: WorkflowUpdateResponse) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflows/update?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -44586,8 +43214,8 @@ export class Client { * @return Returned if the request is successful. */ validateUpdateWorkflows(body: WorkflowUpdateValidateRequestBean, onSuccess?: (result: WorkflowValidationErrorList) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflows/update/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update/validation") + .toString(); const content_ = JSON.stringify(body); @@ -44656,16 +43284,13 @@ export class Client { * @return Returned if the request is successful. */ getAllWorkflowSchemes(startAt?: number | undefined, maxResults?: number | undefined, onSuccess?: (result: PageBeanWorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -44728,8 +43353,8 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowScheme(body: WorkflowScheme, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .toString(); const content_ = JSON.stringify(body); @@ -44801,12 +43426,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeProjectAssociations(projectId: number[], onSuccess?: (result: ContainerOfWorkflowSchemeAssociations) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .paramArray("projectId", projectId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -44873,8 +43497,8 @@ export class Client { * @return Returned if the request is successful. */ assignSchemeToProject(body: WorkflowSchemeProjectAssociation, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -44955,12 +43579,11 @@ export class Client { * @return Returned if the request is successful. */ readWorkflowSchemes(body: WorkflowSchemeReadRequest, expand?: string | undefined, onSuccess?: (result: WorkflowSchemeReadResponse[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/read?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/read") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -45034,8 +43657,8 @@ export class Client { * @return Returned if the request is successful and there is no asynchronous task. */ updateSchemes(body: WorkflowSchemeUpdateRequest, onSuccess?: (result: any) => void, onFail?: (exception: TaskProgressBeanObject | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update") + .toString(); const content_ = JSON.stringify(body); @@ -45114,8 +43737,8 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeMappings(body: WorkflowSchemeUpdateRequiredMappingsRequest, onSuccess?: (result: WorkflowSchemeUpdateRequiredMappingsResponse) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -45183,11 +43806,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowScheme(id: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -45261,15 +43884,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowScheme(id: number, returnDraftIfExists?: boolean | undefined, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -45337,11 +43958,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowScheme(id: number, body: WorkflowScheme, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -45417,11 +44038,11 @@ export class Client { * @return Returned if the request is successful. */ createWorkflowSchemeDraftFromParent(id: number, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -45490,15 +44111,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDefaultWorkflow(id: number, updateDraftIfNeeded?: boolean | undefined, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -45571,15 +44190,13 @@ export class Client { * @return Returned if the request is successful. */ getDefaultWorkflow(id: number, returnDraftIfExists?: boolean | undefined, onSuccess?: (result: DefaultWorkflow) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -45648,11 +44265,11 @@ export class Client { * @return Returned if the request is successful. */ updateDefaultWorkflow(id: number, body: DefaultWorkflow, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -45728,11 +44345,11 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraft(id: number, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -45796,11 +44413,11 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraft(id: number, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -45868,11 +44485,11 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowSchemeDraft(id: number, body: WorkflowScheme, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -45948,11 +44565,11 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftDefaultWorkflow(id: number, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -46020,11 +44637,11 @@ export class Client { * @return Returned if the request is successful. */ getDraftDefaultWorkflow(id: number, onSuccess?: (result: DefaultWorkflow) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -46093,11 +44710,11 @@ export class Client { * @return Returned if the request is successful. */ updateDraftDefaultWorkflow(id: number, body: DefaultWorkflow, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -46174,14 +44791,13 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeDraftIssueType(id: number, issueType: string, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -46250,14 +44866,13 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeDraftIssueType(id: number, issueType: string, onSuccess?: (result: IssueTypeWorkflowMapping) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -46327,14 +44942,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeDraftIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -46412,15 +45026,13 @@ export class Client { * @return Returned if the request is only for validation and is successful. */ publishDraftWorkflowScheme(id: number, body: PublishDraftWorkflowScheme, validateOnly?: boolean | undefined, onSuccess?: () => void, onFail?: (exception: TaskProgressBeanObject | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (validateOnly === null) - throw new globalThis.Error("The parameter 'validateOnly' cannot be null."); - else if (validateOnly !== undefined) - url_ += "validateOnly=" + encodeURIComponent("" + validateOnly) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(validateOnly, 'validateOnly'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish") + .path("id", id) + .param("validateOnly", validateOnly) + .toString(); const content_ = JSON.stringify(body); @@ -46500,15 +45112,13 @@ export class Client { * @return Returned if the request is successful. */ deleteDraftWorkflowMapping(id: number, workflowName: string, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -46573,15 +45183,13 @@ export class Client { * @return Returned if the request is successful. */ getDraftWorkflow(id: number, workflowName?: string | undefined, onSuccess?: (result: IssueTypesWorkflowMapping) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -46650,15 +45258,13 @@ export class Client { * @return Returned if the request is successful. */ updateDraftWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -46736,18 +45342,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowSchemeIssueType(id: number, issueType: string, updateDraftIfNeeded?: boolean | undefined, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -46821,18 +45424,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflowSchemeIssueType(id: number, issueType: string, returnDraftIfExists?: boolean | undefined, onSuccess?: (result: IssueTypeWorkflowMapping) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -46902,14 +45502,13 @@ export class Client { * @return Returned if the request is successful. */ setWorkflowSchemeIssueType(id: number, issueType: string, body: IssueTypeWorkflowMapping, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -46987,19 +45586,15 @@ export class Client { * @return Returned if the request is successful. */ deleteWorkflowMapping(id: number, workflowName: string, updateDraftIfNeeded?: boolean | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -47069,19 +45664,15 @@ export class Client { * @return Returned if the request is successful. */ getWorkflow(id: number, workflowName?: string | undefined, returnDraftIfExists?: boolean | undefined, onSuccess?: (result: IssueTypesWorkflowMapping) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -47150,15 +45741,13 @@ export class Client { * @return Returned if the request is successful. */ updateWorkflowMapping(id: number, workflowName: string, body: IssueTypesWorkflowMapping, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -47236,19 +45825,15 @@ export class Client { * @return Returned if the request is successful. */ getProjectUsagesForWorkflowScheme(workflowSchemeId: string, nextPageToken?: string | undefined, maxResults?: number | undefined, onSuccess?: (result: WorkflowSchemeProjectUsageDTO) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages?"; - if (workflowSchemeId === undefined || workflowSchemeId === null) - throw new globalThis.Error("The parameter 'workflowSchemeId' must be defined."); - url_ = url_.replace("{workflowSchemeId}", encodeURIComponent("" + workflowSchemeId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowSchemeId, 'workflowSchemeId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages") + .path("workflowSchemeId", workflowSchemeId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -47316,12 +45901,11 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsDeletedSince(since?: number | undefined, onSuccess?: (result: ChangedWorklogs) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/worklog/deleted?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/deleted") + .param("since", since) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -47382,12 +45966,11 @@ export class Client { * @return Returned if the request is successful. */ getWorklogsForIds(body: WorklogIdsRequestBean, expand?: string | undefined, onSuccess?: (result: Worklog[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/worklog/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -47463,16 +46046,13 @@ export class Client { * @return Returned if the request is successful. */ getIdsOfWorklogsModifiedSince(since?: number | undefined, expand?: string | undefined, onSuccess?: (result: ChangedWorklogs) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/api/3/worklog/updated?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/updated") + .param("since", since) + .param("expand", expand) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -47532,11 +46112,11 @@ export class Client { * @return Returned if the request is successful. */ deleteForgeAppProperty(propertyKey: string, onSuccess?: () => void, onFail?: (exception: OperationMessage | OperationMessage | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -47610,11 +46190,11 @@ export class Client { * @return Returned if the property is updated. */ putForgeAppProperty(propertyKey: string, body: any, onSuccess?: (result: OperationMessage) => void, onFail?: (exception: OperationMessage | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -47706,11 +46286,11 @@ export class AddonPropertiesResource_getAddonPropertiesClient { * @return Returned if the request is successful. */ get(addonKey: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: OperationMessage | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties") + .path("addonKey", addonKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -47784,14 +46364,13 @@ export class AddonPropertiesResource_deleteAddonPropertyClient { * @return Returned if the request is successful. */ delete(addonKey: string, propertyKey: string, onSuccess?: () => void, onFail?: (exception: OperationMessage | OperationMessage | OperationMessage | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -47875,14 +46454,13 @@ export class AddonPropertiesResource_getAddonPropertyClient { * @return Returned if the request is successful. */ get(addonKey: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: OperationMessage | OperationMessage | OperationMessage | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -47970,14 +46548,13 @@ export class AddonPropertiesResource_putAddonPropertyClient { * @return Returned if the property is updated. */ put(addonKey: string, propertyKey: string, body: any, onSuccess?: (result: OperationMessage) => void, onFail?: (exception: OperationMessage | OperationMessage | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -48070,12 +46647,11 @@ export class DynamicModulesResource_removeModulesClient { * @return Returned if the request is successful. */ delete(moduleKey?: string[] | undefined, onSuccess?: () => void, onFail?: (exception: ErrorMessage | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic?"; - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(moduleKey, 'moduleKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .paramArray("moduleKey", moduleKey) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -48143,8 +46719,8 @@ export class DynamicModulesResource_getModulesClient { * @return Returned if the request is successful. */ get(onSuccess?: (result: ConnectModules) => void, onFail?: (exception: ErrorMessage | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -48216,8 +46792,8 @@ export class DynamicModulesResource_registerModulesClient { * @return Returned if the request is successful. */ post(body: ConnectModules, onSuccess?: () => void, onFail?: (exception: ErrorMessage | ErrorMessage | string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); const content_ = JSON.stringify(body); @@ -48297,8 +46873,8 @@ export class AppIssueFieldValueUpdateResource_updateIssueFieldsClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, body: ConnectCustomFieldValues, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/field") + .toString(); const content_ = JSON.stringify(body); @@ -48379,11 +46955,11 @@ export class MigrationResource_updateEntityPropertiesValueClient { * @return Returned if the request is successful. */ put(atlassian_Transfer_Id: string, entityType: EntityType, body: EntityPropertyDetails[], onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}"; - if (entityType === undefined || entityType === null) - throw new globalThis.Error("The parameter 'entityType' must be defined."); - url_ = url_.replace("{entityType}", encodeURIComponent("" + entityType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityType, 'entityType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}") + .path("entityType", entityType) + .toString(); const content_ = JSON.stringify(body); @@ -48458,8 +47034,8 @@ export class MigrationResource_workflowRuleSearchClient { * @return Returned if the request is successful. */ post(atlassian_Transfer_Id: string, body: WorkflowRulesSearch, onSuccess?: (result: WorkflowRulesSearchDetails) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search") + .toString(); const content_ = JSON.stringify(body); @@ -48538,12 +47114,11 @@ export class ServiceRegistryResource_servicesClient { * @return Returned if the request is successful. */ get(serviceIds: string[], onSuccess?: (result: ServiceRegistry[]) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/service-registry?"; - if (serviceIds === undefined || serviceIds === null) - throw new globalThis.Error("The parameter 'serviceIds' must be defined and cannot be null."); - else - serviceIds && serviceIds.forEach(item => { url_ += "serviceIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(serviceIds, 'serviceIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/service-registry") + .paramArray("serviceIds", serviceIds) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -107302,4 +105877,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_JQueryPromises.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_JQueryPromises.verified.txt index 8ade677af..fe129066c 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_JQueryPromises.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JIRA_OpenAPI_JQueryPromises.verified.txt @@ -24,8 +24,8 @@ export class Client { } private getBannerWithCallbacks(onSuccess?: (result: AnnouncementBannerConfiguration) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); jQuery.ajax({ url: url_, @@ -96,8 +96,8 @@ export class Client { } private setBannerWithCallbacks(body: AnnouncementBannerConfigurationUpdate, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/announcementBanner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/announcementBanner") + .toString(); const content_ = JSON.stringify(body); @@ -187,36 +187,23 @@ export class Client { } private getCustomFieldsConfigurationsWithCallbacks(body: ConfigurationsListParameters, id: number[] | undefined, fieldContextId: number[] | undefined, issueId: number | undefined, projectKeyOrId: string | undefined, issueTypeId: string | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanBulkContextualConfiguration) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/app/field/context/configuration/list?"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/context/configuration/list") + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -294,12 +281,11 @@ export class Client { } private updateMultipleCustomFieldValuesWithCallbacks(body: MultipleCustomFieldValuesUpdateDetails, generateChangelog: boolean | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/app/field/value?"; - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/value") + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -381,39 +367,25 @@ export class Client { } private getCustomFieldConfigurationWithCallbacks(fieldIdOrKey: string, id: number[] | undefined, fieldContextId: number[] | undefined, issueId: number | undefined, projectKeyOrId: string | undefined, issueTypeId: string | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanContextualConfiguration) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (fieldContextId === null) - throw new globalThis.Error("The parameter 'fieldContextId' cannot be null."); - else if (fieldContextId !== undefined) - fieldContextId && fieldContextId.forEach(item => { url_ += "fieldContextId=" + encodeURIComponent("" + item) + "&"; }); - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' cannot be null."); - else if (projectKeyOrId !== undefined) - url_ += "projectKeyOrId=" + encodeURIComponent("" + projectKeyOrId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(id, 'id'); + Guard.notNull(fieldContextId, 'fieldContextId'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .paramArray("id", id) + .paramArray("fieldContextId", fieldContextId) + .param("issueId", issueId) + .param("projectKeyOrId", projectKeyOrId) + .param("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -487,11 +459,11 @@ export class Client { } private updateCustomFieldConfigurationWithCallbacks(fieldIdOrKey: string, body: CustomFieldConfigurations, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/context/configuration") + .path("fieldIdOrKey", fieldIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -571,15 +543,13 @@ export class Client { } private updateCustomFieldValueWithCallbacks(fieldIdOrKey: string, body: CustomFieldValueUpdateDetails, generateChangelog: boolean | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value?"; - if (fieldIdOrKey === undefined || fieldIdOrKey === null) - throw new globalThis.Error("The parameter 'fieldIdOrKey' must be defined."); - url_ = url_.replace("{fieldIdOrKey}", encodeURIComponent("" + fieldIdOrKey)); - if (generateChangelog === null) - throw new globalThis.Error("The parameter 'generateChangelog' cannot be null."); - else if (generateChangelog !== undefined) - url_ += "generateChangelog=" + encodeURIComponent("" + generateChangelog) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldIdOrKey, 'fieldIdOrKey'); + Guard.notNull(generateChangelog, 'generateChangelog'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/app/field/{fieldIdOrKey}/value") + .path("fieldIdOrKey", fieldIdOrKey) + .param("generateChangelog", generateChangelog) + .toString(); const content_ = JSON.stringify(body); @@ -656,20 +626,15 @@ export class Client { } private getApplicationPropertyWithCallbacks(key: string | undefined, permissionLevel: string | undefined, keyFilter: string | undefined, onSuccess?: (result: ApplicationProperty[]) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/application-properties?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (permissionLevel === null) - throw new globalThis.Error("The parameter 'permissionLevel' cannot be null."); - else if (permissionLevel !== undefined) - url_ += "permissionLevel=" + encodeURIComponent("" + permissionLevel) + "&"; - if (keyFilter === null) - throw new globalThis.Error("The parameter 'keyFilter' cannot be null."); - else if (keyFilter !== undefined) - url_ += "keyFilter=" + encodeURIComponent("" + keyFilter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + Guard.notNull(permissionLevel, 'permissionLevel'); + Guard.notNull(keyFilter, 'keyFilter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties") + .param("key", key) + .param("permissionLevel", permissionLevel) + .param("keyFilter", keyFilter) + .toString(); jQuery.ajax({ url: url_, @@ -747,8 +712,8 @@ export class Client { } private getAdvancedSettingsWithCallbacks(onSuccess?: (result: ApplicationProperty[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/application-properties/advanced-settings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/advanced-settings") + .toString(); jQuery.ajax({ url: url_, @@ -821,11 +786,11 @@ export class Client { } private setApplicationPropertyWithCallbacks(id: string, body: SimpleApplicationPropertyBean, onSuccess?: (result: ApplicationProperty) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/application-properties/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/application-properties/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -914,8 +879,8 @@ export class Client { } private getAllApplicationRolesWithCallbacks(onSuccess?: (result: ApplicationRole[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/applicationrole"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole") + .toString(); jQuery.ajax({ url: url_, @@ -988,11 +953,11 @@ export class Client { } private getApplicationRoleWithCallbacks(key: string, onSuccess?: (result: ApplicationRole) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/applicationrole/{key}"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined."); - url_ = url_.replace("{key}", encodeURIComponent("" + key)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/applicationrole/{key}") + .path("key", key) + .toString(); jQuery.ajax({ url: url_, @@ -1063,15 +1028,13 @@ export class Client { } private getAttachmentContentWithCallbacks(id: string, redirect: boolean | undefined, onSuccess?: (result: any[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/attachment/content/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/content/{id}") + .path("id", id) + .param("redirect", redirect) + .toString(); jQuery.ajax({ url: url_, @@ -1163,8 +1126,8 @@ export class Client { } private getAttachmentMetaWithCallbacks(onSuccess?: (result: AttachmentSettings) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/attachment/meta"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/meta") + .toString(); jQuery.ajax({ url: url_, @@ -1230,27 +1193,19 @@ export class Client { } private getAttachmentThumbnailWithCallbacks(id: string, redirect: boolean | undefined, fallbackToDefault: boolean | undefined, width: number | undefined, height: number | undefined, onSuccess?: (result: any[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (redirect === null) - throw new globalThis.Error("The parameter 'redirect' cannot be null."); - else if (redirect !== undefined) - url_ += "redirect=" + encodeURIComponent("" + redirect) + "&"; - if (fallbackToDefault === null) - throw new globalThis.Error("The parameter 'fallbackToDefault' cannot be null."); - else if (fallbackToDefault !== undefined) - url_ += "fallbackToDefault=" + encodeURIComponent("" + fallbackToDefault) + "&"; - if (width === null) - throw new globalThis.Error("The parameter 'width' cannot be null."); - else if (width !== undefined) - url_ += "width=" + encodeURIComponent("" + width) + "&"; - if (height === null) - throw new globalThis.Error("The parameter 'height' cannot be null."); - else if (height !== undefined) - url_ += "height=" + encodeURIComponent("" + height) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(redirect, 'redirect'); + Guard.notNull(fallbackToDefault, 'fallbackToDefault'); + Guard.notNull(width, 'width'); + Guard.notNull(height, 'height'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/thumbnail/{id}") + .path("id", id) + .param("redirect", redirect) + .param("fallbackToDefault", fallbackToDefault) + .param("width", width) + .param("height", height) + .toString(); jQuery.ajax({ url: url_, @@ -1335,11 +1290,11 @@ export class Client { } private removeAttachmentWithCallbacks(id: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -1401,11 +1356,11 @@ export class Client { } private getAttachmentWithCallbacks(id: string, onSuccess?: (result: AttachmentMetadata) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -1475,11 +1430,11 @@ export class Client { } private expandAttachmentForHumansWithCallbacks(id: string, onSuccess?: (result: AttachmentArchiveMetadataReadable) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/human"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/human") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -1553,11 +1508,11 @@ export class Client { } private expandAttachmentForMachinesWithCallbacks(id: string, onSuccess?: (result: AttachmentArchiveImpl) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/attachment/{id}/expand/raw") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -1635,28 +1590,19 @@ export class Client { } private getAuditRecordsWithCallbacks(offset: number | undefined, limit: number | undefined, filter: string | undefined, from: string | undefined, to: string | undefined, onSuccess?: (result: AuditRecords) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/auditing/record?"; - if (offset === null) - throw new globalThis.Error("The parameter 'offset' cannot be null."); - else if (offset !== undefined) - url_ += "offset=" + encodeURIComponent("" + offset) + "&"; - if (limit === null) - throw new globalThis.Error("The parameter 'limit' cannot be null."); - else if (limit !== undefined) - url_ += "limit=" + encodeURIComponent("" + limit) + "&"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (from === null) - throw new globalThis.Error("The parameter 'from' cannot be null."); - else if (from !== undefined) - url_ += "from=" + encodeURIComponent("" + from) + "&"; - if (to === null) - throw new globalThis.Error("The parameter 'to' cannot be null."); - else if (to !== undefined) - url_ += "to=" + encodeURIComponent("" + to) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(offset, 'offset'); + Guard.notNull(limit, 'limit'); + Guard.notNull(filter, 'filter'); + Guard.notNull(from, 'from'); + Guard.notNull(to, 'to'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/auditing/record") + .param("offset", offset) + .param("limit", limit) + .param("filter", filter) + .param("from", from) + .param("to", to) + .toString(); jQuery.ajax({ url: url_, @@ -1728,11 +1674,11 @@ export class Client { } private getAllSystemAvatarsWithCallbacks(type: Type, onSuccess?: (result: SystemAvatars) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/avatar/{type}/system"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/avatar/{type}/system") + .path("type", type) + .toString(); jQuery.ajax({ url: url_, @@ -1798,8 +1744,8 @@ export class Client { } private submitBulkDeleteWithCallbacks(body: IssueBulkDeletePayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/delete") + .toString(); const content_ = JSON.stringify(body); @@ -1885,24 +1831,17 @@ export class Client { } private getBulkEditableFieldsWithCallbacks(issueIdsOrKeys: string, searchText: string | undefined, endingBefore: string | undefined, startingAfter: string | undefined, onSuccess?: (result: BulkEditGetFields) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (searchText === null) - throw new globalThis.Error("The parameter 'searchText' cannot be null."); - else if (searchText !== undefined) - url_ += "searchText=" + encodeURIComponent("" + searchText) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(searchText, 'searchText'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("searchText", searchText) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); jQuery.ajax({ url: url_, @@ -1988,8 +1927,8 @@ export class Client { } private submitBulkEditWithCallbacks(body: IssueBulkEditPayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/fields"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/fields") + .toString(); const content_ = JSON.stringify(body); @@ -2064,8 +2003,8 @@ export class Client { } private submitBulkMoveWithCallbacks(body: IssueBulkMovePayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/move") + .toString(); const content_ = JSON.stringify(body); @@ -2143,20 +2082,15 @@ export class Client { } private getAvailableTransitionsWithCallbacks(issueIdsOrKeys: string, endingBefore: string | undefined, startingAfter: string | undefined, onSuccess?: (result: BulkTransitionGetAvailableTransitions) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition?"; - if (issueIdsOrKeys === undefined || issueIdsOrKeys === null) - throw new globalThis.Error("The parameter 'issueIdsOrKeys' must be defined and cannot be null."); - else - url_ += "issueIdsOrKeys=" + encodeURIComponent("" + issueIdsOrKeys) + "&"; - if (endingBefore === null) - throw new globalThis.Error("The parameter 'endingBefore' cannot be null."); - else if (endingBefore !== undefined) - url_ += "endingBefore=" + encodeURIComponent("" + endingBefore) + "&"; - if (startingAfter === null) - throw new globalThis.Error("The parameter 'startingAfter' cannot be null."); - else if (startingAfter !== undefined) - url_ += "startingAfter=" + encodeURIComponent("" + startingAfter) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdsOrKeys, 'issueIdsOrKeys'); + Guard.notNull(endingBefore, 'endingBefore'); + Guard.notNull(startingAfter, 'startingAfter'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .param("issueIdsOrKeys", issueIdsOrKeys) + .param("endingBefore", endingBefore) + .param("startingAfter", startingAfter) + .toString(); jQuery.ajax({ url: url_, @@ -2235,8 +2169,8 @@ export class Client { } private submitBulkTransitionWithCallbacks(body: IssueBulkTransitionPayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/transition"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/transition") + .toString(); const content_ = JSON.stringify(body); @@ -2319,8 +2253,8 @@ export class Client { } private submitBulkUnwatchWithCallbacks(body: IssueBulkWatchOrUnwatchPayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/unwatch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/unwatch") + .toString(); const content_ = JSON.stringify(body); @@ -2403,8 +2337,8 @@ export class Client { } private submitBulkWatchWithCallbacks(body: IssueBulkWatchOrUnwatchPayload, onSuccess?: (result: SubmittedBulkOperation) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/bulk/issues/watch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/issues/watch") + .toString(); const content_ = JSON.stringify(body); @@ -2487,11 +2421,11 @@ export class Client { } private getBulkOperationProgressWithCallbacks(taskId: string, onSuccess?: (result: BulkOperationProgress) => void, onFail?: (exception: BulkOperationErrorResponse | BulkOperationErrorResponse | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/bulk/queue/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/bulk/queue/{taskId}") + .path("taskId", taskId) + .toString(); jQuery.ajax({ url: url_, @@ -2563,8 +2497,8 @@ export class Client { } private getBulkChangelogsWithCallbacks(body: BulkChangelogRequestBean, onSuccess?: (result: BulkChangelogResponseBean) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/changelog/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/changelog/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -2631,16 +2565,13 @@ export class Client { } private getAllUserDataClassificationLevelsWithCallbacks(status: Status2[] | undefined, orderBy: OrderBy | undefined, onSuccess?: (result: DataClassificationLevelsBean) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/classification-levels?"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(status, 'status'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/classification-levels") + .paramArray("status", status) + .param("orderBy", orderBy) + .toString(); jQuery.ajax({ url: url_, @@ -2706,12 +2637,11 @@ export class Client { } private getCommentsByIdsWithCallbacks(body: IssueCommentListRequestBean, expand: string | undefined, onSuccess?: (result: PageBeanComment) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/comment/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -2777,11 +2707,11 @@ export class Client { } private getCommentPropertyKeysWithCallbacks(commentId: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties") + .path("commentId", commentId) + .toString(); jQuery.ajax({ url: url_, @@ -2856,14 +2786,13 @@ export class Client { } private deleteCommentPropertyWithCallbacks(commentId: string, propertyKey: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -2934,14 +2863,13 @@ export class Client { } private getCommentPropertyWithCallbacks(commentId: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -3017,14 +2945,13 @@ export class Client { } private setCommentPropertyWithCallbacks(commentId: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}"; - if (commentId === undefined || commentId === null) - throw new globalThis.Error("The parameter 'commentId' must be defined."); - url_ = url_.replace("{commentId}", encodeURIComponent("" + commentId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(commentId, 'commentId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/comment/{commentId}/properties/{propertyKey}") + .path("commentId", commentId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -3118,28 +3045,19 @@ export class Client { } private findComponentsForProjectsWithCallbacks(projectIdsOrKeys: string[] | undefined, startAt: number | undefined, maxResults: number | undefined, orderBy: OrderBy2 | undefined, query: string | undefined, onSuccess?: (result: PageBean2ComponentJsonBean) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/component?"; - if (projectIdsOrKeys === null) - throw new globalThis.Error("The parameter 'projectIdsOrKeys' cannot be null."); - else if (projectIdsOrKeys !== undefined) - projectIdsOrKeys && projectIdsOrKeys.forEach(item => { url_ += "projectIdsOrKeys=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIdsOrKeys, 'projectIdsOrKeys'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .paramArray("projectIdsOrKeys", projectIdsOrKeys) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .toString(); jQuery.ajax({ url: url_, @@ -3204,8 +3122,8 @@ export class Client { } private createComponentWithCallbacks(body: ProjectComponent, onSuccess?: (result: ProjectComponent) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/component"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component") + .toString(); const content_ = JSON.stringify(body); @@ -3284,15 +3202,13 @@ export class Client { } private deleteComponentWithCallbacks(id: string, moveIssuesTo: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/component/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' cannot be null."); - else if (moveIssuesTo !== undefined) - url_ += "moveIssuesTo=" + encodeURIComponent("" + moveIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .param("moveIssuesTo", moveIssuesTo) + .toString(); jQuery.ajax({ url: url_, @@ -3358,11 +3274,11 @@ export class Client { } private getComponentWithCallbacks(id: string, onSuccess?: (result: ProjectComponent) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -3428,11 +3344,11 @@ export class Client { } private updateComponentWithCallbacks(id: string, body: ProjectComponent, onSuccess?: (result: ProjectComponent) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/component/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -3510,11 +3426,11 @@ export class Client { } private getComponentRelatedIssuesWithCallbacks(id: string, onSuccess?: (result: ComponentIssuesCount) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/component/{id}/relatedIssueCounts") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -3579,8 +3495,8 @@ export class Client { } private getConfigurationWithCallbacks(onSuccess?: (result: Configuration) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/configuration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration") + .toString(); jQuery.ajax({ url: url_, @@ -3641,8 +3557,8 @@ export class Client { } private getSelectedTimeTrackingImplementationWithCallbacks(onSuccess?: (result: TimeTrackingProvider) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); jQuery.ajax({ url: url_, @@ -3715,8 +3631,8 @@ export class Client { } private selectTimeTrackingImplementationWithCallbacks(body: TimeTrackingProvider, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking") + .toString(); const content_ = JSON.stringify(body); @@ -3790,8 +3706,8 @@ export class Client { } private getAvailableTimeTrackingImplementationsWithCallbacks(onSuccess?: (result: TimeTrackingProvider[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/list"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/list") + .toString(); jQuery.ajax({ url: url_, @@ -3863,8 +3779,8 @@ export class Client { } private getSharedTimeTrackingConfigurationWithCallbacks(onSuccess?: (result: TimeTrackingConfiguration) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); jQuery.ajax({ url: url_, @@ -3929,8 +3845,8 @@ export class Client { } private setSharedTimeTrackingConfigurationWithCallbacks(body: TimeTrackingConfiguration, onSuccess?: (result: TimeTrackingConfiguration) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/configuration/timetracking/options"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/configuration/timetracking/options") + .toString(); const content_ = JSON.stringify(body); @@ -4004,11 +3920,11 @@ export class Client { } private getCustomFieldOptionWithCallbacks(id: string, onSuccess?: (result: CustomFieldOption) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/customFieldOption/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/customFieldOption/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -4079,20 +3995,15 @@ export class Client { } private getAllDashboardsWithCallbacks(filter: Filter2 | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageOfDashboards) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (filter === null) - throw new globalThis.Error("The parameter 'filter' cannot be null."); - else if (filter !== undefined) - url_ += "filter=" + encodeURIComponent("" + filter) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filter, 'filter'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("filter", filter) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -4165,12 +4076,11 @@ export class Client { } private createDashboardWithCallbacks(body: DashboardDetails, extendAdminPermissions: boolean | undefined, onSuccess?: (result: Dashboard) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard?"; - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard") + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -4246,8 +4156,8 @@ export class Client { } private bulkEditDashboardsWithCallbacks(body: BulkEditShareableEntityRequest, onSuccess?: (result: BulkEditShareableEntityResponse) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/bulk/edit"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/bulk/edit") + .toString(); const content_ = JSON.stringify(body); @@ -4322,8 +4232,8 @@ export class Client { } private getAllAvailableDashboardGadgetsWithCallbacks(onSuccess?: (result: AvailableDashboardGadgetsResponse) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/gadgets"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/gadgets") + .toString(); jQuery.ajax({ url: url_, @@ -4421,52 +4331,31 @@ export class Client { } private getDashboardsPaginatedWithCallbacks(dashboardName: string | undefined, accountId: string | undefined, owner: string | undefined, groupname: string | undefined, groupId: string | undefined, projectId: number | undefined, orderBy: OrderBy3 | undefined, startAt: number | undefined, maxResults: number | undefined, status: Status3 | undefined, expand: string | undefined, onSuccess?: (result: PageBeanDashboard) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/search?"; - if (dashboardName === null) - throw new globalThis.Error("The parameter 'dashboardName' cannot be null."); - else if (dashboardName !== undefined) - url_ += "dashboardName=" + encodeURIComponent("" + dashboardName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(dashboardName, 'dashboardName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/search") + .param("dashboardName", dashboardName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("status", status) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -4541,23 +4430,17 @@ export class Client { } private getAllGadgetsWithCallbacks(dashboardId: number, moduleKey: string[] | undefined, uri: string[] | undefined, gadgetId: number[] | undefined, onSuccess?: (result: DashboardGadgetResponse) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget?"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - if (uri === null) - throw new globalThis.Error("The parameter 'uri' cannot be null."); - else if (uri !== undefined) - uri && uri.forEach(item => { url_ += "uri=" + encodeURIComponent("" + item) + "&"; }); - if (gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' cannot be null."); - else if (gadgetId !== undefined) - gadgetId && gadgetId.forEach(item => { url_ += "gadgetId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.notNull(moduleKey, 'moduleKey'); + Guard.notNull(uri, 'uri'); + Guard.notNull(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .paramArray("moduleKey", moduleKey) + .paramArray("uri", uri) + .paramArray("gadgetId", gadgetId) + .toString(); jQuery.ajax({ url: url_, @@ -4626,11 +4509,11 @@ export class Client { } private addGadgetWithCallbacks(dashboardId: number, body: DashboardGadgetSettings, onSuccess?: (result: DashboardGadget) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget") + .path("dashboardId", dashboardId) + .toString(); const content_ = JSON.stringify(body); @@ -4711,14 +4594,13 @@ export class Client { } private removeGadgetWithCallbacks(dashboardId: number, gadgetId: number, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); jQuery.ajax({ url: url_, @@ -4789,14 +4671,13 @@ export class Client { } private updateGadgetWithCallbacks(dashboardId: number, gadgetId: number, body: DashboardGadgetUpdateRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (gadgetId === undefined || gadgetId === null) - throw new globalThis.Error("The parameter 'gadgetId' must be defined."); - url_ = url_.replace("{gadgetId}", encodeURIComponent("" + gadgetId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(gadgetId, 'gadgetId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/gadget/{gadgetId}") + .path("dashboardId", dashboardId) + .path("gadgetId", gadgetId) + .toString(); const content_ = JSON.stringify(body); @@ -4878,14 +4759,13 @@ export class Client { } private getDashboardItemPropertyKeysWithCallbacks(dashboardId: string, itemId: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .toString(); jQuery.ajax({ url: url_, @@ -4959,17 +4839,15 @@ export class Client { } private deleteDashboardItemPropertyWithCallbacks(dashboardId: string, itemId: string, propertyKey: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -5058,17 +4936,15 @@ export class Client { } private getDashboardItemPropertyWithCallbacks(dashboardId: string, itemId: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -5143,17 +5019,15 @@ export class Client { } private setDashboardItemPropertyWithCallbacks(dashboardId: string, itemId: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}"; - if (dashboardId === undefined || dashboardId === null) - throw new globalThis.Error("The parameter 'dashboardId' must be defined."); - url_ = url_.replace("{dashboardId}", encodeURIComponent("" + dashboardId)); - if (itemId === undefined || itemId === null) - throw new globalThis.Error("The parameter 'itemId' must be defined."); - url_ = url_.replace("{itemId}", encodeURIComponent("" + itemId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(dashboardId, 'dashboardId'); + Guard.required(itemId, 'itemId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}") + .path("dashboardId", dashboardId) + .path("itemId", itemId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -5252,11 +5126,11 @@ export class Client { } private deleteDashboardWithCallbacks(id: string, onSuccess?: (result: void) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -5324,11 +5198,11 @@ export class Client { } private getDashboardWithCallbacks(id: string, onSuccess?: (result: Dashboard) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -5406,15 +5280,13 @@ export class Client { } private updateDashboardWithCallbacks(id: string, body: DashboardDetails, extendAdminPermissions: boolean | undefined, onSuccess?: (result: Dashboard) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -5498,15 +5370,13 @@ export class Client { } private copyDashboardWithCallbacks(id: string, body: DashboardDetails, extendAdminPermissions: boolean | undefined, onSuccess?: (result: Dashboard) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/dashboard/{id}/copy?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (extendAdminPermissions === null) - throw new globalThis.Error("The parameter 'extendAdminPermissions' cannot be null."); - else if (extendAdminPermissions !== undefined) - url_ += "extendAdminPermissions=" + encodeURIComponent("" + extendAdminPermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(extendAdminPermissions, 'extendAdminPermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/dashboard/{id}/copy") + .path("id", id) + .param("extendAdminPermissions", extendAdminPermissions) + .toString(); const content_ = JSON.stringify(body); @@ -5588,8 +5458,8 @@ export class Client { } private getPolicyWithCallbacks(onSuccess?: (result: WorkspaceDataPolicy) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/data-policy"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy") + .toString(); jQuery.ajax({ url: url_, @@ -5661,12 +5531,11 @@ export class Client { } private getPoliciesWithCallbacks(ids: string | undefined, onSuccess?: (result: ProjectDataPolicies) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/data-policy/project?"; - if (ids === null) - throw new globalThis.Error("The parameter 'ids' cannot be null."); - else if (ids !== undefined) - url_ += "ids=" + encodeURIComponent("" + ids) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(ids, 'ids'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/data-policy/project") + .param("ids", ids) + .toString(); jQuery.ajax({ url: url_, @@ -5744,8 +5613,8 @@ export class Client { } private getEventsWithCallbacks(onSuccess?: (result: IssueEvent[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/events"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/events") + .toString(); jQuery.ajax({ url: url_, @@ -5823,12 +5692,11 @@ export class Client { } private analyseExpressionWithCallbacks(body: JiraExpressionForAnalysis, check: Check | undefined, onSuccess?: (result: JiraExpressionsAnalysis) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/expression/analyse?"; - if (check === null) - throw new globalThis.Error("The parameter 'check' cannot be null."); - else if (check !== undefined) - url_ += "check=" + encodeURIComponent("" + check) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(check, 'check'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/analyse") + .param("check", check) + .toString(); const content_ = JSON.stringify(body); @@ -5910,12 +5778,11 @@ export class Client { } private evaluateJiraExpressionWithCallbacks(body: JiraExpressionEvalRequestBean, expand: string | undefined, onSuccess?: (result: JiraExpressionResult) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/expression/eval?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/eval") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -5996,12 +5863,11 @@ export class Client { } private evaluateJSISJiraExpressionWithCallbacks(body: JiraExpressionEvaluateRequestBean, expand: string | undefined, onSuccess?: (result: JExpEvaluateJiraExpressionResultBean) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/expression/evaluate?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/expression/evaluate") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -6080,8 +5946,8 @@ export class Client { } private getFieldsWithCallbacks(onSuccess?: (result: FieldDetails[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); jQuery.ajax({ url: url_, @@ -6150,8 +6016,8 @@ export class Client { } private createCustomFieldWithCallbacks(body: CustomFieldDefinitionJsonBean, onSuccess?: (result: FieldDetails) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field") + .toString(); const content_ = JSON.stringify(body); @@ -6217,8 +6083,8 @@ export class Client { } private removeAssociationsWithCallbacks(body: FieldAssociationsRequest, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -6293,8 +6159,8 @@ export class Client { } private createAssociationsWithCallbacks(body: FieldAssociationsRequest, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/association"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/association") + .toString(); const content_ = JSON.stringify(body); @@ -6389,40 +6255,25 @@ export class Client { } private getFieldsPaginatedWithCallbacks(startAt: number | undefined, maxResults: number | undefined, type: Type2[] | undefined, id: string[] | undefined, query: string | undefined, orderBy: OrderBy4 | undefined, expand: string | undefined, projectIds: number[] | undefined, onSuccess?: (result: PageBeanField) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (type === null) - throw new globalThis.Error("The parameter 'type' cannot be null."); - else if (type !== undefined) - type && type.forEach(item => { url_ += "type=" + encodeURIComponent("" + item) + "&"; }); - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(type, 'type'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectIds, 'projectIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("type", type) + .paramArray("id", id) + .param("query", query) + .param("orderBy", orderBy) + .param("expand", expand) + .paramArray("projectIds", projectIds) + .toString(); jQuery.ajax({ url: url_, @@ -6507,32 +6358,21 @@ export class Client { } private getTrashedFieldsPaginatedWithCallbacks(startAt: number | undefined, maxResults: number | undefined, id: string[] | undefined, query: string | undefined, expand: Expand | undefined, orderBy: string | undefined, onSuccess?: (result: PageBeanField) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/search/trashed?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(query, 'query'); + Guard.notNull(expand, 'expand'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/search/trashed") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("query", query) + .param("expand", expand) + .param("orderBy", orderBy) + .toString(); jQuery.ajax({ url: url_, @@ -6609,11 +6449,11 @@ export class Client { } private updateCustomFieldWithCallbacks(fieldId: string, body: UpdateCustomFieldDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -6697,31 +6537,21 @@ export class Client { } private getContextsForFieldWithCallbacks(fieldId: string, isAnyIssueType: boolean | undefined, isGlobalContext: boolean | undefined, contextId: number[] | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanCustomFieldContext) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (isAnyIssueType === null) - throw new globalThis.Error("The parameter 'isAnyIssueType' cannot be null."); - else if (isAnyIssueType !== undefined) - url_ += "isAnyIssueType=" + encodeURIComponent("" + isAnyIssueType) + "&"; - if (isGlobalContext === null) - throw new globalThis.Error("The parameter 'isGlobalContext' cannot be null."); - else if (isGlobalContext !== undefined) - url_ += "isGlobalContext=" + encodeURIComponent("" + isGlobalContext) + "&"; - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(isAnyIssueType, 'isAnyIssueType'); + Guard.notNull(isGlobalContext, 'isGlobalContext'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .param("isAnyIssueType", isAnyIssueType) + .param("isGlobalContext", isGlobalContext) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -6791,11 +6621,11 @@ export class Client { } private createCustomFieldContextWithCallbacks(fieldId: string, body: CreateCustomFieldContext, onSuccess?: (result: CreateCustomFieldContext) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -6876,23 +6706,17 @@ export class Client { } private getDefaultValuesWithCallbacks(fieldId: string, contextId: number[] | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanCustomFieldContextDefaultValue) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -6962,11 +6786,11 @@ export class Client { } private setDefaultValuesWithCallbacks(fieldId: string, body: CustomFieldContextDefaultValueUpdate, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/defaultValue") + .path("fieldId", fieldId) + .toString(); const content_ = JSON.stringify(body); @@ -7048,23 +6872,17 @@ export class Client { } private getIssueTypeMappingsForContextsWithCallbacks(fieldId: string, contextId: number[] | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanIssueTypeToContextMapping) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/issuetypemapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -7133,19 +6951,15 @@ export class Client { } private getCustomFieldContextsForProjectsAndIssueTypesWithCallbacks(fieldId: string, body: ProjectIssueTypeMappings, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanContextForProjectAndIssueType) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/mapping") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); const content_ = JSON.stringify(body); @@ -7226,23 +7040,17 @@ export class Client { } private getProjectContextMappingWithCallbacks(fieldId: string, contextId: number[] | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanCustomFieldContextProjectMapping) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === null) - throw new globalThis.Error("The parameter 'contextId' cannot be null."); - else if (contextId !== undefined) - contextId && contextId.forEach(item => { url_ += "contextId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(contextId, 'contextId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/projectmapping") + .path("fieldId", fieldId) + .paramArray("contextId", contextId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -7313,14 +7121,13 @@ export class Client { } private deleteCustomFieldContextWithCallbacks(fieldId: string, contextId: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); jQuery.ajax({ url: url_, @@ -7396,14 +7203,13 @@ export class Client { } private updateCustomFieldContextWithCallbacks(fieldId: string, contextId: number, body: CustomFieldContextUpdateDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7483,14 +7289,13 @@ export class Client { } private addIssueTypesToContextWithCallbacks(fieldId: string, contextId: number, body: IssueTypeIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7574,14 +7379,13 @@ export class Client { } private removeIssueTypesFromContextWithCallbacks(fieldId: string, contextId: number, body: IssueTypeIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/issuetype/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7665,30 +7469,21 @@ export class Client { } private getOptionsForContextWithCallbacks(fieldId: string, contextId: number, optionId: number | undefined, onlyOptions: boolean | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanCustomFieldContextOption) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === null) - throw new globalThis.Error("The parameter 'optionId' cannot be null."); - else if (optionId !== undefined) - url_ += "optionId=" + encodeURIComponent("" + optionId) + "&"; - if (onlyOptions === null) - throw new globalThis.Error("The parameter 'onlyOptions' cannot be null."); - else if (onlyOptions !== undefined) - url_ += "onlyOptions=" + encodeURIComponent("" + onlyOptions) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(optionId, 'optionId'); + Guard.notNull(onlyOptions, 'onlyOptions'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .param("optionId", optionId) + .param("onlyOptions", onlyOptions) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -7763,14 +7558,13 @@ export class Client { } private createCustomFieldOptionWithCallbacks(fieldId: string, contextId: number, body: BulkCustomFieldOptionCreateRequest, onSuccess?: (result: CustomFieldCreatedContextOptionsList) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7849,14 +7643,13 @@ export class Client { } private updateCustomFieldOptionWithCallbacks(fieldId: string, contextId: number, body: BulkCustomFieldOptionUpdateRequest, onSuccess?: (result: CustomFieldUpdatedContextOptionsList) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -7935,14 +7728,13 @@ export class Client { } private reorderCustomFieldOptionsWithCallbacks(fieldId: string, contextId: number, body: OrderOfCustomFieldOptions, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/move") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -8023,17 +7815,15 @@ export class Client { } private deleteCustomFieldOptionWithCallbacks(fieldId: string, contextId: number, optionId: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}") + .path("fieldId", fieldId) + .path("contextId", contextId) + .path("optionId", optionId) + .toString(); jQuery.ajax({ url: url_, @@ -8106,25 +7896,19 @@ export class Client { } private replaceCustomFieldOptionWithCallbacks(fieldId: string, optionId: number, contextId: number, replaceWith: number | undefined, jql: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: TaskProgressBeanRemoveOptionFromIssuesResult | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(optionId, 'optionId'); + Guard.required(contextId, 'contextId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/option/{optionId}/issue") + .path("fieldId", fieldId) + .path("optionId", optionId) + .path("contextId", contextId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .toString(); jQuery.ajax({ url: url_, @@ -8194,14 +7978,13 @@ export class Client { } private assignProjectsToCustomFieldContextWithCallbacks(fieldId: string, contextId: number, body: ProjectIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -8281,14 +8064,13 @@ export class Client { } private removeCustomFieldContextFromProjectsWithCallbacks(fieldId: string, contextId: number, body: ProjectIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (contextId === undefined || contextId === null) - throw new globalThis.Error("The parameter 'contextId' must be defined."); - url_ = url_.replace("{contextId}", encodeURIComponent("" + contextId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.required(contextId, 'contextId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/context/{contextId}/project/remove") + .path("fieldId", fieldId) + .path("contextId", contextId) + .toString(); const content_ = JSON.stringify(body); @@ -8370,19 +8152,15 @@ export class Client { } private getContextsForFieldDeprecatedWithCallbacks(fieldId: string, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanContext) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/contexts?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/contexts") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -8451,23 +8229,17 @@ export class Client { } private getScreensForFieldWithCallbacks(fieldId: string, startAt: number | undefined, maxResults: number | undefined, expand: string | undefined, onSuccess?: (result: PageBeanScreenWithTab) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldId}/screens?"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldId}/screens") + .path("fieldId", fieldId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -8538,19 +8310,15 @@ export class Client { } private getAllIssueFieldOptionsWithCallbacks(fieldKey: string, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanIssueFieldOption) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -8619,11 +8387,11 @@ export class Client { } private createIssueFieldOptionWithCallbacks(fieldKey: string, body: IssueFieldOptionCreateBean, onSuccess?: (result: IssueFieldOption) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option") + .path("fieldKey", fieldKey) + .toString(); const content_ = JSON.stringify(body); @@ -8703,23 +8471,17 @@ export class Client { } private getSelectableIssueFieldOptionsWithCallbacks(fieldKey: string, startAt: number | undefined, maxResults: number | undefined, projectId: number | undefined, onSuccess?: (result: PageBeanIssueFieldOption) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/edit") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); jQuery.ajax({ url: url_, @@ -8791,23 +8553,17 @@ export class Client { } private getVisibleIssueFieldOptionsWithCallbacks(fieldKey: string, startAt: number | undefined, maxResults: number | undefined, projectId: number | undefined, onSuccess?: (result: PageBeanIssueFieldOption) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/suggestions/search") + .path("fieldKey", fieldKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("projectId", projectId) + .toString(); jQuery.ajax({ url: url_, @@ -8877,14 +8633,13 @@ export class Client { } private deleteIssueFieldOptionWithCallbacks(fieldKey: string, optionId: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); jQuery.ajax({ url: url_, @@ -8959,14 +8714,13 @@ export class Client { } private getIssueFieldOptionWithCallbacks(fieldKey: string, optionId: number, onSuccess?: (result: IssueFieldOption) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); jQuery.ajax({ url: url_, @@ -9040,14 +8794,13 @@ export class Client { } private updateIssueFieldOptionWithCallbacks(fieldKey: string, optionId: number, body: IssueFieldOption, onSuccess?: (result: IssueFieldOption) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .toString(); const content_ = JSON.stringify(body); @@ -9128,30 +8881,21 @@ export class Client { } private replaceIssueFieldOptionWithCallbacks(fieldKey: string, optionId: number, replaceWith: number | undefined, jql: string | undefined, overrideScreenSecurity: boolean | undefined, overrideEditableFlag: boolean | undefined, onSuccess?: (result: void) => void, onFail?: (exception: TaskProgressBeanRemoveOptionFromIssuesResult | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue?"; - if (fieldKey === undefined || fieldKey === null) - throw new globalThis.Error("The parameter 'fieldKey' must be defined."); - url_ = url_.replace("{fieldKey}", encodeURIComponent("" + fieldKey)); - if (optionId === undefined || optionId === null) - throw new globalThis.Error("The parameter 'optionId' must be defined."); - url_ = url_.replace("{optionId}", encodeURIComponent("" + optionId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldKey, 'fieldKey'); + Guard.required(optionId, 'optionId'); + Guard.notNull(replaceWith, 'replaceWith'); + Guard.notNull(jql, 'jql'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{fieldKey}/option/{optionId}/issue") + .path("fieldKey", fieldKey) + .path("optionId", optionId) + .param("replaceWith", replaceWith) + .param("jql", jql) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); jQuery.ajax({ url: url_, @@ -9219,11 +8963,11 @@ export class Client { } private deleteCustomFieldWithCallbacks(id: string, onSuccess?: (result: void) => void, onFail?: (exception: TaskProgressBeanObject | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -9315,11 +9059,11 @@ export class Client { } private restoreCustomFieldWithCallbacks(id: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/restore"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/restore") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -9406,11 +9150,11 @@ export class Client { } private trashCustomFieldWithCallbacks(id: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/field/{id}/trash"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/field/{id}/trash") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -9501,28 +9245,19 @@ export class Client { } private getAllFieldConfigurationsWithCallbacks(startAt: number | undefined, maxResults: number | undefined, id: number[] | undefined, isDefault: boolean | undefined, query: string | undefined, onSuccess?: (result: PageBeanFieldConfigurationDetails) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (isDefault === null) - throw new globalThis.Error("The parameter 'isDefault' cannot be null."); - else if (isDefault !== undefined) - url_ += "isDefault=" + encodeURIComponent("" + isDefault) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(isDefault, 'isDefault'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("isDefault", isDefault) + .param("query", query) + .toString(); jQuery.ajax({ url: url_, @@ -9587,8 +9322,8 @@ export class Client { } private createFieldConfigurationWithCallbacks(body: FieldConfigurationDetails, onSuccess?: (result: FieldConfiguration) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration") + .toString(); const content_ = JSON.stringify(body); @@ -9662,11 +9397,11 @@ export class Client { } private deleteFieldConfigurationWithCallbacks(id: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -9741,11 +9476,11 @@ export class Client { } private updateFieldConfigurationWithCallbacks(id: number, body: FieldConfigurationDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9826,19 +9561,15 @@ export class Client { } private getFieldConfigurationItemsWithCallbacks(id: number, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanFieldConfigurationItem) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -9908,11 +9639,11 @@ export class Client { } private updateFieldConfigurationItemsWithCallbacks(id: number, body: FieldConfigurationItemsDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfiguration/{id}/fields") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -9993,20 +9724,15 @@ export class Client { } private getAllFieldConfigurationSchemesWithCallbacks(startAt: number | undefined, maxResults: number | undefined, id: number[] | undefined, onSuccess?: (result: PageBeanFieldConfigurationScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -10076,8 +9802,8 @@ export class Client { } private createFieldConfigurationSchemeWithCallbacks(body: UpdateFieldConfigurationSchemeDetails, onSuccess?: (result: FieldConfigurationScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -10153,20 +9879,15 @@ export class Client { } private getFieldConfigurationSchemeMappingsWithCallbacks(startAt: number | undefined, maxResults: number | undefined, fieldConfigurationSchemeId: number[] | undefined, onSuccess?: (result: PageBeanFieldConfigurationIssueTypeItem) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fieldConfigurationSchemeId === null) - throw new globalThis.Error("The parameter 'fieldConfigurationSchemeId' cannot be null."); - else if (fieldConfigurationSchemeId !== undefined) - fieldConfigurationSchemeId && fieldConfigurationSchemeId.forEach(item => { url_ += "fieldConfigurationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fieldConfigurationSchemeId, 'fieldConfigurationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("fieldConfigurationSchemeId", fieldConfigurationSchemeId) + .toString(); jQuery.ajax({ url: url_, @@ -10242,20 +9963,15 @@ export class Client { } private getFieldConfigurationSchemeProjectMappingWithCallbacks(projectId: number[], startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanFieldConfigurationSchemeProjects) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -10324,8 +10040,8 @@ export class Client { } private assignFieldConfigurationSchemeToProjectWithCallbacks(body: FieldConfigurationSchemeProjectAssociation, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -10404,11 +10120,11 @@ export class Client { } private deleteFieldConfigurationSchemeWithCallbacks(id: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -10484,11 +10200,11 @@ export class Client { } private updateFieldConfigurationSchemeWithCallbacks(id: number, body: UpdateFieldConfigurationSchemeDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -10567,11 +10283,11 @@ export class Client { } private setFieldConfigurationSchemeMappingWithCallbacks(id: number, body: AssociateFieldConfigurationsWithIssueTypesRequest, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -10651,11 +10367,11 @@ export class Client { } private removeIssueTypesFromGlobalFieldConfigurationSchemeWithCallbacks(id: number, body: IssueTypeIdsToRemove, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/fieldconfigurationscheme/{id}/mapping/delete") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -10751,16 +10467,13 @@ export class Client { } private createFilterWithCallbacks(body: Filter, expand: string | undefined, overrideSharePermissions: boolean | undefined, onSuccess?: (result: Filter) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter") + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -10829,8 +10542,8 @@ export class Client { } private getDefaultShareScopeWithCallbacks(onSuccess?: (result: DefaultShareScope) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); jQuery.ajax({ url: url_, @@ -10891,8 +10604,8 @@ export class Client { } private setDefaultShareScopeWithCallbacks(body: DefaultShareScope, onSuccess?: (result: DefaultShareScope) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/defaultShareScope"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/defaultShareScope") + .toString(); const content_ = JSON.stringify(body); @@ -10965,12 +10678,11 @@ export class Client { } private getFavouriteFiltersWithCallbacks(expand: string | undefined, onSuccess?: (result: Filter[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/favourite?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/favourite") + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -11043,16 +10755,13 @@ export class Client { } private getMyFiltersWithCallbacks(expand: string | undefined, includeFavourites: boolean | undefined, onSuccess?: (result: Filter[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/my?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (includeFavourites === null) - throw new globalThis.Error("The parameter 'includeFavourites' cannot be null."); - else if (includeFavourites !== undefined) - url_ += "includeFavourites=" + encodeURIComponent("" + includeFavourites) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(includeFavourites, 'includeFavourites'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/my") + .param("expand", expand) + .param("includeFavourites", includeFavourites) + .toString(); jQuery.ajax({ url: url_, @@ -11154,60 +10863,35 @@ export class Client { } private getFiltersPaginatedWithCallbacks(filterName: string | undefined, accountId: string | undefined, owner: string | undefined, groupname: string | undefined, groupId: string | undefined, projectId: number | undefined, id: number[] | undefined, orderBy: OrderBy5 | undefined, startAt: number | undefined, maxResults: number | undefined, expand: string | undefined, overrideSharePermissions: boolean | undefined, isSubstringMatch: boolean | undefined, onSuccess?: (result: PageBeanFilterDetails) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/search?"; - if (filterName === null) - throw new globalThis.Error("The parameter 'filterName' cannot be null."); - else if (filterName !== undefined) - url_ += "filterName=" + encodeURIComponent("" + filterName) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (owner === null) - throw new globalThis.Error("The parameter 'owner' cannot be null."); - else if (owner !== undefined) - url_ += "owner=" + encodeURIComponent("" + owner) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - if (isSubstringMatch === null) - throw new globalThis.Error("The parameter 'isSubstringMatch' cannot be null."); - else if (isSubstringMatch !== undefined) - url_ += "isSubstringMatch=" + encodeURIComponent("" + isSubstringMatch) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(filterName, 'filterName'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(owner, 'owner'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + Guard.notNull(isSubstringMatch, 'isSubstringMatch'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/search") + .param("filterName", filterName) + .param("accountId", accountId) + .param("owner", owner) + .param("groupname", groupname) + .param("groupId", groupId) + .param("projectId", projectId) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .param("isSubstringMatch", isSubstringMatch) + .toString(); jQuery.ajax({ url: url_, @@ -11276,11 +10960,11 @@ export class Client { } private deleteFilterWithCallbacks(id: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -11347,19 +11031,15 @@ export class Client { } private getFilterWithCallbacks(id: number, expand: string | undefined, overrideSharePermissions: boolean | undefined, onSuccess?: (result: Filter) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); jQuery.ajax({ url: url_, @@ -11431,19 +11111,15 @@ export class Client { } private updateFilterWithCallbacks(id: number, body: Filter, expand: string | undefined, overrideSharePermissions: boolean | undefined, onSuccess?: (result: Filter) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideSharePermissions === null) - throw new globalThis.Error("The parameter 'overrideSharePermissions' cannot be null."); - else if (overrideSharePermissions !== undefined) - url_ += "overrideSharePermissions=" + encodeURIComponent("" + overrideSharePermissions) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideSharePermissions, 'overrideSharePermissions'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}") + .path("id", id) + .param("expand", expand) + .param("overrideSharePermissions", overrideSharePermissions) + .toString(); const content_ = JSON.stringify(body); @@ -11513,11 +11189,11 @@ export class Client { } private resetColumnsWithCallbacks(id: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -11579,11 +11255,11 @@ export class Client { } private getColumnsWithCallbacks(id: number, onSuccess?: (result: ColumnItem[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -11662,17 +11338,15 @@ export class Client { } private setColumnsWithCallbacks(id: number, body: ColumnRequestBody, columns: string[] | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/columns"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/columns") + .path("id", id) + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); jQuery.ajax({ url: url_, @@ -11746,15 +11420,13 @@ export class Client { } private deleteFavouriteForFilterWithCallbacks(id: number, expand: string | undefined, onSuccess?: (result: Filter) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -11820,15 +11492,13 @@ export class Client { } private setFavouriteForFilterWithCallbacks(id: number, expand: string | undefined, onSuccess?: (result: Filter) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/favourite?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/favourite") + .path("id", id) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -11891,11 +11561,11 @@ export class Client { } private changeFilterOwnerWithCallbacks(id: number, body: ChangeFilterOwner, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/owner"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/owner") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -11970,11 +11640,11 @@ export class Client { } private getSharePermissionsWithCallbacks(id: number, onSuccess?: (result: SharePermission[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -12047,11 +11717,11 @@ export class Client { } private addSharePermissionWithCallbacks(id: number, body: SharePermissionInputBean, onSuccess?: (result: SharePermission[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -12133,14 +11803,13 @@ export class Client { } private deleteSharePermissionWithCallbacks(id: number, permissionId: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); jQuery.ajax({ url: url_, @@ -12203,14 +11872,13 @@ export class Client { } private getSharePermissionWithCallbacks(id: number, permissionId: number, onSuccess?: (result: SharePermission) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/filter/{id}/permission/{permissionId}") + .path("id", id) + .path("permissionId", permissionId) + .toString(); jQuery.ajax({ url: url_, @@ -12280,24 +11948,17 @@ export class Client { } private removeGroupWithCallbacks(groupname: string | undefined, groupId: string | undefined, swapGroup: string | undefined, swapGroupId: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (swapGroup === null) - throw new globalThis.Error("The parameter 'swapGroup' cannot be null."); - else if (swapGroup !== undefined) - url_ += "swapGroup=" + encodeURIComponent("" + swapGroup) + "&"; - if (swapGroupId === null) - throw new globalThis.Error("The parameter 'swapGroupId' cannot be null."); - else if (swapGroupId !== undefined) - url_ += "swapGroupId=" + encodeURIComponent("" + swapGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(swapGroup, 'swapGroup'); + Guard.notNull(swapGroupId, 'swapGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("swapGroup", swapGroup) + .param("swapGroupId", swapGroupId) + .toString(); jQuery.ajax({ url: url_, @@ -12371,20 +12032,15 @@ export class Client { } private getGroupWithCallbacks(groupname: string | undefined, groupId: string | undefined, expand: string | undefined, onSuccess?: (result: Group) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/group?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .param("groupname", groupname) + .param("groupId", groupId) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -12458,8 +12114,8 @@ export class Client { } private createGroupWithCallbacks(body: AddGroupBean, onSuccess?: (result: Group) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/group"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group") + .toString(); const content_ = JSON.stringify(body); @@ -12538,32 +12194,21 @@ export class Client { } private bulkGetGroupsWithCallbacks(startAt: number | undefined, maxResults: number | undefined, groupId: string[] | undefined, groupName: string[] | undefined, accessType: string | undefined, applicationKey: string | undefined, onSuccess?: (result: PageBeanGroupDetails) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/group/bulk?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - groupId && groupId.forEach(item => { url_ += "groupId=" + encodeURIComponent("" + item) + "&"; }); - if (groupName === null) - throw new globalThis.Error("The parameter 'groupName' cannot be null."); - else if (groupName !== undefined) - groupName && groupName.forEach(item => { url_ += "groupName=" + encodeURIComponent("" + item) + "&"; }); - if (accessType === null) - throw new globalThis.Error("The parameter 'accessType' cannot be null."); - else if (accessType !== undefined) - url_ += "accessType=" + encodeURIComponent("" + accessType) + "&"; - if (applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' cannot be null."); - else if (applicationKey !== undefined) - url_ += "applicationKey=" + encodeURIComponent("" + applicationKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(groupName, 'groupName'); + Guard.notNull(accessType, 'accessType'); + Guard.notNull(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/bulk") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("groupId", groupId) + .paramArray("groupName", groupName) + .param("accessType", accessType) + .param("applicationKey", applicationKey) + .toString(); jQuery.ajax({ url: url_, @@ -12642,28 +12287,19 @@ export class Client { } private getUsersFromGroupWithCallbacks(groupname: string | undefined, groupId: string | undefined, includeInactiveUsers: boolean | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanUserDetails) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/group/member?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (includeInactiveUsers === null) - throw new globalThis.Error("The parameter 'includeInactiveUsers' cannot be null."); - else if (includeInactiveUsers !== undefined) - url_ += "includeInactiveUsers=" + encodeURIComponent("" + includeInactiveUsers) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(includeInactiveUsers, 'includeInactiveUsers'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/member") + .param("groupname", groupname) + .param("groupId", groupId) + .param("includeInactiveUsers", includeInactiveUsers) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -12741,24 +12377,17 @@ export class Client { } private removeUserFromGroupWithCallbacks(accountId: string, groupname: string | undefined, groupId: string | undefined, username: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("accountId", accountId) + .param("groupname", groupname) + .param("groupId", groupId) + .param("username", username) + .toString(); jQuery.ajax({ url: url_, @@ -12831,16 +12460,13 @@ export class Client { } private addUserToGroupWithCallbacks(body: UpdateUserToGroupBean, groupname: string | undefined, groupId: string | undefined, onSuccess?: (result: Group) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/group/user?"; - if (groupname === null) - throw new globalThis.Error("The parameter 'groupname' cannot be null."); - else if (groupname !== undefined) - url_ += "groupname=" + encodeURIComponent("" + groupname) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(groupname, 'groupname'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/group/user") + .param("groupname", groupname) + .param("groupId", groupId) + .toString(); const content_ = JSON.stringify(body); @@ -12929,36 +12555,23 @@ export class Client { } private findGroupsWithCallbacks(accountId: string | undefined, query: string | undefined, exclude: string[] | undefined, excludeId: string[] | undefined, maxResults: number | undefined, caseInsensitive: boolean | undefined, userName: string | undefined, onSuccess?: (result: FoundGroups) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/groups/picker?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeId === null) - throw new globalThis.Error("The parameter 'excludeId' cannot be null."); - else if (excludeId !== undefined) - excludeId && excludeId.forEach(item => { url_ += "excludeId=" + encodeURIComponent("" + item) + "&"; }); - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (userName === null) - throw new globalThis.Error("The parameter 'userName' cannot be null."); - else if (userName !== undefined) - url_ += "userName=" + encodeURIComponent("" + userName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeId, 'excludeId'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(userName, 'userName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groups/picker") + .param("accountId", accountId) + .param("query", query) + .paramArray("exclude", exclude) + .paramArray("excludeId", excludeId) + .param("maxResults", maxResults) + .param("caseInsensitive", caseInsensitive) + .param("userName", userName) + .toString(); jQuery.ajax({ url: url_, @@ -13024,44 +12637,27 @@ export class Client { } private findUsersAndGroupsWithCallbacks(query: string, maxResults: number | undefined, showAvatar: boolean | undefined, fieldId: string | undefined, projectId: string[] | undefined, issueTypeId: string[] | undefined, avatarSize: AvatarSize | undefined, caseInsensitive: boolean | undefined, excludeConnectAddons: boolean | undefined, onSuccess?: (result: FoundUsersAndGroups) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/groupuserpicker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' cannot be null."); - else if (fieldId !== undefined) - url_ += "fieldId=" + encodeURIComponent("" + fieldId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - issueTypeId && issueTypeId.forEach(item => { url_ += "issueTypeId=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (caseInsensitive === null) - throw new globalThis.Error("The parameter 'caseInsensitive' cannot be null."); - else if (caseInsensitive !== undefined) - url_ += "caseInsensitive=" + encodeURIComponent("" + caseInsensitive) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(fieldId, 'fieldId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(caseInsensitive, 'caseInsensitive'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/groupuserpicker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .param("fieldId", fieldId) + .paramArray("projectId", projectId) + .paramArray("issueTypeId", issueTypeId) + .param("avatarSize", avatarSize) + .param("caseInsensitive", caseInsensitive) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); jQuery.ajax({ url: url_, @@ -13134,8 +12730,8 @@ export class Client { } private getLicenseWithCallbacks(onSuccess?: (result: License) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/instance/license"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/instance/license") + .toString(); jQuery.ajax({ url: url_, @@ -13197,12 +12793,11 @@ export class Client { } private createIssueWithCallbacks(body: IssueUpdateDetails, updateHistory: boolean | undefined, onSuccess?: (result: CreatedIssue) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue?"; - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(updateHistory, 'updateHistory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue") + .param("updateHistory", updateHistory) + .toString(); const content_ = JSON.stringify(body); @@ -13292,8 +12887,8 @@ export class Client { } private archiveIssuesWithCallbacks(body: ArchiveIssueAsyncRequest, onSuccess?: (result: string) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -13372,8 +12967,8 @@ export class Client { } private archiveIssuesWithCallbacks(body: IssueArchivalSyncRequest, onSuccess?: (result: IssueArchivalSyncResponse) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/archive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/archive") + .toString(); const content_ = JSON.stringify(body); @@ -13458,8 +13053,8 @@ export class Client { } private createIssuesWithCallbacks(body: IssuesUpdateBean, onSuccess?: (result: CreatedIssues) => void, onFail?: (exception: CreatedIssues | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/bulk"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulk") + .toString(); const content_ = JSON.stringify(body); @@ -13532,8 +13127,8 @@ export class Client { } private bulkFetchIssuesWithCallbacks(body: BulkFetchIssueRequestBean, onSuccess?: (result: BulkIssueResults) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/bulkfetch"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/bulkfetch") + .toString(); const content_ = JSON.stringify(body); @@ -13608,28 +13203,19 @@ export class Client { } private getCreateIssueMetaWithCallbacks(projectIds: string[] | undefined, projectKeys: string[] | undefined, issuetypeIds: string[] | undefined, issuetypeNames: string[] | undefined, expand: string | undefined, onSuccess?: (result: IssueCreateMetadata) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta?"; - if (projectIds === null) - throw new globalThis.Error("The parameter 'projectIds' cannot be null."); - else if (projectIds !== undefined) - projectIds && projectIds.forEach(item => { url_ += "projectIds=" + encodeURIComponent("" + item) + "&"; }); - if (projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' cannot be null."); - else if (projectKeys !== undefined) - projectKeys && projectKeys.forEach(item => { url_ += "projectKeys=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeIds === null) - throw new globalThis.Error("The parameter 'issuetypeIds' cannot be null."); - else if (issuetypeIds !== undefined) - issuetypeIds && issuetypeIds.forEach(item => { url_ += "issuetypeIds=" + encodeURIComponent("" + item) + "&"; }); - if (issuetypeNames === null) - throw new globalThis.Error("The parameter 'issuetypeNames' cannot be null."); - else if (issuetypeNames !== undefined) - issuetypeNames && issuetypeNames.forEach(item => { url_ += "issuetypeNames=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectIds, 'projectIds'); + Guard.notNull(projectKeys, 'projectKeys'); + Guard.notNull(issuetypeIds, 'issuetypeIds'); + Guard.notNull(issuetypeNames, 'issuetypeNames'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta") + .paramArray("projectIds", projectIds) + .paramArray("projectKeys", projectKeys) + .paramArray("issuetypeIds", issuetypeIds) + .paramArray("issuetypeNames", issuetypeNames) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -13693,19 +13279,15 @@ export class Client { } private getCreateIssueMetaIssueTypesWithCallbacks(projectIdOrKey: string, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageOfCreateMetaIssueTypes) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -13774,22 +13356,17 @@ export class Client { } private getCreateIssueMetaIssueTypeIdWithCallbacks(projectIdOrKey: string, issueTypeId: string, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageOfCreateMetaIssueTypeWithField) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}") + .path("projectIdOrKey", projectIdOrKey) + .path("issueTypeId", issueTypeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -13857,12 +13434,11 @@ export class Client { } private getIssueLimitReportWithCallbacks(isReturningKeys: boolean | undefined, onSuccess?: (result: IssueLimitReportResponseBean) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/limit/report?"; - if (isReturningKeys === null) - throw new globalThis.Error("The parameter 'isReturningKeys' cannot be null."); - else if (isReturningKeys !== undefined) - url_ += "isReturningKeys=" + encodeURIComponent("" + isReturningKeys) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(isReturningKeys, 'isReturningKeys'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/limit/report") + .param("isReturningKeys", isReturningKeys) + .toString(); jQuery.ajax({ url: url_, @@ -13933,32 +13509,21 @@ export class Client { } private getIssuePickerResourceWithCallbacks(query: string | undefined, currentJQL: string | undefined, currentIssueKey: string | undefined, currentProjectId: string | undefined, showSubTasks: boolean | undefined, showSubTaskParent: boolean | undefined, onSuccess?: (result: IssuePickerSuggestions) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/picker?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (currentJQL === null) - throw new globalThis.Error("The parameter 'currentJQL' cannot be null."); - else if (currentJQL !== undefined) - url_ += "currentJQL=" + encodeURIComponent("" + currentJQL) + "&"; - if (currentIssueKey === null) - throw new globalThis.Error("The parameter 'currentIssueKey' cannot be null."); - else if (currentIssueKey !== undefined) - url_ += "currentIssueKey=" + encodeURIComponent("" + currentIssueKey) + "&"; - if (currentProjectId === null) - throw new globalThis.Error("The parameter 'currentProjectId' cannot be null."); - else if (currentProjectId !== undefined) - url_ += "currentProjectId=" + encodeURIComponent("" + currentProjectId) + "&"; - if (showSubTasks === null) - throw new globalThis.Error("The parameter 'showSubTasks' cannot be null."); - else if (showSubTasks !== undefined) - url_ += "showSubTasks=" + encodeURIComponent("" + showSubTasks) + "&"; - if (showSubTaskParent === null) - throw new globalThis.Error("The parameter 'showSubTaskParent' cannot be null."); - else if (showSubTaskParent !== undefined) - url_ += "showSubTaskParent=" + encodeURIComponent("" + showSubTaskParent) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(currentJQL, 'currentJQL'); + Guard.notNull(currentIssueKey, 'currentIssueKey'); + Guard.notNull(currentProjectId, 'currentProjectId'); + Guard.notNull(showSubTasks, 'showSubTasks'); + Guard.notNull(showSubTaskParent, 'showSubTaskParent'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/picker") + .param("query", query) + .param("currentJQL", currentJQL) + .param("currentIssueKey", currentIssueKey) + .param("currentProjectId", currentProjectId) + .param("showSubTasks", showSubTasks) + .param("showSubTaskParent", showSubTaskParent) + .toString(); jQuery.ajax({ url: url_, @@ -14019,8 +13584,8 @@ export class Client { } private bulkSetIssuesPropertiesListWithCallbacks(body: IssueEntityProperties, onSuccess?: (result: void) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/properties"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties") + .toString(); const content_ = JSON.stringify(body); @@ -14091,8 +13656,8 @@ export class Client { } private bulkSetIssuePropertiesByIssueWithCallbacks(body: MultiIssueEntityProperties, onSuccess?: (result: void) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/multi"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/multi") + .toString(); const content_ = JSON.stringify(body); @@ -14170,11 +13735,11 @@ export class Client { } private bulkDeleteIssuePropertyWithCallbacks(propertyKey: string, body: IssueFilterForBulkPropertyDelete, onSuccess?: (result: void) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -14245,11 +13810,11 @@ export class Client { } private bulkSetIssuePropertyWithCallbacks(propertyKey: string, body: BulkIssuePropertyUpdateRequest, onSuccess?: (result: void) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -14321,8 +13886,8 @@ export class Client { } private unarchiveIssuesWithCallbacks(body: IssueArchivalSyncRequest, onSuccess?: (result: IssueArchivalSyncResponse) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/unarchive"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/unarchive") + .toString(); const content_ = JSON.stringify(body); @@ -14400,8 +13965,8 @@ export class Client { } private getIsWatchingIssueBulkWithCallbacks(body: IssueList, onSuccess?: (result: BulkIssueIsWatching) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/watching"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/watching") + .toString(); const content_ = JSON.stringify(body); @@ -14468,15 +14033,13 @@ export class Client { } private deleteIssueWithCallbacks(issueIdOrKey: string, deleteSubtasks: DeleteSubtasks | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (deleteSubtasks === null) - throw new globalThis.Error("The parameter 'deleteSubtasks' cannot be null."); - else if (deleteSubtasks !== undefined) - url_ += "deleteSubtasks=" + encodeURIComponent("" + deleteSubtasks) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(deleteSubtasks, 'deleteSubtasks'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("deleteSubtasks", deleteSubtasks) + .toString(); jQuery.ajax({ url: url_, @@ -14585,35 +14148,23 @@ export class Client { } private getIssueWithCallbacks(issueIdOrKey: string, fields: string[] | undefined, fieldsByKeys: boolean | undefined, expand: string | undefined, properties: string[] | undefined, updateHistory: boolean | undefined, failFast: boolean | undefined, onSuccess?: (result: IssueBean) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (updateHistory === null) - throw new globalThis.Error("The parameter 'updateHistory' cannot be null."); - else if (updateHistory !== undefined) - url_ += "updateHistory=" + encodeURIComponent("" + updateHistory) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(fields, 'fields'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(updateHistory, 'updateHistory'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .paramArray("fields", fields) + .param("fieldsByKeys", fieldsByKeys) + .param("expand", expand) + .paramArray("properties", properties) + .param("updateHistory", updateHistory) + .param("failFast", failFast) + .toString(); jQuery.ajax({ url: url_, @@ -14684,31 +14235,21 @@ export class Client { } private editIssueWithCallbacks(issueIdOrKey: string, body: IssueUpdateDetails, notifyUsers: boolean | undefined, overrideScreenSecurity: boolean | undefined, overrideEditableFlag: boolean | undefined, returnIssue: boolean | undefined, expand: string | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (returnIssue === null) - throw new globalThis.Error("The parameter 'returnIssue' cannot be null."); - else if (returnIssue !== undefined) - url_ += "returnIssue=" + encodeURIComponent("" + returnIssue) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(returnIssue, 'returnIssue'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .param("returnIssue", returnIssue) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -14804,11 +14345,11 @@ export class Client { } private assignIssueWithCallbacks(issueIdOrKey: string, body: User, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/assignee") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -14883,11 +14424,11 @@ export class Client { } private addAttachmentWithCallbacks(issueIdOrKey: string, body: Blob, onSuccess?: (result: Attachment[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/attachments") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = body; @@ -14970,19 +14511,15 @@ export class Client { } private getChangeLogsWithCallbacks(issueIdOrKey: string, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanChangelog) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -15044,11 +14581,11 @@ export class Client { } private getChangeLogsByIdsWithCallbacks(issueIdOrKey: string, body: IssueChangelogIds, onSuccess?: (result: PageOfChangelogs) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/changelog/list") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -15122,27 +14659,19 @@ export class Client { } private getCommentsWithCallbacks(issueIdOrKey: string, startAt: number | undefined, maxResults: number | undefined, orderBy: OrderBy6 | undefined, expand: string | undefined, onSuccess?: (result: PageOfComments) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -15213,15 +14742,13 @@ export class Client { } private addCommentWithCallbacks(issueIdOrKey: string, body: Comment, expand: string | undefined, onSuccess?: (result: Comment) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -15300,14 +14827,13 @@ export class Client { } private deleteCommentWithCallbacks(issueIdOrKey: string, id: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -15379,18 +14905,15 @@ export class Client { } private getCommentWithCallbacks(issueIdOrKey: string, id: string, expand: string | undefined, onSuccess?: (result: Comment) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -15460,26 +14983,19 @@ export class Client { } private updateCommentWithCallbacks(issueIdOrKey: string, id: string, body: Comment, notifyUsers: boolean | undefined, overrideEditableFlag: boolean | undefined, expand: string | undefined, onSuccess?: (result: Comment) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/comment/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("overrideEditableFlag", overrideEditableFlag) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -15555,19 +15071,15 @@ export class Client { } private getEditIssueMetaWithCallbacks(issueIdOrKey: string, overrideScreenSecurity: boolean | undefined, overrideEditableFlag: boolean | undefined, onSuccess?: (result: IssueUpdateMetadata) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (overrideScreenSecurity === null) - throw new globalThis.Error("The parameter 'overrideScreenSecurity' cannot be null."); - else if (overrideScreenSecurity !== undefined) - url_ += "overrideScreenSecurity=" + encodeURIComponent("" + overrideScreenSecurity) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(overrideScreenSecurity, 'overrideScreenSecurity'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/editmeta") + .path("issueIdOrKey", issueIdOrKey) + .param("overrideScreenSecurity", overrideScreenSecurity) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); jQuery.ajax({ url: url_, @@ -15638,11 +15150,11 @@ export class Client { } private notifyWithCallbacks(issueIdOrKey: string, body: Notification, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/notify") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -15717,11 +15229,11 @@ export class Client { } private getIssuePropertyKeysWithCallbacks(issueIdOrKey: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties") + .path("issueIdOrKey", issueIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -15784,14 +15296,13 @@ export class Client { } private deleteIssuePropertyWithCallbacks(issueIdOrKey: string, propertyKey: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -15854,14 +15365,13 @@ export class Client { } private getIssuePropertyWithCallbacks(issueIdOrKey: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -15929,14 +15439,13 @@ export class Client { } private setIssuePropertyWithCallbacks(issueIdOrKey: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -16024,15 +15533,13 @@ export class Client { } private deleteRemoteIssueLinkByGlobalIdWithCallbacks(issueIdOrKey: string, globalId: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === undefined || globalId === null) - throw new globalThis.Error("The parameter 'globalId' must be defined and cannot be null."); - else - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); jQuery.ajax({ url: url_, @@ -16103,15 +15610,13 @@ export class Client { } private getRemoteIssueLinksWithCallbacks(issueIdOrKey: string, globalId: string | undefined, onSuccess?: (result: RemoteIssueLink) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (globalId === null) - throw new globalThis.Error("The parameter 'globalId' cannot be null."); - else if (globalId !== undefined) - url_ += "globalId=" + encodeURIComponent("" + globalId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(globalId, 'globalId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .param("globalId", globalId) + .toString(); jQuery.ajax({ url: url_, @@ -16189,11 +15694,11 @@ export class Client { } private createOrUpdateRemoteIssueLinkWithCallbacks(issueIdOrKey: string, body: RemoteIssueLinkRequest, onSuccess?: (result: RemoteIssueLinkIdentifies) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -16279,14 +15784,13 @@ export class Client { } private deleteRemoteIssueLinkByIdWithCallbacks(issueIdOrKey: string, linkId: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); jQuery.ajax({ url: url_, @@ -16357,14 +15861,13 @@ export class Client { } private getRemoteIssueLinkByIdWithCallbacks(issueIdOrKey: string, linkId: string, onSuccess?: (result: RemoteIssueLink) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); jQuery.ajax({ url: url_, @@ -16439,14 +15942,13 @@ export class Client { } private updateRemoteIssueLinkWithCallbacks(issueIdOrKey: string, linkId: string, body: RemoteIssueLinkRequest, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/remotelink/{linkId}") + .path("issueIdOrKey", issueIdOrKey) + .path("linkId", linkId) + .toString(); const content_ = JSON.stringify(body); @@ -16530,31 +16032,21 @@ export class Client { } private getTransitionsWithCallbacks(issueIdOrKey: string, expand: string | undefined, transitionId: string | undefined, skipRemoteOnlyCondition: boolean | undefined, includeUnavailableTransitions: boolean | undefined, sortByOpsBarAndStatus: boolean | undefined, onSuccess?: (result: Transitions) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' cannot be null."); - else if (transitionId !== undefined) - url_ += "transitionId=" + encodeURIComponent("" + transitionId) + "&"; - if (skipRemoteOnlyCondition === null) - throw new globalThis.Error("The parameter 'skipRemoteOnlyCondition' cannot be null."); - else if (skipRemoteOnlyCondition !== undefined) - url_ += "skipRemoteOnlyCondition=" + encodeURIComponent("" + skipRemoteOnlyCondition) + "&"; - if (includeUnavailableTransitions === null) - throw new globalThis.Error("The parameter 'includeUnavailableTransitions' cannot be null."); - else if (includeUnavailableTransitions !== undefined) - url_ += "includeUnavailableTransitions=" + encodeURIComponent("" + includeUnavailableTransitions) + "&"; - if (sortByOpsBarAndStatus === null) - throw new globalThis.Error("The parameter 'sortByOpsBarAndStatus' cannot be null."); - else if (sortByOpsBarAndStatus !== undefined) - url_ += "sortByOpsBarAndStatus=" + encodeURIComponent("" + sortByOpsBarAndStatus) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(transitionId, 'transitionId'); + Guard.notNull(skipRemoteOnlyCondition, 'skipRemoteOnlyCondition'); + Guard.notNull(includeUnavailableTransitions, 'includeUnavailableTransitions'); + Guard.notNull(sortByOpsBarAndStatus, 'sortByOpsBarAndStatus'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .param("expand", expand) + .param("transitionId", transitionId) + .param("skipRemoteOnlyCondition", skipRemoteOnlyCondition) + .param("includeUnavailableTransitions", includeUnavailableTransitions) + .param("sortByOpsBarAndStatus", sortByOpsBarAndStatus) + .toString(); jQuery.ajax({ url: url_, @@ -16620,11 +16112,11 @@ export class Client { } private doTransitionWithCallbacks(issueIdOrKey: string, body: IssueUpdateDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/transitions") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -16711,11 +16203,11 @@ export class Client { } private removeVoteWithCallbacks(issueIdOrKey: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -16777,11 +16269,11 @@ export class Client { } private getVotesWithCallbacks(issueIdOrKey: string, onSuccess?: (result: Votes) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -16847,11 +16339,11 @@ export class Client { } private addVoteWithCallbacks(issueIdOrKey: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/votes") + .path("issueIdOrKey", issueIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -16924,19 +16416,15 @@ export class Client { } private removeWatcherWithCallbacks(issueIdOrKey: string, username: string | undefined, accountId: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .param("username", username) + .param("accountId", accountId) + .toString(); jQuery.ajax({ url: url_, @@ -17006,11 +16494,11 @@ export class Client { } private getIssueWatchersWithCallbacks(issueIdOrKey: string, onSuccess?: (result: Watchers) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -17077,11 +16565,11 @@ export class Client { } private addWatcherWithCallbacks(issueIdOrKey: string, body: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/watchers") + .path("issueIdOrKey", issueIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -17166,19 +16654,15 @@ export class Client { } private bulkDeleteWorklogsWithCallbacks(issueIdOrKey: string, body: WorklogIdsRequestBean, adjustEstimate: AdjustEstimate | undefined, overrideEditableFlag: boolean | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -17257,31 +16741,21 @@ export class Client { } private getIssueWorklogWithCallbacks(issueIdOrKey: string, startAt: number | undefined, maxResults: number | undefined, startedAfter: number | undefined, startedBefore: number | undefined, expand: string | undefined, onSuccess?: (result: PageOfWorklogs) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (startedAfter === null) - throw new globalThis.Error("The parameter 'startedAfter' cannot be null."); - else if (startedAfter !== undefined) - url_ += "startedAfter=" + encodeURIComponent("" + startedAfter) + "&"; - if (startedBefore === null) - throw new globalThis.Error("The parameter 'startedBefore' cannot be null."); - else if (startedBefore !== undefined) - url_ += "startedBefore=" + encodeURIComponent("" + startedBefore) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(startedAfter, 'startedAfter'); + Guard.notNull(startedBefore, 'startedBefore'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("startedAfter", startedAfter) + .param("startedBefore", startedBefore) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -17358,35 +16832,23 @@ export class Client { } private addWorklogWithCallbacks(issueIdOrKey: string, body: Worklog, notifyUsers: boolean | undefined, adjustEstimate: AdjustEstimate2 | undefined, newEstimate: string | undefined, reduceBy: string | undefined, expand: string | undefined, overrideEditableFlag: boolean | undefined, onSuccess?: (result: Worklog) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (reduceBy === null) - throw new globalThis.Error("The parameter 'reduceBy' cannot be null."); - else if (reduceBy !== undefined) - url_ += "reduceBy=" + encodeURIComponent("" + reduceBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(reduceBy, 'reduceBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog") + .path("issueIdOrKey", issueIdOrKey) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("reduceBy", reduceBy) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -17469,19 +16931,15 @@ export class Client { } private bulkMoveWorklogsWithCallbacks(issueIdOrKey: string, body: WorklogsMoveRequestBean, adjustEstimate: AdjustEstimate3 | undefined, overrideEditableFlag: boolean | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/move") + .path("issueIdOrKey", issueIdOrKey) + .param("adjustEstimate", adjustEstimate) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -17566,34 +17024,23 @@ export class Client { } private deleteWorklogWithCallbacks(issueIdOrKey: string, id: string, notifyUsers: boolean | undefined, adjustEstimate: AdjustEstimate4 | undefined, newEstimate: string | undefined, increaseBy: string | undefined, overrideEditableFlag: boolean | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (increaseBy === null) - throw new globalThis.Error("The parameter 'increaseBy' cannot be null."); - else if (increaseBy !== undefined) - url_ += "increaseBy=" + encodeURIComponent("" + increaseBy) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(increaseBy, 'increaseBy'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("increaseBy", increaseBy) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); jQuery.ajax({ url: url_, @@ -17663,18 +17110,15 @@ export class Client { } private getWorklogWithCallbacks(issueIdOrKey: string, id: string, expand: string | undefined, onSuccess?: (result: Worklog) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -17750,34 +17194,23 @@ export class Client { } private updateWorklogWithCallbacks(issueIdOrKey: string, id: string, body: Worklog, notifyUsers: boolean | undefined, adjustEstimate: AdjustEstimate5 | undefined, newEstimate: string | undefined, expand: string | undefined, overrideEditableFlag: boolean | undefined, onSuccess?: (result: Worklog) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}?"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (notifyUsers === null) - throw new globalThis.Error("The parameter 'notifyUsers' cannot be null."); - else if (notifyUsers !== undefined) - url_ += "notifyUsers=" + encodeURIComponent("" + notifyUsers) + "&"; - if (adjustEstimate === null) - throw new globalThis.Error("The parameter 'adjustEstimate' cannot be null."); - else if (adjustEstimate !== undefined) - url_ += "adjustEstimate=" + encodeURIComponent("" + adjustEstimate) + "&"; - if (newEstimate === null) - throw new globalThis.Error("The parameter 'newEstimate' cannot be null."); - else if (newEstimate !== undefined) - url_ += "newEstimate=" + encodeURIComponent("" + newEstimate) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (overrideEditableFlag === null) - throw new globalThis.Error("The parameter 'overrideEditableFlag' cannot be null."); - else if (overrideEditableFlag !== undefined) - url_ += "overrideEditableFlag=" + encodeURIComponent("" + overrideEditableFlag) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(notifyUsers, 'notifyUsers'); + Guard.notNull(adjustEstimate, 'adjustEstimate'); + Guard.notNull(newEstimate, 'newEstimate'); + Guard.notNull(expand, 'expand'); + Guard.notNull(overrideEditableFlag, 'overrideEditableFlag'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{id}") + .path("issueIdOrKey", issueIdOrKey) + .path("id", id) + .param("notifyUsers", notifyUsers) + .param("adjustEstimate", adjustEstimate) + .param("newEstimate", newEstimate) + .param("expand", expand) + .param("overrideEditableFlag", overrideEditableFlag) + .toString(); const content_ = JSON.stringify(body); @@ -17852,14 +17285,13 @@ export class Client { } private getWorklogPropertyKeysWithCallbacks(issueIdOrKey: string, worklogId: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .toString(); jQuery.ajax({ url: url_, @@ -17931,17 +17363,15 @@ export class Client { } private deleteWorklogPropertyWithCallbacks(issueIdOrKey: string, worklogId: string, propertyKey: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -18013,17 +17443,15 @@ export class Client { } private getWorklogPropertyWithCallbacks(issueIdOrKey: string, worklogId: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -18096,17 +17524,15 @@ export class Client { } private setWorklogPropertyWithCallbacks(issueIdOrKey: string, worklogId: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}"; - if (issueIdOrKey === undefined || issueIdOrKey === null) - throw new globalThis.Error("The parameter 'issueIdOrKey' must be defined."); - url_ = url_.replace("{issueIdOrKey}", encodeURIComponent("" + issueIdOrKey)); - if (worklogId === undefined || worklogId === null) - throw new globalThis.Error("The parameter 'worklogId' must be defined."); - url_ = url_.replace("{worklogId}", encodeURIComponent("" + worklogId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueIdOrKey, 'issueIdOrKey'); + Guard.required(worklogId, 'worklogId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}/properties/{propertyKey}") + .path("issueIdOrKey", issueIdOrKey) + .path("worklogId", worklogId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -18193,8 +17619,8 @@ export class Client { } private linkIssuesWithCallbacks(body: LinkIssueRequestJsonBean, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issueLink"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink") + .toString(); const content_ = JSON.stringify(body); @@ -18273,11 +17699,11 @@ export class Client { } private deleteIssueLinkWithCallbacks(linkId: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); jQuery.ajax({ url: url_, @@ -18347,11 +17773,11 @@ export class Client { } private getIssueLinkWithCallbacks(linkId: string, onSuccess?: (result: IssueLink) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issueLink/{linkId}"; - if (linkId === undefined || linkId === null) - throw new globalThis.Error("The parameter 'linkId' must be defined."); - url_ = url_.replace("{linkId}", encodeURIComponent("" + linkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(linkId, 'linkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLink/{linkId}") + .path("linkId", linkId) + .toString(); jQuery.ajax({ url: url_, @@ -18420,8 +17846,8 @@ export class Client { } private getIssueLinkTypesWithCallbacks(onSuccess?: (result: IssueLinkTypes) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); jQuery.ajax({ url: url_, @@ -18486,8 +17912,8 @@ export class Client { } private createIssueLinkTypeWithCallbacks(body: IssueLinkType, onSuccess?: (result: IssueLinkType) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType") + .toString(); const content_ = JSON.stringify(body); @@ -18561,11 +17987,11 @@ export class Client { } private deleteIssueLinkTypeWithCallbacks(issueLinkTypeId: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); jQuery.ajax({ url: url_, @@ -18631,11 +18057,11 @@ export class Client { } private getIssueLinkTypeWithCallbacks(issueLinkTypeId: string, onSuccess?: (result: IssueLinkType) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); jQuery.ajax({ url: url_, @@ -18705,11 +18131,11 @@ export class Client { } private updateIssueLinkTypeWithCallbacks(issueLinkTypeId: string, body: IssueLinkType, onSuccess?: (result: IssueLinkType) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}"; - if (issueLinkTypeId === undefined || issueLinkTypeId === null) - throw new globalThis.Error("The parameter 'issueLinkTypeId' must be defined."); - url_ = url_.replace("{issueLinkTypeId}", encodeURIComponent("" + issueLinkTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueLinkTypeId, 'issueLinkTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issueLinkType/{issueLinkTypeId}") + .path("issueLinkTypeId", issueLinkTypeId) + .toString(); const content_ = JSON.stringify(body); @@ -18783,8 +18209,8 @@ export class Client { } private exportArchivedIssuesWithCallbacks(body: ArchivedIssuesFilterRequest, onSuccess?: (result: ExportArchivedIssuesTaskProgressResponse) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issues/archive/export"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issues/archive/export") + .toString(); const content_ = JSON.stringify(body); @@ -18861,8 +18287,8 @@ export class Client { } private getIssueSecuritySchemesWithCallbacks(onSuccess?: (result: SecuritySchemes) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); jQuery.ajax({ url: url_, @@ -18927,8 +18353,8 @@ export class Client { } private createIssueSecuritySchemeWithCallbacks(body: CreateIssueSecuritySchemeDetails, onSuccess?: (result: SecuritySchemeId) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes") + .toString(); const content_ = JSON.stringify(body); @@ -19015,28 +18441,19 @@ export class Client { } private getSecurityLevelsWithCallbacks(startAt: string | undefined, maxResults: string | undefined, id: string[] | undefined, schemeId: string[] | undefined, onlyDefault: boolean | undefined, onSuccess?: (result: PageBeanSecurityLevel) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .param("onlyDefault", onlyDefault) + .toString(); jQuery.ajax({ url: url_, @@ -19114,8 +18531,8 @@ export class Client { } private setDefaultLevelsWithCallbacks(body: SetDefaultLevelsRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/default") + .toString(); const content_ = JSON.stringify(body); @@ -19217,32 +18634,21 @@ export class Client { } private getSecurityLevelMembersWithCallbacks(startAt: string | undefined, maxResults: string | undefined, id: string[] | undefined, schemeId: string[] | undefined, levelId: string[] | undefined, expand: string | undefined, onSuccess?: (result: PageBeanSecurityLevelMember) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (levelId === null) - throw new globalThis.Error("The parameter 'levelId' cannot be null."); - else if (levelId !== undefined) - levelId && levelId.forEach(item => { url_ += "levelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(levelId, 'levelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/level/member") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("schemeId", schemeId) + .paramArray("levelId", levelId) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -19315,24 +18721,17 @@ export class Client { } private searchProjectsUsingSecuritySchemesWithCallbacks(startAt: string | undefined, maxResults: string | undefined, issueSecuritySchemeId: string[] | undefined, projectId: string[] | undefined, onSuccess?: (result: PageBeanIssueSecuritySchemeToProjectMapping) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' cannot be null."); - else if (issueSecuritySchemeId !== undefined) - issueSecuritySchemeId && issueSecuritySchemeId.forEach(item => { url_ += "issueSecuritySchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecuritySchemeId", issueSecuritySchemeId) + .paramArray("projectId", projectId) + .toString(); jQuery.ajax({ url: url_, @@ -19409,8 +18808,8 @@ export class Client { } private associateSchemesToProjectsWithCallbacks(body: AssociateSecuritySchemeWithProjectDetails, onSuccess?: (result: void) => void, onFail?: (exception: TaskProgressBeanObject | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/project") + .toString(); const content_ = JSON.stringify(body); @@ -19509,24 +18908,17 @@ export class Client { } private searchSecuritySchemesWithCallbacks(startAt: string | undefined, maxResults: string | undefined, id: string[] | undefined, projectId: string[] | undefined, onSuccess?: (result: PageBeanSecuritySchemeWithProjects) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .toString(); jQuery.ajax({ url: url_, @@ -19596,11 +18988,11 @@ export class Client { } private getIssueSecuritySchemeWithCallbacks(id: number, onSuccess?: (result: SecurityScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -19666,11 +19058,11 @@ export class Client { } private updateIssueSecuritySchemeWithCallbacks(id: string, body: UpdateIssueSecuritySchemeRequestBean, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -19771,27 +19163,19 @@ export class Client { } private getIssueSecurityLevelMembersWithCallbacks(issueSecuritySchemeId: number, startAt: number | undefined, maxResults: number | undefined, issueSecurityLevelId: string[] | undefined, expand: string | undefined, onSuccess?: (result: PageBeanIssueSecurityLevelMember) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members?"; - if (issueSecuritySchemeId === undefined || issueSecuritySchemeId === null) - throw new globalThis.Error("The parameter 'issueSecuritySchemeId' must be defined."); - url_ = url_.replace("{issueSecuritySchemeId}", encodeURIComponent("" + issueSecuritySchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueSecurityLevelId === null) - throw new globalThis.Error("The parameter 'issueSecurityLevelId' cannot be null."); - else if (issueSecurityLevelId !== undefined) - issueSecurityLevelId && issueSecurityLevelId.forEach(item => { url_ += "issueSecurityLevelId=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueSecuritySchemeId, 'issueSecuritySchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueSecurityLevelId, 'issueSecurityLevelId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{issueSecuritySchemeId}/members") + .path("issueSecuritySchemeId", issueSecuritySchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueSecurityLevelId", issueSecurityLevelId) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -19865,11 +19249,11 @@ export class Client { } private deleteSecuritySchemeWithCallbacks(schemeId: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}") + .path("schemeId", schemeId) + .toString(); jQuery.ajax({ url: url_, @@ -19956,11 +19340,11 @@ export class Client { } private addSecurityLevelWithCallbacks(schemeId: string, body: AddSecuritySchemeLevelsRequestBean, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -20052,18 +19436,15 @@ export class Client { } private removeLevelWithCallbacks(schemeId: string, levelId: string, replaceWith: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: TaskProgressBeanObject | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' cannot be null."); - else if (replaceWith !== undefined) - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.notNull(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .param("replaceWith", replaceWith) + .toString(); jQuery.ajax({ url: url_, @@ -20156,14 +19537,13 @@ export class Client { } private updateSecurityLevelWithCallbacks(schemeId: string, levelId: string, body: UpdateIssueSecurityLevelDetails, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -20255,14 +19635,13 @@ export class Client { } private addSecurityLevelMembersWithCallbacks(schemeId: string, levelId: string, body: SecuritySchemeMembersRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member") + .path("schemeId", schemeId) + .path("levelId", levelId) + .toString(); const content_ = JSON.stringify(body); @@ -20355,17 +19734,15 @@ export class Client { } private removeMemberFromSecurityLevelWithCallbacks(schemeId: string, levelId: string, memberId: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (levelId === undefined || levelId === null) - throw new globalThis.Error("The parameter 'levelId' must be defined."); - url_ = url_.replace("{levelId}", encodeURIComponent("" + levelId)); - if (memberId === undefined || memberId === null) - throw new globalThis.Error("The parameter 'memberId' must be defined."); - url_ = url_.replace("{memberId}", encodeURIComponent("" + memberId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(levelId, 'levelId'); + Guard.required(memberId, 'memberId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuesecurityschemes/{schemeId}/level/{levelId}/member/{memberId}") + .path("schemeId", schemeId) + .path("levelId", levelId) + .path("memberId", memberId) + .toString(); jQuery.ajax({ url: url_, @@ -20451,8 +19828,8 @@ export class Client { } private getIssueAllTypesWithCallbacks(onSuccess?: (result: IssueTypeDetails[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); jQuery.ajax({ url: url_, @@ -20516,8 +19893,8 @@ export class Client { } private createIssueTypeWithCallbacks(body: IssueTypeCreateBean, onSuccess?: (result: IssueTypeDetails) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype") + .toString(); const content_ = JSON.stringify(body); @@ -20600,16 +19977,13 @@ export class Client { } private getIssueTypesForProjectWithCallbacks(projectId: number, level: number | undefined, onSuccess?: (result: IssueTypeDetails[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (level === null) - throw new globalThis.Error("The parameter 'level' cannot be null."); - else if (level !== undefined) - url_ += "level=" + encodeURIComponent("" + level) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(level, 'level'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/project") + .param("projectId", projectId) + .param("level", level) + .toString(); jQuery.ajax({ url: url_, @@ -20683,15 +20057,13 @@ export class Client { } private deleteIssueTypeWithCallbacks(id: string, alternativeIssueTypeId: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (alternativeIssueTypeId === null) - throw new globalThis.Error("The parameter 'alternativeIssueTypeId' cannot be null."); - else if (alternativeIssueTypeId !== undefined) - url_ += "alternativeIssueTypeId=" + encodeURIComponent("" + alternativeIssueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(alternativeIssueTypeId, 'alternativeIssueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .param("alternativeIssueTypeId", alternativeIssueTypeId) + .toString(); jQuery.ajax({ url: url_, @@ -20769,11 +20141,11 @@ export class Client { } private getIssueTypeWithCallbacks(id: string, onSuccess?: (result: IssueTypeDetails) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -20839,11 +20211,11 @@ export class Client { } private updateIssueTypeWithCallbacks(id: string, body: IssueTypeUpdateBean, onSuccess?: (result: IssueTypeDetails) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -20925,11 +20297,11 @@ export class Client { } private getAlternativeIssueTypesWithCallbacks(id: string, onSuccess?: (result: IssueTypeDetails[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/alternatives") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -21001,23 +20373,17 @@ export class Client { } private createIssueTypeAvatarWithCallbacks(id: string, size: number, body: any, x: number | undefined, y: number | undefined, onSuccess?: (result: Avatar) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{id}/avatar2") + .path("id", id) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -21095,11 +20461,11 @@ export class Client { } private getIssueTypePropertyKeysWithCallbacks(issueTypeId: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties") + .path("issueTypeId", issueTypeId) + .toString(); jQuery.ajax({ url: url_, @@ -21166,14 +20532,13 @@ export class Client { } private deleteIssueTypePropertyWithCallbacks(issueTypeId: string, propertyKey: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -21244,14 +20609,13 @@ export class Client { } private getIssueTypePropertyWithCallbacks(issueTypeId: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -21323,14 +20687,13 @@ export class Client { } private setIssueTypePropertyWithCallbacks(issueTypeId: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}"; - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeId, 'issueTypeId'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetype/{issueTypeId}/properties/{propertyKey}") + .path("issueTypeId", issueTypeId) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -21428,32 +20791,21 @@ export class Client { } private getAllIssueTypeSchemesWithCallbacks(startAt: number | undefined, maxResults: number | undefined, id: number[] | undefined, orderBy: OrderBy7 | undefined, expand: string | undefined, queryString: string | undefined, onSuccess?: (result: PageBeanIssueTypeScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("orderBy", orderBy) + .param("expand", expand) + .param("queryString", queryString) + .toString(); jQuery.ajax({ url: url_, @@ -21522,8 +20874,8 @@ export class Client { } private createIssueTypeSchemeWithCallbacks(body: IssueTypeSchemeDetails, onSuccess?: (result: IssueTypeSchemeID) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme") + .toString(); const content_ = JSON.stringify(body); @@ -21603,20 +20955,15 @@ export class Client { } private getIssueTypeSchemesMappingWithCallbacks(startAt: number | undefined, maxResults: number | undefined, issueTypeSchemeId: number[] | undefined, onSuccess?: (result: PageBeanIssueTypeSchemeMapping) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' cannot be null."); - else if (issueTypeSchemeId !== undefined) - issueTypeSchemeId && issueTypeSchemeId.forEach(item => { url_ += "issueTypeSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeSchemeId", issueTypeSchemeId) + .toString(); jQuery.ajax({ url: url_, @@ -21688,20 +21035,15 @@ export class Client { } private getIssueTypeSchemeForProjectsWithCallbacks(projectId: number[], startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanIssueTypeSchemeProjects) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -21770,8 +21112,8 @@ export class Client { } private assignIssueTypeSchemeToProjectWithCallbacks(body: IssueTypeSchemeProjectAssociation, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -21850,11 +21192,11 @@ export class Client { } private deleteIssueTypeSchemeWithCallbacks(issueTypeSchemeId: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); jQuery.ajax({ url: url_, @@ -21929,11 +21271,11 @@ export class Client { } private updateIssueTypeSchemeWithCallbacks(issueTypeSchemeId: number, body: IssueTypeSchemeUpdateDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -22012,11 +21354,11 @@ export class Client { } private addIssueTypesToIssueTypeSchemeWithCallbacks(issueTypeSchemeId: number, body: IssueTypeIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -22095,11 +21437,11 @@ export class Client { } private reorderIssueTypesInIssueTypeSchemeWithCallbacks(issueTypeSchemeId: number, body: OrderOfIssueTypes, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/move") + .path("issueTypeSchemeId", issueTypeSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -22179,14 +21521,13 @@ export class Client { } private removeIssueTypeFromIssueTypeSchemeWithCallbacks(issueTypeSchemeId: number, issueTypeId: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}"; - if (issueTypeSchemeId === undefined || issueTypeSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeSchemeId' must be defined."); - url_ = url_.replace("{issueTypeSchemeId}", encodeURIComponent("" + issueTypeSchemeId)); - if (issueTypeId === undefined || issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' must be defined."); - url_ = url_.replace("{issueTypeId}", encodeURIComponent("" + issueTypeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeSchemeId, 'issueTypeSchemeId'); + Guard.required(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescheme/{issueTypeSchemeId}/issuetype/{issueTypeId}") + .path("issueTypeSchemeId", issueTypeSchemeId) + .path("issueTypeId", issueTypeId) + .toString(); jQuery.ajax({ url: url_, @@ -22269,32 +21610,21 @@ export class Client { } private getIssueTypeScreenSchemesWithCallbacks(startAt: number | undefined, maxResults: number | undefined, id: number[] | undefined, queryString: string | undefined, orderBy: OrderBy8 | undefined, expand: string | undefined, onSuccess?: (result: PageBeanIssueTypeScreenScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -22364,8 +21694,8 @@ export class Client { } private createIssueTypeScreenSchemeWithCallbacks(body: IssueTypeScreenSchemeDetails, onSuccess?: (result: IssueTypeScreenSchemeId) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -22449,20 +21779,15 @@ export class Client { } private getIssueTypeScreenSchemeMappingsWithCallbacks(startAt: number | undefined, maxResults: number | undefined, issueTypeScreenSchemeId: number[] | undefined, onSuccess?: (result: PageBeanIssueTypeScreenSchemeItem) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' cannot be null."); - else if (issueTypeScreenSchemeId !== undefined) - issueTypeScreenSchemeId && issueTypeScreenSchemeId.forEach(item => { url_ += "issueTypeScreenSchemeId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/mapping") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); jQuery.ajax({ url: url_, @@ -22534,20 +21859,15 @@ export class Client { } private getIssueTypeScreenSchemeProjectAssociationsWithCallbacks(projectId: number[], startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanIssueTypeScreenSchemesProjects) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .paramArray("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -22616,8 +21936,8 @@ export class Client { } private assignIssueTypeScreenSchemeToProjectWithCallbacks(body: IssueTypeScreenSchemeProjectAssociation, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -22696,11 +22016,11 @@ export class Client { } private deleteIssueTypeScreenSchemeWithCallbacks(issueTypeScreenSchemeId: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); jQuery.ajax({ url: url_, @@ -22776,11 +22096,11 @@ export class Client { } private updateIssueTypeScreenSchemeWithCallbacks(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeUpdateDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -22859,11 +22179,11 @@ export class Client { } private appendMappingsForIssueTypeScreenSchemeWithCallbacks(issueTypeScreenSchemeId: string, body: IssueTypeScreenSchemeMappingDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -22946,11 +22266,11 @@ export class Client { } private updateDefaultScreenSchemeWithCallbacks(issueTypeScreenSchemeId: string, body: UpdateDefaultScreenScheme, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/default") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -23029,11 +22349,11 @@ export class Client { } private removeMappingsFromIssueTypeScreenSchemeWithCallbacks(issueTypeScreenSchemeId: string, body: IssueTypeIds, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/mapping/remove") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -23115,23 +22435,17 @@ export class Client { } private getProjectsForIssueTypeScreenSchemeWithCallbacks(issueTypeScreenSchemeId: number, startAt: number | undefined, maxResults: number | undefined, query: string | undefined, onSuccess?: (result: PageBeanProjectDetails) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project?"; - if (issueTypeScreenSchemeId === undefined || issueTypeScreenSchemeId === null) - throw new globalThis.Error("The parameter 'issueTypeScreenSchemeId' must be defined."); - url_ = url_.replace("{issueTypeScreenSchemeId}", encodeURIComponent("" + issueTypeScreenSchemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(issueTypeScreenSchemeId, 'issueTypeScreenSchemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/issuetypescreenscheme/{issueTypeScreenSchemeId}/project") + .path("issueTypeScreenSchemeId", issueTypeScreenSchemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .toString(); jQuery.ajax({ url: url_, @@ -23200,8 +22514,8 @@ export class Client { } private getAutoCompleteWithCallbacks(onSuccess?: (result: JQLReferenceData) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); jQuery.ajax({ url: url_, @@ -23262,8 +22576,8 @@ export class Client { } private getAutoCompletePostWithCallbacks(body: SearchAutoCompleteFilter, onSuccess?: (result: JQLReferenceData) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata") + .toString(); const content_ = JSON.stringify(body); @@ -23336,24 +22650,17 @@ export class Client { } private getFieldAutoCompleteForQueryStringWithCallbacks(fieldName: string | undefined, fieldValue: string | undefined, predicateName: string | undefined, predicateValue: string | undefined, onSuccess?: (result: AutoCompleteSuggestions) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions?"; - if (fieldName === null) - throw new globalThis.Error("The parameter 'fieldName' cannot be null."); - else if (fieldName !== undefined) - url_ += "fieldName=" + encodeURIComponent("" + fieldName) + "&"; - if (fieldValue === null) - throw new globalThis.Error("The parameter 'fieldValue' cannot be null."); - else if (fieldValue !== undefined) - url_ += "fieldValue=" + encodeURIComponent("" + fieldValue) + "&"; - if (predicateName === null) - throw new globalThis.Error("The parameter 'predicateName' cannot be null."); - else if (predicateName !== undefined) - url_ += "predicateName=" + encodeURIComponent("" + predicateName) + "&"; - if (predicateValue === null) - throw new globalThis.Error("The parameter 'predicateValue' cannot be null."); - else if (predicateValue !== undefined) - url_ += "predicateValue=" + encodeURIComponent("" + predicateValue) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(fieldName, 'fieldName'); + Guard.notNull(fieldValue, 'fieldValue'); + Guard.notNull(predicateName, 'predicateName'); + Guard.notNull(predicateValue, 'predicateValue'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/autocompletedata/suggestions") + .param("fieldName", fieldName) + .param("fieldValue", fieldValue) + .param("predicateName", predicateName) + .param("predicateValue", predicateValue) + .toString(); jQuery.ajax({ url: url_, @@ -23430,24 +22737,17 @@ export class Client { } private getPrecomputationsWithCallbacks(functionKey: string[] | undefined, startAt: number | undefined, maxResults: number | undefined, orderBy: string | undefined, onSuccess?: (result: PageBean2JqlFunctionPrecomputationBean) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (functionKey === null) - throw new globalThis.Error("The parameter 'functionKey' cannot be null."); - else if (functionKey !== undefined) - functionKey && functionKey.forEach(item => { url_ += "functionKey=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(functionKey, 'functionKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .paramArray("functionKey", functionKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .toString(); jQuery.ajax({ url: url_, @@ -23521,12 +22821,11 @@ export class Client { } private updatePrecomputationsWithCallbacks(body: JqlFunctionPrecomputationUpdateRequestBean, skipNotFoundPrecomputations: boolean | undefined, onSuccess?: (result: JqlFunctionPrecomputationUpdateResponse) => void, onFail?: (exception: JqlFunctionPrecomputationUpdateErrorResponse | JqlFunctionPrecomputationUpdateErrorResponse | JqlFunctionPrecomputationUpdateErrorResponse | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation?"; - if (skipNotFoundPrecomputations === null) - throw new globalThis.Error("The parameter 'skipNotFoundPrecomputations' cannot be null."); - else if (skipNotFoundPrecomputations !== undefined) - url_ += "skipNotFoundPrecomputations=" + encodeURIComponent("" + skipNotFoundPrecomputations) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(skipNotFoundPrecomputations, 'skipNotFoundPrecomputations'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation") + .param("skipNotFoundPrecomputations", skipNotFoundPrecomputations) + .toString(); const content_ = JSON.stringify(body); @@ -23622,12 +22921,11 @@ export class Client { } private getPrecomputationsByIDWithCallbacks(body: JqlFunctionPrecomputationGetByIdRequest, orderBy: string | undefined, onSuccess?: (result: JqlFunctionPrecomputationGetByIdResponse) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/jql/function/computation/search?"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/function/computation/search") + .param("orderBy", orderBy) + .toString(); const content_ = JSON.stringify(body); @@ -23704,8 +23002,8 @@ export class Client { } private matchIssuesWithCallbacks(body: IssuesAndJQLQueries, onSuccess?: (result: IssueMatches) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/jql/match"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/match") + .toString(); const content_ = JSON.stringify(body); @@ -23775,12 +23073,11 @@ export class Client { } private parseJqlQueriesWithCallbacks(validation: Validation, body: JqlQueriesToParse, onSuccess?: (result: ParsedJqlQueries) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/jql/parse?"; - if (validation === undefined || validation === null) - throw new globalThis.Error("The parameter 'validation' must be defined and cannot be null."); - else - url_ += "validation=" + encodeURIComponent("" + validation) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(validation, 'validation'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/parse") + .param("validation", validation) + .toString(); const content_ = JSON.stringify(body); @@ -23852,8 +23149,8 @@ export class Client { } private migrateQueriesWithCallbacks(body: JQLPersonalDataMigrationRequest, onSuccess?: (result: ConvertedJQLQueries) => void, onFail?: (exception: string | string | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/jql/pdcleaner"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/pdcleaner") + .toString(); const content_ = JSON.stringify(body); @@ -23930,8 +23227,8 @@ export class Client { } private sanitiseJqlQueriesWithCallbacks(body: JqlQueriesToSanitize, onSuccess?: (result: SanitizedJqlQueries) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/jql/sanitize"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/jql/sanitize") + .toString(); const content_ = JSON.stringify(body); @@ -24015,16 +23312,13 @@ export class Client { } private getAllLabelsWithCallbacks(startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanString) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/label?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/label") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -24081,8 +23375,8 @@ export class Client { } private getApproximateLicenseCountWithCallbacks(onSuccess?: (result: LicenseMetric) => void, onFail?: (exception: ErrorCollections | ErrorCollections | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount") + .toString(); jQuery.ajax({ url: url_, @@ -24154,11 +23448,11 @@ export class Client { } private getApproximateApplicationLicenseCountWithCallbacks(applicationKey: ApplicationKey, onSuccess?: (result: LicenseMetric) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}"; - if (applicationKey === undefined || applicationKey === null) - throw new globalThis.Error("The parameter 'applicationKey' must be defined."); - url_ = url_.replace("{applicationKey}", encodeURIComponent("" + applicationKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(applicationKey, 'applicationKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/license/approximateLicenseCount/product/{applicationKey}") + .path("applicationKey", applicationKey) + .toString(); jQuery.ajax({ url: url_, @@ -24237,40 +23531,25 @@ export class Client { } private getMyPermissionsWithCallbacks(projectKey: string | undefined, projectId: string | undefined, issueKey: string | undefined, issueId: string | undefined, permissions: string | undefined, projectUuid: string | undefined, projectConfigurationUuid: string | undefined, commentId: string | undefined, onSuccess?: (result: Permissions) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/mypermissions?"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (permissions === null) - throw new globalThis.Error("The parameter 'permissions' cannot be null."); - else if (permissions !== undefined) - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (projectUuid === null) - throw new globalThis.Error("The parameter 'projectUuid' cannot be null."); - else if (projectUuid !== undefined) - url_ += "projectUuid=" + encodeURIComponent("" + projectUuid) + "&"; - if (projectConfigurationUuid === null) - throw new globalThis.Error("The parameter 'projectConfigurationUuid' cannot be null."); - else if (projectConfigurationUuid !== undefined) - url_ += "projectConfigurationUuid=" + encodeURIComponent("" + projectConfigurationUuid) + "&"; - if (commentId === null) - throw new globalThis.Error("The parameter 'commentId' cannot be null."); - else if (commentId !== undefined) - url_ += "commentId=" + encodeURIComponent("" + commentId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(permissions, 'permissions'); + Guard.notNull(projectUuid, 'projectUuid'); + Guard.notNull(projectConfigurationUuid, 'projectConfigurationUuid'); + Guard.notNull(commentId, 'commentId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypermissions") + .param("projectKey", projectKey) + .param("projectId", projectId) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("permissions", permissions) + .param("projectUuid", projectUuid) + .param("projectConfigurationUuid", projectConfigurationUuid) + .param("commentId", commentId) + .toString(); jQuery.ajax({ url: url_, @@ -24349,12 +23628,11 @@ export class Client { } private removePreferenceWithCallbacks(key: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); jQuery.ajax({ url: url_, @@ -24416,12 +23694,11 @@ export class Client { } private getPreferenceWithCallbacks(key: string, onSuccess?: (result: string) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); jQuery.ajax({ url: url_, @@ -24489,12 +23766,11 @@ export class Client { } private setPreferenceWithCallbacks(key: string, body: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/mypreferences?"; - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences") + .param("key", key) + .toString(); const content_ = JSON.stringify(body); @@ -24565,8 +23841,8 @@ export class Client { } private deleteLocaleWithCallbacks(onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); jQuery.ajax({ url: url_, @@ -24628,8 +23904,8 @@ export class Client { } private getLocaleWithCallbacks(onSuccess?: (result: Locale) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); jQuery.ajax({ url: url_, @@ -24692,8 +23968,8 @@ export class Client { } private setLocaleWithCallbacks(body: Locale, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/mypreferences/locale"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/mypreferences/locale") + .toString(); const content_ = JSON.stringify(body); @@ -24767,12 +24043,11 @@ export class Client { } private getCurrentUserWithCallbacks(expand: string | undefined, onSuccess?: (result: User) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/myself?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/myself") + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -24846,32 +24121,21 @@ export class Client { } private getNotificationSchemesWithCallbacks(startAt: string | undefined, maxResults: string | undefined, id: string[] | undefined, projectId: string[] | undefined, onlyDefault: boolean | undefined, expand: string | undefined, onSuccess?: (result: PageBeanNotificationScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -24936,8 +24200,8 @@ export class Client { } private createNotificationSchemeWithCallbacks(body: CreateNotificationSchemeDetails, onSuccess?: (result: NotificationSchemeId) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme") + .toString(); const content_ = JSON.stringify(body); @@ -25023,24 +24287,17 @@ export class Client { } private getNotificationSchemeToProjectMappingsWithCallbacks(startAt: string | undefined, maxResults: string | undefined, notificationSchemeId: string[] | undefined, projectId: string[] | undefined, onSuccess?: (result: PageBeanNotificationSchemeAndProjectMappingJsonBean) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/project?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' cannot be null."); - else if (notificationSchemeId !== undefined) - notificationSchemeId && notificationSchemeId.forEach(item => { url_ += "notificationSchemeId=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(notificationSchemeId, 'notificationSchemeId'); + Guard.notNull(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/project") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("notificationSchemeId", notificationSchemeId) + .paramArray("projectId", projectId) + .toString(); jQuery.ajax({ url: url_, @@ -25120,15 +24377,13 @@ export class Client { } private getNotificationSchemeWithCallbacks(id: number, expand: string | undefined, onSuccess?: (result: NotificationScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -25198,11 +24453,11 @@ export class Client { } private updateNotificationSchemeWithCallbacks(id: string, body: UpdateNotificationSchemeDetails, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -25293,11 +24548,11 @@ export class Client { } private addNotificationsWithCallbacks(id: string, body: AddNotificationsDetails, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{id}/notification") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -25388,11 +24643,11 @@ export class Client { } private deleteNotificationSchemeWithCallbacks(notificationSchemeId: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}") + .path("notificationSchemeId", notificationSchemeId) + .toString(); jQuery.ajax({ url: url_, @@ -25480,14 +24735,13 @@ export class Client { } private removeNotificationFromNotificationSchemeWithCallbacks(notificationSchemeId: string, notificationId: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}"; - if (notificationSchemeId === undefined || notificationSchemeId === null) - throw new globalThis.Error("The parameter 'notificationSchemeId' must be defined."); - url_ = url_.replace("{notificationSchemeId}", encodeURIComponent("" + notificationSchemeId)); - if (notificationId === undefined || notificationId === null) - throw new globalThis.Error("The parameter 'notificationId' must be defined."); - url_ = url_.replace("{notificationId}", encodeURIComponent("" + notificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(notificationSchemeId, 'notificationSchemeId'); + Guard.required(notificationId, 'notificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/notificationscheme/{notificationSchemeId}/notification/{notificationId}") + .path("notificationSchemeId", notificationSchemeId) + .path("notificationId", notificationId) + .toString(); jQuery.ajax({ url: url_, @@ -25573,8 +24827,8 @@ export class Client { } private getAllPermissionsWithCallbacks(onSuccess?: (result: Permissions) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissions"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions") + .toString(); jQuery.ajax({ url: url_, @@ -25640,8 +24894,8 @@ export class Client { } private getBulkPermissionsWithCallbacks(body: BulkPermissionsRequestBean, onSuccess?: (result: BulkPermissionGrants) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissions/check"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/check") + .toString(); const content_ = JSON.stringify(body); @@ -25716,8 +24970,8 @@ export class Client { } private getPermittedProjectsWithCallbacks(body: PermissionsKeysBean, onSuccess?: (result: PermittedProjects) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissions/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissions/project") + .toString(); const content_ = JSON.stringify(body); @@ -25794,12 +25048,11 @@ export class Client { } private getAllPermissionSchemesWithCallbacks(expand: string | undefined, onSuccess?: (result: PermissionSchemes) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -25869,12 +25122,11 @@ export class Client { } private createPermissionSchemeWithCallbacks(body: PermissionScheme, expand: string | undefined, onSuccess?: (result: PermissionScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -25948,11 +25200,11 @@ export class Client { } private deletePermissionSchemeWithCallbacks(schemeId: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); jQuery.ajax({ url: url_, @@ -26026,15 +25278,13 @@ export class Client { } private getPermissionSchemeWithCallbacks(schemeId: number, expand: string | undefined, onSuccess?: (result: PermissionScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -26108,15 +25358,13 @@ export class Client { } private updatePermissionSchemeWithCallbacks(schemeId: number, body: PermissionScheme, expand: string | undefined, onSuccess?: (result: PermissionScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -26198,15 +25446,13 @@ export class Client { } private getPermissionSchemeGrantsWithCallbacks(schemeId: number, expand: string | undefined, onSuccess?: (result: PermissionGrants) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -26281,15 +25527,13 @@ export class Client { } private createPermissionGrantWithCallbacks(schemeId: number, body: PermissionGrant, expand: string | undefined, onSuccess?: (result: PermissionGrant) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission") + .path("schemeId", schemeId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -26364,14 +25608,13 @@ export class Client { } private deletePermissionSchemeEntityWithCallbacks(schemeId: number, permissionId: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .toString(); jQuery.ajax({ url: url_, @@ -26446,18 +25689,15 @@ export class Client { } private getPermissionSchemeGrantWithCallbacks(schemeId: number, permissionId: number, expand: string | undefined, onSuccess?: (result: PermissionGrant) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (permissionId === undefined || permissionId === null) - throw new globalThis.Error("The parameter 'permissionId' must be defined."); - url_ = url_.replace("{permissionId}", encodeURIComponent("" + permissionId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.required(permissionId, 'permissionId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/permissionscheme/{schemeId}/permission/{permissionId}") + .path("schemeId", schemeId) + .path("permissionId", permissionId) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -26526,24 +25766,17 @@ export class Client { } private getPlansWithCallbacks(includeTrashed: boolean | undefined, includeArchived: boolean | undefined, cursor: string | undefined, maxResults: number | undefined, onSuccess?: (result: PageWithCursorGetPlanResponseForPage) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (includeTrashed === null) - throw new globalThis.Error("The parameter 'includeTrashed' cannot be null."); - else if (includeTrashed !== undefined) - url_ += "includeTrashed=" + encodeURIComponent("" + includeTrashed) + "&"; - if (includeArchived === null) - throw new globalThis.Error("The parameter 'includeArchived' cannot be null."); - else if (includeArchived !== undefined) - url_ += "includeArchived=" + encodeURIComponent("" + includeArchived) + "&"; - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(includeTrashed, 'includeTrashed'); + Guard.notNull(includeArchived, 'includeArchived'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("includeTrashed", includeTrashed) + .param("includeArchived", includeArchived) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -26615,12 +25848,11 @@ export class Client { } private createPlanWithCallbacks(body: CreatePlanRequest, useGroupId: boolean | undefined, onSuccess?: (result: number) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan?"; - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan") + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -26705,15 +25937,13 @@ export class Client { } private getPlanWithCallbacks(planId: number, useGroupId: boolean | undefined, onSuccess?: (result: GetPlanResponse) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); jQuery.ajax({ url: url_, @@ -26793,15 +26023,13 @@ export class Client { } private updatePlanWithCallbacks(planId: number, body: any, useGroupId: boolean | undefined, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (useGroupId === null) - throw new globalThis.Error("The parameter 'useGroupId' cannot be null."); - else if (useGroupId !== undefined) - url_ += "useGroupId=" + encodeURIComponent("" + useGroupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(useGroupId, 'useGroupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}") + .path("planId", planId) + .param("useGroupId", useGroupId) + .toString(); const content_ = JSON.stringify(body); @@ -26899,11 +26127,11 @@ export class Client { } private archivePlanWithCallbacks(planId: number, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/archive") + .path("planId", planId) + .toString(); jQuery.ajax({ url: url_, @@ -26990,11 +26218,11 @@ export class Client { } private duplicatePlanWithCallbacks(planId: number, body: DuplicatePlanRequest, onSuccess?: (result: number) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/duplicate") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -27094,19 +26322,15 @@ export class Client { } private getTeamsWithCallbacks(planId: number, cursor: string | undefined, maxResults: number | undefined, onSuccess?: (result: PageWithCursorGetTeamResponseForPage) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team?"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (cursor === null) - throw new globalThis.Error("The parameter 'cursor' cannot be null."); - else if (cursor !== undefined) - url_ += "cursor=" + encodeURIComponent("" + cursor) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.notNull(cursor, 'cursor'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team") + .path("planId", planId) + .param("cursor", cursor) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -27185,11 +26409,11 @@ export class Client { } private addAtlassianTeamWithCallbacks(planId: number, body: AddAtlassianTeamRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -27288,14 +26512,13 @@ export class Client { } private removeAtlassianTeamWithCallbacks(planId: number, atlassianTeamId: string, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); jQuery.ajax({ url: url_, @@ -27383,14 +26606,13 @@ export class Client { } private getAtlassianTeamWithCallbacks(planId: number, atlassianTeamId: string, onSuccess?: (result: GetAtlassianTeamResponse) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); jQuery.ajax({ url: url_, @@ -27477,14 +26699,13 @@ export class Client { } private updateAtlassianTeamWithCallbacks(planId: number, atlassianTeamId: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (atlassianTeamId === undefined || atlassianTeamId === null) - throw new globalThis.Error("The parameter 'atlassianTeamId' must be defined."); - url_ = url_.replace("{atlassianTeamId}", encodeURIComponent("" + atlassianTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(atlassianTeamId, 'atlassianTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/atlassian/{atlassianTeamId}") + .path("planId", planId) + .path("atlassianTeamId", atlassianTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -27582,11 +26803,11 @@ export class Client { } private createPlanOnlyTeamWithCallbacks(planId: number, body: CreatePlanOnlyTeamRequest, onSuccess?: (result: number) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly") + .path("planId", planId) + .toString(); const content_ = JSON.stringify(body); @@ -27685,14 +26906,13 @@ export class Client { } private deletePlanOnlyTeamWithCallbacks(planId: number, planOnlyTeamId: number, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); jQuery.ajax({ url: url_, @@ -27780,14 +27000,13 @@ export class Client { } private getPlanOnlyTeamWithCallbacks(planId: number, planOnlyTeamId: number, onSuccess?: (result: GetPlanOnlyTeamResponse) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); jQuery.ajax({ url: url_, @@ -27874,14 +27093,13 @@ export class Client { } private updatePlanOnlyTeamWithCallbacks(planId: number, planOnlyTeamId: number, body: any, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - if (planOnlyTeamId === undefined || planOnlyTeamId === null) - throw new globalThis.Error("The parameter 'planOnlyTeamId' must be defined."); - url_ = url_.replace("{planOnlyTeamId}", encodeURIComponent("" + planOnlyTeamId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + Guard.required(planOnlyTeamId, 'planOnlyTeamId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/team/planonly/{planOnlyTeamId}") + .path("planId", planId) + .path("planOnlyTeamId", planOnlyTeamId) + .toString(); const content_ = JSON.stringify(body); @@ -27979,11 +27197,11 @@ export class Client { } private trashPlanWithCallbacks(planId: number, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash"; - if (planId === undefined || planId === null) - throw new globalThis.Error("The parameter 'planId' must be defined."); - url_ = url_.replace("{planId}", encodeURIComponent("" + planId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(planId, 'planId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/plans/plan/{planId}/trash") + .path("planId", planId) + .toString(); jQuery.ajax({ url: url_, @@ -28070,8 +27288,8 @@ export class Client { } private getPrioritiesWithCallbacks(onSuccess?: (result: Priority[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); jQuery.ajax({ url: url_, @@ -28140,8 +27358,8 @@ export class Client { } private createPriorityWithCallbacks(body: CreatePriorityDetails, onSuccess?: (result: PriorityId) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priority"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority") + .toString(); const content_ = JSON.stringify(body); @@ -28223,8 +27441,8 @@ export class Client { } private setDefaultPriorityWithCallbacks(body: SetDefaultPriorityRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priority/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/default") + .toString(); const content_ = JSON.stringify(body); @@ -28314,8 +27532,8 @@ export class Client { } private movePrioritiesWithCallbacks(body: ReorderIssuePriorities, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priority/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/move") + .toString(); const content_ = JSON.stringify(body); @@ -28413,36 +27631,23 @@ export class Client { } private searchPrioritiesWithCallbacks(startAt: string | undefined, maxResults: string | undefined, id: string[] | undefined, projectId: string[] | undefined, priorityName: string | undefined, onlyDefault: boolean | undefined, expand: string | undefined, onSuccess?: (result: PageBeanPriority) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priority/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (priorityName === null) - throw new globalThis.Error("The parameter 'priorityName' cannot be null."); - else if (priorityName !== undefined) - url_ += "priorityName=" + encodeURIComponent("" + priorityName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(priorityName, 'priorityName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .paramArray("projectId", projectId) + .param("priorityName", priorityName) + .param("onlyDefault", onlyDefault) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -28506,11 +27711,11 @@ export class Client { } private deletePriorityWithCallbacks(id: string, onSuccess?: (result: void) => void, onFail?: (exception: TaskProgressBeanObject | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -28602,11 +27807,11 @@ export class Client { } private getPriorityWithCallbacks(id: string, onSuccess?: (result: Priority) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -28673,11 +27878,11 @@ export class Client { } private updatePriorityWithCallbacks(id: string, body: UpdatePriorityDetails, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priority/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priority/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -28775,40 +27980,25 @@ export class Client { } private getPrioritySchemesWithCallbacks(startAt: string | undefined, maxResults: string | undefined, priorityId: number[] | undefined, schemeId: number[] | undefined, schemeName: string | undefined, onlyDefault: boolean | undefined, orderBy: OrderBy9 | undefined, expand: string | undefined, onSuccess?: (result: PageBeanPrioritySchemeWithPaginatedPrioritiesAndProjects) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (priorityId === null) - throw new globalThis.Error("The parameter 'priorityId' cannot be null."); - else if (priorityId !== undefined) - priorityId && priorityId.forEach(item => { url_ += "priorityId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' cannot be null."); - else if (schemeId !== undefined) - schemeId && schemeId.forEach(item => { url_ += "schemeId=" + encodeURIComponent("" + item) + "&"; }); - if (schemeName === null) - throw new globalThis.Error("The parameter 'schemeName' cannot be null."); - else if (schemeName !== undefined) - url_ += "schemeName=" + encodeURIComponent("" + schemeName) + "&"; - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(priorityId, 'priorityId'); + Guard.notNull(schemeId, 'schemeId'); + Guard.notNull(schemeName, 'schemeName'); + Guard.notNull(onlyDefault, 'onlyDefault'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("priorityId", priorityId) + .paramArray("schemeId", schemeId) + .param("schemeName", schemeName) + .param("onlyDefault", onlyDefault) + .param("orderBy", orderBy) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -28873,8 +28063,8 @@ export class Client { } private createPrioritySchemeWithCallbacks(body: CreatePrioritySchemeDetails, onSuccess?: (result: PrioritySchemeId) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme") + .toString(); const content_ = JSON.stringify(body); @@ -28958,8 +28148,8 @@ export class Client { } private suggestedPrioritiesForMappingsWithCallbacks(body: SuggestedMappingsRequestBean, onSuccess?: (result: PageBeanPriorityWithSequence) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -29033,28 +28223,19 @@ export class Client { } private getAvailablePrioritiesByPrioritySchemeWithCallbacks(schemeId: string, startAt: string | undefined, maxResults: string | undefined, query: string | undefined, exclude: string[] | undefined, onSuccess?: (result: PageBeanPriorityWithSequence) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/priorities/available?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined and cannot be null."); - else - url_ += "schemeId=" + encodeURIComponent("" + schemeId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(query, 'query'); + Guard.notNull(exclude, 'exclude'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/priorities/available") + .param("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("query", query) + .paramArray("exclude", exclude) + .toString(); jQuery.ajax({ url: url_, @@ -29120,11 +28301,11 @@ export class Client { } private deletePrioritySchemeWithCallbacks(schemeId: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); jQuery.ajax({ url: url_, @@ -29195,11 +28376,11 @@ export class Client { } private updatePrioritySchemeWithCallbacks(schemeId: number, body: UpdatePrioritySchemeRequestBean, onSuccess?: (result: UpdatePrioritySchemeResponseBean) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}") + .path("schemeId", schemeId) + .toString(); const content_ = JSON.stringify(body); @@ -29279,19 +28460,15 @@ export class Client { } private getPrioritiesByPrioritySchemeWithCallbacks(schemeId: string, startAt: string | undefined, maxResults: string | undefined, onSuccess?: (result: PageBeanPriorityWithSequence) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/priorities") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -29361,27 +28538,19 @@ export class Client { } private getProjectsByPrioritySchemeWithCallbacks(schemeId: string, startAt: string | undefined, maxResults: string | undefined, projectId: number[] | undefined, query: string | undefined, onSuccess?: (result: PageBeanProject) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects?"; - if (schemeId === undefined || schemeId === null) - throw new globalThis.Error("The parameter 'schemeId' must be defined."); - url_ = url_.replace("{schemeId}", encodeURIComponent("" + schemeId)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(schemeId, 'schemeId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/priorityscheme/{schemeId}/projects") + .path("schemeId", schemeId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("projectId", projectId) + .param("query", query) + .toString(); jQuery.ajax({ url: url_, @@ -29455,20 +28624,15 @@ export class Client { } private getAllProjectsWithCallbacks(expand: string | undefined, recent: number | undefined, properties: string[] | undefined, onSuccess?: (result: Project[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (recent === null) - throw new globalThis.Error("The parameter 'recent' cannot be null."); - else if (recent !== undefined) - url_ += "recent=" + encodeURIComponent("" + recent) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(recent, 'recent'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .param("expand", expand) + .param("recent", recent) + .paramArray("properties", properties) + .toString(); jQuery.ajax({ url: url_, @@ -29537,8 +28701,8 @@ export class Client { } private createProjectWithCallbacks(body: CreateProjectDetails, onSuccess?: (result: ProjectIdentifiers) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project") + .toString(); const content_ = JSON.stringify(body); @@ -29611,8 +28775,8 @@ export class Client { } private createProjectWithCustomTemplateWithCallbacks(body: ProjectCustomTemplateCreateRequestDTO, onSuccess?: (result: void) => void, onFail?: (exception: any | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project-template"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project-template") + .toString(); const content_ = JSON.stringify(body); @@ -29684,21 +28848,13 @@ export class Client { } private getRecentWithCallbacks(expand: string | undefined, properties: StringList[] | undefined, onSuccess?: (result: Project[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/recent?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/recent") + .param("expand", expand) + .paramArray("properties", properties) + .toString(); jQuery.ajax({ url: url_, @@ -29815,65 +28971,35 @@ export class Client { } private searchProjectsWithCallbacks(startAt: number | undefined, maxResults: number | undefined, orderBy: OrderBy10 | undefined, id: number[] | undefined, keys: string[] | undefined, query: string | undefined, typeKey: string | undefined, categoryId: number | undefined, action: Action | undefined, expand: string | undefined, status: Status4[] | undefined, properties: StringList[] | undefined, propertyQuery: string | undefined, onSuccess?: (result: PageBeanProject) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (typeKey === null) - throw new globalThis.Error("The parameter 'typeKey' cannot be null."); - else if (typeKey !== undefined) - url_ += "typeKey=" + encodeURIComponent("" + typeKey) + "&"; - if (categoryId === null) - throw new globalThis.Error("The parameter 'categoryId' cannot be null."); - else if (categoryId !== undefined) - url_ += "categoryId=" + encodeURIComponent("" + categoryId) + "&"; - if (action === null) - throw new globalThis.Error("The parameter 'action' cannot be null."); - else if (action !== undefined) - url_ += "action=" + encodeURIComponent("" + action) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - status && status.forEach(item => { url_ += "status=" + encodeURIComponent("" + item) + "&"; }); - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "properties[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); - if (propertyQuery === null) - throw new globalThis.Error("The parameter 'propertyQuery' cannot be null."); - else if (propertyQuery !== undefined) - url_ += "propertyQuery=" + encodeURIComponent("" + propertyQuery) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(id, 'id'); + Guard.notNull(keys, 'keys'); + Guard.notNull(query, 'query'); + Guard.notNull(typeKey, 'typeKey'); + Guard.notNull(categoryId, 'categoryId'); + Guard.notNull(action, 'action'); + Guard.notNull(expand, 'expand'); + Guard.notNull(status, 'status'); + Guard.notNull(properties, 'properties'); + Guard.notNull(propertyQuery, 'propertyQuery'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .paramArray("id", id) + .paramArray("keys", keys) + .param("query", query) + .param("typeKey", typeKey) + .param("categoryId", categoryId) + .param("action", action) + .param("expand", expand) + .paramArray("status", status) + .paramArray("properties", properties) + .param("propertyQuery", propertyQuery) + .toString(); jQuery.ajax({ url: url_, @@ -29942,8 +29068,8 @@ export class Client { } private getAllProjectTypesWithCallbacks(onSuccess?: (result: ProjectType[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/type"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type") + .toString(); jQuery.ajax({ url: url_, @@ -30011,8 +29137,8 @@ export class Client { } private getAllAccessibleProjectTypesWithCallbacks(onSuccess?: (result: ProjectType[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/type/accessible"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/accessible") + .toString(); jQuery.ajax({ url: url_, @@ -30077,11 +29203,11 @@ export class Client { } private getProjectTypeByKeyWithCallbacks(projectTypeKey: ProjectTypeKey, onSuccess?: (result: ProjectType) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}") + .path("projectTypeKey", projectTypeKey) + .toString(); jQuery.ajax({ url: url_, @@ -30147,11 +29273,11 @@ export class Client { } private getAccessibleProjectTypeByKeyWithCallbacks(projectTypeKey: ProjectTypeKey2, onSuccess?: (result: ProjectType) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible"; - if (projectTypeKey === undefined || projectTypeKey === null) - throw new globalThis.Error("The parameter 'projectTypeKey' must be defined."); - url_ = url_.replace("{projectTypeKey}", encodeURIComponent("" + projectTypeKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectTypeKey, 'projectTypeKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/type/{projectTypeKey}/accessible") + .path("projectTypeKey", projectTypeKey) + .toString(); jQuery.ajax({ url: url_, @@ -30218,15 +29344,13 @@ export class Client { } private deleteProjectWithCallbacks(projectIdOrKey: string, enableUndo: boolean | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (enableUndo === null) - throw new globalThis.Error("The parameter 'enableUndo' cannot be null."); - else if (enableUndo !== undefined) - url_ += "enableUndo=" + encodeURIComponent("" + enableUndo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(enableUndo, 'enableUndo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("enableUndo", enableUndo) + .toString(); jQuery.ajax({ url: url_, @@ -30296,19 +29420,15 @@ export class Client { } private getProjectWithCallbacks(projectIdOrKey: string, expand: string | undefined, properties: string[] | undefined, onSuccess?: (result: Project) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .paramArray("properties", properties) + .toString(); jQuery.ajax({ url: url_, @@ -30381,15 +29501,13 @@ export class Client { } private updateProjectWithCallbacks(projectIdOrKey: string, body: UpdateProjectDetails, expand: string | undefined, onSuccess?: (result: Project) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -30467,11 +29585,11 @@ export class Client { } private archiveProjectWithCallbacks(projectIdOrKey: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/archive") + .path("projectIdOrKey", projectIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -30546,11 +29664,11 @@ export class Client { } private updateProjectAvatarWithCallbacks(projectIdOrKey: string, body: Avatar, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -30626,14 +29744,13 @@ export class Client { } private deleteProjectAvatarWithCallbacks(projectIdOrKey: string, id: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -30702,23 +29819,17 @@ export class Client { } private createProjectAvatarWithCallbacks(projectIdOrKey: string, body: any, x: number | undefined, y: number | undefined, size: number | undefined, onSuccess?: (result: Avatar) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + Guard.notNull(size, 'size'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatar2") + .path("projectIdOrKey", projectIdOrKey) + .param("x", x) + .param("y", y) + .param("size", size) + .toString(); const content_ = JSON.stringify(body); @@ -30796,11 +29907,11 @@ export class Client { } private getAllProjectAvatarsWithCallbacks(projectIdOrKey: string, onSuccess?: (result: ProjectAvatars) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/avatars") + .path("projectIdOrKey", projectIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -30866,11 +29977,11 @@ export class Client { } private removeDefaultProjectClassificationWithCallbacks(projectIdOrKey: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -30941,11 +30052,11 @@ export class Client { } private getDefaultProjectClassificationWithCallbacks(projectIdOrKey: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -31012,11 +30123,11 @@ export class Client { } private updateDefaultProjectClassificationWithCallbacks(projectIdOrKey: string, body: UpdateDefaultProjectClassificationBean, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/classification-level/default") + .path("projectIdOrKey", projectIdOrKey) + .toString(); const content_ = JSON.stringify(body); @@ -31101,31 +30212,21 @@ export class Client { } private getProjectComponentsPaginatedWithCallbacks(projectIdOrKey: string, startAt: number | undefined, maxResults: number | undefined, orderBy: OrderBy11 | undefined, componentSource: ComponentSource | undefined, query: string | undefined, onSuccess?: (result: PageBeanComponentWithIssueCount) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(componentSource, 'componentSource'); + Guard.notNull(query, 'query'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/component") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("componentSource", componentSource) + .param("query", query) + .toString(); jQuery.ajax({ url: url_, @@ -31192,15 +30293,13 @@ export class Client { } private getProjectComponentsWithCallbacks(projectIdOrKey: string, componentSource: ComponentSource2 | undefined, onSuccess?: (result: ProjectComponent[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (componentSource === null) - throw new globalThis.Error("The parameter 'componentSource' cannot be null."); - else if (componentSource !== undefined) - url_ += "componentSource=" + encodeURIComponent("" + componentSource) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(componentSource, 'componentSource'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/components") + .path("projectIdOrKey", projectIdOrKey) + .param("componentSource", componentSource) + .toString(); jQuery.ajax({ url: url_, @@ -31272,11 +30371,11 @@ export class Client { } private deleteProjectAsynchronouslyWithCallbacks(projectIdOrKey: string, onSuccess?: (result: void) => void, onFail?: (exception: TaskProgressBeanObject | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/delete") + .path("projectIdOrKey", projectIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -31345,11 +30444,11 @@ export class Client { } private getFeaturesForProjectWithCallbacks(projectIdOrKey: string, onSuccess?: (result: ContainerForProjectFeatures) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features") + .path("projectIdOrKey", projectIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -31425,14 +30524,13 @@ export class Client { } private toggleFeatureForProjectWithCallbacks(projectIdOrKey: string, featureKey: string, body: ProjectFeatureState, onSuccess?: (result: ContainerForProjectFeatures) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (featureKey === undefined || featureKey === null) - throw new globalThis.Error("The parameter 'featureKey' must be defined."); - url_ = url_.replace("{featureKey}", encodeURIComponent("" + featureKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(featureKey, 'featureKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/features/{featureKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("featureKey", featureKey) + .toString(); const content_ = JSON.stringify(body); @@ -31510,11 +30608,11 @@ export class Client { } private getProjectPropertyKeysWithCallbacks(projectIdOrKey: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties") + .path("projectIdOrKey", projectIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -31589,14 +30687,13 @@ export class Client { } private deleteProjectPropertyWithCallbacks(projectIdOrKey: string, propertyKey: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -31667,14 +30764,13 @@ export class Client { } private getProjectPropertyWithCallbacks(projectIdOrKey: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -31750,14 +30846,13 @@ export class Client { } private setProjectPropertyWithCallbacks(projectIdOrKey: string, propertyKey: string, body: any, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/properties/{propertyKey}") + .path("projectIdOrKey", projectIdOrKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -31844,11 +30939,11 @@ export class Client { } private restoreWithCallbacks(projectIdOrKey: string, onSuccess?: (result: Project) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/restore") + .path("projectIdOrKey", projectIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -31918,11 +31013,11 @@ export class Client { } private getProjectRolesWithCallbacks(projectIdOrKey: string, onSuccess?: (result: { [key: string]: string; }) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role") + .path("projectIdOrKey", projectIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -32001,26 +31096,19 @@ export class Client { } private deleteActorWithCallbacks(projectIdOrKey: string, id: number, user: string | undefined, group: string | undefined, groupId: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(group, 'group'); + Guard.notNull(groupId, 'groupId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("user", user) + .param("group", group) + .param("groupId", groupId) + .toString(); jQuery.ajax({ url: url_, @@ -32084,18 +31172,15 @@ export class Client { } private getProjectRoleWithCallbacks(projectIdOrKey: string, id: number, excludeInactiveUsers: boolean | undefined, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (excludeInactiveUsers === null) - throw new globalThis.Error("The parameter 'excludeInactiveUsers' cannot be null."); - else if (excludeInactiveUsers !== undefined) - url_ += "excludeInactiveUsers=" + encodeURIComponent("" + excludeInactiveUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + Guard.notNull(excludeInactiveUsers, 'excludeInactiveUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .param("excludeInactiveUsers", excludeInactiveUsers) + .toString(); jQuery.ajax({ url: url_, @@ -32169,14 +31254,13 @@ export class Client { } private addActorUsersWithCallbacks(projectIdOrKey: string, id: number, body: ActorsMap, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32252,14 +31336,13 @@ export class Client { } private setActorsWithCallbacks(projectIdOrKey: string, id: number, body: ProjectRoleActorsUpdateBean, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/role/{id}") + .path("projectIdOrKey", projectIdOrKey) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -32335,19 +31418,15 @@ export class Client { } private getProjectRoleDetailsWithCallbacks(projectIdOrKey: string, currentMember: boolean | undefined, excludeConnectAddons: boolean | undefined, onSuccess?: (result: ProjectRoleDetails[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (currentMember === null) - throw new globalThis.Error("The parameter 'currentMember' cannot be null."); - else if (currentMember !== undefined) - url_ += "currentMember=" + encodeURIComponent("" + currentMember) + "&"; - if (excludeConnectAddons === null) - throw new globalThis.Error("The parameter 'excludeConnectAddons' cannot be null."); - else if (excludeConnectAddons !== undefined) - url_ += "excludeConnectAddons=" + encodeURIComponent("" + excludeConnectAddons) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(currentMember, 'currentMember'); + Guard.notNull(excludeConnectAddons, 'excludeConnectAddons'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/roledetails") + .path("projectIdOrKey", projectIdOrKey) + .param("currentMember", currentMember) + .param("excludeConnectAddons", excludeConnectAddons) + .toString(); jQuery.ajax({ url: url_, @@ -32420,11 +31499,11 @@ export class Client { } private getAllStatusesWithCallbacks(projectIdOrKey: string, onSuccess?: (result: IssueTypeWithStatus[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/statuses") + .path("projectIdOrKey", projectIdOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -32514,35 +31593,23 @@ export class Client { } private getProjectVersionsPaginatedWithCallbacks(projectIdOrKey: string, startAt: number | undefined, maxResults: number | undefined, orderBy: OrderBy12 | undefined, query: string | undefined, status: string | undefined, expand: string | undefined, onSuccess?: (result: PageBeanVersion) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (status === null) - throw new globalThis.Error("The parameter 'status' cannot be null."); - else if (status !== undefined) - url_ += "status=" + encodeURIComponent("" + status) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(query, 'query'); + Guard.notNull(status, 'status'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/version") + .path("projectIdOrKey", projectIdOrKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("orderBy", orderBy) + .param("query", query) + .param("status", status) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -32605,15 +31672,13 @@ export class Client { } private getProjectVersionsWithCallbacks(projectIdOrKey: string, expand: string | undefined, onSuccess?: (result: Version[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions?"; - if (projectIdOrKey === undefined || projectIdOrKey === null) - throw new globalThis.Error("The parameter 'projectIdOrKey' must be defined."); - url_ = url_.replace("{projectIdOrKey}", encodeURIComponent("" + projectIdOrKey)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectIdOrKey, 'projectIdOrKey'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectIdOrKey}/versions") + .path("projectIdOrKey", projectIdOrKey) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -32682,11 +31747,11 @@ export class Client { } private getProjectEmailWithCallbacks(projectId: number, onSuccess?: (result: ProjectEmailAddress) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); jQuery.ajax({ url: url_, @@ -32757,11 +31822,11 @@ export class Client { } private updateProjectEmailWithCallbacks(projectId: number, body: ProjectEmailAddress, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/email"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/email") + .path("projectId", projectId) + .toString(); const content_ = JSON.stringify(body); @@ -32840,11 +31905,11 @@ export class Client { } private getHierarchyWithCallbacks(projectId: number, onSuccess?: (result: ProjectIssueTypeHierarchy) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectId}/hierarchy") + .path("projectId", projectId) + .toString(); jQuery.ajax({ url: url_, @@ -32914,11 +31979,11 @@ export class Client { } private getProjectIssueSecuritySchemeWithCallbacks(projectKeyOrId: string, onSuccess?: (result: SecurityScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/issuesecuritylevelscheme") + .path("projectKeyOrId", projectKeyOrId) + .toString(); jQuery.ajax({ url: url_, @@ -33000,15 +32065,13 @@ export class Client { } private getNotificationSchemeForProjectWithCallbacks(projectKeyOrId: string, expand: string | undefined, onSuccess?: (result: NotificationScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/notificationscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -33086,15 +32149,13 @@ export class Client { } private getAssignedPermissionSchemeWithCallbacks(projectKeyOrId: string, expand: string | undefined, onSuccess?: (result: PermissionScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -33172,15 +32233,13 @@ export class Client { } private assignPermissionSchemeWithCallbacks(projectKeyOrId: string, body: IdBean, expand: string | undefined, onSuccess?: (result: PermissionScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme?"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/permissionscheme") + .path("projectKeyOrId", projectKeyOrId) + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -33254,11 +32313,11 @@ export class Client { } private getSecurityLevelsForProjectWithCallbacks(projectKeyOrId: string, onSuccess?: (result: ProjectIssueSecurityLevels) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel"; - if (projectKeyOrId === undefined || projectKeyOrId === null) - throw new globalThis.Error("The parameter 'projectKeyOrId' must be defined."); - url_ = url_.replace("{projectKeyOrId}", encodeURIComponent("" + projectKeyOrId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeyOrId, 'projectKeyOrId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/project/{projectKeyOrId}/securitylevel") + .path("projectKeyOrId", projectKeyOrId) + .toString(); jQuery.ajax({ url: url_, @@ -33319,8 +32378,8 @@ export class Client { } private getAllProjectCategoriesWithCallbacks(onSuccess?: (result: ProjectCategory[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); jQuery.ajax({ url: url_, @@ -33388,8 +32447,8 @@ export class Client { } private createProjectCategoryWithCallbacks(body: ProjectCategory, onSuccess?: (result: ProjectCategory) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/projectCategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory") + .toString(); const content_ = JSON.stringify(body); @@ -33467,11 +32526,11 @@ export class Client { } private removeProjectCategoryWithCallbacks(id: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -33537,11 +32596,11 @@ export class Client { } private getProjectCategoryByIdWithCallbacks(id: number, onSuccess?: (result: ProjectCategory) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -33606,11 +32665,11 @@ export class Client { } private updateProjectCategoryWithCallbacks(id: number, body: ProjectCategory, onSuccess?: (result: UpdatedProjectCategory) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/projectCategory/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectCategory/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -33688,12 +32747,11 @@ export class Client { } private validateProjectKeyWithCallbacks(key: string | undefined, onSuccess?: (result: ErrorCollection) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/key?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/key") + .param("key", key) + .toString(); jQuery.ajax({ url: url_, @@ -33755,12 +32813,11 @@ export class Client { } private getValidProjectKeyWithCallbacks(key: string | undefined, onSuccess?: (result: string) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey?"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectKey") + .param("key", key) + .toString(); jQuery.ajax({ url: url_, @@ -33823,12 +32880,11 @@ export class Client { } private getValidProjectNameWithCallbacks(name: string, onSuccess?: (result: string) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/projectvalidate/validProjectName?"; - if (name === undefined || name === null) - throw new globalThis.Error("The parameter 'name' must be defined and cannot be null."); - else - url_ += "name=" + encodeURIComponent("" + name) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(name, 'name'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/projectvalidate/validProjectName") + .param("name", name) + .toString(); jQuery.ajax({ url: url_, @@ -33899,8 +32955,8 @@ export class Client { } private getResolutionsWithCallbacks(onSuccess?: (result: Resolution[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); jQuery.ajax({ url: url_, @@ -33968,8 +33024,8 @@ export class Client { } private createResolutionWithCallbacks(body: CreateResolutionDetails, onSuccess?: (result: ResolutionId) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/resolution"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution") + .toString(); const content_ = JSON.stringify(body); @@ -34051,8 +33107,8 @@ export class Client { } private setDefaultResolutionWithCallbacks(body: SetDefaultResolutionRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/resolution/default"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/default") + .toString(); const content_ = JSON.stringify(body); @@ -34142,8 +33198,8 @@ export class Client { } private moveResolutionsWithCallbacks(body: ReorderIssueResolutionsRequest, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/resolution/move"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/move") + .toString(); const content_ = JSON.stringify(body); @@ -34237,24 +33293,17 @@ export class Client { } private searchResolutionsWithCallbacks(startAt: string | undefined, maxResults: string | undefined, id: string[] | undefined, onlyDefault: boolean | undefined, onSuccess?: (result: PageBeanResolutionJsonBean) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/resolution/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (onlyDefault === null) - throw new globalThis.Error("The parameter 'onlyDefault' cannot be null."); - else if (onlyDefault !== undefined) - url_ += "onlyDefault=" + encodeURIComponent("" + onlyDefault) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(onlyDefault, 'onlyDefault'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("onlyDefault", onlyDefault) + .toString(); jQuery.ajax({ url: url_, @@ -34319,15 +33368,13 @@ export class Client { } private deleteResolutionWithCallbacks(id: string, replaceWith: string, onSuccess?: (result: void) => void, onFail?: (exception: TaskProgressBeanObject | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (replaceWith === undefined || replaceWith === null) - throw new globalThis.Error("The parameter 'replaceWith' must be defined and cannot be null."); - else - url_ += "replaceWith=" + encodeURIComponent("" + replaceWith) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(replaceWith, 'replaceWith'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .param("replaceWith", replaceWith) + .toString(); jQuery.ajax({ url: url_, @@ -34419,11 +33466,11 @@ export class Client { } private getResolutionWithCallbacks(id: string, onSuccess?: (result: Resolution) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -34489,11 +33536,11 @@ export class Client { } private updateResolutionWithCallbacks(id: string, body: UpdateResolutionDetails, onSuccess?: (result: any) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/resolution/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/resolution/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -34583,8 +33630,8 @@ export class Client { } private getAllProjectRolesWithCallbacks(onSuccess?: (result: ProjectRole[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); jQuery.ajax({ url: url_, @@ -34656,8 +33703,8 @@ export class Client { } private createProjectRoleWithCallbacks(body: CreateUpdateRoleRequestBean, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/role"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role") + .toString(); const content_ = JSON.stringify(body); @@ -34736,15 +33783,13 @@ export class Client { } private deleteProjectRoleWithCallbacks(id: number, swap: number | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/role/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (swap === null) - throw new globalThis.Error("The parameter 'swap' cannot be null."); - else if (swap !== undefined) - url_ += "swap=" + encodeURIComponent("" + swap) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(swap, 'swap'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .param("swap", swap) + .toString(); jQuery.ajax({ url: url_, @@ -34818,11 +33863,11 @@ export class Client { } private getProjectRoleByIdWithCallbacks(id: number, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -34892,11 +33937,11 @@ export class Client { } private partialUpdateProjectRoleWithCallbacks(id: number, body: CreateUpdateRoleRequestBean, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -34974,11 +34019,11 @@ export class Client { } private fullyUpdateProjectRoleWithCallbacks(id: number, body: CreateUpdateRoleRequestBean, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/role/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -35059,23 +34104,17 @@ export class Client { } private deleteProjectRoleActorsFromRoleWithCallbacks(id: number, user: string | undefined, groupId: string | undefined, group: string | undefined, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (user === null) - throw new globalThis.Error("The parameter 'user' cannot be null."); - else if (user !== undefined) - url_ += "user=" + encodeURIComponent("" + user) + "&"; - if (groupId === null) - throw new globalThis.Error("The parameter 'groupId' cannot be null."); - else if (groupId !== undefined) - url_ += "groupId=" + encodeURIComponent("" + groupId) + "&"; - if (group === null) - throw new globalThis.Error("The parameter 'group' cannot be null."); - else if (group !== undefined) - url_ += "group=" + encodeURIComponent("" + group) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(user, 'user'); + Guard.notNull(groupId, 'groupId'); + Guard.notNull(group, 'group'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .param("user", user) + .param("groupId", groupId) + .param("group", group) + .toString(); jQuery.ajax({ url: url_, @@ -35149,11 +34188,11 @@ export class Client { } private getProjectRoleActorsForRoleWithCallbacks(id: number, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -35227,11 +34266,11 @@ export class Client { } private addProjectRoleActorsToRoleWithCallbacks(id: number, body: ActorInputBean, onSuccess?: (result: ProjectRole) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/role/{id}/actors"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/role/{id}/actors") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -35317,32 +34356,21 @@ export class Client { } private getScreensWithCallbacks(startAt: number | undefined, maxResults: number | undefined, id: number[] | undefined, queryString: string | undefined, scope: Scope2[] | undefined, orderBy: OrderBy13 | undefined, onSuccess?: (result: PageBeanScreen) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - scope && scope.forEach(item => { url_ += "scope=" + encodeURIComponent("" + item) + "&"; }); - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(scope, 'scope'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("queryString", queryString) + .paramArray("scope", scope) + .param("orderBy", orderBy) + .toString(); jQuery.ajax({ url: url_, @@ -35407,8 +34435,8 @@ export class Client { } private createScreenWithCallbacks(body: ScreenDetails, onSuccess?: (result: Screen) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens") + .toString(); const content_ = JSON.stringify(body); @@ -35482,11 +34510,11 @@ export class Client { } private addFieldToDefaultScreenWithCallbacks(fieldId: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}"; - if (fieldId === undefined || fieldId === null) - throw new globalThis.Error("The parameter 'fieldId' must be defined."); - url_ = url_.replace("{fieldId}", encodeURIComponent("" + fieldId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(fieldId, 'fieldId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/addToDefault/{fieldId}") + .path("fieldId", fieldId) + .toString(); jQuery.ajax({ url: url_, @@ -35564,24 +34592,17 @@ export class Client { } private getBulkScreenTabsWithCallbacks(screenId: number[] | undefined, tabId: number[] | undefined, startAt: number | undefined, maxResult: number | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/tabs?"; - if (screenId === null) - throw new globalThis.Error("The parameter 'screenId' cannot be null."); - else if (screenId !== undefined) - screenId && screenId.forEach(item => { url_ += "screenId=" + encodeURIComponent("" + item) + "&"; }); - if (tabId === null) - throw new globalThis.Error("The parameter 'tabId' cannot be null."); - else if (tabId !== undefined) - tabId && tabId.forEach(item => { url_ += "tabId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(screenId, 'screenId'); + Guard.notNull(tabId, 'tabId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/tabs") + .paramArray("screenId", screenId) + .paramArray("tabId", tabId) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); jQuery.ajax({ url: url_, @@ -35648,11 +34669,11 @@ export class Client { } private deleteScreenWithCallbacks(screenId: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); jQuery.ajax({ url: url_, @@ -35722,11 +34743,11 @@ export class Client { } private updateScreenWithCallbacks(screenId: number, body: UpdateScreenDetails, onSuccess?: (result: Screen) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -35804,11 +34825,11 @@ export class Client { } private getAvailableScreenFieldsWithCallbacks(screenId: number, onSuccess?: (result: ScreenableField[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/availableFields") + .path("screenId", screenId) + .toString(); jQuery.ajax({ url: url_, @@ -35886,15 +34907,13 @@ export class Client { } private getAllScreenTabsWithCallbacks(screenId: number, projectKey: string | undefined, onSuccess?: (result: ScreenableTab[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .param("projectKey", projectKey) + .toString(); jQuery.ajax({ url: url_, @@ -35975,11 +34994,11 @@ export class Client { } private addScreenTabWithCallbacks(screenId: number, body: ScreenableTab, onSuccess?: (result: ScreenableTab) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs") + .path("screenId", screenId) + .toString(); const content_ = JSON.stringify(body); @@ -36058,14 +35077,13 @@ export class Client { } private deleteScreenTabWithCallbacks(screenId: number, tabId: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); jQuery.ajax({ url: url_, @@ -36132,14 +35150,13 @@ export class Client { } private renameScreenTabWithCallbacks(screenId: number, tabId: number, body: ScreenableTab, onSuccess?: (result: ScreenableTab) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -36219,18 +35236,15 @@ export class Client { } private getAllScreenTabFieldsWithCallbacks(screenId: number, tabId: number, projectKey: string | undefined, onSuccess?: (result: ScreenableField[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields?"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.notNull(projectKey, 'projectKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .param("projectKey", projectKey) + .toString(); jQuery.ajax({ url: url_, @@ -36308,14 +35322,13 @@ export class Client { } private addScreenTabFieldWithCallbacks(screenId: number, tabId: number, body: AddFieldBean, onSuccess?: (result: ScreenableField) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields") + .path("screenId", screenId) + .path("tabId", tabId) + .toString(); const content_ = JSON.stringify(body); @@ -36395,17 +35408,15 @@ export class Client { } private removeScreenTabFieldWithCallbacks(screenId: number, tabId: number, id: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -36477,17 +35488,15 @@ export class Client { } private moveScreenTabFieldWithCallbacks(screenId: number, tabId: number, id: string, body: MoveFieldBean, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/fields/{id}/move") + .path("screenId", screenId) + .path("tabId", tabId) + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -36568,17 +35577,15 @@ export class Client { } private moveScreenTabWithCallbacks(screenId: number, tabId: number, pos: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}"; - if (screenId === undefined || screenId === null) - throw new globalThis.Error("The parameter 'screenId' must be defined."); - url_ = url_.replace("{screenId}", encodeURIComponent("" + screenId)); - if (tabId === undefined || tabId === null) - throw new globalThis.Error("The parameter 'tabId' must be defined."); - url_ = url_.replace("{tabId}", encodeURIComponent("" + tabId)); - if (pos === undefined || pos === null) - throw new globalThis.Error("The parameter 'pos' must be defined."); - url_ = url_.replace("{pos}", encodeURIComponent("" + pos)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenId, 'screenId'); + Guard.required(tabId, 'tabId'); + Guard.required(pos, 'pos'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screens/{screenId}/tabs/{tabId}/move/{pos}") + .path("screenId", screenId) + .path("tabId", tabId) + .path("pos", pos) + .toString(); jQuery.ajax({ url: url_, @@ -36661,32 +35668,21 @@ export class Client { } private getScreenSchemesWithCallbacks(startAt: number | undefined, maxResults: number | undefined, id: number[] | undefined, expand: string | undefined, queryString: string | undefined, orderBy: OrderBy14 | undefined, onSuccess?: (result: PageBeanScreenScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screenscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (id === null) - throw new globalThis.Error("The parameter 'id' cannot be null."); - else if (id !== undefined) - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(id, 'id'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("id", id) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .toString(); jQuery.ajax({ url: url_, @@ -36751,8 +35747,8 @@ export class Client { } private createScreenSchemeWithCallbacks(body: ScreenSchemeDetails, onSuccess?: (result: ScreenSchemeId) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screenscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme") + .toString(); const content_ = JSON.stringify(body); @@ -36830,11 +35826,11 @@ export class Client { } private deleteScreenSchemeWithCallbacks(screenSchemeId: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); jQuery.ajax({ url: url_, @@ -36905,11 +35901,11 @@ export class Client { } private updateScreenSchemeWithCallbacks(screenSchemeId: string, body: UpdateScreenSchemeDetails, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}"; - if (screenSchemeId === undefined || screenSchemeId === null) - throw new globalThis.Error("The parameter 'screenSchemeId' must be defined."); - url_ = url_.replace("{screenSchemeId}", encodeURIComponent("" + screenSchemeId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(screenSchemeId, 'screenSchemeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/screenscheme/{screenSchemeId}") + .path("screenSchemeId", screenSchemeId) + .toString(); const content_ = JSON.stringify(body); @@ -37032,44 +36028,27 @@ export class Client { } private searchForIssuesUsingJqlWithCallbacks(jql: string | undefined, startAt: number | undefined, maxResults: number | undefined, validateQuery: ValidateQuery | undefined, fields: string[] | undefined, expand: string | undefined, properties: string[] | undefined, fieldsByKeys: boolean | undefined, failFast: boolean | undefined, onSuccess?: (result: SearchResults) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/search?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (validateQuery === null) - throw new globalThis.Error("The parameter 'validateQuery' cannot be null."); - else if (validateQuery !== undefined) - url_ += "validateQuery=" + encodeURIComponent("" + validateQuery) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(validateQuery, 'validateQuery'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .param("jql", jql) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("validateQuery", validateQuery) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .toString(); jQuery.ajax({ url: url_, @@ -37136,8 +36115,8 @@ export class Client { } private searchForIssuesUsingJqlPostWithCallbacks(body: SearchRequestBean, onSuccess?: (result: SearchResults) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search") + .toString(); const content_ = JSON.stringify(body); @@ -37207,8 +36186,8 @@ export class Client { } private countIssuesWithCallbacks(body: JQLCountRequestBean, onSuccess?: (result: JQLCountResultsBean) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/search/approximate-count"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/approximate-count") + .toString(); const content_ = JSON.stringify(body); @@ -37279,8 +36258,8 @@ export class Client { } private searchForIssuesIdsWithCallbacks(body: IdSearchRequestBean, onSuccess?: (result: IdSearchResults) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/search/id"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/id") + .toString(); const content_ = JSON.stringify(body); @@ -37393,44 +36372,27 @@ export class Client { } private searchAndReconsileIssuesUsingJqlWithCallbacks(jql: string | undefined, nextPageToken: string | undefined, maxResults: number | undefined, fields: string[] | undefined, expand: string | undefined, properties: string[] | undefined, fieldsByKeys: boolean | undefined, failFast: boolean | undefined, reconcileIssues: number[] | undefined, onSuccess?: (result: SearchAndReconcileResults) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/search/jql?"; - if (jql === null) - throw new globalThis.Error("The parameter 'jql' cannot be null."); - else if (jql !== undefined) - url_ += "jql=" + encodeURIComponent("" + jql) + "&"; - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (fields === null) - throw new globalThis.Error("The parameter 'fields' cannot be null."); - else if (fields !== undefined) - fields && fields.forEach(item => { url_ += "fields=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (properties === null) - throw new globalThis.Error("The parameter 'properties' cannot be null."); - else if (properties !== undefined) - properties && properties.forEach(item => { url_ += "properties=" + encodeURIComponent("" + item) + "&"; }); - if (fieldsByKeys === null) - throw new globalThis.Error("The parameter 'fieldsByKeys' cannot be null."); - else if (fieldsByKeys !== undefined) - url_ += "fieldsByKeys=" + encodeURIComponent("" + fieldsByKeys) + "&"; - if (failFast === null) - throw new globalThis.Error("The parameter 'failFast' cannot be null."); - else if (failFast !== undefined) - url_ += "failFast=" + encodeURIComponent("" + failFast) + "&"; - if (reconcileIssues === null) - throw new globalThis.Error("The parameter 'reconcileIssues' cannot be null."); - else if (reconcileIssues !== undefined) - reconcileIssues && reconcileIssues.forEach(item => { url_ += "reconcileIssues=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(jql, 'jql'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(fields, 'fields'); + Guard.notNull(expand, 'expand'); + Guard.notNull(properties, 'properties'); + Guard.notNull(fieldsByKeys, 'fieldsByKeys'); + Guard.notNull(failFast, 'failFast'); + Guard.notNull(reconcileIssues, 'reconcileIssues'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .param("jql", jql) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .paramArray("fields", fields) + .param("expand", expand) + .paramArray("properties", properties) + .param("fieldsByKeys", fieldsByKeys) + .param("failFast", failFast) + .paramArray("reconcileIssues", reconcileIssues) + .toString(); jQuery.ajax({ url: url_, @@ -37495,8 +36457,8 @@ export class Client { } private searchAndReconsileIssuesUsingJqlPostWithCallbacks(body: SearchAndReconcileRequestBean, onSuccess?: (result: SearchAndReconcileResults) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/search/jql"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/search/jql") + .toString(); const content_ = JSON.stringify(body); @@ -37566,11 +36528,11 @@ export class Client { } private getIssueSecurityLevelWithCallbacks(id: string, onSuccess?: (result: SecurityLevel) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/securitylevel/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/securitylevel/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -37635,8 +36597,8 @@ export class Client { } private getServerInfoWithCallbacks(onSuccess?: (result: ServerInformation) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/serverInfo"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/serverInfo") + .toString(); jQuery.ajax({ url: url_, @@ -37697,8 +36659,8 @@ export class Client { } private getIssueNavigatorDefaultColumnsWithCallbacks(onSuccess?: (result: ColumnItem[]) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); jQuery.ajax({ url: url_, @@ -37778,14 +36740,12 @@ export class Client { } private setIssueNavigatorDefaultColumnsWithCallbacks(body: ColumnRequestBody, columns: string[] | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/settings/columns"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/settings/columns") + .toString(); + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); jQuery.ajax({ url: url_, @@ -37857,8 +36817,8 @@ export class Client { } private getStatusesWithCallbacks(onSuccess?: (result: StatusDetails[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/status"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status") + .toString(); jQuery.ajax({ url: url_, @@ -37927,11 +36887,11 @@ export class Client { } private getStatusWithCallbacks(idOrName: string, onSuccess?: (result: StatusDetails) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/status/{idOrName}"; - if (idOrName === undefined || idOrName === null) - throw new globalThis.Error("The parameter 'idOrName' must be defined."); - url_ = url_.replace("{idOrName}", encodeURIComponent("" + idOrName)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrName, 'idOrName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/status/{idOrName}") + .path("idOrName", idOrName) + .toString(); jQuery.ajax({ url: url_, @@ -37996,8 +36956,8 @@ export class Client { } private getStatusCategoriesWithCallbacks(onSuccess?: (result: StatusCategory[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/statuscategory"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory") + .toString(); jQuery.ajax({ url: url_, @@ -38066,11 +37026,11 @@ export class Client { } private getStatusCategoryWithCallbacks(idOrKey: string, onSuccess?: (result: StatusCategory) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}"; - if (idOrKey === undefined || idOrKey === null) - throw new globalThis.Error("The parameter 'idOrKey' must be defined."); - url_ = url_.replace("{idOrKey}", encodeURIComponent("" + idOrKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(idOrKey, 'idOrKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuscategory/{idOrKey}") + .path("idOrKey", idOrKey) + .toString(); jQuery.ajax({ url: url_, @@ -38138,12 +37098,11 @@ export class Client { } private deleteStatusesByIdWithCallbacks(id: string[], onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -38218,16 +37177,13 @@ export class Client { } private getStatusesByIdWithCallbacks(id: string[], expand: string | undefined, onSuccess?: (result: JiraStatus[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/statuses?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined and cannot be null."); - else - id && id.forEach(item => { url_ += "id=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .paramArray("id", id) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -38300,8 +37256,8 @@ export class Client { } private createStatusesWithCallbacks(body: StatusCreateRequest, onSuccess?: (result: JiraStatus[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -38382,8 +37338,8 @@ export class Client { } private updateStatusesWithCallbacks(body: StatusUpdateRequest, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/statuses"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses") + .toString(); const content_ = JSON.stringify(body); @@ -38468,32 +37424,21 @@ export class Client { } private searchWithCallbacks(expand: string | undefined, projectId: string | undefined, startAt: number | undefined, maxResults: number | undefined, searchString: string | undefined, statusCategory: string | undefined, onSuccess?: (result: PageOfStatuses) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/statuses/search?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (searchString === null) - throw new globalThis.Error("The parameter 'searchString' cannot be null."); - else if (searchString !== undefined) - url_ += "searchString=" + encodeURIComponent("" + searchString) + "&"; - if (statusCategory === null) - throw new globalThis.Error("The parameter 'statusCategory' cannot be null."); - else if (statusCategory !== undefined) - url_ += "statusCategory=" + encodeURIComponent("" + statusCategory) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(searchString, 'searchString'); + Guard.notNull(statusCategory, 'statusCategory'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/search") + .param("expand", expand) + .param("projectId", projectId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("searchString", searchString) + .param("statusCategory", statusCategory) + .toString(); jQuery.ajax({ url: url_, @@ -38562,22 +37507,17 @@ export class Client { } private getProjectIssueTypeUsagesForStatusWithCallbacks(statusId: string, projectId: string, nextPageToken: string | undefined, maxResults: number | undefined, onSuccess?: (result: StatusProjectIssueTypeUsageDTO) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/project/{projectId}/issueTypeUsages") + .path("statusId", statusId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -38649,19 +37589,15 @@ export class Client { } private getProjectUsagesForStatusWithCallbacks(statusId: string, nextPageToken: string | undefined, maxResults: number | undefined, onSuccess?: (result: StatusProjectUsageDTO) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/projectUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -38733,19 +37669,15 @@ export class Client { } private getWorkflowUsagesForStatusWithCallbacks(statusId: string, nextPageToken: string | undefined, maxResults: number | undefined, onSuccess?: (result: StatusWorkflowUsageDTO) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages?"; - if (statusId === undefined || statusId === null) - throw new globalThis.Error("The parameter 'statusId' must be defined."); - url_ = url_.replace("{statusId}", encodeURIComponent("" + statusId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(statusId, 'statusId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/statuses/{statusId}/workflowUsages") + .path("statusId", statusId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -38815,11 +37747,11 @@ export class Client { } private getTaskWithCallbacks(taskId: string, onSuccess?: (result: TaskProgressBeanObject) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}") + .path("taskId", taskId) + .toString(); jQuery.ajax({ url: url_, @@ -38889,11 +37821,11 @@ export class Client { } private cancelTaskWithCallbacks(taskId: string, onSuccess?: (result: any) => void, onFail?: (exception: string[] | string[] | string[] | string[] | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/task/{taskId}/cancel"; - if (taskId === undefined || taskId === null) - throw new globalThis.Error("The parameter 'taskId' must be defined."); - url_ = url_.replace("{taskId}", encodeURIComponent("" + taskId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(taskId, 'taskId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/task/{taskId}/cancel") + .path("taskId", taskId) + .toString(); jQuery.ajax({ url: url_, @@ -39013,20 +37945,15 @@ export class Client { } private getUiModificationsWithCallbacks(startAt: number | undefined, maxResults: number | undefined, expand: string | undefined, onSuccess?: (result: PageBeanUiModificationDetails) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/uiModifications?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -39096,8 +38023,8 @@ export class Client { } private createUiModificationWithCallbacks(body: CreateUiModificationDetails, onSuccess?: (result: UiModificationIdentifiers) => void, onFail?: (exception: DetailedErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/uiModifications"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications") + .toString(); const content_ = JSON.stringify(body); @@ -39178,11 +38105,11 @@ export class Client { } private deleteUiModificationWithCallbacks(uiModificationId: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); jQuery.ajax({ url: url_, @@ -39254,11 +38181,11 @@ export class Client { } private updateUiModificationWithCallbacks(uiModificationId: string, body: UpdateUiModificationDetails, onSuccess?: (result: any) => void, onFail?: (exception: DetailedErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}"; - if (uiModificationId === undefined || uiModificationId === null) - throw new globalThis.Error("The parameter 'uiModificationId' must be defined."); - url_ = url_.replace("{uiModificationId}", encodeURIComponent("" + uiModificationId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(uiModificationId, 'uiModificationId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/uiModifications/{uiModificationId}") + .path("uiModificationId", uiModificationId) + .toString(); const content_ = JSON.stringify(body); @@ -39341,14 +38268,13 @@ export class Client { } private getAvatarsWithCallbacks(type: Type3, entityId: string, onSuccess?: (result: Avatars) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .toString(); jQuery.ajax({ url: url_, @@ -39418,26 +38344,19 @@ export class Client { } private storeAvatarWithCallbacks(type: Type4, entityId: string, size: number, body: any, x: number | undefined, y: number | undefined, onSuccess?: (result: Avatar) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === undefined || size === null) - throw new globalThis.Error("The parameter 'size' must be defined and cannot be null."); - else - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (x === null) - throw new globalThis.Error("The parameter 'x' cannot be null."); - else if (x !== undefined) - url_ += "x=" + encodeURIComponent("" + x) + "&"; - if (y === null) - throw new globalThis.Error("The parameter 'y' cannot be null."); - else if (y !== undefined) - url_ += "y=" + encodeURIComponent("" + y) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.required(size, 'size'); + Guard.notNull(x, 'x'); + Guard.notNull(y, 'y'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("x", x) + .param("y", y) + .toString(); const content_ = JSON.stringify(body); @@ -39517,17 +38436,15 @@ export class Client { } private deleteAvatarWithCallbacks(type: Type5, owningObjectId: string, id: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (owningObjectId === undefined || owningObjectId === null) - throw new globalThis.Error("The parameter 'owningObjectId' must be defined."); - url_ = url_.replace("{owningObjectId}", encodeURIComponent("" + owningObjectId)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(owningObjectId, 'owningObjectId'); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}") + .path("type", type) + .path("owningObjectId", owningObjectId) + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -39595,19 +38512,15 @@ export class Client { } private getAvatarImageByTypeWithCallbacks(type: Type6, size: Size | undefined, format: Format | undefined, onSuccess?: (result: StreamingResponseBody) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}") + .path("type", type) + .param("size", size) + .param("format", format) + .toString(); jQuery.ajax({ url: url_, @@ -39689,22 +38602,17 @@ export class Client { } private getAvatarImageByIDWithCallbacks(type: Type7, id: number, size: Size2 | undefined, format: Format2 | undefined, onSuccess?: (result: StreamingResponseBody) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(id, 'id'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/avatar/{id}") + .path("type", type) + .path("id", id) + .param("size", size) + .param("format", format) + .toString(); jQuery.ajax({ url: url_, @@ -39793,22 +38701,17 @@ export class Client { } private getAvatarImageByOwnerWithCallbacks(type: Type8, entityId: string, size: Size3 | undefined, format: Format3 | undefined, onSuccess?: (result: StreamingResponseBody) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}?"; - if (type === undefined || type === null) - throw new globalThis.Error("The parameter 'type' must be defined."); - url_ = url_.replace("{type}", encodeURIComponent("" + type)); - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - if (size === null) - throw new globalThis.Error("The parameter 'size' cannot be null."); - else if (size !== undefined) - url_ += "size=" + encodeURIComponent("" + size) + "&"; - if (format === null) - throw new globalThis.Error("The parameter 'format' cannot be null."); - else if (format !== undefined) - url_ += "format=" + encodeURIComponent("" + format) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(type, 'type'); + Guard.required(entityId, 'entityId'); + Guard.notNull(size, 'size'); + Guard.notNull(format, 'format'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/universal_avatar/view/type/{type}/owner/{entityId}") + .path("type", type) + .path("entityId", entityId) + .param("size", size) + .param("format", format) + .toString(); jQuery.ajax({ url: url_, @@ -39896,20 +38799,15 @@ export class Client { } private removeUserWithCallbacks(accountId: string, username: string | undefined, key: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); jQuery.ajax({ url: url_, @@ -39985,24 +38883,17 @@ export class Client { } private getUserWithCallbacks(accountId: string | undefined, username: string | undefined, key: string | undefined, expand: string | undefined, onSuccess?: (result: User) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -40072,8 +38963,8 @@ export class Client { } private createUserWithCallbacks(body: NewUserDetails, onSuccess?: (result: User) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user") + .toString(); const content_ = JSON.stringify(body); @@ -40152,32 +39043,21 @@ export class Client { } private findBulkAssignableUsersWithCallbacks(projectKeys: string, query: string | undefined, username: string | undefined, accountId: string | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch?"; - if (projectKeys === undefined || projectKeys === null) - throw new globalThis.Error("The parameter 'projectKeys' must be defined and cannot be null."); - else - url_ += "projectKeys=" + encodeURIComponent("" + projectKeys) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectKeys, 'projectKeys'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/multiProjectSearch") + .param("projectKeys", projectKeys) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -40268,52 +39148,31 @@ export class Client { } private findAssignableUsersWithCallbacks(query: string | undefined, sessionId: string | undefined, username: string | undefined, accountId: string | undefined, project: string | undefined, issueKey: string | undefined, issueId: string | undefined, startAt: number | undefined, maxResults: number | undefined, actionDescriptorId: number | undefined, recommend: boolean | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/assignable/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (sessionId === null) - throw new globalThis.Error("The parameter 'sessionId' cannot be null."); - else if (sessionId !== undefined) - url_ += "sessionId=" + encodeURIComponent("" + sessionId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (project === null) - throw new globalThis.Error("The parameter 'project' cannot be null."); - else if (project !== undefined) - url_ += "project=" + encodeURIComponent("" + project) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (issueId === null) - throw new globalThis.Error("The parameter 'issueId' cannot be null."); - else if (issueId !== undefined) - url_ += "issueId=" + encodeURIComponent("" + issueId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (actionDescriptorId === null) - throw new globalThis.Error("The parameter 'actionDescriptorId' cannot be null."); - else if (actionDescriptorId !== undefined) - url_ += "actionDescriptorId=" + encodeURIComponent("" + actionDescriptorId) + "&"; - if (recommend === null) - throw new globalThis.Error("The parameter 'recommend' cannot be null."); - else if (recommend !== undefined) - url_ += "recommend=" + encodeURIComponent("" + recommend) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(sessionId, 'sessionId'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(project, 'project'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(issueId, 'issueId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(actionDescriptorId, 'actionDescriptorId'); + Guard.notNull(recommend, 'recommend'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/assignable/search") + .param("query", query) + .param("sessionId", sessionId) + .param("username", username) + .param("accountId", accountId) + .param("project", project) + .param("issueKey", issueKey) + .param("issueId", issueId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("actionDescriptorId", actionDescriptorId) + .param("recommend", recommend) + .toString(); jQuery.ajax({ url: url_, @@ -40398,28 +39257,19 @@ export class Client { } private bulkGetUsersWithCallbacks(accountId: string[], startAt: number | undefined, maxResults: number | undefined, username: string[] | undefined, key: string[] | undefined, onSuccess?: (result: PageBeanUser) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk") + .paramArray("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); jQuery.ajax({ url: url_, @@ -40488,24 +39338,17 @@ export class Client { } private bulkGetUsersMigrationWithCallbacks(startAt: number | undefined, maxResults: number | undefined, username: string[] | undefined, key: string[] | undefined, onSuccess?: (result: UserMigrationBean[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/bulk/migration?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - username && username.forEach(item => { url_ += "username=" + encodeURIComponent("" + item) + "&"; }); - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - key && key.forEach(item => { url_ += "key=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/bulk/migration") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("username", username) + .paramArray("key", key) + .toString(); jQuery.ajax({ url: url_, @@ -40579,16 +39422,13 @@ export class Client { } private resetUserColumnsWithCallbacks(accountId: string | undefined, username: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); jQuery.ajax({ url: url_, @@ -40651,16 +39491,13 @@ export class Client { } private getUserDefaultColumnsWithCallbacks(accountId: string | undefined, username: string | undefined, onSuccess?: (result: ColumnItem[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .param("username", username) + .toString(); jQuery.ajax({ url: url_, @@ -40739,18 +39576,15 @@ export class Client { } private setUserColumnsWithCallbacks(body: UserColumnRequestBody, accountId: string | undefined, columns: string[] | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/columns?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/columns") + .param("accountId", accountId) + .toString(); + + Guard.notNull(columns, "columns"); const content_ = new FormData(); - if (columns === null || columns === undefined) - throw new globalThis.Error("The parameter 'columns' cannot be null."); - else - columns.forEach(item_ => content_.append("columns", item_.toString())); + columns.forEach(item_ => content_.append("columns", item_.toString())); jQuery.ajax({ url: url_, @@ -40832,12 +39666,11 @@ export class Client { } private getUserEmailWithCallbacks(accountId: string, onSuccess?: (result: UnrestrictedUserEmail) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/email?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email") + .param("accountId", accountId) + .toString(); jQuery.ajax({ url: url_, @@ -40911,12 +39744,11 @@ export class Client { } private getUserEmailBulkWithCallbacks(accountId: string[], onSuccess?: (result: UnrestrictedUserEmail) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/email/bulk?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - accountId && accountId.forEach(item => { url_ += "accountId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/email/bulk") + .paramArray("accountId", accountId) + .toString(); jQuery.ajax({ url: url_, @@ -40988,20 +39820,15 @@ export class Client { } private getUserGroupsWithCallbacks(accountId: string, username: string | undefined, key: string | undefined, onSuccess?: (result: GroupName[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/groups?"; - if (accountId === undefined || accountId === null) - throw new globalThis.Error("The parameter 'accountId' must be defined and cannot be null."); - else - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(accountId, 'accountId'); + Guard.notNull(username, 'username'); + Guard.notNull(key, 'key'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/groups") + .param("accountId", accountId) + .param("username", username) + .param("key", key) + .toString(); jQuery.ajax({ url: url_, @@ -41079,15 +39906,13 @@ export class Client { } private getUserNavPropertyWithCallbacks(propertyKey: string, accountId: string | undefined, onSuccess?: (result: UserNavPropertyJsonBean) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); jQuery.ajax({ url: url_, @@ -41163,15 +39988,13 @@ export class Client { } private setUserNavPropertyWithCallbacks(propertyKey: string, body: any, accountId: string | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/nav4-opt-property/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .toString(); const content_ = JSON.stringify(body); @@ -41298,40 +40121,25 @@ export class Client { } private findUsersWithAllPermissionsWithCallbacks(permissions: string, query: string | undefined, username: string | undefined, accountId: string | undefined, issueKey: string | undefined, projectKey: string | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/permission/search?"; - if (permissions === undefined || permissions === null) - throw new globalThis.Error("The parameter 'permissions' must be defined and cannot be null."); - else - url_ += "permissions=" + encodeURIComponent("" + permissions) + "&"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(permissions, 'permissions'); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/permission/search") + .param("permissions", permissions) + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -41422,36 +40230,23 @@ export class Client { } private findUsersForPickerWithCallbacks(query: string, maxResults: number | undefined, showAvatar: boolean | undefined, exclude: string[] | undefined, excludeAccountIds: string[] | undefined, avatarSize: string | undefined, excludeConnectUsers: boolean | undefined, onSuccess?: (result: FoundUsers) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/picker?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (showAvatar === null) - throw new globalThis.Error("The parameter 'showAvatar' cannot be null."); - else if (showAvatar !== undefined) - url_ += "showAvatar=" + encodeURIComponent("" + showAvatar) + "&"; - if (exclude === null) - throw new globalThis.Error("The parameter 'exclude' cannot be null."); - else if (exclude !== undefined) - exclude && exclude.forEach(item => { url_ += "exclude=" + encodeURIComponent("" + item) + "&"; }); - if (excludeAccountIds === null) - throw new globalThis.Error("The parameter 'excludeAccountIds' cannot be null."); - else if (excludeAccountIds !== undefined) - excludeAccountIds && excludeAccountIds.forEach(item => { url_ += "excludeAccountIds=" + encodeURIComponent("" + item) + "&"; }); - if (avatarSize === null) - throw new globalThis.Error("The parameter 'avatarSize' cannot be null."); - else if (avatarSize !== undefined) - url_ += "avatarSize=" + encodeURIComponent("" + avatarSize) + "&"; - if (excludeConnectUsers === null) - throw new globalThis.Error("The parameter 'excludeConnectUsers' cannot be null."); - else if (excludeConnectUsers !== undefined) - url_ += "excludeConnectUsers=" + encodeURIComponent("" + excludeConnectUsers) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(showAvatar, 'showAvatar'); + Guard.notNull(exclude, 'exclude'); + Guard.notNull(excludeAccountIds, 'excludeAccountIds'); + Guard.notNull(avatarSize, 'avatarSize'); + Guard.notNull(excludeConnectUsers, 'excludeConnectUsers'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/picker") + .param("query", query) + .param("maxResults", maxResults) + .param("showAvatar", showAvatar) + .paramArray("exclude", exclude) + .paramArray("excludeAccountIds", excludeAccountIds) + .param("avatarSize", avatarSize) + .param("excludeConnectUsers", excludeConnectUsers) + .toString(); jQuery.ajax({ url: url_, @@ -41523,20 +40318,15 @@ export class Client { } private getUserPropertyKeysWithCallbacks(accountId: string | undefined, userKey: string | undefined, username: string | undefined, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/properties?"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties") + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); jQuery.ajax({ url: url_, @@ -41613,23 +40403,17 @@ export class Client { } private deleteUserPropertyWithCallbacks(propertyKey: string, accountId: string | undefined, userKey: string | undefined, username: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); jQuery.ajax({ url: url_, @@ -41702,23 +40486,17 @@ export class Client { } private getUserPropertyWithCallbacks(propertyKey: string, accountId: string | undefined, userKey: string | undefined, username: string | undefined, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); jQuery.ajax({ url: url_, @@ -41796,23 +40574,17 @@ export class Client { } private setUserPropertyWithCallbacks(propertyKey: string, body: any, accountId: string | undefined, userKey: string | undefined, username: string | undefined, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/properties/{propertyKey}?"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (userKey === null) - throw new globalThis.Error("The parameter 'userKey' cannot be null."); - else if (userKey !== undefined) - url_ += "userKey=" + encodeURIComponent("" + userKey) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(userKey, 'userKey'); + Guard.notNull(username, 'username'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .param("accountId", accountId) + .param("userKey", userKey) + .param("username", username) + .toString(); const content_ = JSON.stringify(body); @@ -41908,32 +40680,21 @@ export class Client { } private findUsersWithCallbacks(query: string | undefined, username: string | undefined, accountId: string | undefined, startAt: number | undefined, maxResults: number | undefined, property: string | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (property === null) - throw new globalThis.Error("The parameter 'property' cannot be null."); - else if (property !== undefined) - url_ += "property=" + encodeURIComponent("" + property) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(property, 'property'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("property", property) + .toString(); jQuery.ajax({ url: url_, @@ -42012,20 +40773,15 @@ export class Client { } private findUsersByQueryWithCallbacks(query: string, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanUser) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/search/query?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query") + .param("query", query) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -42113,20 +40869,15 @@ export class Client { } private findUserKeysByQueryWithCallbacks(query: string, startAt: number | undefined, maxResult: number | undefined, onSuccess?: (result: PageBeanUserKey) => void, onFail?: (exception: ErrorCollection | ErrorCollection | ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/search/query/key?"; - if (query === undefined || query === null) - throw new globalThis.Error("The parameter 'query' must be defined and cannot be null."); - else - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResult === null) - throw new globalThis.Error("The parameter 'maxResult' cannot be null."); - else if (maxResult !== undefined) - url_ += "maxResult=" + encodeURIComponent("" + maxResult) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(query, 'query'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResult, 'maxResult'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/search/query/key") + .param("query", query) + .param("startAt", startAt) + .param("maxResult", maxResult) + .toString(); jQuery.ajax({ url: url_, @@ -42218,36 +40969,23 @@ export class Client { } private findUsersWithBrowsePermissionWithCallbacks(query: string | undefined, username: string | undefined, accountId: string | undefined, issueKey: string | undefined, projectKey: string | undefined, startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/user/viewissue/search?"; - if (query === null) - throw new globalThis.Error("The parameter 'query' cannot be null."); - else if (query !== undefined) - url_ += "query=" + encodeURIComponent("" + query) + "&"; - if (username === null) - throw new globalThis.Error("The parameter 'username' cannot be null."); - else if (username !== undefined) - url_ += "username=" + encodeURIComponent("" + username) + "&"; - if (accountId === null) - throw new globalThis.Error("The parameter 'accountId' cannot be null."); - else if (accountId !== undefined) - url_ += "accountId=" + encodeURIComponent("" + accountId) + "&"; - if (issueKey === null) - throw new globalThis.Error("The parameter 'issueKey' cannot be null."); - else if (issueKey !== undefined) - url_ += "issueKey=" + encodeURIComponent("" + issueKey) + "&"; - if (projectKey === null) - throw new globalThis.Error("The parameter 'projectKey' cannot be null."); - else if (projectKey !== undefined) - url_ += "projectKey=" + encodeURIComponent("" + projectKey) + "&"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(query, 'query'); + Guard.notNull(username, 'username'); + Guard.notNull(accountId, 'accountId'); + Guard.notNull(issueKey, 'issueKey'); + Guard.notNull(projectKey, 'projectKey'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/user/viewissue/search") + .param("query", query) + .param("username", username) + .param("accountId", accountId) + .param("issueKey", issueKey) + .param("projectKey", projectKey) + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -42329,16 +41067,13 @@ export class Client { } private getAllUsersDefaultWithCallbacks(startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/users?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -42416,16 +41151,13 @@ export class Client { } private getAllUsersWithCallbacks(startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: User[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/users/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/users/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -42501,8 +41233,8 @@ export class Client { } private createVersionWithCallbacks(body: Version, onSuccess?: (result: Version) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version") + .toString(); const content_ = JSON.stringify(body); @@ -42579,19 +41311,15 @@ export class Client { } private deleteVersionWithCallbacks(id: string, moveFixIssuesTo: string | undefined, moveAffectedIssuesTo: string | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveFixIssuesTo === null) - throw new globalThis.Error("The parameter 'moveFixIssuesTo' cannot be null."); - else if (moveFixIssuesTo !== undefined) - url_ += "moveFixIssuesTo=" + encodeURIComponent("" + moveFixIssuesTo) + "&"; - if (moveAffectedIssuesTo === null) - throw new globalThis.Error("The parameter 'moveAffectedIssuesTo' cannot be null."); - else if (moveAffectedIssuesTo !== undefined) - url_ += "moveAffectedIssuesTo=" + encodeURIComponent("" + moveAffectedIssuesTo) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(moveFixIssuesTo, 'moveFixIssuesTo'); + Guard.notNull(moveAffectedIssuesTo, 'moveAffectedIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("moveFixIssuesTo", moveFixIssuesTo) + .param("moveAffectedIssuesTo", moveAffectedIssuesTo) + .toString(); jQuery.ajax({ url: url_, @@ -42663,15 +41391,13 @@ export class Client { } private getVersionWithCallbacks(id: string, expand: string | undefined, onSuccess?: (result: Version) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -42737,11 +41463,11 @@ export class Client { } private updateVersionWithCallbacks(id: string, body: Version, onSuccess?: (result: Version) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -42816,14 +41542,13 @@ export class Client { } private mergeVersionsWithCallbacks(id: string, moveIssuesTo: string, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (moveIssuesTo === undefined || moveIssuesTo === null) - throw new globalThis.Error("The parameter 'moveIssuesTo' must be defined."); - url_ = url_.replace("{moveIssuesTo}", encodeURIComponent("" + moveIssuesTo)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(moveIssuesTo, 'moveIssuesTo'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/mergeto/{moveIssuesTo}") + .path("id", id) + .path("moveIssuesTo", moveIssuesTo) + .toString(); jQuery.ajax({ url: url_, @@ -42894,11 +41619,11 @@ export class Client { } private moveVersionWithCallbacks(id: string, body: VersionMoveBean, onSuccess?: (result: Version) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/move"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/move") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -42972,11 +41697,11 @@ export class Client { } private getVersionRelatedIssuesWithCallbacks(id: string, onSuccess?: (result: VersionIssueCounts) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedIssueCounts") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -43042,11 +41767,11 @@ export class Client { } private getRelatedWorkWithCallbacks(id: string, onSuccess?: (result: VersionRelatedWork[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -43122,11 +41847,11 @@ export class Client { } private createRelatedWorkWithCallbacks(id: string, body: VersionRelatedWork, onSuccess?: (result: VersionRelatedWork) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -43204,11 +41929,11 @@ export class Client { } private updateRelatedWorkWithCallbacks(id: string, body: VersionRelatedWork, onSuccess?: (result: VersionRelatedWork) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/relatedwork"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/relatedwork") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -43286,11 +42011,11 @@ export class Client { } private deleteAndReplaceVersionWithCallbacks(id: string, body: DeleteAndReplaceVersionBean, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/removeAndSwap") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -43365,11 +42090,11 @@ export class Client { } private getVersionUnresolvedIssuesWithCallbacks(id: string, onSuccess?: (result: VersionUnresolvedIssuesCount) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{id}/unresolvedIssueCount") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -43436,14 +42161,13 @@ export class Client { } private deleteRelatedWorkWithCallbacks(versionId: string, relatedWorkId: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}"; - if (versionId === undefined || versionId === null) - throw new globalThis.Error("The parameter 'versionId' must be defined."); - url_ = url_.replace("{versionId}", encodeURIComponent("" + versionId)); - if (relatedWorkId === undefined || relatedWorkId === null) - throw new globalThis.Error("The parameter 'relatedWorkId' must be defined."); - url_ = url_.replace("{relatedWorkId}", encodeURIComponent("" + relatedWorkId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(versionId, 'versionId'); + Guard.required(relatedWorkId, 'relatedWorkId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/version/{versionId}/relatedwork/{relatedWorkId}") + .path("versionId", versionId) + .path("relatedWorkId", relatedWorkId) + .toString(); jQuery.ajax({ url: url_, @@ -43512,8 +42236,8 @@ export class Client { } private deleteWebhookByIdWithCallbacks(body: ContainerForWebhookIDs, onSuccess?: (result: void) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -43586,16 +42310,13 @@ export class Client { } private getDynamicWebhooksForAppWithCallbacks(startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanWebhook) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/webhook?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -43666,8 +42387,8 @@ export class Client { } private registerDynamicWebhooksWithCallbacks(body: WebhookRegistrationDetails, onSuccess?: (result: ContainerForRegisteredWebhooks) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/webhook"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook") + .toString(); const content_ = JSON.stringify(body); @@ -43744,16 +42465,13 @@ export class Client { } private getFailedWebhooksWithCallbacks(maxResults: number | undefined, after: number | undefined, onSuccess?: (result: FailedWebhooks) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/webhook/failed?"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (after === null) - throw new globalThis.Error("The parameter 'after' cannot be null."); - else if (after !== undefined) - url_ += "after=" + encodeURIComponent("" + after) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(after, 'after'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/failed") + .param("maxResults", maxResults) + .param("after", after) + .toString(); jQuery.ajax({ url: url_, @@ -43824,8 +42542,8 @@ export class Client { } private refreshWebhooksWithCallbacks(body: ContainerForWebhookIDs, onSuccess?: (result: WebhooksExpirationDate) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/webhook/refresh"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/webhook/refresh") + .toString(); const content_ = JSON.stringify(body); @@ -43902,12 +42620,11 @@ export class Client { } private getAllWorkflowsWithCallbacks(workflowName: string | undefined, onSuccess?: (result: DeprecatedWorkflow[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow?"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .param("workflowName", workflowName) + .toString(); jQuery.ajax({ url: url_, @@ -43977,8 +42694,8 @@ export class Client { } private createWorkflowWithCallbacks(body: CreateWorkflowDetails, onSuccess?: (result: WorkflowIDs) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow") + .toString(); const content_ = JSON.stringify(body); @@ -44063,40 +42780,25 @@ export class Client { } private getWorkflowTransitionRuleConfigurationsWithCallbacks(types: Types[], startAt: number | undefined, maxResults: number | undefined, keys: string[] | undefined, workflowNames: string[] | undefined, withTags: string[] | undefined, draft: boolean | undefined, expand: string | undefined, onSuccess?: (result: PageBeanWorkflowTransitionRules) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config?"; - if (types === undefined || types === null) - throw new globalThis.Error("The parameter 'types' must be defined and cannot be null."); - else - types && types.forEach(item => { url_ += "types=" + encodeURIComponent("" + item) + "&"; }); - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (keys === null) - throw new globalThis.Error("The parameter 'keys' cannot be null."); - else if (keys !== undefined) - keys && keys.forEach(item => { url_ += "keys=" + encodeURIComponent("" + item) + "&"; }); - if (workflowNames === null) - throw new globalThis.Error("The parameter 'workflowNames' cannot be null."); - else if (workflowNames !== undefined) - workflowNames && workflowNames.forEach(item => { url_ += "workflowNames=" + encodeURIComponent("" + item) + "&"; }); - if (withTags === null) - throw new globalThis.Error("The parameter 'withTags' cannot be null."); - else if (withTags !== undefined) - withTags && withTags.forEach(item => { url_ += "withTags=" + encodeURIComponent("" + item) + "&"; }); - if (draft === null) - throw new globalThis.Error("The parameter 'draft' cannot be null."); - else if (draft !== undefined) - url_ += "draft=" + encodeURIComponent("" + draft) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(types, 'types'); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(keys, 'keys'); + Guard.notNull(workflowNames, 'workflowNames'); + Guard.notNull(withTags, 'withTags'); + Guard.notNull(draft, 'draft'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .paramArray("types", types) + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("keys", keys) + .paramArray("workflowNames", workflowNames) + .paramArray("withTags", withTags) + .param("draft", draft) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -44175,8 +42877,8 @@ export class Client { } private updateWorkflowTransitionRuleConfigurationsWithCallbacks(body: WorkflowTransitionRulesUpdate, onSuccess?: (result: WorkflowTransitionRulesUpdateErrors) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config") + .toString(); const content_ = JSON.stringify(body); @@ -44255,8 +42957,8 @@ export class Client { } private deleteWorkflowTransitionRuleConfigurationsWithCallbacks(body: WorkflowsWithTransitionRulesDetails, onSuccess?: (result: WorkflowTransitionRulesUpdateErrors) => void, onFail?: (exception: ErrorCollection | ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/rule/config/delete"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/rule/config/delete") + .toString(); const content_ = JSON.stringify(body); @@ -44353,36 +43055,23 @@ export class Client { } private getWorkflowsPaginatedWithCallbacks(startAt: number | undefined, maxResults: number | undefined, workflowName: string[] | undefined, expand: string | undefined, queryString: string | undefined, orderBy: OrderBy15 | undefined, isActive: boolean | undefined, onSuccess?: (result: PageBeanWorkflow) => void, onFail?: (exception: ErrorCollection | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - workflowName && workflowName.forEach(item => { url_ += "workflowName=" + encodeURIComponent("" + item) + "&"; }); - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .paramArray("workflowName", workflowName) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("isActive", isActive) + .toString(); jQuery.ajax({ url: url_, @@ -44454,23 +43143,17 @@ export class Client { } private deleteWorkflowTransitionPropertyWithCallbacks(transitionId: number, key: string, workflowName: string, workflowMode: WorkflowMode | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); jQuery.ajax({ url: url_, @@ -44548,27 +43231,19 @@ export class Client { } private getWorkflowTransitionPropertiesWithCallbacks(transitionId: number, workflowName: string, includeReservedKeys: boolean | undefined, key: string | undefined, workflowMode: WorkflowMode2 | undefined, onSuccess?: (result: WorkflowTransitionProperty) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (includeReservedKeys === null) - throw new globalThis.Error("The parameter 'includeReservedKeys' cannot be null."); - else if (includeReservedKeys !== undefined) - url_ += "includeReservedKeys=" + encodeURIComponent("" + includeReservedKeys) + "&"; - if (key === null) - throw new globalThis.Error("The parameter 'key' cannot be null."); - else if (key !== undefined) - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(includeReservedKeys, 'includeReservedKeys'); + Guard.notNull(key, 'key'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("workflowName", workflowName) + .param("includeReservedKeys", includeReservedKeys) + .param("key", key) + .param("workflowMode", workflowMode) + .toString(); jQuery.ajax({ url: url_, @@ -44645,23 +43320,17 @@ export class Client { } private createWorkflowTransitionPropertyWithCallbacks(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode: WorkflowMode3 | undefined, onSuccess?: (result: WorkflowTransitionProperty) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -44742,23 +43411,17 @@ export class Client { } private updateWorkflowTransitionPropertyWithCallbacks(transitionId: number, key: string, workflowName: string, body: WorkflowTransitionProperty, workflowMode: WorkflowMode4 | undefined, onSuccess?: (result: WorkflowTransitionProperty) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties?"; - if (transitionId === undefined || transitionId === null) - throw new globalThis.Error("The parameter 'transitionId' must be defined."); - url_ = url_.replace("{transitionId}", encodeURIComponent("" + transitionId)); - if (key === undefined || key === null) - throw new globalThis.Error("The parameter 'key' must be defined and cannot be null."); - else - url_ += "key=" + encodeURIComponent("" + key) + "&"; - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (workflowMode === null) - throw new globalThis.Error("The parameter 'workflowMode' cannot be null."); - else if (workflowMode !== undefined) - url_ += "workflowMode=" + encodeURIComponent("" + workflowMode) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(transitionId, 'transitionId'); + Guard.required(key, 'key'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(workflowMode, 'workflowMode'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/transitions/{transitionId}/properties") + .path("transitionId", transitionId) + .param("key", key) + .param("workflowName", workflowName) + .param("workflowMode", workflowMode) + .toString(); const content_ = JSON.stringify(body); @@ -44840,11 +43503,11 @@ export class Client { } private deleteInactiveWorkflowWithCallbacks(entityId: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/{entityId}"; - if (entityId === undefined || entityId === null) - throw new globalThis.Error("The parameter 'entityId' must be defined."); - url_ = url_.replace("{entityId}", encodeURIComponent("" + entityId)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityId, 'entityId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{entityId}") + .path("entityId", entityId) + .toString(); jQuery.ajax({ url: url_, @@ -44917,22 +43580,17 @@ export class Client { } private getWorkflowProjectIssueTypeUsagesWithCallbacks(workflowId: string, projectId: number, nextPageToken: string | undefined, maxResults: number | undefined, onSuccess?: (result: WorkflowProjectIssueTypeUsageDTO) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined."); - url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.required(projectId, 'projectId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages") + .path("workflowId", workflowId) + .path("projectId", projectId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -45004,19 +43662,15 @@ export class Client { } private getProjectUsagesForWorkflowWithCallbacks(workflowId: string, nextPageToken: string | undefined, maxResults: number | undefined, onSuccess?: (result: WorkflowProjectUsageDTO) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/projectUsages") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -45088,19 +43742,15 @@ export class Client { } private getWorkflowSchemeUsagesForWorkflowWithCallbacks(workflowId: string, nextPageToken: string | undefined, maxResults: number | undefined, onSuccess?: (result: WorkflowSchemeUsageDTO) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes?"; - if (workflowId === undefined || workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' must be defined."); - url_ = url_.replace("{workflowId}", encodeURIComponent("" + workflowId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowId, 'workflowId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflow/{workflowId}/workflowSchemes") + .path("workflowId", workflowId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -45176,16 +43826,13 @@ export class Client { } private readWorkflowsWithCallbacks(body: WorkflowReadRequest, expand: string | undefined, useApprovalConfiguration: boolean | undefined, onSuccess?: (result: WorkflowReadResponse) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflows?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (useApprovalConfiguration === null) - throw new globalThis.Error("The parameter 'useApprovalConfiguration' cannot be null."); - else if (useApprovalConfiguration !== undefined) - url_ += "useApprovalConfiguration=" + encodeURIComponent("" + useApprovalConfiguration) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + Guard.notNull(useApprovalConfiguration, 'useApprovalConfiguration'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows") + .param("expand", expand) + .param("useApprovalConfiguration", useApprovalConfiguration) + .toString(); const content_ = JSON.stringify(body); @@ -45257,20 +43904,15 @@ export class Client { } private workflowCapabilitiesWithCallbacks(workflowId: string | undefined, projectId: string | undefined, issueTypeId: string | undefined, onSuccess?: (result: WorkflowCapabilities) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflows/capabilities?"; - if (workflowId === null) - throw new globalThis.Error("The parameter 'workflowId' cannot be null."); - else if (workflowId !== undefined) - url_ += "workflowId=" + encodeURIComponent("" + workflowId) + "&"; - if (projectId === null) - throw new globalThis.Error("The parameter 'projectId' cannot be null."); - else if (projectId !== undefined) - url_ += "projectId=" + encodeURIComponent("" + projectId) + "&"; - if (issueTypeId === null) - throw new globalThis.Error("The parameter 'issueTypeId' cannot be null."); - else if (issueTypeId !== undefined) - url_ += "issueTypeId=" + encodeURIComponent("" + issueTypeId) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(workflowId, 'workflowId'); + Guard.notNull(projectId, 'projectId'); + Guard.notNull(issueTypeId, 'issueTypeId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/capabilities") + .param("workflowId", workflowId) + .param("projectId", projectId) + .param("issueTypeId", issueTypeId) + .toString(); jQuery.ajax({ url: url_, @@ -45335,8 +43977,8 @@ export class Client { } private createWorkflowsWithCallbacks(body: WorkflowCreateRequest, onSuccess?: (result: WorkflowCreateResponse) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflows/create"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create") + .toString(); const content_ = JSON.stringify(body); @@ -45409,8 +44051,8 @@ export class Client { } private validateCreateWorkflowsWithCallbacks(body: WorkflowCreateValidateRequest, onSuccess?: (result: WorkflowValidationErrorList) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflows/create/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/create/validation") + .toString(); const content_ = JSON.stringify(body); @@ -45492,36 +44134,23 @@ export class Client { } private searchWorkflowsWithCallbacks(startAt: number | undefined, maxResults: number | undefined, expand: string | undefined, queryString: string | undefined, orderBy: string | undefined, scope: string | undefined, isActive: boolean | undefined, onSuccess?: (result: WorkflowSearchResponse) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflows/search?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - if (queryString === null) - throw new globalThis.Error("The parameter 'queryString' cannot be null."); - else if (queryString !== undefined) - url_ += "queryString=" + encodeURIComponent("" + queryString) + "&"; - if (orderBy === null) - throw new globalThis.Error("The parameter 'orderBy' cannot be null."); - else if (orderBy !== undefined) - url_ += "orderBy=" + encodeURIComponent("" + orderBy) + "&"; - if (scope === null) - throw new globalThis.Error("The parameter 'scope' cannot be null."); - else if (scope !== undefined) - url_ += "scope=" + encodeURIComponent("" + scope) + "&"; - if (isActive === null) - throw new globalThis.Error("The parameter 'isActive' cannot be null."); - else if (isActive !== undefined) - url_ += "isActive=" + encodeURIComponent("" + isActive) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + Guard.notNull(expand, 'expand'); + Guard.notNull(queryString, 'queryString'); + Guard.notNull(orderBy, 'orderBy'); + Guard.notNull(scope, 'scope'); + Guard.notNull(isActive, 'isActive'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/search") + .param("startAt", startAt) + .param("maxResults", maxResults) + .param("expand", expand) + .param("queryString", queryString) + .param("orderBy", orderBy) + .param("scope", scope) + .param("isActive", isActive) + .toString(); jQuery.ajax({ url: url_, @@ -45590,12 +44219,11 @@ export class Client { } private updateWorkflowsWithCallbacks(body: WorkflowUpdateRequest, expand: string | undefined, onSuccess?: (result: WorkflowUpdateResponse) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflows/update?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -45668,8 +44296,8 @@ export class Client { } private validateUpdateWorkflowsWithCallbacks(body: WorkflowUpdateValidateRequestBean, onSuccess?: (result: WorkflowValidationErrorList) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflows/update/validation"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflows/update/validation") + .toString(); const content_ = JSON.stringify(body); @@ -45740,16 +44368,13 @@ export class Client { } private getAllWorkflowSchemesWithCallbacks(startAt: number | undefined, maxResults: number | undefined, onSuccess?: (result: PageBeanWorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme?"; - if (startAt === null) - throw new globalThis.Error("The parameter 'startAt' cannot be null."); - else if (startAt !== undefined) - url_ += "startAt=" + encodeURIComponent("" + startAt) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(startAt, 'startAt'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .param("startAt", startAt) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -45814,8 +44439,8 @@ export class Client { } private createWorkflowSchemeWithCallbacks(body: WorkflowScheme, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme") + .toString(); const content_ = JSON.stringify(body); @@ -45889,12 +44514,11 @@ export class Client { } private getWorkflowSchemeProjectAssociationsWithCallbacks(projectId: number[], onSuccess?: (result: ContainerOfWorkflowSchemeAssociations) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project?"; - if (projectId === undefined || projectId === null) - throw new globalThis.Error("The parameter 'projectId' must be defined and cannot be null."); - else - projectId && projectId.forEach(item => { url_ += "projectId=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(projectId, 'projectId'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .paramArray("projectId", projectId) + .toString(); jQuery.ajax({ url: url_, @@ -45963,8 +44587,8 @@ export class Client { } private assignSchemeToProjectWithCallbacks(body: WorkflowSchemeProjectAssociation, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/project"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/project") + .toString(); const content_ = JSON.stringify(body); @@ -46047,12 +44671,11 @@ export class Client { } private readWorkflowSchemesWithCallbacks(body: WorkflowSchemeReadRequest, expand: string | undefined, onSuccess?: (result: WorkflowSchemeReadResponse[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/read?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/read") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -46128,8 +44751,8 @@ export class Client { } private updateSchemesWithCallbacks(body: WorkflowSchemeUpdateRequest, onSuccess?: (result: any) => void, onFail?: (exception: TaskProgressBeanObject | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update") + .toString(); const content_ = JSON.stringify(body); @@ -46210,8 +44833,8 @@ export class Client { } private updateWorkflowSchemeMappingsWithCallbacks(body: WorkflowSchemeUpdateRequiredMappingsRequest, onSuccess?: (result: WorkflowSchemeUpdateRequiredMappingsResponse) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/update/mappings"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/update/mappings") + .toString(); const content_ = JSON.stringify(body); @@ -46281,11 +44904,11 @@ export class Client { } private deleteWorkflowSchemeWithCallbacks(id: number, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -46361,15 +44984,13 @@ export class Client { } private getWorkflowSchemeWithCallbacks(id: number, returnDraftIfExists: boolean | undefined, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); jQuery.ajax({ url: url_, @@ -46439,11 +45060,11 @@ export class Client { } private updateWorkflowSchemeWithCallbacks(id: number, body: WorkflowScheme, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -46521,11 +45142,11 @@ export class Client { } private createWorkflowSchemeDraftFromParentWithCallbacks(id: number, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/createdraft") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -46596,15 +45217,13 @@ export class Client { } private deleteDefaultWorkflowWithCallbacks(id: number, updateDraftIfNeeded: boolean | undefined, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); jQuery.ajax({ url: url_, @@ -46679,15 +45298,13 @@ export class Client { } private getDefaultWorkflowWithCallbacks(id: number, returnDraftIfExists: boolean | undefined, onSuccess?: (result: DefaultWorkflow) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); jQuery.ajax({ url: url_, @@ -46758,11 +45375,11 @@ export class Client { } private updateDefaultWorkflowWithCallbacks(id: number, body: DefaultWorkflow, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -46840,11 +45457,11 @@ export class Client { } private deleteWorkflowSchemeDraftWithCallbacks(id: number, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -46910,11 +45527,11 @@ export class Client { } private getWorkflowSchemeDraftWithCallbacks(id: number, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -46984,11 +45601,11 @@ export class Client { } private updateWorkflowSchemeDraftWithCallbacks(id: number, body: WorkflowScheme, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -47066,11 +45683,11 @@ export class Client { } private deleteDraftDefaultWorkflowWithCallbacks(id: number, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -47140,11 +45757,11 @@ export class Client { } private getDraftDefaultWorkflowWithCallbacks(id: number, onSuccess?: (result: DefaultWorkflow) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); jQuery.ajax({ url: url_, @@ -47215,11 +45832,11 @@ export class Client { } private updateDraftDefaultWorkflowWithCallbacks(id: number, body: DefaultWorkflow, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/default") + .path("id", id) + .toString(); const content_ = JSON.stringify(body); @@ -47298,14 +45915,13 @@ export class Client { } private deleteWorkflowSchemeDraftIssueTypeWithCallbacks(id: number, issueType: string, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); jQuery.ajax({ url: url_, @@ -47376,14 +45992,13 @@ export class Client { } private getWorkflowSchemeDraftIssueTypeWithCallbacks(id: number, issueType: string, onSuccess?: (result: IssueTypeWorkflowMapping) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); jQuery.ajax({ url: url_, @@ -47455,14 +46070,13 @@ export class Client { } private setWorkflowSchemeDraftIssueTypeWithCallbacks(id: number, issueType: string, body: IssueTypeWorkflowMapping, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -47542,15 +46156,13 @@ export class Client { } private publishDraftWorkflowSchemeWithCallbacks(id: number, body: PublishDraftWorkflowScheme, validateOnly: boolean | undefined, onSuccess?: (result: void) => void, onFail?: (exception: TaskProgressBeanObject | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (validateOnly === null) - throw new globalThis.Error("The parameter 'validateOnly' cannot be null."); - else if (validateOnly !== undefined) - url_ += "validateOnly=" + encodeURIComponent("" + validateOnly) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(validateOnly, 'validateOnly'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/publish") + .path("id", id) + .param("validateOnly", validateOnly) + .toString(); const content_ = JSON.stringify(body); @@ -47632,15 +46244,13 @@ export class Client { } private deleteDraftWorkflowMappingWithCallbacks(id: number, workflowName: string, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); jQuery.ajax({ url: url_, @@ -47707,15 +46317,13 @@ export class Client { } private getDraftWorkflowWithCallbacks(id: number, workflowName: string | undefined, onSuccess?: (result: IssueTypesWorkflowMapping) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); jQuery.ajax({ url: url_, @@ -47786,15 +46394,13 @@ export class Client { } private updateDraftWorkflowMappingWithCallbacks(id: number, workflowName: string, body: IssueTypesWorkflowMapping, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/draft/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -47874,18 +46480,15 @@ export class Client { } private deleteWorkflowSchemeIssueTypeWithCallbacks(id: number, issueType: string, updateDraftIfNeeded: boolean | undefined, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); jQuery.ajax({ url: url_, @@ -47961,18 +46564,15 @@ export class Client { } private getWorkflowSchemeIssueTypeWithCallbacks(id: number, issueType: string, returnDraftIfExists: boolean | undefined, onSuccess?: (result: IssueTypeWorkflowMapping) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); jQuery.ajax({ url: url_, @@ -48044,14 +46644,13 @@ export class Client { } private setWorkflowSchemeIssueTypeWithCallbacks(id: number, issueType: string, body: IssueTypeWorkflowMapping, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (issueType === undefined || issueType === null) - throw new globalThis.Error("The parameter 'issueType' must be defined."); - url_ = url_.replace("{issueType}", encodeURIComponent("" + issueType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(issueType, 'issueType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/issuetype/{issueType}") + .path("id", id) + .path("issueType", issueType) + .toString(); const content_ = JSON.stringify(body); @@ -48131,19 +46730,15 @@ export class Client { } private deleteWorkflowMappingWithCallbacks(id: number, workflowName: string, updateDraftIfNeeded: boolean | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (updateDraftIfNeeded === null) - throw new globalThis.Error("The parameter 'updateDraftIfNeeded' cannot be null."); - else if (updateDraftIfNeeded !== undefined) - url_ += "updateDraftIfNeeded=" + encodeURIComponent("" + updateDraftIfNeeded) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + Guard.notNull(updateDraftIfNeeded, 'updateDraftIfNeeded'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("updateDraftIfNeeded", updateDraftIfNeeded) + .toString(); jQuery.ajax({ url: url_, @@ -48215,19 +46810,15 @@ export class Client { } private getWorkflowWithCallbacks(id: number, workflowName: string | undefined, returnDraftIfExists: boolean | undefined, onSuccess?: (result: IssueTypesWorkflowMapping) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' cannot be null."); - else if (workflowName !== undefined) - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - if (returnDraftIfExists === null) - throw new globalThis.Error("The parameter 'returnDraftIfExists' cannot be null."); - else if (returnDraftIfExists !== undefined) - url_ += "returnDraftIfExists=" + encodeURIComponent("" + returnDraftIfExists) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.notNull(workflowName, 'workflowName'); + Guard.notNull(returnDraftIfExists, 'returnDraftIfExists'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .param("returnDraftIfExists", returnDraftIfExists) + .toString(); jQuery.ajax({ url: url_, @@ -48298,15 +46889,13 @@ export class Client { } private updateWorkflowMappingWithCallbacks(id: number, workflowName: string, body: IssueTypesWorkflowMapping, onSuccess?: (result: WorkflowScheme) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow?"; - if (id === undefined || id === null) - throw new globalThis.Error("The parameter 'id' must be defined."); - url_ = url_.replace("{id}", encodeURIComponent("" + id)); - if (workflowName === undefined || workflowName === null) - throw new globalThis.Error("The parameter 'workflowName' must be defined and cannot be null."); - else - url_ += "workflowName=" + encodeURIComponent("" + workflowName) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(id, 'id'); + Guard.required(workflowName, 'workflowName'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{id}/workflow") + .path("id", id) + .param("workflowName", workflowName) + .toString(); const content_ = JSON.stringify(body); @@ -48386,19 +46975,15 @@ export class Client { } private getProjectUsagesForWorkflowSchemeWithCallbacks(workflowSchemeId: string, nextPageToken: string | undefined, maxResults: number | undefined, onSuccess?: (result: WorkflowSchemeProjectUsageDTO) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages?"; - if (workflowSchemeId === undefined || workflowSchemeId === null) - throw new globalThis.Error("The parameter 'workflowSchemeId' must be defined."); - url_ = url_.replace("{workflowSchemeId}", encodeURIComponent("" + workflowSchemeId)); - if (nextPageToken === null) - throw new globalThis.Error("The parameter 'nextPageToken' cannot be null."); - else if (nextPageToken !== undefined) - url_ += "nextPageToken=" + encodeURIComponent("" + nextPageToken) + "&"; - if (maxResults === null) - throw new globalThis.Error("The parameter 'maxResults' cannot be null."); - else if (maxResults !== undefined) - url_ += "maxResults=" + encodeURIComponent("" + maxResults) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(workflowSchemeId, 'workflowSchemeId'); + Guard.notNull(nextPageToken, 'nextPageToken'); + Guard.notNull(maxResults, 'maxResults'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/workflowscheme/{workflowSchemeId}/projectUsages") + .path("workflowSchemeId", workflowSchemeId) + .param("nextPageToken", nextPageToken) + .param("maxResults", maxResults) + .toString(); jQuery.ajax({ url: url_, @@ -48468,12 +47053,11 @@ export class Client { } private getIdsOfWorklogsDeletedSinceWithCallbacks(since: number | undefined, onSuccess?: (result: ChangedWorklogs) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/worklog/deleted?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/deleted") + .param("since", since) + .toString(); jQuery.ajax({ url: url_, @@ -48536,12 +47120,11 @@ export class Client { } private getWorklogsForIdsWithCallbacks(body: WorklogIdsRequestBean, expand: string | undefined, onSuccess?: (result: Worklog[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/worklog/list?"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/list") + .param("expand", expand) + .toString(); const content_ = JSON.stringify(body); @@ -48619,16 +47202,13 @@ export class Client { } private getIdsOfWorklogsModifiedSinceWithCallbacks(since: number | undefined, expand: string | undefined, onSuccess?: (result: ChangedWorklogs) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/api/3/worklog/updated?"; - if (since === null) - throw new globalThis.Error("The parameter 'since' cannot be null."); - else if (since !== undefined) - url_ += "since=" + encodeURIComponent("" + since) + "&"; - if (expand === null) - throw new globalThis.Error("The parameter 'expand' cannot be null."); - else if (expand !== undefined) - url_ += "expand=" + encodeURIComponent("" + expand) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(since, 'since'); + Guard.notNull(expand, 'expand'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/api/3/worklog/updated") + .param("since", since) + .param("expand", expand) + .toString(); jQuery.ajax({ url: url_, @@ -48690,11 +47270,11 @@ export class Client { } private deleteForgeAppPropertyWithCallbacks(propertyKey: string, onSuccess?: (result: void) => void, onFail?: (exception: OperationMessage | OperationMessage | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -48770,11 +47350,11 @@ export class Client { } private putForgeAppPropertyWithCallbacks(propertyKey: string, body: any, onSuccess?: (result: OperationMessage) => void, onFail?: (exception: OperationMessage | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}"; - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/forge/1/app/properties/{propertyKey}") + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -48868,11 +47448,11 @@ export class AddonPropertiesResource_getAddonPropertiesClient { } private getWithCallbacks(addonKey: string, onSuccess?: (result: PropertyKeys) => void, onFail?: (exception: OperationMessage | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties") + .path("addonKey", addonKey) + .toString(); jQuery.ajax({ url: url_, @@ -48948,14 +47528,13 @@ export class AddonPropertiesResource_deleteAddonPropertyClient { } private deleteWithCallbacks(addonKey: string, propertyKey: string, onSuccess?: (result: void) => void, onFail?: (exception: OperationMessage | OperationMessage | OperationMessage | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -49041,14 +47620,13 @@ export class AddonPropertiesResource_getAddonPropertyClient { } private getWithCallbacks(addonKey: string, propertyKey: string, onSuccess?: (result: EntityProperty) => void, onFail?: (exception: OperationMessage | OperationMessage | OperationMessage | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); jQuery.ajax({ url: url_, @@ -49138,14 +47716,13 @@ export class AddonPropertiesResource_putAddonPropertyClient { } private putWithCallbacks(addonKey: string, propertyKey: string, body: any, onSuccess?: (result: OperationMessage) => void, onFail?: (exception: OperationMessage | OperationMessage | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}"; - if (addonKey === undefined || addonKey === null) - throw new globalThis.Error("The parameter 'addonKey' must be defined."); - url_ = url_.replace("{addonKey}", encodeURIComponent("" + addonKey)); - if (propertyKey === undefined || propertyKey === null) - throw new globalThis.Error("The parameter 'propertyKey' must be defined."); - url_ = url_.replace("{propertyKey}", encodeURIComponent("" + propertyKey)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(addonKey, 'addonKey'); + Guard.required(propertyKey, 'propertyKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/addons/{addonKey}/properties/{propertyKey}") + .path("addonKey", addonKey) + .path("propertyKey", propertyKey) + .toString(); const content_ = JSON.stringify(body); @@ -49240,12 +47817,11 @@ export class DynamicModulesResource_removeModulesClient { } private deleteWithCallbacks(moduleKey: string[] | undefined, onSuccess?: (result: void) => void, onFail?: (exception: ErrorMessage | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic?"; - if (moduleKey === null) - throw new globalThis.Error("The parameter 'moduleKey' cannot be null."); - else if (moduleKey !== undefined) - moduleKey && moduleKey.forEach(item => { url_ += "moduleKey=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.notNull(moduleKey, 'moduleKey'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .paramArray("moduleKey", moduleKey) + .toString(); jQuery.ajax({ url: url_, @@ -49315,8 +47891,8 @@ export class DynamicModulesResource_getModulesClient { } private getWithCallbacks(onSuccess?: (result: ConnectModules) => void, onFail?: (exception: ErrorMessage | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); jQuery.ajax({ url: url_, @@ -49390,8 +47966,8 @@ export class DynamicModulesResource_registerModulesClient { } private postWithCallbacks(body: ConnectModules, onSuccess?: (result: void) => void, onFail?: (exception: ErrorMessage | ErrorMessage | string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/app/module/dynamic") + .toString(); const content_ = JSON.stringify(body); @@ -49473,8 +48049,8 @@ export class AppIssueFieldValueUpdateResource_updateIssueFieldsClient { } private putWithCallbacks(atlassian_Transfer_Id: string, body: ConnectCustomFieldValues, onSuccess?: (result: any) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/field"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/field") + .toString(); const content_ = JSON.stringify(body); @@ -49557,11 +48133,11 @@ export class MigrationResource_updateEntityPropertiesValueClient { } private putWithCallbacks(atlassian_Transfer_Id: string, entityType: EntityType, body: EntityPropertyDetails[], onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}"; - if (entityType === undefined || entityType === null) - throw new globalThis.Error("The parameter 'entityType' must be defined."); - url_ = url_.replace("{entityType}", encodeURIComponent("" + entityType)); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(entityType, 'entityType'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/properties/{entityType}") + .path("entityType", entityType) + .toString(); const content_ = JSON.stringify(body); @@ -49638,8 +48214,8 @@ export class MigrationResource_workflowRuleSearchClient { } private postWithCallbacks(atlassian_Transfer_Id: string, body: WorkflowRulesSearch, onSuccess?: (result: WorkflowRulesSearchDetails) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/migration/workflow/rule/search") + .toString(); const content_ = JSON.stringify(body); @@ -49720,12 +48296,11 @@ export class ServiceRegistryResource_servicesClient { } private getWithCallbacks(serviceIds: string[], onSuccess?: (result: ServiceRegistry[]) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/rest/atlassian-connect/1/service-registry?"; - if (serviceIds === undefined || serviceIds === null) - throw new globalThis.Error("The parameter 'serviceIds' must be defined and cannot be null."); - else - serviceIds && serviceIds.forEach(item => { url_ += "serviceIds=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + Guard.required(serviceIds, 'serviceIds'); + + const url_ = new UriBuilder(this.baseUrl + "/rest/atlassian-connect/1/service-registry") + .paramArray("serviceIds", serviceIds) + .toString(); jQuery.ajax({ url: url_, @@ -108480,4 +107055,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt index b7a5d14b6..a51fa6aa9 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt @@ -13,15 +13,16 @@ export class UrlEncodedRequestConsumingClient { } addMessage(message: Foo | null | undefined, messageId: string | null | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - content_ = content_.replace(/&$/, ""); + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -136,4 +137,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt index 45cbd8f16..1efb72550 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt @@ -17,8 +17,8 @@ class DiscussionClient implements IDiscussionClient { } addMessage(message: Foo | null | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/api/Discussion"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/Discussion") + .toString(); const content_ = JSON.stringify(message); @@ -134,4 +134,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_export_types_is_true_then_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_export_types_is_true_then_add_export_before_classes.verified.txt index f47ea902b..134f17047 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_export_types_is_true_then_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryCallbacksTests.When_export_types_is_true_then_add_export_before_classes.verified.txt @@ -17,8 +17,8 @@ export class DiscussionClient implements IDiscussionClient { } addMessage(message: Foo | null | undefined, onSuccess?: () => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/api/Discussion"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/Discussion") + .toString(); const content_ = JSON.stringify(message); @@ -134,4 +134,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt index cd5c86b2a..93d212e90 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt @@ -19,15 +19,16 @@ export class UrlEncodedRequestConsumingClient { } private addMessageWithCallbacks(message: Foo | null | undefined, messageId: string | null | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - content_ = content_.replace(/&$/, ""); + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .toString(); jQuery.ajax({ url: url_, @@ -138,4 +139,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt index e666d575a..4278e717a 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt @@ -23,8 +23,8 @@ class DiscussionClient implements IDiscussionClient { } private addMessageWithCallbacks(message: Foo | null | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/api/Discussion"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/Discussion") + .toString(); const content_ = JSON.stringify(message); @@ -136,4 +136,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_export_types_is_true_then_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_export_types_is_true_then_add_export_before_classes.verified.txt index b45c6caad..0372459b3 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_export_types_is_true_then_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/JQueryPromisesTests.When_export_types_is_true_then_add_export_before_classes.verified.txt @@ -23,8 +23,8 @@ export class DiscussionClient implements IDiscussionClient { } private addMessageWithCallbacks(message: Foo | null | undefined, onSuccess?: (result: void) => void, onFail?: (exception: string, reason: string) => void) { - let url_ = this.baseUrl + "/api/Discussion"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/Discussion") + .toString(); const content_ = JSON.stringify(message); @@ -136,4 +136,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt index 5b03a1622..a0a63db68 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_consumes_is_url_encoded_then_construct_url_encoded_request.verified.txt @@ -18,15 +18,16 @@ export class UrlEncodedRequestConsumingClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/api/UrlEncodedRequestConsuming"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/UrlEncodedRequestConsuming") + .toString(); - let content_ = ""; - if (message !== undefined) - content_ += encodeURIComponent("message") + "=" + encodeURIComponent("" + message) + "&"; - if (messageId !== undefined) - content_ += encodeURIComponent("messageId") + "=" + encodeURIComponent("" + messageId) + "&"; - content_ = content_.replace(/&$/, ""); + Guard.defined(message, "message"); + Guard.defined(messageId, "messageId"); + + const content_ = new UriBuilder("") + .param("message", message) + .param("messageId", messageId) + .toString(); const response = http.request( "POST", @@ -134,4 +135,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt index 1f3100b67..5dd3bdfef 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_export_types_is_false_then_dont_add_export_before_classes.verified.txt @@ -27,8 +27,8 @@ class DiscussionClient implements IDiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/AddMessage"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/AddMessage") + .toString(); const content_ = JSON.stringify(message); @@ -53,8 +53,8 @@ class DiscussionClient implements IDiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/GenericRequestTest1"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest1") + .toString(); const content_ = JSON.stringify(request); @@ -79,8 +79,8 @@ class DiscussionClient implements IDiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/GenericRequestTest2"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest2") + .toString(); const content_ = JSON.stringify(request); @@ -379,4 +379,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_export_types_is_true_then_add_export_before_classes.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_export_types_is_true_then_add_export_before_classes.verified.txt index 438a9d9a0..5f566f9ed 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_export_types_is_true_then_add_export_before_classes.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_export_types_is_true_then_add_export_before_classes.verified.txt @@ -27,8 +27,8 @@ export class DiscussionClient implements IDiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/AddMessage"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/AddMessage") + .toString(); const content_ = JSON.stringify(message); @@ -53,8 +53,8 @@ export class DiscussionClient implements IDiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/GenericRequestTest1"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest1") + .toString(); const content_ = JSON.stringify(request); @@ -79,8 +79,8 @@ export class DiscussionClient implements IDiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/GenericRequestTest2"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest2") + .toString(); const content_ = JSON.stringify(request); @@ -379,4 +379,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_generic_request.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_generic_request.verified.txt index 80e2f24b3..04182b761 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_generic_request.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_generic_request.verified.txt @@ -18,8 +18,8 @@ class DiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/AddMessage"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/AddMessage") + .toString(); const content_ = JSON.stringify(message); @@ -44,8 +44,8 @@ class DiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/GenericRequestTest1"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest1") + .toString(); const content_ = JSON.stringify(request); @@ -70,8 +70,8 @@ class DiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/GenericRequestTest2"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest2") + .toString(); const content_ = JSON.stringify(request); @@ -370,4 +370,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_return_value_is_void_then_client_returns_observable_of_void.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_return_value_is_void_then_client_returns_observable_of_void.verified.txt index 438a9d9a0..5f566f9ed 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_return_value_is_void_then_client_returns_observable_of_void.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/K6Tests.When_return_value_is_void_then_client_returns_observable_of_void.verified.txt @@ -27,8 +27,8 @@ export class DiscussionClient implements IDiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/AddMessage"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/AddMessage") + .toString(); const content_ = JSON.stringify(message); @@ -53,8 +53,8 @@ export class DiscussionClient implements IDiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/GenericRequestTest1"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest1") + .toString(); const content_ = JSON.stringify(request); @@ -79,8 +79,8 @@ export class DiscussionClient implements IDiscussionClient { requestParameters || {}, this.commonRequestParameters, ); - let url_ = this.baseUrl + "/Discussion/GenericRequestTest2"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/Discussion/GenericRequestTest2") + .toString(); const content_ = JSON.stringify(request); @@ -379,4 +379,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..c9ea9a531 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 @@ -14,22 +14,16 @@ export class FileUploadClient { /** */ uploadFile(file: FileParameter | undefined, propertyDto: any | undefined, test: string | undefined): Promise { - let url_ = this.baseUrl + "/api/FileUpload/UploadFile"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/api/FileUpload/UploadFile") + .toString(); + Guard.notNull(file, "file"); + Guard.notNull(propertyDto, "propertyDto"); + Guard.notNull(test, "test"); const content_ = new FormData(); - if (file === null || file === undefined) - throw new globalThis.Error("The parameter 'file' cannot be null."); - else - content_.append("file", file.data, file.fileName ? file.fileName : "file"); - if (propertyDto === null || propertyDto === undefined) - throw new globalThis.Error("The parameter 'propertyDto' cannot be null."); - else - content_.append("propertyDto", JSON.stringify(propertyDto)); - if (test === null || test === undefined) - throw new globalThis.Error("The parameter 'test' cannot be null."); - else - content_.append("test", test.toString()); + content_.append("file", file.data, file.fileName ? file.fileName : "file"); + content_.append("propertyDto", JSON.stringify(propertyDto)); + content_.append("test", test.toString()); let options_: RequestInit = { body: content_, @@ -108,4 +102,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/OperationParameterTests.When_query_parameter_is_enum_array_then_the_enum_is_referenced.verified.txt b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/OperationParameterTests.When_query_parameter_is_enum_array_then_the_enum_is_referenced.verified.txt index 68418d1e5..f1b65e887 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/OperationParameterTests.When_query_parameter_is_enum_array_then_the_enum_is_referenced.verified.txt +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/Snapshots/OperationParameterTests.When_query_parameter_is_enum_array_then_the_enum_is_referenced.verified.txt @@ -13,10 +13,9 @@ export class FooClient { } getFoos(bars: Bar[] | null | undefined, onSuccess?: (result: Foo[] | null) => void, onFail?: (exception: string, reason: string) => void): JQueryXHR { - let url_ = this.baseUrl + "/foos?"; - if (bars !== undefined && bars !== null) - bars && bars.forEach(item => { url_ += "bars=" + encodeURIComponent("" + item) + "&"; }); - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/foos") + .paramArray("bars", bars) + .toString(); let jqXhr = jQuery.ajax({ url: url_, @@ -148,4 +147,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..41ffda999 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 @@ -12,14 +12,12 @@ export class Client { } get(lastname: string, firstname?: string | null | undefined): Promise { - let url_ = this.baseUrl + "/?"; - if (lastname === undefined || lastname === null) - throw new globalThis.Error("The parameter 'lastname' must be defined and cannot be null."); - else - url_ += "lastname=" + encodeURIComponent("" + lastname) + "&"; - if (firstname !== undefined && firstname !== null) - url_ += "firstname=" + encodeURIComponent("" + firstname) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(lastname, 'lastname'); + + const url_ = new UriBuilder(this.baseUrl + "/") + .param("lastname", lastname) + .param("firstname", firstname) + .toString(); let options_: RequestInit = { method: "GET", @@ -82,4 +80,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..b6d20a735 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 @@ -12,8 +12,8 @@ export class DiscriminatorClient { } testLeaf(param: OneChild | SecondChild | null | undefined): Promise { - let url_ = this.baseUrl + "/foo"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/foo") + .toString(); const content_ = JSON.stringify(param); @@ -51,8 +51,8 @@ export class DiscriminatorClient { } testLeafArr(param: (OneChild | SecondChild)[] | null | undefined): Promise { - let url_ = this.baseUrl + "/foo-arr"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/foo-arr") + .toString(); const content_ = JSON.stringify(param); @@ -90,8 +90,8 @@ export class DiscriminatorClient { } test(param: OneChild | null | undefined): Promise { - let url_ = this.baseUrl + "/bar"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/bar") + .toString(); const content_ = JSON.stringify(param); @@ -129,8 +129,8 @@ export class DiscriminatorClient { } testNested(param: Nested | null | undefined): Promise { - let url_ = this.baseUrl + "/baz"; - url_ = url_.replace(/[?&]$/, ""); + const url_ = new UriBuilder(this.baseUrl + "/baz") + .toString(); const content_ = JSON.stringify(param); @@ -366,4 +366,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..2043cbb4b 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 @@ -12,16 +12,13 @@ export class NullableParameterClient { } test(a: number, b: number | null): Promise { - let url_ = this.baseUrl + "/foo?"; - if (a === undefined || a === null) - throw new globalThis.Error("The parameter 'a' must be defined and cannot be null."); - else - url_ += "a=" + encodeURIComponent("" + a) + "&"; - if (b === undefined) - throw new globalThis.Error("The parameter 'b' must be defined."); - else if(b !== null) - url_ += "b=" + encodeURIComponent("" + b) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(a, 'a'); + Guard.defined(b, 'b'); + + const url_ = new UriBuilder(this.baseUrl + "/foo") + .param("a", a) + .param("b", b) + .toString(); let options_: RequestInit = { method: "POST", @@ -84,4 +81,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..2043cbb4b 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 @@ -12,16 +12,13 @@ export class NullableParameterClient { } test(a: number, b: number | null): Promise { - let url_ = this.baseUrl + "/foo?"; - if (a === undefined || a === null) - throw new globalThis.Error("The parameter 'a' must be defined and cannot be null."); - else - url_ += "a=" + encodeURIComponent("" + a) + "&"; - if (b === undefined) - throw new globalThis.Error("The parameter 'b' must be defined."); - else if(b !== null) - url_ += "b=" + encodeURIComponent("" + b) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(a, 'a'); + Guard.defined(b, 'b'); + + const url_ = new UriBuilder(this.baseUrl + "/foo") + .param("a", a) + .param("b", b) + .toString(); let options_: RequestInit = { method: "POST", @@ -84,4 +81,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..dd08603fb 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 @@ -12,14 +12,12 @@ export class NullableOptionalParameterClient { } test(a: number, b: number | null | undefined): Promise { - let url_ = this.baseUrl + "/foo?"; - if (a === undefined || a === null) - throw new globalThis.Error("The parameter 'a' must be defined and cannot be null."); - else - url_ += "a=" + encodeURIComponent("" + a) + "&"; - if (b !== undefined && b !== null) - url_ += "b=" + encodeURIComponent("" + b) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(a, 'a'); + + const url_ = new UriBuilder(this.baseUrl + "/foo") + .param("a", a) + .param("b", b) + .toString(); let options_: RequestInit = { method: "POST", @@ -82,4 +80,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file 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..dd08603fb 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 @@ -12,14 +12,12 @@ export class NullableOptionalParameterClient { } test(a: number, b: number | null | undefined): Promise { - let url_ = this.baseUrl + "/foo?"; - if (a === undefined || a === null) - throw new globalThis.Error("The parameter 'a' must be defined and cannot be null."); - else - url_ += "a=" + encodeURIComponent("" + a) + "&"; - if (b !== undefined && b !== null) - url_ += "b=" + encodeURIComponent("" + b) + "&"; - url_ = url_.replace(/[?&]$/, ""); + Guard.required(a, 'a'); + + const url_ = new UriBuilder(this.baseUrl + "/foo") + .param("a", a) + .param("b", b) + .toString(); let options_: RequestInit = { method: "POST", @@ -82,4 +80,68 @@ function throwException(message: string, status: number, response: string, heade throw result; else throw new ApiException(message, status, response, headers, null); +} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } } \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript/Templates/Client.RequestBody.liquid b/src/NSwag.CodeGeneration.TypeScript/Templates/Client.RequestBody.liquid index fa5330508..1cc8b4a28 100644 --- a/src/NSwag.CodeGeneration.TypeScript/Templates/Client.RequestBody.liquid +++ b/src/NSwag.CodeGeneration.TypeScript/Templates/Client.RequestBody.liquid @@ -1,70 +1,54 @@ {%- if operation.HasFormParameters -%} -{%- if operation.ConsumesOnlyFormUrlEncoded -%} -let content_ = ""; {%- for parameter in operation.FormParameters -%} {%- if parameter.IsRequired -%} {%- if parameter.IsNullable -%} -if ({{ parameter.VariableName }} === undefined) - throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' must be defined."); -else +Guard.defined({{ parameter.VariableName }}, "{{ parameter.VariableName }}"); {%- else -%} -if ({{ parameter.VariableName }} === undefined || {{ parameter.VariableName }} === null) - throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' must be defined and cannot be null."); -else +Guard.required({{ parameter.VariableName }}, "{{ parameter.VariableName }}"); {%- endif -%} {%- else -%} {%- if parameter.IsNullable -%} -if ({{ parameter.VariableName }} !== undefined) +Guard.defined({{ parameter.VariableName }}, "{{ parameter.VariableName }}"); {%- else -%} -if ({{ parameter.VariableName }} === null) - throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' cannot be null."); -else if ({{ parameter.VariableName }} !== undefined) +Guard.notNull({{ parameter.VariableName }}, "{{ parameter.VariableName }}"); {%- endif -%} {%- endif -%} +{%- endfor -%} + +{%- if operation.ConsumesOnlyFormUrlEncoded -%} +const content_ = new UriBuilder("") +{%- for parameter in operation.FormParameters -%} {%- if parameter.IsDateOrDateTimeArray -%} - {{ parameter.VariableName }} && {{ parameter.VariableName }}.forEach(item_ => { content_ += encodeURIComponent("{{ parameter.Name }}") + "=" + encodeURIComponent(item_ ? "" + item_.toJSON() : "null") + "&"; }); + .paramArray("{{ parameter.Name }}", {{ parameter.VariableName }}.map(d => d ? d.toJSON() : "")) {%- elsif parameter.IsObjectArray -%} - {{ parameter.VariableName }} && {{ parameter.VariableName }}.forEach((item_, index_) => { - for (const attr_ in item_) { - if (item_.hasOwnProperty(attr_)) { - content_ += encodeURIComponent("{{ parameter.Name }}[" + index_ + "]." + attr_) + "=" + encodeURIComponent("" + (item_ as any)[attr_]) + "&"; - } - } - }); + .paramObjectArray("{{ parameter.Name }}", {{ parameter.VariableName }}) {%- elsif parameter.IsDateOrDateTime -%} - content_ += encodeURIComponent("{{ parameter.Name }}") + "=" + encodeURIComponent({{ parameter.VariableName }} ? "" + {{ parameter.VariableName }}.toJSON() : "{{ QueryNullValue }}") + "&"; + .param("{{ parameter.Name }}", {{ parameter.VariableName }} ? {{ parameter.VariableName }}.toJSON() : "") {%- elsif parameter.IsArray -%} - {{ parameter.VariableName }} && {{ parameter.VariableName }}.forEach(item => { content_ += encodeURIComponent("{{ parameter.Name }}") + "=" + encodeURIComponent("" + item) + "&"; }); + .paramArray("{{ parameter.Name }}", {{ parameter.VariableName }}) {%- else -%} - content_ += encodeURIComponent("{{ parameter.Name }}") + "=" + encodeURIComponent("" + {{ parameter.VariableName }}) + "&"; + .param("{{ parameter.Name }}", {{ parameter.VariableName }}) {%- endif -%} {%- endfor -%} -content_ = content_.replace(/&$/, ""); + .toString(); {%- else -%} const content_ = new FormData(); {% for parameter in operation.FormParameters -%} -{%- if parameter.IsNullable -%} -if ({{ parameter.VariableName }} !== null && {{ parameter.VariableName }} !== undefined) -{%- else -%} -if ({{ parameter.VariableName }} === null || {{ parameter.VariableName }} === undefined) - throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' cannot be null."); -else -{%- endif -%} {%- if parameter.IsFile -%} {%- if parameter.IsArray -%} - {{ parameter.VariableName }}.forEach(item_ => content_.append("{{ parameter.Name }}", item_.data, item_.fileName ? item_.fileName : "{{ parameter.Name }}") ); +{{ parameter.VariableName }}.forEach(item_ => content_.append("{{ parameter.Name }}", item_.data, item_.fileName ? item_.fileName : "{{ parameter.Name }}") ); {%- else -%} - content_.append("{{ parameter.Name }}", {{ parameter.VariableName }}.data, {{ parameter.VariableName }}.fileName ? {{ parameter.VariableName }}.fileName : "{{ parameter.Name }}"); +content_.append("{{ parameter.Name }}", {{ parameter.VariableName }}.data, {{ parameter.VariableName }}.fileName ? {{ parameter.VariableName }}.fileName : "{{ parameter.Name }}"); {%- endif -%} {%- elsif parameter.IsDateOrDateTime -%} - content_.append("{{ parameter.Name }}", {{ parameter.VariableName }}.toJSON()); +content_.append("{{ parameter.Name }}", {{ parameter.VariableName }}.toJSON()); {%- elsif parameter.IsObject -%} - content_.append("{{ parameter.Name }}", JSON.stringify({{ parameter.VariableName }})); +content_.append("{{ parameter.Name }}", JSON.stringify({{ parameter.VariableName }})); {%- elsif parameter.IsArray -%} - {{ parameter.VariableName }}.forEach(item_ => content_.append("{{ parameter.Name }}", item_.toString())); +{{ parameter.VariableName }}.forEach(item_ => content_.append("{{ parameter.Name }}", item_.toString())); {%- else -%} - content_.append("{{ parameter.Name }}", {{ parameter.VariableName }}.toString()); +content_.append("{{ parameter.Name }}", {{ parameter.VariableName }}.toString()); {%- endif -%} {%- endfor -%} {%- endif -%} diff --git a/src/NSwag.CodeGeneration.TypeScript/Templates/Client.RequestUrl.liquid b/src/NSwag.CodeGeneration.TypeScript/Templates/Client.RequestUrl.liquid index f8f28e7c5..1b5174185 100644 --- a/src/NSwag.CodeGeneration.TypeScript/Templates/Client.RequestUrl.liquid +++ b/src/NSwag.CodeGeneration.TypeScript/Templates/Client.RequestUrl.liquid @@ -1,60 +1,33 @@ -let url_ = this.baseUrl + "/{{ operation.Path }}{% if operation.HasQueryParameters %}?{% endif %}"; -{% for parameter in operation.PathParameters -%} -{% if parameter.IsRequired -%} -if ({{ parameter.VariableName }} === undefined || {{ parameter.VariableName }} === null) - throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' must be defined."); -{% else -%} -if ({{ parameter.VariableName }} !== null && {{ parameter.VariableName }} !== undefined) -{% endif -%} -{% if parameter.IsDateOrDateTimeArray -%} -url_ = url_.replace("{{ "{" }}{{ parameter.Name }}}", encodeURIComponent({{ parameter.VariableName }}.map(s_ => s_ ? s_.{{ parameter.GetDateTimeToString }} : "null").join())); -{% elsif parameter.IsDateOrDateTime -%} -url_ = url_.replace("{{ "{" }}{{ parameter.Name }}}", encodeURIComponent({{ parameter.VariableName }} ? "" + {{ parameter.VariableName }}.{{ parameter.GetDateTimeToString }} : "null")); -{% elsif parameter.IsArray -%} -url_ = url_.replace("{{ "{" }}{{ parameter.Name }}}", encodeURIComponent({{ parameter.VariableName }}.join())); -{% else -%} -url_ = url_.replace("{{ "{" }}{{ parameter.Name }}}", encodeURIComponent("" + {{ parameter.VariableName }})); -{% endif -%} -{% if parameter.IsOptional -%} -else - url_ = url_.replace("/{{ "{" }}{{ parameter.Name }}}", ""); -{% endif -%} +{% for parameter in operation.PathParameters -%} +{% if parameter.IsRequired -%} +Guard.required({{ parameter.VariableName }}, '{{ parameter.VariableName }}'); +{% endif -%} {% endfor -%} {% for parameter in operation.QueryParameters -%} {% if parameter.IsRequired -%} {% if parameter.IsNullable -%} -if ({{ parameter.VariableName }} === undefined) - throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' must be defined."); -else if({{ parameter.VariableName }} !== null) -{% else -%} -if ({{ parameter.VariableName }} === undefined || {{ parameter.VariableName }} === null) - throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' must be defined and cannot be null."); -else -{% endif -%} -{% else -%} -{% if parameter.IsNullable -%} -if ({{ parameter.VariableName }} !== undefined && {{ parameter.VariableName }} !== null) +Guard.defined({{ parameter.VariableName }}, '{{ parameter.VariableName }}'); {% else -%} -if ({{ parameter.VariableName }} === null) - throw new globalThis.Error("The parameter '{{ parameter.VariableName }}' cannot be null."); -else if ({{ parameter.VariableName }} !== undefined) -{% endif -%} -{% endif -%} -{% if parameter.IsDateOrDateTimeArray -%} - {{ parameter.VariableName }} && {{ parameter.VariableName }}.forEach(item_ => { url_ += "{{ parameter.Name }}=" + encodeURIComponent(item_ ? "" + item_.{{ parameter.GetDateTimeToString }} : "null") + "&"; }); -{% elsif parameter.IsObjectArray -%} - {{ parameter.VariableName }} && {{ parameter.VariableName }}.forEach((item, index) => { - for (const attr in item) - if (item.hasOwnProperty(attr)) { - url_ += "{{ parameter.Name }}[" + index + "]." + attr + "=" + encodeURIComponent("" + (item as any)[attr]) + "&"; - } - }); -{% elsif parameter.IsDateOrDateTime -%} - url_ += "{{ parameter.Name }}=" + encodeURIComponent({{ parameter.VariableName }} ? "" + {{ parameter.VariableName }}.{{ parameter.GetDateTimeToString }} : "{{ QueryNullValue }}") + "&"; -{% elsif parameter.IsArray -%} - {{ parameter.VariableName }} && {{ parameter.VariableName }}.forEach(item => { url_ += "{{ parameter.Name }}=" + encodeURIComponent("" + item) + "&"; }); -{% else -%} - url_ += "{{ parameter.Name }}=" + encodeURIComponent("" + {{ parameter.VariableName }}) + "&"; -{% endif -%} +Guard.required({{ parameter.VariableName }}, '{{ parameter.VariableName }}'); +{% endif -%} +{% elsif parameter.IsNullable == false -%} +Guard.notNull({{ parameter.VariableName }}, '{{ parameter.VariableName }}'); +{% endif -%} +{% endfor -%} + +const url_ = new UriBuilder(this.baseUrl + "/{{ operation.Path }}") +{% for parameter in operation.PathParameters -%} + .path("{{ parameter.Name }}", {{ parameter.VariableName }}) +{% endfor -%} +{% for parameter in operation.QueryParameters -%} +{% if parameter.IsDateOrDateTime -%} + .param("{{ parameter.Name }}",{{ parameter.VariableName }} ? {{ parameter.VariableName }}.{{ parameter.GetDateTimeToString }} : "{{ QueryNullValue }}") +{% elsif parameter.IsArray -%} + .paramArray("{{ parameter.Name }}", {{ parameter.VariableName }}) +{% elsif parameter.IsObjectArray -%} + .paramObjectArray("{{ parameter.Name }}", {{ parameter.VariableName }}) +{% else -%} + .param("{{ parameter.Name }}", {{ parameter.VariableName }}) +{% endif -%} {% endfor -%} -url_ = url_.replace(/[?&]$/, ""); \ No newline at end of file + .toString(); \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript/Templates/File.Utilities.liquid b/src/NSwag.CodeGeneration.TypeScript/Templates/File.Utilities.liquid index 0c0a9eb25..48cbf4c99 100644 --- a/src/NSwag.CodeGeneration.TypeScript/Templates/File.Utilities.liquid +++ b/src/NSwag.CodeGeneration.TypeScript/Templates/File.Utilities.liquid @@ -68,4 +68,68 @@ function isAxiosError(obj: any): obj is AxiosError { } {% endif -%} -{% endif -%} \ No newline at end of file +{% endif -%} + +class Guard { + static required(value: any, name: string) { + if (value === undefined || value === null) + throw new globalThis.Error(`The parameter '${name}' must be defined and cannot be null.`); + } + + static defined(value: any, name: string) { + if (value === undefined) + throw new globalThis.Error(`The parameter '${name}' must be defined.`); + } + + static notNull(value: any, name: string) { + if (value === null) + throw new globalThis.Error(`The parameter '${name}' cannot be null.`); + } +} + +class UriBuilder { + private params: string[] = []; + + constructor(private url: string) {} + + path(name: string, value: any) { + if (value === undefined || value === null) { + this.url = this.url.replace(`/{${name}}`, "").replace(`{${name}}`, ""); + return this; + } + const resolved = Array.isArray(value) ? value.join() : value; + this.url = this.url.replace(`{${name}}`, encodeURIComponent("" + resolved)); + return this; + } + + param(name: string, value: any) { + if (value == null) return this; + this.params.push(`${name}=${encodeURIComponent("" + value)}`); + return this; + } + + paramArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach(v => + this.params.push(`${name}=${encodeURIComponent("" + v)}`) + ); + return this; + } + + paramObjectArray(name: string, arr: any[]) { + if (!arr) return this; + arr.forEach((obj, i) => { + Object.entries(obj).forEach(([k, v]) => { + this.params.push( + `${name}[${i}].${k}=${encodeURIComponent("" + v)}` + ); + }); + }); + return this; + } + + toString() { + if (!this.params.length) return this.url; + return this.url + (this.url.includes("?") ? "&" : "?") + this.params.join("&"); + } +} \ No newline at end of file