diff --git a/DemoCoreWeb/DemoCoreWeb.csproj b/DemoCoreWeb/DemoCoreWeb.csproj index c2de9269..8e247114 100644 --- a/DemoCoreWeb/DemoCoreWeb.csproj +++ b/DemoCoreWeb/DemoCoreWeb.csproj @@ -30,10 +30,6 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/DemoCoreWeb/wwwroot/scripts/ClientApi/HttpClient.js b/DemoCoreWeb/wwwroot/scripts/ClientApi/HttpClient.js deleted file mode 100644 index c321fac9..00000000 --- a/DemoCoreWeb/wwwroot/scripts/ClientApi/HttpClient.js +++ /dev/null @@ -1,119 +0,0 @@ -class HttpClient { - /** - location.origin may not be working in some releases of IE. And locationOrigin is an alternative implementation - **/ - static locationOrigin = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '') + '/'; - /** - **/ - get(url, callback, errorCalback, statusCodeCallback, headersHandler) { - this.executeAjax(url, null, "GET", callback, errorCalback, statusCodeCallback, null, headersHandler); - } - post(url, dataToSave, callback, errorCalback, statusCodeCallback, contentType, headersHandler) { - this.executeAjax(url, dataToSave, "POST", callback, errorCalback, statusCodeCallback, contentType, headersHandler); - } - put(url, dataToSave, callback, errorCalback, statusCodeCallback, contentType, headersHandler) { - this.executeAjax(url, dataToSave, "PUT", callback, errorCalback, statusCodeCallback, contentType, headersHandler); - } - patch(url, dataToSave, callback, errorCalback, statusCodeCallback, contentType, headersHandler) { - this.executeAjax(url, dataToSave, "PATCH", callback, errorCalback, statusCodeCallback, contentType, headersHandler); - } - delete(url, callback, errorCalback, statusCodeCallback, headersHandler) { - this.executeAjax(url, null, "DELETE", callback, errorCalback, statusCodeCallback, null, headersHandler); - } - executeAjax(url, dataToSave, httpVerb, callback, errorCallback, statusCodeCallback, contentType, headersHandler) { - jQuery.ajax(url, { - data: JSON.stringify(dataToSave), - type: httpVerb, - success: (data, textStatus, jqXHR) => { - if (callback !== null) { - callback(data); - } - }, - error: (xhr, ajaxOptions, thrown) => { - if (errorCallback != null) { - errorCallback(xhr, ajaxOptions, thrown); - } - }, - statusCode: statusCodeCallback, - contentType: contentType, - headers: headersHandler ? headersHandler() : undefined - }); - } -} -class AuthHttpClient { - /** - location.origin may not be working in some releases of IE. And locationOrigin is an alternative implementation - **/ - static locationOrigin = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '') + '/'; - get(url, callback, errorCalback, statusCodeCallback, headersHandler) { - this.executeAjax(url, null, "GET", callback, errorCalback, statusCodeCallback, null, headersHandler); - } - post(url, dataToSave, callback, errorCalback, statusCodeCallback, contentType, headersHandler) { - this.executeAjax(url, dataToSave, "POST", callback, errorCalback, statusCodeCallback, contentType, headersHandler); - } - put(url, dataToSave, callback, errorCalback, statusCodeCallback, contentType, headersHandler) { - this.executeAjax(url, dataToSave, "PUT", callback, errorCalback, statusCodeCallback, contentType, headersHandler); - } - patch(url, dataToSave, callback, errorCalback, statusCodeCallback, contentType, headersHandler) { - this.executeAjax(url, dataToSave, "PATCH", callback, errorCalback, statusCodeCallback, contentType, headersHandler); - } - delete(url, callback, errorCalback, statusCodeCallback, headersHandler) { - this.executeAjax(url, null, "DELETE", callback, errorCalback, statusCodeCallback, null, headersHandler); - } - executeAjax(url, dataToSave, httpVerb, callback, errorCallback, statusCodeCallback, contentType, headersHandler) { - //http://api.jquery.com/JQ.ajax/ - jQuery.ajax(url, { - data: JSON.stringify(dataToSave), - type: httpVerb, - success: (data, textStatus, jqXHR) => { - if (callback !== null) { - callback(data); - } - }, - error: (xhr, ajaxOptions, thrown) => { - if (errorCallback != null) { - errorCallback(xhr, ajaxOptions, thrown); - } - }, - statusCode: statusCodeCallback, - contentType: contentType, - headers: headersHandler ? headersHandler() : undefined, - beforeSend: (xhr, settings) => { - xhr.setRequestHeader('Authorization', 'bearer ' + sessionStorage.getItem('access_token')); - } - }); - } - /** - * Get oAuth token through username and password. The token will be saved in sessionStorage. - */ - getToken(url, username, password, callback, errorCallback, statusCodeCallback) { - jQuery.ajax(url + 'token', { - data: { - 'grant_type': 'password', - 'username': username, - 'password': password - }, - type: 'POST', - success: (data, textStatus, jqXHR) => { - if (data != null && data != '') { - sessionStorage.setItem("access_token", data.access_token); - sessionStorage.setItem("expires_in", data.expires_in); - } - if (callback !== null) { - callback(data); - } - }, - error: (xhr, ajaxOptions, thrown) => { - if (errorCallback != null) { - errorCallback(xhr, ajaxOptions, thrown); - } - }, - statusCode: statusCodeCallback, - contentType: 'application/x-www-form-urlencoded; charset=UTF-8', - headers: { - Accept: 'text/html,application/xhtml+xml,application/json,application/xml;q=0.9,*/*;q=0.8', - } - }); - } -} -//# sourceMappingURL=HttpClient.js.map \ No newline at end of file diff --git a/DemoCoreWeb/wwwroot/scripts/ClientApi/WebApiCoreJQClientAuto.js b/DemoCoreWeb/wwwroot/scripts/ClientApi/WebApiCoreJQClientAuto.js deleted file mode 100644 index a0b7c772..00000000 --- a/DemoCoreWeb/wwwroot/scripts/ClientApi/WebApiCoreJQClientAuto.js +++ /dev/null @@ -1,1497 +0,0 @@ -/// -/// -var DemoWebApi_Controllers_Client; -(function (DemoWebApi_Controllers_Client) { - /** - * For testing different commbinations of parameters and returns - */ - class DateTypes { - baseUri; - httpClient; - error; - statusCode; - constructor(baseUri = HttpClient.locationOrigin, httpClient = new HttpClient(), error, statusCode) { - this.baseUri = baseUri; - this.httpClient = httpClient; - this.error = error; - this.statusCode = statusCode; - } - /** - * GET api/DateTypes/GetDateOnlyMin - * @return {Date} Type: DateOnly - */ - getDateOnlyMin(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/DateTypes/GetDateOnlyMin', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/DateTypes/NullableDatetime/{hasValue} - */ - getDateTime(hasValue, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/DateTypes/NullableDatetime/' + hasValue, callback, this.error, this.statusCode, headersHandler); - } - /** - * return DateTimeOffset.Now - * GET api/DateTypes/ForDateTimeOffset - */ - getDateTimeOffset(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/DateTypes/ForDateTimeOffset', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/DateTypes/NextHour/{dt} - */ - getNextHour(dt, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/DateTypes/NextHour/' + dt?.toISOString(), callback, this.error, this.statusCode, headersHandler); - } - /** - * If Dt is not defined, add a hour from now - * GET api/DateTypes/NextHourNullable?n={n}&dt={dt} - * @param {number} n Type: int, -2,147,483,648 to 2,147,483,647 - */ - getNextHourNullable(n, dt, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/DateTypes/NextHourNullable?n=' + n + (dt ? '&dt=' + dt?.toISOString() : ''), callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/DateTypes/NextYear/{dt} - */ - getNextYear(dt, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/DateTypes/NextYear/' + dt?.toISOString(), callback, this.error, this.statusCode, headersHandler); - } - /** - * If Dt is not defined, add a year from now - * GET api/DateTypes/NextYearNullable?n={n}&dt={dt} - * @param {number} n Type: int, -2,147,483,648 to 2,147,483,647 - */ - getNextYearNullable(n, dt, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/DateTypes/NextYearNullable?n=' + n + (dt ? '&dt=' + dt?.toISOString() : ''), callback, this.error, this.statusCode, headersHandler); - } - /** - * Client should send DateTime.Date - * POST api/DateTypes/IsDateTimeDate - */ - isDateTimeDate(dt, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/IsDateTimeDate', dt, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/DateTypes/IsDateTimeOffsetDate - */ - isDateTimeOffsetDate(dt, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/IsDateTimeOffsetDate', dt, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/DateTypes/ForDateOnly - * @param {Date} d Type: DateOnly - * @return {Date} Type: DateOnly - */ - postDateOnly(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/ForDateOnly', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/DateTypes/DateOnlyNullable - */ - postDateOnlyNullable(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/DateOnlyNullable', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/DateTypes/ForDateTime - */ - postDateTime(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/ForDateTime', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/DateTypes/DateTimeNullable - */ - postDateTimeNullable(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/DateTimeNullable', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * return d; - * POST api/DateTypes/ForDateTimeOffset - */ - postDateTimeOffset(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/ForDateTimeOffset', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * return d.ToString("O") - * POST api/DateTypes/ForDateTimeOffsetForO - */ - postDateTimeOffsetForO(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/ForDateTimeOffsetForO', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/DateTypes/ForDateTimeOffsetForOffset - */ - postDateTimeOffsetForOffset(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/ForDateTimeOffsetForOffset', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Returned is DateTimeOffset? - * POST api/DateTypes/DateTimeOffsetNullable - */ - postDateTimeOffsetNullable(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/DateTimeOffsetNullable', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/DateTypes/ForDateTimeOffsetStringForOffset - */ - postDateTimeOffsetStringForOffset(s, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/ForDateTimeOffsetStringForOffset', s, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/DateTypes/NextYear - */ - postNextYear(dt, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/DateTypes/NextYear', dt, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * GET api/DateTypes/DateOnlyStringQuery?d={d} - * @return {Date} Type: DateOnly - */ - queryDateOnlyAsString(d, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/DateTypes/DateOnlyStringQuery?d=' + (!d ? '' : encodeURIComponent(d)), callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/DateTypes/RouteDateTimeOffset/{d} - */ - routeDateTimeOffset(d, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/DateTypes/RouteDateTimeOffset/' + d?.toISOString(), callback, this.error, this.statusCode, headersHandler); - } - /** - * Return Tuple DateTime?, DateTime? - * GET api/DateTypes/SearchDateRange?startDate={startDate}&endDate={endDate} - * @param {Date} startDate DateTime? startDate = null - * @param {Date} endDate DateTime? endDate = null - */ - searchDateRange(startDate, endDate, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/DateTypes/SearchDateRange?' + (startDate ? 'startDate=' + startDate?.toISOString() : '') + (endDate ? '&endDate=' + endDate?.toISOString() : ''), callback, this.error, this.statusCode, headersHandler); - } - } - DemoWebApi_Controllers_Client.DateTypes = DateTypes; - /** - * Entities, Person and Company - * Some with AuthorizeAttribute - */ - class Entities { - baseUri; - httpClient; - error; - statusCode; - constructor(baseUri = HttpClient.locationOrigin, httpClient = new HttpClient(), error, statusCode) { - this.baseUri = baseUri; - this.httpClient = httpClient; - this.error = error; - this.statusCode = statusCode; - } - /** - * POST api/Entities/createCompany - */ - createCompany(p, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/createCompany', p, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Entities/createPerson - * @return {string} Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - */ - createPerson(p, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/createPerson', p, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Entities/createPerson2 - */ - createPerson2(p, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/createPerson2', p, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Entities/createPerson3 - */ - createPerson3(p, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/createPerson3', p, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Entities/createPersonByAdmin - * Status Codes: 404:NotFound, 204:NoContent, 422:UnprocessableEntity - */ - createPersonByAdmin(p, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/createPersonByAdmin', p, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Entities/createPersonWeak - * Status Codes: 404:NotFound, 204:NoContent, 200:OK : DemoWebApi.DemoData.Person - */ - createPersonWeak(p, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/createPersonWeak', p, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Entities/createPersonWithNotFound - * Status Codes: 404:NotFound - */ - createPersonWithNotFound(p, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/createPersonWithNotFound', p, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Entities/createPersonWithStatuses - * Status Codes: 404:NotFound, 204:NoContent, 422:UnprocessableEntity - */ - createPersonWithStatuses(p, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/createPersonWithStatuses', p, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * DELETE api/Entities/{id} - * @param {string} id Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - */ - delete(id, callback, headersHandler) { - this.httpClient.delete(this.baseUri + 'api/Entities/' + id, callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/Entities/Company/{id} - * @param {string} id Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - */ - getCompany(id, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Entities/Company/' + id, callback, this.error, this.statusCode, headersHandler); - } - /** - * POST api/Entities/Mims - */ - getMims(p, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/Mims', p, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Post MyGeneric string, decimal, double - * POST api/Entities/MyGeneric - */ - getMyGeneric(s, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/MyGeneric', s, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Post MyGeneric string, decimal, Person - * POST api/Entities/MyGenericPerson - */ - getMyGenericPerson(s, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/MyGenericPerson', s, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Return empty body, status 204. MaybeNull - * GET api/Entities/NullCompany - */ - getNullCompany(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Entities/NullCompany', callback, this.error, this.statusCode, headersHandler); - } - /** - * Get a person - * so to know the person - * GET api/Entities/getPerson/{id} - * @param {string} id unique id of that guy - * @return {DemoWebApi_DemoData_Client.Person} person in db - */ - getPerson(id, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Entities/getPerson/' + id, callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/Entities/getPerson2/{id} - * @param {string} id Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - */ - getPerson2(id, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Entities/getPerson2/' + id, callback, this.error, this.statusCode, headersHandler); - } - /** - * PUT api/Entities/link?id={id}&relationship={relationship} - * @param {string} id Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - */ - linkPerson(id, relationship, person, callback, headersHandler) { - this.httpClient.put(this.baseUri + 'api/Entities/link?id=' + id + '&relationship=' + (!relationship ? '' : encodeURIComponent(relationship)), person, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH - * PATCH api/Entities/patchPerson - */ - patchPerson(person, callback, headersHandler) { - this.httpClient.patch(this.baseUri + 'api/Entities/patchPerson', person, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Entities/IdMap - */ - postIdMap(idMap, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Entities/IdMap', idMap, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * PUT api/Entities/updatePerson - */ - updatePerson(person, callback, headersHandler) { - this.httpClient.put(this.baseUri + 'api/Entities/updatePerson', person, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - } - DemoWebApi_Controllers_Client.Entities = Entities; - /** - * Heroes operations. Decorated by nullable directive. - */ - class Heroes { - baseUri; - httpClient; - error; - statusCode; - constructor(baseUri = HttpClient.locationOrigin, httpClient = new HttpClient(), error, statusCode) { - this.baseUri = baseUri; - this.httpClient = httpClient; - this.error = error; - this.statusCode = statusCode; - } - /** - * DELETE api/Heroes/{id} - * @param {string} id Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - */ - delete(id, callback, headersHandler) { - this.httpClient.delete(this.baseUri + 'api/Heroes/' + id, callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/Heroes/asyncHeroes - */ - getAsyncHeroes(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Heroes/asyncHeroes', callback, this.error, this.statusCode, headersHandler); - } - /** - * Get a hero. Nullable reference. MaybeNull - * GET api/Heroes/{id} - * @param {string} id Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - */ - getHero(id, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Heroes/' + id, callback, this.error, this.statusCode, headersHandler); - } - /** - * Get all heroes. - * GET api/Heroes - */ - getHeroes(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Heroes', callback, this.error, this.statusCode, headersHandler); - } - /** - * MaybeNull - * GET api/Heroes/super?id={id} - * @param {string} id Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - */ - getSuperHero(id, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Heroes/super?id=' + id, callback, this.error, this.statusCode, headersHandler); - } - /** - * POST api/Heroes - */ - post(name, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Heroes', name, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Add a hero. The client will not expect null. NotNull - * POST api/Heroes/q?name={name} - * @param {string} name name of hero - * @return {DemoWebApi_Controllers_Client.Hero} Always object. - */ - postWithQuery(name, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Heroes/q?name=' + (!name ? '' : encodeURIComponent(name)), null, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Update hero. - * PUT api/Heroes - */ - put(hero, callback, headersHandler) { - this.httpClient.put(this.baseUri + 'api/Heroes', hero, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Search heroes - * GET api/Heroes/search/{name} - * @param {string} name keyword contained in hero name. - * @return {Array} Hero array matching the keyword. - */ - search(name, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Heroes/search/' + (!name ? '' : encodeURIComponent(name)), callback, this.error, this.statusCode, headersHandler); - } - } - DemoWebApi_Controllers_Client.Heroes = Heroes; - /** - * For testing different commbinations of parameters and returns - */ - class Numbers { - baseUri; - httpClient; - error; - statusCode; - constructor(baseUri = HttpClient.locationOrigin, httpClient = new HttpClient(), error, statusCode) { - this.baseUri = baseUri; - this.httpClient = httpClient; - this.error = error; - this.statusCode = statusCode; - } - /** - * GET api/Numbers/byte?d={d} - * @param {number} d Type: byte, 0 to 255 - * @return {number} Type: byte, 0 to 255 - */ - getByte(d, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Numbers/byte?d=' + d, callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/Numbers/byteWithRange?d={d} - * @param {number} d Byte for small number. - * @return {number} Type: byte, 0 to 255 - */ - getByteWithRange(d, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Numbers/byteWithRange?d=' + d, callback, this.error, this.statusCode, headersHandler); - } - /** - * POST api/Numbers/byte - * @param {number} d Type: byte, 0 to 255 - * @return {number} Type: byte, 0 to 255 - */ - postByDOfByte(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/byte', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/sbyte - * @param {number} d Type: sbyte, -128 to 127 - * @return {number} Type: sbyte, -128 to 127 - */ - postByDOfSByte(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/sbyte', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/short - * @param {number} d Type: short, -32,768 to 32,767 - * @return {number} Type: short, -32,768 to 32,767 - */ - postByDOfInt16(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/short', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/ushort - * @param {number} d Type: ushort, 0 to 65,535 - * @return {number} Type: ushort, 0 to 65,535 - */ - postByDOfUInt16(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/ushort', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/int - * @param {number} d Type: int, -2,147,483,648 to 2,147,483,647 - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - postByDOfInt32(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/int', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/long - * @param {string} d Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - * @return {string} Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - */ - postByDOfInt64(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/long', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/ulong - * @param {string} d Type: ulong, 0 to 18,446,744,073,709,551,615 - * @return {string} Type: ulong, 0 to 18,446,744,073,709,551,615 - */ - postByDOfUInt64(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/ulong', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/bigInteger - * @param {string} bigInteger Type: BigInteger - * @return {string} Type: BigInteger - */ - postBigInteger(bigInteger, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/bigInteger', bigInteger, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/bigIntegralAsStringForJs - */ - postBigIntegralAsStringForJs(bigIntegral, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/bigIntegralAsStringForJs', bigIntegral, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/BigNumbers - */ - postBigNumbers(bigNumbers, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/BigNumbers', bigNumbers, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/int128 - * @param {string} int128 Type: Int128, -170141183460469231731687303715884105728 to 170141183460469231731687303715884105727 - * @return {string} Type: Int128, -170141183460469231731687303715884105728 to 170141183460469231731687303715884105727 - */ - postInt128(int128, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/int128', int128, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/int64 - * @param {string} int64 Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - * @return {string} Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - */ - postInt64(int64, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/int64', int64, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/IntegralEntity - */ - postIntegralEntity(integralEntity, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/IntegralEntity', integralEntity, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/IntegralEntityMustBeValid - */ - postIntegralEntityMustBeValid(integralEntity, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/IntegralEntityMustBeValid', integralEntity, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/intRange - * @param {number} d Type: int - * Range: inclusive between 1 and 100 - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - postIntWithRange(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/intRange', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Range is with double, not long. Precision of double: ~15-17 digits, while long.MaxValue 9223372036854775807 has 19 decimal digits. - * POST api/Numbers/longRange - * @param {string} d Type: long - * Range: inclusive between 1000 and 9223372036854775800 - * @return {string} Type: long, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - */ - postLongWithRange(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/longRange', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/uint128 - * @param {string} uint128 Type: UInt128, 0 to 340282366920938463463374607431768211455 - * @return {string} Type: UInt128, 0 to 340282366920938463463374607431768211455 - */ - postUint128(uint128, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/uint128', uint128, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Numbers/uint64 - * @param {string} uint64 Type: ulong, 0 to 18,446,744,073,709,551,615 - * @return {string} Type: ulong, 0 to 18,446,744,073,709,551,615 - */ - postUint64(uint64, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Numbers/uint64', uint64, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - } - DemoWebApi_Controllers_Client.Numbers = Numbers; - /** - * For testing posting and getting string data. Returned string is JSON object. - */ - class StringData { - baseUri; - httpClient; - error; - statusCode; - constructor(baseUri = HttpClient.locationOrigin, httpClient = new HttpClient(), error, statusCode) { - this.baseUri = baseUri; - this.httpClient = httpClient; - this.error = error; - this.statusCode = statusCode; - } - /** - * Athlethe Search - * GET api/StringData/AthletheSearch?take={take}&skip={skip}&order={order}&sort={sort}&search={search} - * @param {number} take Generic optional parameter. Default 10 - * @param {number} skip Default 0 - * @param {string} order default null - */ - athletheSearch(take, skip, order, sort, search, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/StringData/AthletheSearch?' + (take ? 'take=' + take.toString() : '') + '&skip=' + skip + '&order=' + (!order ? '' : encodeURIComponent(order)) + '&sort=' + (!sort ? '' : encodeURIComponent(sort)) + '&search=' + (!search ? '' : encodeURIComponent(search)), callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/StringData/String - */ - getABCDE(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/StringData/String', callback, this.error, this.statusCode, headersHandler); - } - /** - * Return empty string JSON object. Status 200. - * GET api/StringData/EmptyString - */ - getEmptyString(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/StringData/EmptyString', callback, this.error, this.statusCode, headersHandler); - } - /** - * Return empty body with status 204 No Content, even though the default mime type is application/json. MaybeNull - * GET api/StringData/NullString - */ - getNullString(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/StringData/NullString', callback, this.error, this.statusCode, headersHandler); - } - } - DemoWebApi_Controllers_Client.StringData = StringData; - /** - * For testing different commbinations of parameters and returns - */ - class SuperDemo { - baseUri; - httpClient; - error; - statusCode; - constructor(baseUri = HttpClient.locationOrigin, httpClient = new HttpClient(), error, statusCode) { - this.baseUri = baseUri; - this.httpClient = httpClient; - this.error = error; - this.statusCode = statusCode; - } - /** - * GET api/SuperDemo/ActionResult - */ - getActionResult(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/ActionResult', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/ActionResult2 - */ - getActionResult2(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/ActionResult2', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/ActionStringResult - * Status Codes: 200:OK : System.String - */ - getActionStringResult(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/ActionStringResult', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/BadRequest - */ - getBadRequest(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/BadRequest', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/BadRequest2 - */ - getBadRequest2(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/BadRequest2', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/bool - */ - getBool(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/bool', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/byte - * @return {number} Type: byte, 0 to 255 - */ - getbyte(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/byte', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/ByteArray - */ - getByteArray(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/ByteArray', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/char - * @return {string} Type: char - */ - getChar(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/char', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/Collection - */ - getCollection(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/Collection', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/enumGet?d={d} - */ - getDay(d, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/enumGet?d=' + d, callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/decimal - * @return {number} Type: decimal - */ - getDecimal(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/decimal', callback, this.error, this.statusCode, headersHandler); - } - /** - * Demo - * GET api/SuperDemo/decimalArrayQ?a={a} - */ - getDecimalArrayQ(a, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/decimalArrayQ?' + a?.map(z => `a=${encodeURIComponent(z)}`).join('&'), callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/decimal/{d} - * @param {number} d Type: decimal - * @return {number} Type: decimal - */ - getDecimalSquare(d, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/decimal/' + d, callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/DecimalZero - * @return {number} Type: decimal - */ - getDecimalZero(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/DecimalZero', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/StringStringDic - */ - getDictionary(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/StringStringDic', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/StringPersonDic - */ - getDictionaryOfPeople(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/StringPersonDic', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/StringPersonDic2 - */ - getDictionaryOfPeople2(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/StringPersonDic2', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/doulbe - * @return {number} Type: double - */ - getdouble(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/doulbe', callback, this.error, this.statusCode, headersHandler); - } - /** - * Result of 0.1d + 0.2d - 0.3d - * GET api/SuperDemo/DoubleZero - * @return {number} Type: double - */ - getDoubleZero(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/DoubleZero', callback, this.error, this.statusCode, headersHandler); - } - /** - * Demo IEnumerable Days - * GET api/SuperDemo/enumArrayDays?a={a} - */ - getEnumArrayDays(a, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/enumArrayDays?' + a?.map(z => `a=${z}`).join('&'), callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/enumArrayQ2?a={a} - */ - getEnumArrayQ2(a, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/enumArrayQ2?' + a?.map(z => `a=${z}`).join('&'), callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/FloatZero - * @return {number} Type: float - */ - getFloatZero(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/FloatZero', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/ICollection - */ - getICollection(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/ICollection', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/IList - */ - getIList(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/IList', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/int2d - */ - getInt2D(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/int2d', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/int2dJagged - */ - getInt2DJagged(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/int2dJagged', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/intArray - */ - getIntArray(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/intArray', callback, this.error, this.statusCode, headersHandler); - } - /** - * Demo int[]; - * GET api/SuperDemo/intArrayQ?a={a} - */ - getIntArrayQ(a, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/intArrayQ?' + a?.map(z => `a=${encodeURIComponent(z)}`).join('&'), callback, this.error, this.statusCode, headersHandler); - } - /** - * Demo IEnumerable long - * GET api/SuperDemo/intArrayQ2?a={a} - */ - getIntArrayQ2(a, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/intArrayQ2?' + a?.map(z => `a=${encodeURIComponent(z)}`).join('&'), callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/int/{d} - * @param {number} d Type: int, -2,147,483,648 to 2,147,483,647 - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - getIntSquare(d, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/int/' + d, callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/IReadOnlyCollection - */ - getIReadOnlyCollection(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/IReadOnlyCollection', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/IReadOnlyList - */ - getIReadOnlyList(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/IReadOnlyList', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/KeyValuePair - */ - getKeyhValuePair(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/KeyValuePair', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/List - */ - getList(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/List', callback, this.error, this.statusCode, headersHandler); - } - /** - * False to return null, and true to return 1000 - * GET api/SuperDemo/NullableDecimal/{hasValue} - */ - getNullableDecimal(hasValue, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/NullableDecimal/' + hasValue, callback, this.error, this.statusCode, headersHandler); - } - /** - * MaybeNull - * GET api/SuperDemo/NullObject - */ - getNullPerson(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/NullObject', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/DoubleNullable?location={location}&dd={dd}&de={de} - */ - getPrimitiveNullable(location, dd, de, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/DoubleNullable?location=' + (!location ? '' : encodeURIComponent(location)) + (dd ? '&dd=' + dd.toString() : '') + (de ? '&de=' + de.toString() : ''), callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/DoubleNullable2?dd={dd}&de={de} - */ - getPrimitiveNullable2(dd, de, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/DoubleNullable2?' + (dd ? 'dd=' + dd.toString() : '') + (de ? '&de=' + de.toString() : ''), callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/sbyte - * @return {number} Type: sbyte, -128 to 127 - */ - getsbyte(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/sbyte', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/short - * @return {number} Type: short, -32,768 to 32,767 - */ - getShort(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/short', callback, this.error, this.statusCode, headersHandler); - } - /** - * Demo string array - * GET api/SuperDemo/stringArrayQ?a={a} - */ - getStringArrayQ(a, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/stringArrayQ?' + a?.map(z => `a=${encodeURIComponent(z)}`).join('&'), callback, this.error, this.statusCode, headersHandler); - } - /** - * Demo List string - * GET api/SuperDemo/stringArrayQ2?a={a} - */ - getStringArrayQ2(a, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/stringArrayQ2?' + a?.map(z => `a=${encodeURIComponent(z)}`).join('&'), callback, this.error, this.statusCode, headersHandler); - } - /** - * ActionResult with FileStreamResult - * GET api/SuperDemo/TextStream - */ - getTextStream(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/TextStream', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/uint - * @return {number} Type: uint, 0 to 4,294,967,295 - */ - getUint(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/uint', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/ulong - * @return {string} Type: ulong, 0 to 18,446,744,073,709,551,615 - */ - getulong(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/ulong', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SuperDemo/ushort - * @return {number} Type: ushort, 0 to 65,535 - */ - getUShort(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SuperDemo/ushort', callback, this.error, this.statusCode, headersHandler); - } - /** - * POST api/SuperDemo/ActionResult - */ - postActionResult(callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/ActionResult', null, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/SuperDemo/PostActionResult2 - */ - postActionResult2(s, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/PostActionResult2', s, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/SuperDemo/PostActionResult3 - */ - postActionResult3(person, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/PostActionResult3', person, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Post a collection of person - * POST api/SuperDemo/Collection - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - postCollection(list, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/Collection', list, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/SuperDemo/enumPost?d={d} - */ - postDay(d, d2, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/enumPost?d=' + d, d2, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Demo Dic string and person - * POST api/SuperDemo/StringPersonDic - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - postDictionary(dic, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/StringPersonDic', dic, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/SuperDemo/Guids - */ - postGuids(guids, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/Guids', guids, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Post ICollection of person - * POST api/SuperDemo/ICollection - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - postICollection(list, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/ICollection', list, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Post IList of person - * POST api/SuperDemo/IList - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - postIList(list, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/IList', list, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/SuperDemo/int2d - */ - postInt2D(a, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/int2d', a, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Demo int[][] - * POST api/SuperDemo/int2djagged - */ - postInt2DJagged(a, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/int2djagged', a, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Demo int[] - * POST api/SuperDemo/intArray - * @param {Array} a Min length: 1 - * Max length: 10 - */ - postIntArray(a, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/intArray', a, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Post IReadOnlyCollection of person - * POST api/SuperDemo/IReadOnlyCollection - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - postIReadOnlyCollection(list, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/IReadOnlyCollection', list, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Post e of person - * POST api/SuperDemo/IReadOnlyList - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - postIReadOnlyList(list, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/IReadOnlyList', list, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Post a list of person - * POST api/SuperDemo/List - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - postList(list, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/List', list, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/SuperDemo/PostEmpty/{i} - * @param {number} i Type: int, -2,147,483,648 to 2,147,483,647 - */ - postWithQueryButEmptyBody(s, i, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SuperDemo/PostEmpty/' + i, s, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - } - DemoWebApi_Controllers_Client.SuperDemo = SuperDemo; - /** - * For testing posting and getting string data. String returned is text/plain by default - */ - class TextData { - baseUri; - httpClient; - error; - statusCode; - constructor(baseUri = HttpClient.locationOrigin, httpClient = new HttpClient(), error, statusCode) { - this.baseUri = baseUri; - this.httpClient = httpClient; - this.error = error; - this.statusCode = statusCode; - } - /** - * GET api/TextData/AthletheSearch?take={take}&skip={skip}&order={order}&sort={sort}&search={search} - * @param {number} skip Type: int, -2,147,483,648 to 2,147,483,647 - */ - athletheSearch(take, skip, order, sort, search, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/TextData/AthletheSearch?' + (take ? 'take=' + take.toString() : '') + '&skip=' + skip + '&order=' + (!order ? '' : encodeURIComponent(order)) + '&sort=' + (!sort ? '' : encodeURIComponent(sort)) + '&search=' + (!search ? '' : encodeURIComponent(search)), callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/TextData/String - */ - getABCDE(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/TextData/String', callback, this.error, this.statusCode, headersHandler); - } - /** - * Return empty body with status 200. - * GET api/TextData/EmptyString - */ - getEmptyString(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/TextData/EmptyString', callback, this.error, this.statusCode, headersHandler); - } - /** - * MaybeNull - * GET api/TextData/NullableString - */ - getNullableString(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/TextData/NullableString', callback, this.error, this.statusCode, headersHandler); - } - /** - * Return empty body with status 204 No Content. - * GET api/TextData/NullString - */ - getNullString(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/TextData/NullString', callback, this.error, this.statusCode, headersHandler); - } - } - DemoWebApi_Controllers_Client.TextData = TextData; - /** - * https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#3.3.3 - */ - class Tuple { - baseUri; - httpClient; - error; - statusCode; - constructor(baseUri = HttpClient.locationOrigin, httpClient = new HttpClient(), error, statusCode) { - this.baseUri = baseUri; - this.httpClient = httpClient; - this.error = error; - this.statusCode = statusCode; - } - /** - * Update in a transaction - * PUT api/Tuple/A1TupleArray - */ - a1TupleArray(idAndOrderArray, callback, headersHandler) { - this.httpClient.put(this.baseUri + 'api/Tuple/A1TupleArray', idAndOrderArray, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Update IEnumerable Tuple in a transaction - * PUT api/Tuple/A2TupleArray - */ - a2TupleIEnumerable(idAndOrderArray, callback, headersHandler) { - this.httpClient.put(this.baseUri + 'api/Tuple/A2TupleArray', idAndOrderArray, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Post tuple - * POST api/Tuple/ChangeName - */ - changeName(d, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/ChangeName', d, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Get Tuple in return. MaybeNull - * GET api/Tuple/PeopleCompany4 - */ - getPeopleCompany4(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Tuple/PeopleCompany4', callback, this.error, this.statusCode, headersHandler); - } - /** - * MaybeNull - * GET api/Tuple/PeopleCompany5 - */ - getPeopleCompany5(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Tuple/PeopleCompany5', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/Tuple/Tuple1 - */ - getTuple1(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Tuple/Tuple1', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/Tuple/Tuple2 - */ - getTuple2(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Tuple/Tuple2', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/Tuple/Tuple3 - */ - getTuple3(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Tuple/Tuple3', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/Tuple/Tuple4 - */ - getTuple4(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Tuple/Tuple4', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/Tuple/Tuple5 - */ - getTuple5(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Tuple/Tuple5', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/Tuple/Tuple6 - */ - getTuple6(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Tuple/Tuple6', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/Tuple/Tuple7 - */ - getTuple7(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Tuple/Tuple7', callback, this.error, this.statusCode, headersHandler); - } - /** - * Post nested tuple - * GET api/Tuple/Tuple8 - */ - getTuple8(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Tuple/Tuple8', callback, this.error, this.statusCode, headersHandler); - } - /** - * POST api/Tuple/PeopleCompany2 - */ - linkPeopleCompany2(peopleAndCompany, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/PeopleCompany2', peopleAndCompany, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/PeopleCompany3 - */ - linkPeopleCompany3(peopleAndCompany, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/PeopleCompany3', peopleAndCompany, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/PeopleCompany4 - */ - linkPeopleCompany4(peopleAndCompany, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/PeopleCompany4', peopleAndCompany, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/PeopleCompany5 - */ - linkPeopleCompany5(peopleAndCompany, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/PeopleCompany5', peopleAndCompany, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/PeopleCompany6 - */ - linkPeopleCompany6(peopleAndCompany, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/PeopleCompany6', peopleAndCompany, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Post long tuple - * POST api/Tuple/PeopleCompany7 - */ - linkPeopleCompany7(peopleAndCompany, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/PeopleCompany7', peopleAndCompany, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/PeopleCompany8 - */ - linkPeopleCompany8(peopleAndCompany, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/PeopleCompany8', peopleAndCompany, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/PersonCompany1 - */ - linkPersonCompany1(peopleAndCompany, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/PersonCompany1', peopleAndCompany, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/Tuple1 - * @return {number} Type: int, -2,147,483,648 to 2,147,483,647 - */ - postTuple1(tuple, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/Tuple1', tuple, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Post tuple string int - * POST api/Tuple/Tuple2 - */ - postTuple2(tuple, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/Tuple2', tuple, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/Tuple3 - */ - postTuple3(tuple, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/Tuple3', tuple, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/Tuple4 - */ - postTuple4(tuple, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/Tuple4', tuple, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/Tuple5 - */ - postTuple5(tuple, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/Tuple5', tuple, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/Tuple6 - */ - postTuple6(tuple, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/Tuple6', tuple, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/Tuple7 - */ - postTuple7(tuple, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/Tuple7', tuple, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * POST api/Tuple/Tuple8 - */ - postTuple8(tuple, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Tuple/Tuple8', tuple, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - } - DemoWebApi_Controllers_Client.Tuple = Tuple; - class Values { - baseUri; - httpClient; - error; - statusCode; - constructor(baseUri = HttpClient.locationOrigin, httpClient = new HttpClient(), error, statusCode) { - this.baseUri = baseUri; - this.httpClient = httpClient; - this.error = error; - this.statusCode = statusCode; - } - /** - * DELETE api/Values/{id} - * @param {number} id Type: int, -2,147,483,648 to 2,147,483,647 - */ - delete(id, callback, headersHandler) { - this.httpClient.delete(this.baseUri + 'api/Values/' + id, callback, this.error, this.statusCode, headersHandler); - } - /** - * Get a list of value - * GET api/Values - */ - get(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Values', callback, this.error, this.statusCode, headersHandler); - } - /** - * Get by both Id and name - * GET api/Values/Name/{id}?name={name} - * @param {number} id Type: int, -2,147,483,648 to 2,147,483,647 - */ - getByIdOfInt32AndNameOfString(id, name, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Values/Name/' + id + '?name=' + (!name ? '' : encodeURIComponent(name)), callback, this.error, this.statusCode, headersHandler); - } - /** - * Get by name - * GET api/Values?name={name} - */ - getByNameOfString(name, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Values?name=' + (!name ? '' : encodeURIComponent(name)), callback, this.error, this.statusCode, headersHandler); - } - /** - * Get by Id - * GET api/Values/{id} - * @param {number} id Type: int, -2,147,483,648 to 2,147,483,647 - */ - getByIdOfInt32(id, callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Values/' + id, callback, this.error, this.statusCode, headersHandler); - } - /** - * Get a list of value async, it is get2 - * GET api/Values/Get2 - */ - get2(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/Values/Get2', callback, this.error, this.statusCode, headersHandler); - } - /** - * POST api/Values - */ - post(value, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/Values', value, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Update with valjue - * PUT api/Values/{id} - * @param {number} id Type: int, -2,147,483,648 to 2,147,483,647 - */ - put(id, value, callback, headersHandler) { - this.httpClient.put(this.baseUri + 'api/Values/' + id, value, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - } - DemoWebApi_Controllers_Client.Values = Values; -})(DemoWebApi_Controllers_Client || (DemoWebApi_Controllers_Client = {})); -var DemoWebApi_DemoData_Client; -(function (DemoWebApi_DemoData_Client) { - let AddressType; - (function (AddressType) { - AddressType[AddressType["Postal"] = 0] = "Postal"; - AddressType[AddressType["Residential"] = 1] = "Residential"; - })(AddressType = DemoWebApi_DemoData_Client.AddressType || (DemoWebApi_DemoData_Client.AddressType = {})); - let Days; - (function (Days) { - Days[Days["Sat"] = 1] = "Sat"; - Days[Days["Sun"] = 2] = "Sun"; - Days[Days["Mon"] = 3] = "Mon"; - Days[Days["Tue"] = 4] = "Tue"; - Days[Days["Wed"] = 5] = "Wed"; - /** - * Thursday - */ - Days[Days["Thu"] = 6] = "Thu"; - Days[Days["Fri"] = 7] = "Fri"; - })(Days = DemoWebApi_DemoData_Client.Days || (DemoWebApi_DemoData_Client.Days = {})); - let MedicalContraindiationResponseTypeReason; - (function (MedicalContraindiationResponseTypeReason) { - MedicalContraindiationResponseTypeReason["M"] = "Mm"; - MedicalContraindiationResponseTypeReason["S"] = "Ss"; - MedicalContraindiationResponseTypeReason["P"] = "Pp"; - MedicalContraindiationResponseTypeReason["I"] = "I"; - MedicalContraindiationResponseTypeReason["A"] = "A"; - })(MedicalContraindiationResponseTypeReason = DemoWebApi_DemoData_Client.MedicalContraindiationResponseTypeReason || (DemoWebApi_DemoData_Client.MedicalContraindiationResponseTypeReason = {})); - let MedicalContraindiationResponseTypeTypeCode; - (function (MedicalContraindiationResponseTypeTypeCode) { - MedicalContraindiationResponseTypeTypeCode["P"] = "P"; - MedicalContraindiationResponseTypeTypeCode["T"] = "Tt"; - })(MedicalContraindiationResponseTypeTypeCode = DemoWebApi_DemoData_Client.MedicalContraindiationResponseTypeTypeCode || (DemoWebApi_DemoData_Client.MedicalContraindiationResponseTypeTypeCode = {})); - let MyEnumType; - (function (MyEnumType) { - MyEnumType[MyEnumType["First"] = 1] = "First"; - MyEnumType[MyEnumType["Two"] = 2] = "Two"; - })(MyEnumType = DemoWebApi_DemoData_Client.MyEnumType || (DemoWebApi_DemoData_Client.MyEnumType = {})); - /** - * Phone type - * Tel, Mobile, Skyp and Fax - */ - let PhoneType; - (function (PhoneType) { - /** - * Land line - */ - PhoneType[PhoneType["Tel"] = 0] = "Tel"; - /** - * Mobile phone - */ - PhoneType[PhoneType["Mobile"] = 1] = "Mobile"; - PhoneType[PhoneType["Skype"] = 2] = "Skype"; - PhoneType[PhoneType["Fax"] = 3] = "Fax"; - })(PhoneType = DemoWebApi_DemoData_Client.PhoneType || (DemoWebApi_DemoData_Client.PhoneType = {})); -})(DemoWebApi_DemoData_Client || (DemoWebApi_DemoData_Client = {})); -var DemoCoreWeb_Controllers_Client; -(function (DemoCoreWeb_Controllers_Client) { - class SpecialTypes { - baseUri; - httpClient; - error; - statusCode; - constructor(baseUri = HttpClient.locationOrigin, httpClient = new HttpClient(), error, statusCode) { - this.baseUri = baseUri; - this.httpClient = httpClient; - this.error = error; - this.statusCode = statusCode; - } - /** - * Anonymous Dynamic of C# - * GET api/SpecialTypes/AnonymousDynamic - * @return {any} dyanmic things - */ - getAnonymousDynamic(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SpecialTypes/AnonymousDynamic', callback, this.error, this.statusCode, headersHandler); - } - /** - * Async function returing dynamic - * GET api/SpecialTypes/AnonymousDynamic2 - */ - getAnonymousDynamic2(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SpecialTypes/AnonymousDynamic2', callback, this.error, this.statusCode, headersHandler); - } - /** - * GET api/SpecialTypes/AnonymousObject - */ - getAnonymousObject(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SpecialTypes/AnonymousObject', callback, this.error, this.statusCode, headersHandler); - } - /** - * Async function returning object - * GET api/SpecialTypes/AnonymousObject2 - */ - getAnonymousObject2(callback, headersHandler) { - this.httpClient.get(this.baseUri + 'api/SpecialTypes/AnonymousObject2', callback, this.error, this.statusCode, headersHandler); - } - /** - * POST api/SpecialTypes/AnonymousObject - */ - postAnonymousObject(obj, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SpecialTypes/AnonymousObject', obj, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - /** - * Async returning object, Post dynamic - * POST api/SpecialTypes/AnonymousObject2 - */ - postAnonymousObject2(obj, callback, headersHandler) { - this.httpClient.post(this.baseUri + 'api/SpecialTypes/AnonymousObject2', obj, callback, this.error, this.statusCode, 'application/json;charset=UTF-8', headersHandler); - } - } - DemoCoreWeb_Controllers_Client.SpecialTypes = SpecialTypes; -})(DemoCoreWeb_Controllers_Client || (DemoCoreWeb_Controllers_Client = {})); -//# sourceMappingURL=WebApiCoreJQClientAuto.js.map \ No newline at end of file diff --git a/DemoCoreWeb/wwwroot/scripts/tests/demo.tests.js b/DemoCoreWeb/wwwroot/scripts/tests/demo.tests.js deleted file mode 100644 index 4be016a5..00000000 --- a/DemoCoreWeb/wwwroot/scripts/tests/demo.tests.js +++ /dev/null @@ -1,897 +0,0 @@ -/// -/// -/// -var CommonCases; -(function (CommonCases) { - QUnit.config.testTimeout = 30000; - const baseUri = HttpClient.locationOrigin; - let authHttpClient = new AuthHttpClient(); - let entitiesApi = new DemoWebApi_Controllers_Client.Entities(baseUri, authHttpClient); - let valuesApi = new DemoWebApi_Controllers_Client.Values(baseUri, authHttpClient); - let superDemoApi = new DemoWebApi_Controllers_Client.SuperDemo(baseUri); - let tupleApi = new DemoWebApi_Controllers_Client.Tuple(baseUri); - let heroesApi = new DemoWebApi_Controllers_Client.Heroes(baseUri); - let stringDataApi = new DemoWebApi_Controllers_Client.StringData(baseUri); - let textDataApi = new DemoWebApi_Controllers_Client.TextData(baseUri); - let dateTypesApi = new DemoWebApi_Controllers_Client.DateTypes(baseUri); - let numbersApi = new DemoWebApi_Controllers_Client.Numbers(baseUri, authHttpClient); - //This should always work since it is a simple unit test. - QUnit.test("data compare", function (assert) { - let person = { - name: "someone", - surname: "my", - givenName: "something", - }; - let person2 = { - name: "someone", - surname: "my", - givenName: "something", - }; - assert.equal(JSON.stringify(person), JSON.stringify(person2)); - }); - QUnit.module("Heroes", function () { - QUnit.test("GetAll", function (assert) { - let done = assert.async(); - heroesApi.getHeroes(data => { - assert.ok(data.length > 0); - done(); - }); - }); - QUnit.test("Get", function (assert) { - let done = assert.async(); - heroesApi.getHero("20", data => { - assert.equal(data.name, "Tornado"); - done(); - }); - }); - QUnit.test("Add", function (assert) { - let done = assert.async(); - heroesApi.post("somebody", data => { - assert.equal(data.name, "somebody"); - done(); - }); - }); - QUnit.test("Search", function (assert) { - let done = assert.async(); - heroesApi.search("Torn", data => { - assert.equal(data.length, 1); - assert.equal(data[0].name, "Tornado"); - done(); - }); - }); - }); - QUnit.module("StringData", function () { - QUnit.test("TestAthletheSearch", function (assert) { - let done = assert.async(); - stringDataApi.athletheSearch(32, 0, null, null, null, data => { - assert.equal(data, '320'); - done(); - }); - }); - QUnit.test("TestAthletheSearch2", function (assert) { - let done = assert.async(); - stringDataApi.athletheSearch(32, 0, null, null, 'Search', data => { - assert.equal(data, '320Search'); - done(); - }); - }); - QUnit.test("TestAthletheSearch3", function (assert) { - let done = assert.async(); - stringDataApi.athletheSearch(32, 0, null, 'Sort', 'Search', data => { - assert.equal(data, '320SortSearch'); - done(); - }); - }); - QUnit.test("TestAthletheSearch4", function (assert) { - let done = assert.async(); - stringDataApi.athletheSearch(32, 0, 'Order', 'Sort', 'Search', data => { - assert.equal(data, '320OrderSortSearch'); - done(); - }); - }); - QUnit.test("TestAthletheSearch5", function (assert) { - let done = assert.async(); - stringDataApi.athletheSearch(32, 0, 'Order', null, 'Search', data => { - assert.equal(data, '320OrderSearch'); - done(); - }); - }); - QUnit.test("TestAthletheSearch6", function (assert) { - let done = assert.async(); - stringDataApi.athletheSearch(32, 0, 'Order', '', 'Search', data => { - assert.equal(data, '320OrderSearch'); - done(); - }); - }); - QUnit.test("getABCDE", function (assert) { - let done = assert.async(); - stringDataApi.getABCDE(data => { - assert.equal(data, 'ABCDE'); //HttpClient based on JQueryXHR is smart enough to intepret JSON string object as plain text. - done(); - }); - }); - QUnit.test("getEmptyString", function (assert) { - let done = assert.async(); - stringDataApi.getEmptyString(data => { - assert.equal(data, ''); - done(); - }); - }); - QUnit.test("getNullString", function (assert) { - let done = assert.async(); - stringDataApi.getNullString(data => { - assert.equal(data, null); - done(); - }); - }); - }); - QUnit.module("TextData", function () { - QUnit.test("TestAthletheSearch1", function (assert) { - let done = assert.async(); - textDataApi.athletheSearch(32, 0, null, null, null, data => { - assert.equal(data, '320'); - done(); - }); - }); - QUnit.test("TestAthletheSearch2", function (assert) { - let done = assert.async(); - textDataApi.athletheSearch(32, 0, null, null, 'Search', data => { - assert.equal(data, '320Search'); - done(); - }); - }); - QUnit.test("TestAthletheSearch3", function (assert) { - let done = assert.async(); - textDataApi.athletheSearch(32, 0, null, 'Sort', 'Search', data => { - assert.equal(data, '320SortSearch'); - done(); - }); - }); - QUnit.test("TestAthletheSearch4", function (assert) { - let done = assert.async(); - textDataApi.athletheSearch(32, 0, 'Order', 'Sort', 'Search', data => { - assert.equal(data, '320OrderSortSearch'); - done(); - }); - }); - QUnit.test("TestAthletheSearch5", function (assert) { - let done = assert.async(); - textDataApi.athletheSearch(32, 0, 'Order', null, 'Search', data => { - assert.equal(data, '320OrderSearch'); - done(); - }); - }); - QUnit.test("TestAthletheSearch6", function (assert) { - let done = assert.async(); - textDataApi.athletheSearch(32, 0, 'Order', '', 'Search', data => { - assert.equal(data, '320OrderSearch'); - done(); - }); - }); - QUnit.test("getABCDE", function (assert) { - let done = assert.async(); - textDataApi.getABCDE(data => { - assert.equal(data, 'ABCDE'); - done(); - }); - }); - QUnit.test("getEmptyString", function (assert) { - let done = assert.async(); - textDataApi.getEmptyString(data => { - assert.equal(data, ''); - done(); - }); - }); - QUnit.test("getNullString", function (assert) { - let done = assert.async(); - textDataApi.getNullString(data => { - assert.equal(data, null); - done(); - }); - }); - }); - QUnit.module("DateTypes", function () { - QUnit.test("GetNextHour", function (assert) { - let done = assert.async(); - let dt = new Date(Date.now()); - let h = dt.getHours(); - dateTypesApi.getNextHour(dt, (data) => { - const dataHour = new Date(data).getHours(); //data is regarded by jQ as string - const expectedH = h + 1; - assert.equal(dataHour, expectedH); - //assert.ok(true); - done(); - }); - }); - QUnit.test("GetDateTime", function (assert) { - let done = assert.async(); - dateTypesApi.getDateTime(true, (data) => { - assert.ok(data); - done(); - }); - }); - QUnit.test("GetDateTimeNull", function (assert) { - let done = assert.async(); - dateTypesApi.getDateTime(false, (data) => { - assert.equal(data, null); - done(); - }); - }); - QUnit.test("postDateTimeOffset", function (assert) { - const dt = new Date(Date.now()); - let done = assert.async(); - dateTypesApi.postDateTimeOffset(dt, (data) => { - assert.deepEqual(new Date(data), dt); - done(); - }); - }); - QUnit.test("postDateTimeOffsetNullable", function (assert) { - const dt = new Date(Date.now()); - let done = assert.async(); - dateTypesApi.postDateTimeOffsetNullable(dt, (data) => { - assert.deepEqual(new Date(data), dt); - done(); - }); - }); - QUnit.test("postDateTimeOffsetNullableWithNull", function (assert) { - let done = assert.async(); - dateTypesApi.postDateTimeOffsetNullable(null, (data) => { - assert.equal(data, null); - done(); - }); - }); - QUnit.test("postDateTimeOffsetNullableWithUndefined", function (assert) { - let done = assert.async(); - dateTypesApi.postDateTimeOffsetNullable(undefined, (data) => { - assert.equal(data, null); - done(); - }); - }); - QUnit.test("postDateOnly", function (assert) { - const dt = new Date(Date.parse('2018-12-23')); //JS will serialize it to 2018-12-23T00:00:00.000Z. - let done = assert.async(); - dateTypesApi.postDateOnly(dt, (data) => { - assert.equal(data, '2018-12-23'); - done(); - }); - }); - QUnit.test("postDateOnlyWithNull", function (assert) { - let done = assert.async(); - dateTypesApi.postDateOnly(null, (data) => { - assert.equal(data, '0001-01-01'); - done(); - }); - }); - QUnit.test("postDateOnlyNullable", function (assert) { - const dt = new Date(Date.parse('2018-12-23')); //JS will serialize it to 2018-12-23T00:00:00.000Z. - let done = assert.async(); - dateTypesApi.postDateOnlyNullable(dt, (data) => { - assert.equal(data, '2018-12-23'); - done(); - }); - }); - QUnit.test("postDateOnlyNullableWithNull", function (assert) { - let done = assert.async(); - dateTypesApi.postDateOnlyNullable(null, (data) => { - assert.equal(data, null); - done(); - }); - }); - QUnit.test("postDateOnlyNullableWithUndefined", function (assert) { - let done = assert.async(); - dateTypesApi.postDateOnlyNullable(undefined, (data) => { - assert.equal(data, null); - done(); - }); - }); - QUnit.test("isDateTimeOffsetDate", function (assert) { - const dt = new Date(Date.parse('2018-12-23')); //JS will serialize it to 2018-12-23T00:00:00.000Z. - let done = assert.async(); - dateTypesApi.isDateTimeOffsetDate(dt, (data) => { - const v = data.item1; - assert.equal(data.item1, '2018-12-23'); - done(); - }); - }); - QUnit.test("isDateTimeDate", function (assert) { - const dt = new Date(Date.parse('2018-12-23')); //JS will serialize it to 2018-12-23T00:00:00.000Z. - let done = assert.async(); - dateTypesApi.isDateTimeDate(dt, (data) => { - const v = data.item1; - assert.equal(data.item1, '2018-12-23'); - done(); - }); - }); - }); - QUnit.module('Entities', function () { - QUnit.test('GetMimsString', function (assert) { - const c = { - tag: 'Hello', - result: { - result: 123.45 - } - }; - let done = assert.async(); - entitiesApi.getMims(c, data => { - assert.strictEqual(data.message, 'Hello'); - assert.equal(data.result, 123.45); - done(); - }); - }); - QUnit.test('myGenericPerson', function (assert) { - const newPerson = { - name: 'John Smith', - givenName: 'John', - surname: 'Smith', - dob: new Date('1977-12-28') - }; - const c = { - myK: 123.456, - myT: 'abc', - myU: newPerson, - status: 'OK', - }; - let done = assert.async(); - entitiesApi.getMyGenericPerson(c, data => { - assert.strictEqual(data.status, 'OK'); - assert.equal(data.myU.name, 'John Smith'); - done(); - }); - }); - }); - QUnit.module("TupleTests", function () { - QUnit.test("GetTuple2", function (assert) { - let done = assert.async(); - tupleApi.getTuple2((data) => { - assert.equal(data["item1"], "Two"); - assert.equal(data["item2"], 2); - done(); - }); - }); - QUnit.test("PostTuple2", function (assert) { - let done = assert.async(); - tupleApi.postTuple2({ item1: "One", item2: 2 }, (data) => { - assert.equal(data, "One"); - done(); - }); - }); - QUnit.test("GetTuple7", function (assert) { - let done = assert.async(); - tupleApi.getTuple7((data) => { - assert.equal(data["item1"], "Seven"); - assert.equal(data["item7"], 7); - done(); - }); - }); - //Visual Studio IDE may give some - QUnit.test("PostTuple7", function (assert) { - let done = assert.async(); - tupleApi.postTuple7({ item1: "One", item2: "", item3: "", item4: "", item5: "", item6: "33333", item7: 9 }, (data) => { - assert.equal(data, "One"); - done(); - }); - }); - QUnit.test("GetTuple8", function (assert) { - let done = assert.async(); - tupleApi.getTuple8((data) => { - assert.equal(data["item1"], "Nested"); - assert.equal(data["rest"].item1, "nine"); - done(); - }); - }); - //Visual Studio IDE may give some - QUnit.test("PostTuple8", function (assert) { - let done = assert.async(); - tupleApi.postTuple8({ item1: "One", item2: "", item3: "", item4: "", item5: "", item6: "", item7: "", rest: { item1: "a", item2: "b", item3: "c" } }, (data) => { - assert.equal(data, "a"); - done(); - }); - }); - QUnit.test("LinkPersonCompany", function (assert) { - let done = assert.async(); - tupleApi.linkPersonCompany1({ - item1: { - name: "someone", - surname: "my", - givenName: "something", - }, - item2: { - name: "Super", - addresses: [{ city: "New York", street1: "Somewhere st" }] - } - }, (data) => { - assert.equal(data.name, "someone"); - done(); - }); - }); - }); - QUnit.module("SuperDemoTests", function () { - QUnit.test("JsZeroNotGood", function (assert) { - assert.notEqual(0.1 + 0.2 - 0.3, 0, "Zero, Zero; equal succeeds"); - }); - //if the WebAPI built with VS 2015 update 2 is hosted in IIS 10, this test pass. - //If the WebAPI built with VS 2015 update 2 is hosted in IIS 7.5, the test will failed. - // with .net core, equal is OK again. - QUnit.test("JsZeroNotGoodWithFloat", function (assert) { - let done = assert.async(); - superDemoApi.getFloatZero((data) => { - // assert.equal(data, 0); - assert.ok(data < 0.0000001); - done(); - }); - }); - QUnit.test("JsZeroNotGoodWithDouble", function (assert) { - let done = assert.async(); - superDemoApi.getDoubleZero((data) => { - assert.notEqual(data, 0); - done(); - }); - }); - QUnit.test("JsZeroGoodWithDecimal", function (assert) { - let done = assert.async(); - superDemoApi.getDecimalZero((data) => { - assert.equal(data, 0); - done(); - }); - }); - QUnit.test("GetIntSquare", function (assert) { - let done = assert.async(); - superDemoApi.getIntSquare(100, (data) => { - assert.equal(data, 10000); - done(); - }); - }); - QUnit.test("GetDecimalSquare", function (assert) { - let done = assert.async(); - superDemoApi.getDecimalSquare(100, (data) => { - assert.equal(data, 10000); - done(); - }); - }); - QUnit.test("GetNullableDecimal", function (assert) { - let done = assert.async(); - superDemoApi.getNullableDecimal(true, (data) => { - assert.ok(data > 10); - done(); - }); - }); - QUnit.test("GetNullableDecimalNull", function (assert) { - let done = assert.async(); - superDemoApi.getNullableDecimal(false, (data) => { - assert.ok(data == undefined); - done(); - }); - }); - QUnit.test("GetNullPerson", function (assert) { - let done = assert.async(); - superDemoApi.getNullPerson((data) => { - assert.ok(data == null); - done(); - }); - }); - QUnit.test("GetByteArray", function (assert) { - let done = assert.async(); - superDemoApi.getByteArray((data) => { - assert.ok(data.length > 0); - done(); - }); - }); - QUnit.test("GetTextStream", function (assert) { - let done = assert.async(); - superDemoApi.getTextStream((data) => { - assert.ok(data); - done(); - }); - }); - QUnit.test("GetActionResult", function (assert) { - let done = assert.async(); - superDemoApi.getActionResult((data) => { - assert.ok(data); - done(); - }); - }); - QUnit.test("GetActionStringResult", function (assert) { - let done = assert.async(); - superDemoApi.getActionResult((data) => { - assert.equal(data, "abcdefg"); - done(); - }); - }); - QUnit.test("Getbyte", function (assert) { - let done = assert.async(); - superDemoApi.getbyte((data) => { - assert.equal(data, 255); - done(); - }); - }); - QUnit.test("GetBool", function (assert) { - let done = assert.async(); - superDemoApi.getBool((data) => { - assert.equal(data, true); - done(); - }); - }); - QUnit.test("Getsbyte", function (assert) { - let done = assert.async(); - superDemoApi.getsbyte((data) => { - assert.equal(data, -127); - done(); - }); - }); - QUnit.test("GetChar", function (assert) { - let done = assert.async(); - superDemoApi.getChar((data) => { - assert.equal(data, "A"); - done(); - }); - }); - QUnit.test("GetDecimal", function (assert) { - let done = assert.async(); - superDemoApi.getDecimal((data) => { - assert.equal(data, 79228162514264337593543950335); - done(); - }); - }); - QUnit.test("Getdouble", function (assert) { - let done = assert.async(); - superDemoApi.getdouble((data) => { - assert.equal(data, -1.7976931348623e308); - done(); - }); - }); - QUnit.test("GetUint", function (assert) { - let done = assert.async(); - superDemoApi.getUint((data) => { - assert.equal(data, 4294967295); - done(); - }); - }); - QUnit.test("Getulong", function (assert) { - let done = assert.async(); - superDemoApi.getulong((data) => { - assert.equal(data, 18446744073709551615); - done(); - }); - }); - QUnit.test("GetInt2d", function (assert) { - let done = assert.async(); - superDemoApi.getInt2D((data) => { - assert.equal(data[0][0], 1); - assert.equal(data[0][3], 4); - assert.equal(data[1][0], 5); - assert.equal(data[1][3], 8); - done(); - }); - }); - QUnit.test("GetInt2dJagged", function (assert) { - let done = assert.async(); - superDemoApi.getInt2DJagged((data) => { - assert.equal(data[0][0], 1); - assert.equal(data[0][3], 4); - assert.equal(data[1][0], 5); - assert.equal(data[1][3], 8); - done(); - }); - }); - QUnit.test("PostInt2d", function (assert) { - let done = assert.async(); - superDemoApi.postInt2D([[1, 2, 3, 4], [5, 6, 7, 8]], (data) => { - assert.ok(data); - done(); - }); - }); - QUnit.test("PostInt2dExpectedFalse", function (assert) { - let done = assert.async(); - superDemoApi.postInt2D([[1, 2, 3, 4], [5, 6, 7, 9]], (data) => { - assert.ok(data == false); - done(); - }); - }); - QUnit.test("PostIntArray", function (assert) { - let done = assert.async(); - superDemoApi.postIntArray([1, 2, 3, 4, 5, 6, 7, 8], (data) => { - assert.ok(data); - done(); - }); - }); - QUnit.test("getIntArrayQ", function (assert) { - let done = assert.async(); - superDemoApi.getIntArrayQ([6, 7, 8], (data) => { - assert.equal(data.length, 3); - assert.equal(data[2], 8); - done(); - }); - }); - QUnit.test("postDay", function (assert) { - let done = assert.async(); - superDemoApi.postDay(DemoWebApi_DemoData_Client.Days.Fri, DemoWebApi_DemoData_Client.Days.Mon, (data) => { - assert.equal(data.length, 2); - assert.equal(data[1], DemoWebApi_DemoData_Client.Days.Mon); - done(); - }); - }); - QUnit.test("PostWithQueryButEmptyBody", function (assert) { - let done = assert.async(); - superDemoApi.postWithQueryButEmptyBody("abc", 123, (data) => { - assert.equal(data.item1, "abc"); - assert.equal(data.item2, 123); - done(); - }); - }); - QUnit.test("GetIntArray", function (assert) { - let done = assert.async(); - superDemoApi.getIntArray((data) => { - assert.equal(data[7], 8); - done(); - }); - }); - QUnit.test("PostInt2dJagged", function (assert) { - let done = assert.async(); - superDemoApi.postInt2DJagged([[1, 2, 3, 4], [5, 6, 7, 8]], (data) => { - assert.ok(data); - done(); - }); - }); - QUnit.test("PostInt2dJaggedExpectedFalse", function (assert) { - let done = assert.async(); - superDemoApi.postInt2DJagged([[1, 2, 3, 4], [5, 6, 7, 9]], (data) => { - assert.ok(data == false); - done(); - }); - }); - QUnit.test("GetDictionaryOfPeople", function (assert) { - let done = assert.async(); - superDemoApi.getDictionaryOfPeople((data) => { - assert.equal(data["Spider Man"].name, "Peter Parker"); - assert.equal(data["Spider Man"].addresses[0].city, "New York"); - done(); - }); - }); - QUnit.test("PostDictionaryOfPeople", function (assert) { - let done = assert.async(); - superDemoApi.postDictionary({ - "Iron Man": { - "surname": "Stark", - "givenName": "Tony", - "dob": null, - "id": "00000000-0000-0000-0000-000000000000", - "name": "Tony Stark", - "addresses": [] - }, - "Spider Man": { - "name": "Peter Parker", - "addresses": [ - { - "id": "00000000-0000-0000-0000-000000000000", - "city": "New York", - state: "Somewhere", - "postalCode": null, - "country": null, - "type": 0, - location: { x: 100, y: 200 } - } - ] - } - }, (data) => { - assert.equal(data, 2); - done(); - }); - }); - QUnit.test("GetKeyValuePair", function (assert) { - let done = assert.async(); - superDemoApi.getKeyhValuePair((data) => { - assert.equal(data.key, "Spider Man"); - assert.equal(data.value.addresses[0].city, "New York"); - done(); - }); - }); - QUnit.module("ValuesTests", function () { - QUnit.test("Get", function (assert) { - let done = assert.async(); - valuesApi.get((data) => { - assert.equal(data[1], "value2"); - done(); - }); - }); - QUnit.test("GetByIdAndName", function (assert) { - let done = assert.async(); - valuesApi.getByIdOfInt32AndNameOfString(1, "something to say中文\\`-=|~!@#$%^&*()_+/|?[]{},.';<>:\"", (data) => { - assert.equal(data, "something to say中文\\`-=|~!@#$%^&*()_+/|?[]{},.';<>:\"1"); - done(); - }); - }); - QUnit.test("GetByName", function (assert) { - let done = assert.async(); - valuesApi.getByNameOfString("something", (data) => { - assert.equal(data, "SOMETHING"); - done(); - }); - }); - QUnit.test("PostValue", function (assert) { - let done = assert.async(); - valuesApi.post('value', (data) => { - assert.equal(data, "VALUE"); - done(); - }); - }); - QUnit.test("Put", function (assert) { - let done = assert.async(); - valuesApi.put(1, 'value', (data) => { - assert.expect(0); - done(); - }); - }); - QUnit.test("Delete", function (assert) { - let done = assert.async(); - valuesApi.delete(1, (data) => { - assert.expect(0); - done(); - }); - }); - }); - }); - QUnit.module("NumbersTests", function () { - /** - * Even though the request payload is 9223372036854776000 (loosing precision, cause of the 53bit issue), or "9223372036854776123", the response is 0 as shown in Chrome's console and Fiddler. - * And the Web API has received actually 0. Not sure if the Web API binding had turned the request payload into 0 if the client is a Web browser. - */ - QUnit.test('postInt64ButIncorrect', function (assert) { - let done = assert.async(); - numbersApi.postInt64('9223372036854775807', (r) => { - assert.equal(BigInt(9223372036854775807n).toString(), '9223372036854775807'); - assert.equal(BigInt(r), BigInt('9223372036854775808')); //reponse is 9223372036854775807, but BigInt(r) gives last 3 digits 808 - done(); - }); - }); - QUnit.test('postBigNumbers', function (assert) { - let done = assert.async(); - const d = { - unsigned64: '18446744073709551615', //2 ^ 64 -1, - signed64: '9223372036854775807', //2 ^ 63 -1, - unsigned128: '340282366920938463463374607431768211455', - signed128: '170141183460469231731687303715884105727', - bigInt: '6277101735386680762814942322444851025767571854389858533375', // 3 unsigned64, 192bits - }; - /** - request: - { - "unsigned64":"18446744073709551615", - "signed64":"9223372036854775807", - "unsigned128":"340282366920938463463374607431768211455", - "signed128":"170141183460469231731687303715884105727", - "bigInt":"6277101735386680762814942322444851025767571854389858533375" - } - response: - { - "signed64": 9223372036854775807, - "unsigned64": 18446744073709551615, - "signed128": "170141183460469231731687303715884105727", - "unsigned128": "340282366920938463463374607431768211455", - "bigInt": 6277101735386680762814942322444851025767571854389858533375 - } - - */ - numbersApi.postBigNumbers(d, (r) => { - assert.notEqual(BigInt(r.unsigned64), BigInt('18446744073709551615')); // BigInt can not handle the coversion from json number form correctly. - assert.equal(BigInt(r.unsigned64), BigInt('18446744073709551616')); // actually incorrect during deserialization - assert.notEqual(BigInt(r.signed64), BigInt('9223372036854775807')); - assert.equal(BigInt(r.signed64), BigInt('9223372036854775808')); - assert.equal(BigInt(r.unsigned128), BigInt(340282366920938463463374607431768211455n)); - assert.equal(BigInt(r.signed128), BigInt(170141183460469231731687303715884105727n)); - assert.notEqual(BigInt(r.bigInt), BigInt(6277101735386680762814942322444851025767571854389858533375n)); - assert.equal(BigInt(r.bigInt), BigInt(6277101735386680763835789423207666416102355444464034512896n)); // how wrong - done(); - }); - }); - /** - postBigIntegerForJs(bigInteger?: string | null, headersHandler?: () => HttpHeaders): Observable { - return this.http.post(this.baseUri + 'api/Numbers/bigIntegerForJs', JSON.stringify(bigInteger), { headers: headersHandler ? headersHandler().append('Content-Type', 'application/json;charset=UTF-8') : new HttpHeaders({ 'Content-Type': 'application/json;charset=UTF-8' }) }); - } - */ - QUnit.test('postBigIntegralAsStringForJs', function (assert) { - let done = assert.async(); - numbersApi.postBigIntegralAsStringForJs('9223372036854775807', (r) => { - assert.equal(BigInt(9223372036854775807n).toString(), '9223372036854775807'); - assert.equal(BigInt('9223372036854775807').toString(), '9223372036854775807'); - assert.equal(BigInt(r), BigInt('9223372036854775807')); - assert.equal(BigInt(r), BigInt(9223372036854775807n)); - done(); - }); - }); - QUnit.test('postBigIntegralAsStringForJs2', function (assert) { - let done = assert.async(); - numbersApi.postBigIntegralAsStringForJs('6277101735386680762814942322444851025767571854389858533375', (r) => { - assert.equal(BigInt(6277101735386680762814942322444851025767571854389858533375n).toString(), '6277101735386680762814942322444851025767571854389858533375'); - assert.equal(BigInt('6277101735386680762814942322444851025767571854389858533375').toString(), '6277101735386680762814942322444851025767571854389858533375'); - assert.equal(BigInt(r), BigInt('6277101735386680762814942322444851025767571854389858533375')); - assert.equal(BigInt(r), BigInt(6277101735386680762814942322444851025767571854389858533375n)); - done(); - }); - }); - QUnit.test('postInt64Smaller', function (assert) { - let done = assert.async(); - numbersApi.postInt64('9223372036854775123', (r) => { - assert.notEqual(BigInt(r), BigInt('9223372036854775123')); //reponse is 9223372036854775123, but BigInt(r) gives l9223372036854774784 - assert.equal(BigInt(r), BigInt('9223372036854774784')); - done(); - }); - }); - QUnit.test('postLongAsBigIntButIncorrect', function (assert) { - let done = assert.async(); - // request: "9223372036854775807" - // response: 9223372036854775807 - numbersApi.postBigInteger('9223372036854775807', (r) => { - assert.equal(BigInt(9223372036854775807n).toString(), '9223372036854775807'); - assert.equal(BigInt(r), BigInt('9223372036854775808')); //reponse is 9223372036854775807, but BigInt(r) gives last 3 digits 808, since the returned value does not have the n suffix. - assert.equal(r.toString(), '9223372036854776000'); //the response is a big int which JS could not handle in toString(), 53bit gets in the way. - assert.equal(BigInt(r).toString(), '9223372036854775808'); - done(); - }); - }); - QUnit.test('postLongAsBigIntWithSmallNumber', function (assert) { - let done = assert.async(); - numbersApi.postBigInteger('123', (r) => { - assert.equal(BigInt(r), BigInt(123n)); - done(); - }); - }); - QUnit.test('postReallyBigInt192bitsButIncorrect', function (assert) { - let done = assert.async(); - // request: "6277101735386680762814942322444851025767571854389858533375" - // response: 6277101735386680762814942322444851025767571854389858533375 - numbersApi.postBigInteger('6277101735386680762814942322444851025767571854389858533375', (r) => { - assert.equal(BigInt(r), BigInt(6277101735386680762814942322444851025767571854389858533375)); //this time, it is correct, but... - assert.notEqual(BigInt(r).valueOf(), 6277101735386680762814942322444851025767571854389858533375n); // not really, - assert.notEqual(BigInt(r).valueOf(), BigInt('6277101735386680762814942322444851025767571854389858533375')); // not really, because what returned is lack of n - done(); - }); - }); - QUnit.test('postReallyBigInt80bitsButIncorect', function (assert) { - let done = assert.async(); - numbersApi.postBigInteger('604462909807314587353087', (r) => { - assert.equal(BigInt(r), BigInt(604462909807314587353087)); //this time, it is correct, but... - assert.notEqual(BigInt(r).valueOf(), 604462909807314587353087n); // not really, - assert.notEqual(BigInt(r).valueOf(), BigInt('604462909807314587353087')); // not really, because what returned is lack of n - done(); - }); - }); - QUnit.test('postReallyBigInt128bitsButIncorect', function (assert) { - let done = assert.async(); - numbersApi.postBigInteger('340282366920938463463374607431768211455', (r) => { - assert.equal(BigInt(r), BigInt(340282366920938463463374607431768211455)); //this time, it is correct, but... - assert.notEqual(BigInt(r).valueOf(), 340282366920938463463374607431768211455n); // not really, - assert.notEqual(BigInt(r).valueOf(), BigInt('340282366920938463463374607431768211455')); // not really, because what returned is lack of n - done(); - }); - }); - /** - * Correct. - * Request as string: "170141183460469231731687303715884105727", - * Response: "170141183460469231731687303715884105727" , Content-Type: application/json; charset=utf-8 - */ - QUnit.test('postInt128', function (assert) { - let done = assert.async(); - numbersApi.postInt128('170141183460469231731687303715884105727', (r) => { - assert.equal(BigInt(r), BigInt('170141183460469231731687303715884105727')); - assert.equal(BigInt(r), BigInt(170141183460469231731687303715884105727n)); - done(); - }); - }); - /** - * Correct. - * Request as string: "340282366920938463463374607431768211455", - * Response: "340282366920938463463374607431768211455" , Content-Type: application/json; charset=utf-8 - */ - QUnit.test('postUInt128', function (assert) { - let done = assert.async(); - numbersApi.postUint128('340282366920938463463374607431768211455', (r) => { - assert.equal(BigInt(r), BigInt('340282366920938463463374607431768211455')); - assert.equal(BigInt(r), BigInt(340282366920938463463374607431768211455n)); - assert.equal(BigInt(r).valueOf(), BigInt('340282366920938463463374607431768211455')); - assert.equal(BigInt(r).valueOf(), BigInt(340282366920938463463374607431768211455n)); - done(); - }); - }); - }); //NumbersTests -})(CommonCases || (CommonCases = {})); -//# sourceMappingURL=demo.tests.js.map \ No newline at end of file diff --git a/DemoCoreWeb/wwwroot/scripts/tests/special.tests.js b/DemoCoreWeb/wwwroot/scripts/tests/special.tests.js deleted file mode 100644 index 7b177cd2..00000000 --- a/DemoCoreWeb/wwwroot/scripts/tests/special.tests.js +++ /dev/null @@ -1,52 +0,0 @@ -/// -/// -/// -/// -// Make sure chutzpah.json is updated with reference to the jQuery lib when the lib is upgraded. -// Sometimes the test cases are not appearing in Test Explorer, then claring %temp% may help. -// To launch IIS Express, use something like this: C:\VsProjects\webapiclientgen>"C:\Program Files (x86)\IIS Express\iisexpress.exe" /site:DemoWebApi /apppool:Clr4IntegratedAppPool /config:c:\vsprojects\webapiclientgen\.vs\config\applicationhost.config -/* -And make sure the testApi credential exists through -POST to http://localhost:10965/api/Account/Register -Content-Type: application/json - -{ -Email: 'testapi@test.com', -Password: 'Tttttttt_8', -ConfirmPassword: 'Tttttttt_8' -} - -*/ -var SpecialObjects; -(function (SpecialObjects) { - QUnit.config.testTimeout = 30000; - const baseUri = HttpClient.locationOrigin; - let specialTypesApi = new DemoCoreWeb_Controllers_Client.SpecialTypes(baseUri); - QUnit.module("SpecialObjects", function () { - QUnit.test("GetAnonymousDynamic", function (assert) { - let done = assert.async(); - specialTypesApi.getAnonymousDynamic((data) => { - assert.equal(data.id, 12345); - assert.equal(data.name, "Something"); - done(); - }); - }); - QUnit.test("GetAnonymousObject", function (assert) { - let done = assert.async(); - specialTypesApi.getAnonymousObject((data) => { - assert.equal(data.id, 12345); - assert.equal(data.name, "Something"); - done(); - }); - }); - QUnit.test("PostAnonymousObject", function (assert) { - let done = assert.async(); - specialTypesApi.postAnonymousObject({ "Id": "12345", "Name": "Something" }, (data) => { - assert.equal(data.Id, "123451"); - assert.equal(data.Name, "Something1"); - done(); - }); - }); - }); -})(SpecialObjects || (SpecialObjects = {})); -//# sourceMappingURL=special.tests.js.map \ No newline at end of file diff --git a/README.md b/README.md index 216661be..0b71b120 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ -Generate client API codes in C# and TypeScript from ASP.NET (Core) Web API directly without involving Swagger/OpenAPI or Swashbuckle, therefore maximizing the support for data types of your Code First approach of ASP.NET Web API. - -Strongly Typed Client API Generators generate strongly typed client API in C# codes and TypeScript codes. You may then provide or publish either the generated source codes or the compiled client API libraries to other developers for developing client programs. +Strongly Typed Client API Generators generate client API codes in C# and TypeScript from ASP.NET (Core) Web API directly without involving Swagger/OpenAPI or Swashbuckle, therefore maximizing the support for data types of your Code First approach of ASP.NET Web API. # Products This project delivers these products: 1. [Code generator for strongly typed client API in C#](https://github.com/zijianhuang/webapiclientgen/wiki/Documentation) supporting .NET and Xamarin.Forms. -1. [Code generators for strongly typed client API in TypeScript](https://github.com/zijianhuang/webapiclientgen/wiki/Code-generator-for-strongly-typed-client-API-in-TypeScript) for jQuery, Angular 2, Aurelia, Axios and Fetch API. +1. [Code generators for strongly typed client API in TypeScript](https://github.com/zijianhuang/webapiclientgen/wiki/Code-generator-for-strongly-typed-client-API-in-TypeScript) for jQuery, Angular 2+, Aurelia, Axios and Fetch API. 1. [TypeScript CodeDOM](https://github.com/zijianhuang/TypeScriptCodeDOM), a .NET CodeDOM component for TypeScript for developing TypeScript code generators. 1. [POCO2TS.exe](https://github.com/zijianhuang/webapiclientgen/wiki/POCO2TS.exe), a command line program that generates TypeScript interfaces from POCO classes. 1. [Fonlow.Poco2Ts](https://github.com/zijianhuang/webapiclientgen/wiki/Fonlow.Poco2Ts), a component that generates TypeScript interfaces from POCO classes.